void TMR0_IRQHandler(void)
{
static uint32_t u32Sec = 1;
printf("%d sec\n", u32Sec++);
/* clear timer interrupt flag */
TIMER_ClearIntFlag(TIMER0);
}
比如这个例子中,先处理了任务,然后才清理了那个定时器中断标识。
void GPIOP0P1_IRQHandler(void)
{
/* To check if P1.3 interrupt occurred */
if(GPIO_GET_INT_FLAG(P1, BIT3))
{
GPIO_CLR_INT_FLAG(P1, BIT3);
printf("P1.3 INT occurred.\n");
}
else
{
/* Un-expected interrupt. Just clear all PORT0, PORT1 interrupts */
P0->ISRC = P0->ISRC;
P1->ISRC = P1->ISRC;
printf("Un-expected interrupts.\n");
}
}
这个例子中是先确认中断标识对不对再清理,之后干其他事情。
|