Marco Zecchini
/
Example_RTOS
Rtos API example
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "test_env.h" 00002 00003 #if !DEVICE_SLEEP 00004 #error [NOT_SUPPORTED] Sleep is not supported 00005 #endif 00006 00007 #if defined(TARGET_LPC4088) 00008 InterruptIn wkp(P2_10); 00009 #elif defined(TARGET_K22F) 00010 InterruptIn wkp(D0); 00011 #elif defined(TARGET_LPC11U68) 00012 InterruptIn wkp(P0_16); 00013 #elif defined(TARGET_SAMR21G18A) 00014 InterruptIn wkp(PA28); 00015 #elif defined(TARGET_SAMD21J18A) 00016 InterruptIn wkp(PA15); 00017 #elif defined(TARGET_SAMD21G18A) 00018 InterruptIn wkp(PB23); 00019 #elif defined(TARGET_SAML21J18A) 00020 InterruptIn wkp(PA02); 00021 #else 00022 InterruptIn wkp(p14); 00023 #endif 00024 00025 void flip() { 00026 printf("button pressed\n"); 00027 } 00028 00029 int main() { 00030 #if defined(TARGET_LPC11U68) 00031 wkp.mode(PullUp); 00032 #endif 00033 wkp.rise(&flip); 00034 00035 while (true) { 00036 // sleep(); 00037 deepsleep(); 00038 } 00039 }
Generated on Sun Jul 17 2022 08:25:26 by 1.7.2