diff options
Diffstat (limited to 'tmk_core/tool/mbed/mbed-sdk/libraries/tests/rtos/cmsis/signals')
-rw-r--r-- | tmk_core/tool/mbed/mbed-sdk/libraries/tests/rtos/cmsis/signals/main.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tmk_core/tool/mbed/mbed-sdk/libraries/tests/rtos/cmsis/signals/main.cpp b/tmk_core/tool/mbed/mbed-sdk/libraries/tests/rtos/cmsis/signals/main.cpp new file mode 100644 index 0000000000..14ce05dadb --- /dev/null +++ b/tmk_core/tool/mbed/mbed-sdk/libraries/tests/rtos/cmsis/signals/main.cpp @@ -0,0 +1,23 @@ +#include "mbed.h" +#include "cmsis_os.h" + +DigitalOut led(LED1); + +void led_thread(void const *argument) { + while (true) { + // Signal flags that are reported as event are automatically cleared. + osSignalWait(0x1, osWaitForever); + led = !led; + } +} + +osThreadDef(led_thread, osPriorityNormal, DEFAULT_STACK_SIZE); + +int main (void) { + osThreadId tid = osThreadCreate(osThread(led_thread), NULL); + + while (true) { + osDelay(1000); + osSignalSet(tid, 0x1); + } +} |