mbed_example
/
DeepSleepLock_Example_1
Example use of the DeepSleepLock class.
Revision 0:66aac0656e71, committed 2017-10-27
- Comitter:
- c1728p9
- Date:
- Fri Oct 27 21:04:30 2017 +0000
- Commit message:
- Initial Commit
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed-os.lib | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 66aac0656e71 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Oct 27 21:04:30 2017 +0000 @@ -0,0 +1,24 @@ +#include "mbed.h" + +InterruptIn button(BUTTON1); +DigitalOut led(LED1); + +void toggle() +{ + led = !led; +} + +int main() +{ + button.rise(&toggle); + button.fall(&toggle); + + // Lock deep sleep to decrease interrupt latency + // at the expense of high power consumption + DeepSleepLock lock; + + while(1) { + // Wait and let interrupts take care of the rest + wait(1.0); + } +} \ No newline at end of file
diff -r 000000000000 -r 66aac0656e71 mbed-os.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-os.lib Fri Oct 27 21:04:30 2017 +0000 @@ -0,0 +1,1 @@ +https://github.com/ARMmbed/mbed-os/#e62a1b9236b44e70ae3b0902dc538481c04d455b