You are viewing an older revision! See the latest version
Working with Interrupts
This page discusses some of the things you may want to do with relation to interrupts.
Enabling and Disabling Interrupts¶
In some cases, you may want to ensure a section of code is not interrupted. For example, you might be talking to a peripheral where the whole transaction must happen in one go within a space of time, and an interrupt could cause the operation to fail.
The simplest way to avoid this is to disable interrupts for the critical section of your code:
__disable_irq(); // Disable Interrupts // do something that can't be interrupted __enable_irq(); // Enable Interrupts