Daiki Kato
/
SoftwareStanby_test_use_OS
This is a sample to make Software Standby using OS.
main.cpp
- Committer:
- dkato
- Date:
- 2019-10-07
- Revision:
- 2:c0f92fd0e8e9
- Parent:
- 1:29fa0989ec31
- Child:
- 3:64e8fa1b8787
File content as of revision 2:c0f92fd0e8e9:
#include "mbed.h" InterruptIn button(USER_BUTTON0); DigitalOut led1(LED1); Thread * pTestTask = NULL; static void interrupt_button(void) { #if(0) // It may or may not be present. if (pTestTask != NULL) { pTestTask->signal_set(1); } #endif } void test_task(void) { int test_cnt = 0; button.fall(&interrupt_button); button.rise(&interrupt_button); while (true) { sleep_manager_sleep_auto(); #if(0) // It may or may not be present. // It becomes sleep during idle task. Thread::signal_wait(1); #endif led1 = !led1; printf("%d\r\n", test_cnt++); ThisThread::sleep_for(5); // Wait for output completion of printf(). } } int main() { pTestTask = new Thread(); pTestTask->start(test_task); }