summaryrefslogtreecommitdiff
path: root/tool/mbed/mbed-sdk/libraries/tests/rtos/cmsis/signals/main.cpp
blob: 14ce05dadb10f0bc1fc219edb4c0f8de51c8e76a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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);
    }
}