]> git.donarmstrong.com Git - qmk_firmware.git/blob - tool/mbed/mbed-sdk/libraries/tests/rtos/cmsis/signals/main.cpp
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[qmk_firmware.git] / tool / mbed / mbed-sdk / libraries / tests / rtos / cmsis / signals / main.cpp
1 #include "mbed.h"
2 #include "cmsis_os.h"
3
4 DigitalOut led(LED1);
5
6 void led_thread(void const *argument) {
7     while (true) {
8         // Signal flags that are reported as event are automatically cleared.
9         osSignalWait(0x1, osWaitForever);
10         led = !led;
11     }
12 }
13
14 osThreadDef(led_thread, osPriorityNormal, DEFAULT_STACK_SIZE);
15
16 int main (void) {
17     osThreadId tid = osThreadCreate(osThread(led_thread), NULL);
18
19     while (true) {
20         osDelay(1000);
21         osSignalSet(tid, 0x1);
22     }
23 }