Working with Interrupts

This content relates to a deprecated version of Mbed

Mbed 2 is now deprecated. For the latest version please see the Mbed OS documentation.

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, 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

All wikipages