asdf
Dependencies: NokiaLCD XMIT_IR mbed
Fork of 4180_mP_WirelessPong_revC by
Diff: main.cpp
- Revision:
- 16:bc0e213ba52d
- Parent:
- 15:21c512907cf6
- Child:
- 17:f92e4a384637
--- a/main.cpp Sat Oct 06 11:34:40 2012 +0000 +++ b/main.cpp Sat Oct 06 12:52:35 2012 +0000 @@ -38,7 +38,7 @@ Serial pc(USBTX,USBRX); PwmOut IRLED_mod(p21); -//IRTransmitter ir_tx(p13,p21,p14,4,&ISR_UARTRX); //tx,pwm,size +IRTransmitter ir_tx(p13,p21,p14,4,&ISR_UARTRX); //tx,pwm,size //Global Vars char text_buffer[32]; @@ -63,6 +63,9 @@ pc.baud(19200); pc.printf("Starting...\n\n"); + //IR_TRX module + ir_tx.set_debug_port(&pc); + //Variable Init for(int i=0; i<10; i++) packet_buff[i]=0; @@ -140,16 +143,21 @@ ir_tx.ir_data_mailbox.free(mail); evt = ir_tx.ir_data_mailbox.get(); }*/ - - char error_code; - //error_code = ir_tx.ReadPacket(irdatIN,4); - pc.printf("0x%02X.",error_code); - + + char result; + result = ir_tx.ReadPacket(irdatIN,4); + if(result == 0x1) { + pc.printf("\n"); + for(int i=0; i<4; i++) { + pc.printf("0x%02X.",irdatIN[i]); + } + } + //Do not return until we have more data //Thread::signal_wait(0x1); - Thread::wait(20); + Thread::wait(10); } } @@ -198,10 +206,10 @@ irdatOUT[2] = ~(irdata_out*2); irdatOUT[3] = irdata_out*7+13; //MakePacket2(irdatOUT,4); - //ir_tx.MakePacket(irdatOUT,4); + ir_tx.MakePacket(irdatOUT,4); //Roughly use to set rate of data packets per second - Thread::wait(50); + Thread::wait(200); } } @@ -233,8 +241,8 @@ /*char* mail = ir_tx.ir_data_mailbox.alloc(); mail[0] = (char)RBR; ir_tx.ir_data_mailbox.put(mail);*/ - - //ir_tx.isr(RBR); + + ir_tx.isr(RBR); //Let message handler run //(*threadptr_irstuff).signal_set(0x1);