ichiro shirasaka
/
scheduler-demo-cq-lpc11u35
Scheduller Demo
Fork of scheduler-demo-cq-lpc11u35 by
Revision 3:d098b01b9dcb, committed 2014-05-18
- Comitter:
- jr1wfh
- Date:
- Sun May 18 03:53:18 2014 +0000
- Parent:
- 2:6b3e85379edd
- Commit message:
- Rev.0
Changed in this revision
diff -r 6b3e85379edd -r d098b01b9dcb led_tsk.cpp --- a/led_tsk.cpp Fri Mar 07 14:57:13 2014 +0000 +++ b/led_tsk.cpp Sun May 18 03:53:18 2014 +0000 @@ -17,13 +17,11 @@ /* for CQ ,lpc11u35 */ +DigitalIn s2(P0_2); DigitalOut led1(P0_20); -DigitalOut led2(P0_21); #define led1_on() led1=0 /* Negative on */ #define led1_off() led1=1 -#define led2_on() led2=0 /* Negative on */ -#define led2_off() led2=1 /******************* @@ -74,24 +72,10 @@ void led1_task( void ) { led1_off(); + taskWait( 1000 ); pwm_fake_t pwm_led( &led1, 10+3); while( 1 ) { pwm_led.run(); } } - -/******************* - -* LED2 task - - *******************/ -void led2_task( void ) -{ - led2_off(); - taskWait( 666 ); - pwm_fake_t pwm_led( &led2, 6+3); - while( 1 ) { - pwm_led.run(); - } -} - +
diff -r 6b3e85379edd -r d098b01b9dcb led_tsk.h --- a/led_tsk.h Fri Mar 07 14:57:13 2014 +0000 +++ b/led_tsk.h Sun May 18 03:53:18 2014 +0000 @@ -9,6 +9,5 @@ #define LED_TSK_H void led1_task( void); -void led2_task( void); #endif
diff -r 6b3e85379edd -r d098b01b9dcb main.cpp --- a/main.cpp Fri Mar 07 14:57:13 2014 +0000 +++ b/main.cpp Sun May 18 03:53:18 2014 +0000 @@ -3,21 +3,24 @@ #include "Scheduler.h" #include "led_tsk.h" -Serial pc(UART_TX, UART_RX); +DigitalIn s1(P0_1); +DigitalOut led2(P0_21); int main() { - int i=0; - pc.baud(115200); scheduler_startLoop( led1_task ); - scheduler_startLoop( led2_task ); - + while(1) { - pc.printf("\nHello World ! / mbed LPC11U35 %4d",i++); - taskWait(1000); + if(s1 == 0){ //ISP SW ON? + led2 = !led2; //Green LED ON/OFF + taskWait(10); //Chattering wait 10ms + while(s1 == 0){ //ISP SW OFF? + taskWait(10); //Chattering wait 10ms + } + } + taskWait(20); //Next check wait } - -} + } \ No newline at end of file