deepsleep() program for mbed LPC11U24 beta
main.cpp@0:1e4c251b7f9d, 2011-10-20 (annotated)
- Committer:
- chris
- Date:
- Thu Oct 20 11:46:18 2011 +0000
- Revision:
- 0:1e4c251b7f9d
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
chris | 0:1e4c251b7f9d | 1 | #include "mbed.h" |
chris | 0:1e4c251b7f9d | 2 | |
chris | 0:1e4c251b7f9d | 3 | BusOut leds(LED1,LED2,LED3,LED4); |
chris | 0:1e4c251b7f9d | 4 | |
chris | 0:1e4c251b7f9d | 5 | InterruptIn wakeup(p14); |
chris | 0:1e4c251b7f9d | 6 | |
chris | 0:1e4c251b7f9d | 7 | void dostuff() { |
chris | 0:1e4c251b7f9d | 8 | for (int i=0; i<5; i++) { |
chris | 0:1e4c251b7f9d | 9 | leds = 1 << i; |
chris | 0:1e4c251b7f9d | 10 | wait(0.25); |
chris | 0:1e4c251b7f9d | 11 | } |
chris | 0:1e4c251b7f9d | 12 | } |
chris | 0:1e4c251b7f9d | 13 | |
chris | 0:1e4c251b7f9d | 14 | int main () { |
chris | 0:1e4c251b7f9d | 15 | |
chris | 0:1e4c251b7f9d | 16 | wakeup.rise(NULL); |
chris | 0:1e4c251b7f9d | 17 | |
chris | 0:1e4c251b7f9d | 18 | while (1) { |
chris | 0:1e4c251b7f9d | 19 | dostuff(); |
chris | 0:1e4c251b7f9d | 20 | deepsleep(); |
chris | 0:1e4c251b7f9d | 21 | } |
chris | 0:1e4c251b7f9d | 22 | |
chris | 0:1e4c251b7f9d | 23 | } |