mbed-os
Fork of mbed-os by
Diff: features/unsupported/tests/mbed/sleep/main.cpp
- Revision:
- 0:f269e3021894
diff -r 000000000000 -r f269e3021894 features/unsupported/tests/mbed/sleep/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/features/unsupported/tests/mbed/sleep/main.cpp Sun Oct 23 15:10:02 2016 +0000 @@ -0,0 +1,39 @@ +#include "test_env.h" + +#if !DEVICE_SLEEP + #error [NOT_SUPPORTED] Sleep is not supported +#endif + +#if defined(TARGET_LPC4088) +InterruptIn wkp(P2_10); +#elif defined(TARGET_K22F) +InterruptIn wkp(D0); +#elif defined(TARGET_LPC11U68) +InterruptIn wkp(P0_16); +#elif defined(TARGET_SAMR21G18A) +InterruptIn wkp(PA28); +#elif defined(TARGET_SAMD21J18A) +InterruptIn wkp(PA15); +#elif defined(TARGET_SAMD21G18A) +InterruptIn wkp(PB23); +#elif defined(TARGET_SAML21J18A) +InterruptIn wkp(PA02); +#else +InterruptIn wkp(p14); +#endif + +void flip() { + printf("button pressed\n"); +} + +int main() { +#if defined(TARGET_LPC11U68) + wkp.mode(PullUp); +#endif + wkp.rise(&flip); + + while (true) { + // sleep(); + deepsleep(); + } +}