/*C9_XMC4500_RTOS - Executie 3 task-uri independente * utilizind ARM RTOS - RTX. * 2 task-uriactiveaza LED-uri iar al III-lea controleaza un servo. * Conexiuni: * led1 - P1.1 * led2 - P1.0 * servo -P3.0 */ #include void blinkled1() // actiune 1 { while(1U) { DIGITAL_IO_ToggleOutput (&led1); osDelay(500); // milisecunde } } osThreadDef(blinkled1, osPriorityNormal, 1, 0); // defineste blinkled1 ca thread void blinkled2() // actiune 2 { while(1) { DIGITAL_IO_ToggleOutput (&led2); osDelay(100); // milisecunde } } osThreadDef(blinkled2, osPriorityNormal, 1, 0); // defineste blinkled2 ca thread void servo() // actiune 3 { while(1) { PWM_SetDutyCycle(&PWM_0,810); // stanga osDelay(1000); PWM_SetDutyCycle(&PWM_0,480); // drepata osDelay(1000); } } osThreadDef(servo, osPriorityNormal, 1, 0); // defineste servo ca thread int main(void) { DAVE_Init(); // Initialization of DAVE APPs osKernelInitialize (); // initialize RTOS kernel osThreadCreate(osThread(blinkled1),NULL);// Activare actiune 1 osThreadCreate(osThread(blinkled2),NULL);// Activare actiune 2 osThreadCreate(osThread(servo),NULL); // Activare actiune 3 osKernelStart(); // start KernelRTOS while(1U) { } }