ir stuff working nicely. rx on interrupt. tx is blocking.
Fork of 4180_mP_WirelessPong_revB by
Revision 1:9ba884d85ac6, committed 2012-10-04
- Comitter:
- cmulady
- Date:
- Thu Oct 04 13:58:09 2012 +0000
- Parent:
- 0:c8ddcaa575ba
- Child:
- 2:406c6fc08ff1
- Commit message:
- Last revision didn't have rtos stuff in it. That's what happens when you have two compiler windows open.
Changed in this revision
--- a/RemoteIR.lib Thu Oct 04 13:12:12 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/shintamainjp/code/RemoteIR/#268cc2ab63bd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/XMIT_IR.lib Thu Oct 04 13:58:09 2012 +0000 @@ -0,0 +1,1 @@ +XMIT_IR#556f9be6047d
--- a/main.cpp Thu Oct 04 13:12:12 2012 +0000 +++ b/main.cpp Thu Oct 04 13:58:09 2012 +0000 @@ -1,23 +1,63 @@ #include "mbed.h" #include "rtos.h" #include "NokiaLCD.h" +#include "XMIT_IR.h" -DigitalOut myled(LED1); +#define FPS 5 + + +DigitalOut led1(LED1); +DigitalOut led2(LED2); NokiaLCD lcd(p5, p7, p8, p9, NokiaLCD::LCD6610); // mosi, sclk, cs, rst, type -int main() { +Serial device(p13, p14); // tx, rx +PwmOut IRLED(p21); + +char buffer[32]; + + +void BlinkAlive(void const* arguments); +void UpdateLCD(void const* arguments); + + +int main() +{ lcd.background(0x000000); - lcd.cls(); - lcd.locate(0,1); - lcd.printf("Debug:"); - - - - + + Thread thread_blinkalive(BlinkAlive); + Thread thread_updatelcd(UpdateLCD); + + + while(1) { - myled = 1; - wait(0.2); - myled = 0; - wait(0.2); + thread_updatelcd.signal_set(0x1); + Thread::wait(1000/FPS); + } } + +void UpdateLCD(void const* arguments) +{ + while(true) { + led2 = 1; + lcd.locate(0,1); + lcd.printf("Debug:"); + + lcd.locate(0,3); + time_t seconds = time(NULL); + strftime(buffer, 32, "%I:%M:%S %p\n", localtime(&seconds)); + lcd.printf("%s", buffer); + + //End - Sleep thread + led2 = 0; + Thread::signal_wait(0x1); + } +} + +void BlinkAlive(void const* arguments) +{ + while(true) { + led1 = !led1; + Thread::wait(500); + } +} \ No newline at end of file