Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
You are viewing an older revision! See the latest version
Usage Cautions
When utilizing the asynchronous api, there is one usage of the interrupt callback handler that worth notice when developing an application: *timing sensitive commands are not supposedly to be executed within an interrupt*
Let's take a look at this short example here:
The MCU is set to go into sleep mode when executing an asynchronous procedure.
When function sleep() is called, the current clock state is stored before the clock that is currently running is disabled. Then, a wait for interrupt function WFI() is executed to listen for any incoming interrupt requests while the execution of MCU is halted. These interrupts could be receiving data through serial, or a pin is set to high, etc.
See the flow char here:
If the interrupt request triggers some timing sensitive events or executions, the clock needs to be enabled in order for these procedures to continues. However, the program is actually still running within sleep() function and has not yet returned. Any timing sensitive execution should be avoided here. Such timing sensitive commands include but are not limited to: printf("content"), wait(number), serial.read(),serial.write().