Test program making the LEDs blink.
Dependencies: mbed-rtos mbed-src
Revision 0:1bbbbd316896, committed 2014-09-23
- Comitter:
- jmgomez
- Date:
- Tue Sep 23 12:54:34 2014 +0000
- Commit message:
- First upload, using the blink program.
Changed in this revision
diff -r 000000000000 -r 1bbbbd316896 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Sep 23 12:54:34 2014 +0000 @@ -0,0 +1,42 @@ +/****************************************************************************** +* DESCRIPTION: +* A "Blinky" CMSIS RTOS program which demonstrates another safe way +* to pass arguments to threads during thread creation. In this case, +* a structure is used to pass multiple arguments. +* AUTHOR: Jose M. Gomez +* LAST REVISED: 23/SEP/2014 +******************************************************************************/ + +#include <mbed.h> +#include <cmsis_os.h> +#include <stdint.h> +#include <limits.h> + +#define NUM_THREADS 6 + +DigitalOut red(LED1); +DigitalOut green(LED2); +DigitalOut blue(LED3); + +void Timer1_Callback (void const *arg) { + red = !red; // update the counter +} + +void Timer2_Callback (void const *arg) { + blue=!blue; // update the counter +} + +osTimerDef (timer1, Timer1_Callback); +osTimerDef (timer2, Timer2_Callback); + +int main (void) { + osTimerId id1; + osTimerId id2; + + green = 0; + id1 = osTimerCreate (osTimer(timer1), osTimerPeriodic, NULL); + osTimerStart (id1, 100UL); + id2 = osTimerCreate (osTimer(timer2), osTimerPeriodic, NULL); + osTimerStart (id2, 157UL); + green = 1; +}
diff -r 000000000000 -r 1bbbbd316896 mbed-rtos.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-rtos.lib Tue Sep 23 12:54:34 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed-rtos/#631c0f1008c3
diff -r 000000000000 -r 1bbbbd316896 mbed-src.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-src.lib Tue Sep 23 12:54:34 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed-src/#c80ac197fa6a