Skip to content

Interrupts

Interrupts allow asynchronous event handling.

Why use interrupts?

Polling wastes CPU time.

NVIC

NVIC manages interrupt priorities.

void EXTI0_IRQHandler(void)
{
    if(EXTI->PR & EXTI_PR_PR0)
    {
        EXTI->PR |= EXTI_PR_PR0;
    }
}

Warning

Keep ISRs short.