mbed official
/
cmsis_rtos_signals
Basic example showing the CMSIS-RTOS signals API
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "mbed.h" 00002 #include "cmsis_os.h" 00003 00004 DigitalOut led(LED1); 00005 00006 void led_thread(void const *args) { 00007 while (true) { 00008 // Signal flags that are reported as event are automatically cleared. 00009 osSignalWait(0x1, osWaitForever); 00010 led = !led; 00011 } 00012 } 00013 osThreadDef(led_thread, osPriorityNormal, DEFAULT_STACK_SIZE); 00014 00015 int main (void) { 00016 osThreadId tid = osThreadCreate(osThread(led_thread), NULL); 00017 00018 while (true) { 00019 osDelay(1000); 00020 osSignalSet(tid, 0x1); 00021 } 00022 }
Generated on Tue Jul 12 2022 11:40:14 by 1.7.2