Torsten Wylegala
/
rtos-example
rtos example
Fork of mbed_blinky by
Diff: main.cpp
- Revision:
- 8:ec1a44f8e456
- Parent:
- 4:81cea7a352b0
--- a/main.cpp Thu Mar 26 22:33:50 2015 +0000 +++ b/main.cpp Thu Feb 04 10:43:16 2016 +0000 @@ -1,12 +1,40 @@ #include "mbed.h" - -DigitalOut myled(LED1); +#include "rtos.h" -int main() { - while(1) { - myled = 1; - wait(0.2); - myled = 0; - wait(0.2); - } -} +#include "TimerTestClass.h" +#include "ThreadTestClass.h" + +/*DigitalOut LEDs[4] = { + DigitalOut(LED1), DigitalOut(LED2), DigitalOut(LED3), DigitalOut(LED4) +}; + +void blink(void const *n) { + LEDs[(int)n] = !LEDs[(int)n]; +}*/ + +int main(void) { + + TimerTestClass timerTestClass; + + RtosTimer testTimer(&Runnable::callback,osTimerPeriodic,(void*)&timerTestClass); + testTimer.start(1000); + + ThreadTestClass threadTestClass; + + Thread thread(&Runnable::callback,(void*)&threadTestClass); + + + //led_1_timer.start(2000); + + /*RtosTimer led_1_timer(blink, osTimerPeriodic, (void *)0); + RtosTimer led_2_timer(blink, osTimerPeriodic, (void *)1); + RtosTimer led_3_timer(blink, osTimerPeriodic, (void *)2); + RtosTimer led_4_timer(blink, osTimerPeriodic, (void *)3); + + led_1_timer.start(2000); + led_2_timer.start(1000); + led_3_timer.start(500); + led_4_timer.start(250);*/ + + Thread::wait(osWaitForever); +} \ No newline at end of file