Daiki Kato / Mbed 2 deprecated Sleep_test_no_OS

Dependencies:   mbed

Committer:
dkato
Date:
Fri Nov 18 08:50:00 2016 +0000
Revision:
0:19a3b76f6ca9
Child:
1:ec156833bab2
first commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dkato 0:19a3b76f6ca9 1 #include "mbed.h"
dkato 0:19a3b76f6ca9 2
dkato 0:19a3b76f6ca9 3 InterruptIn button(USER_BUTTON0);
dkato 0:19a3b76f6ca9 4 DigitalOut led1(LED1);
dkato 0:19a3b76f6ca9 5
dkato 0:19a3b76f6ca9 6 static void interrupt_button(void) {
dkato 0:19a3b76f6ca9 7 // do nothing
dkato 0:19a3b76f6ca9 8 }
dkato 0:19a3b76f6ca9 9
dkato 0:19a3b76f6ca9 10 int main() {
dkato 0:19a3b76f6ca9 11 int test_cnt = 0;
dkato 0:19a3b76f6ca9 12
dkato 0:19a3b76f6ca9 13 button.fall(&interrupt_button);
dkato 0:19a3b76f6ca9 14 button.rise(&interrupt_button);
dkato 0:19a3b76f6ca9 15
dkato 0:19a3b76f6ca9 16 while (true) {
dkato 0:19a3b76f6ca9 17 // Transition to Sleep Mode
dkato 0:19a3b76f6ca9 18 __WFI();
dkato 0:19a3b76f6ca9 19 led1 = !led1;
dkato 0:19a3b76f6ca9 20 printf("%d\n", test_cnt++);
dkato 0:19a3b76f6ca9 21 }
dkato 0:19a3b76f6ca9 22 }