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.
Revision 0:ab9939da6645, committed 2016-11-17
- Comitter:
- pateshian
- Date:
- Thu Nov 17 15:52:54 2016 +0000
- Child:
- 1:e508448feb1c
- Commit message:
- Test_Sleepy_blinky_WFI
Changed in this revision
| mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
| mbed_sleep_blinky.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Nov 17 15:52:54 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/0ab6a29f35bf \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed_sleep_blinky.cpp Thu Nov 17 15:52:54 2016 +0000
@@ -0,0 +1,30 @@
+#include "mbed.h"
+#define IRQ4 (36)
+gpio_irq_t irqHandler;
+
+DigitalOut led1(LED1);
+int gFlag = 0;
+
+void interrupt_irq4_user (uint32_t id, gpio_irq_event event) {
+ if (!gFlag){
+ gFlag = 1;
+ }
+}
+
+// main() runs in its own thread in the OS
+// (note the calls to Thread::wait below for delays)
+int main() {
+
+ gpio_irq_init (&irqHandler, USER_BUTTON0, interrupt_irq4_user, IRQ4);
+
+ while (true) {
+ if ( gFlag == 1 ) {
+ gFlag = 0;
+ led1 = led1;
+ __WFI();
+ led1 = !led1;
+ }
+ //led1 = !led1;
+ //Thread::wait(500);
+ }
+}