/* L97- Real Time Operating System - executie task-uri multiple Fiecare task este realizat pentru rulare in bucla infinita si controleaza activarea celor 4 LED-uri cu intermitente diferite */ #include "mbed.h" #include "cmsis_os.h" DigitalOut led1(LED1); DigitalOut led2(LED2); DigitalOut led3(LED3); DigitalOut led4(LED4); void T1_thread(void const *argument) // control Led1 { while (1) { led1 = !led1; osDelay(100); } } void T2_thread(void const *argument) // control Led2 { while (1) { led2 = !led2; osDelay(1000); } } void T3_thread(void const *argument) // control Led3 { while (1) { led3= !led3; osDelay(2000); } } void T4_thread(void const *argument) // control Led4 { while (1) { led4 = !led4; osDelay(4000); } } osThreadDef(T1_thread, osPriorityNormal, DEFAULT_STACK_SIZE); osThreadDef(T2_thread, osPriorityNormal, DEFAULT_STACK_SIZE); osThreadDef(T3_thread, osPriorityHigh, DEFAULT_STACK_SIZE); osThreadDef(T4_thread, osPriorityNormal, DEFAULT_STACK_SIZE); int main() { osThreadCreate(osThread(T1_thread), NULL); osThreadCreate(osThread(T2_thread), NULL); osThreadCreate(osThread(T3_thread), NULL); osThreadCreate(osThread(T4_thread), NULL); while (1); }