mbed-os

Fork of mbed-os by erkin yucel

Committer:
xuaner
Date:
Thu Jul 20 14:26:57 2017 +0000
Revision:
1:3deb71413561
Parent:
0:f269e3021894
mbed_os

Who changed what in which revision?

UserRevisionLine numberNew contents of line
elessair 0:f269e3021894 1 #include "test_env.h"
elessair 0:f269e3021894 2
elessair 0:f269e3021894 3 #if !DEVICE_SLEEP
elessair 0:f269e3021894 4 #error [NOT_SUPPORTED] Sleep is not supported
elessair 0:f269e3021894 5 #endif
elessair 0:f269e3021894 6
elessair 0:f269e3021894 7 #if defined(TARGET_LPC4088)
elessair 0:f269e3021894 8 InterruptIn wkp(P2_10);
elessair 0:f269e3021894 9 #elif defined(TARGET_K22F)
elessair 0:f269e3021894 10 InterruptIn wkp(D0);
elessair 0:f269e3021894 11 #elif defined(TARGET_LPC11U68)
elessair 0:f269e3021894 12 InterruptIn wkp(P0_16);
elessair 0:f269e3021894 13 #elif defined(TARGET_SAMR21G18A)
elessair 0:f269e3021894 14 InterruptIn wkp(PA28);
elessair 0:f269e3021894 15 #elif defined(TARGET_SAMD21J18A)
elessair 0:f269e3021894 16 InterruptIn wkp(PA15);
elessair 0:f269e3021894 17 #elif defined(TARGET_SAMD21G18A)
elessair 0:f269e3021894 18 InterruptIn wkp(PB23);
elessair 0:f269e3021894 19 #elif defined(TARGET_SAML21J18A)
elessair 0:f269e3021894 20 InterruptIn wkp(PA02);
elessair 0:f269e3021894 21 #else
elessair 0:f269e3021894 22 InterruptIn wkp(p14);
elessair 0:f269e3021894 23 #endif
elessair 0:f269e3021894 24
elessair 0:f269e3021894 25 void flip() {
elessair 0:f269e3021894 26 printf("button pressed\n");
elessair 0:f269e3021894 27 }
elessair 0:f269e3021894 28
elessair 0:f269e3021894 29 int main() {
elessair 0:f269e3021894 30 #if defined(TARGET_LPC11U68)
elessair 0:f269e3021894 31 wkp.mode(PullUp);
elessair 0:f269e3021894 32 #endif
elessair 0:f269e3021894 33 wkp.rise(&flip);
elessair 0:f269e3021894 34
elessair 0:f269e3021894 35 while (true) {
elessair 0:f269e3021894 36 // sleep();
elessair 0:f269e3021894 37 deepsleep();
elessair 0:f269e3021894 38 }
elessair 0:f269e3021894 39 }