asdf

Dependencies:   NokiaLCD XMIT_IR mbed

Fork of 4180_mP_WirelessPong_revC by Curtis Mulady

Revision:
10:4fcd5bdb9642
Parent:
9:3e4e9d6a8ad8
Child:
12:9acca1dd0e8e
diff -r 3e4e9d6a8ad8 -r 4fcd5bdb9642 main.cpp
--- a/main.cpp	Fri Oct 05 19:38:51 2012 +0000
+++ b/main.cpp	Fri Oct 05 21:55:09 2012 +0000
@@ -39,6 +39,7 @@
 DataQueue RX_DataBuffer(1,100);
 bool rx_data_available = false;
 char packet_buff[10];
+Mail<char,64> rx_data_mailbox;
 
 //Function Prototypes
 void BlinkAlive(void const* arguments);
@@ -63,7 +64,7 @@
 
     //Serial init
     device.baud(2400);
-    //device.attach(&ISR_UARTRX,Serial::RxIrq);
+    device.attach(&ISR_UARTRX,Serial::RxIrq);
 
     //PC serial init
     pc.baud(19200);
@@ -134,10 +135,20 @@
         }*/
 
 
-        while(device.readable()) {
-            error_code = CheckPacket2(device.getc(), packet_buff, irdatOUT, 2);
-            pc.printf("  = 0x%02X.\n",error_code);
+        /* while(device.readable()) {
+             error_code = CheckPacket2(device.getc(), packet_buff, irdatOUT, 2);
+             pc.printf("  = 0x%02X.\n",error_code);
+         }*/
+
+        osEvent evt = rx_data_mailbox.get();
+        while(evt.status == osEventMail) {
+            char* mail = (char*)evt.value.p;
+            if((*mail)==0x02) pc.printf("\n");
+            pc.printf("0x%02X.",*mail);
+            rx_data_mailbox.free(mail);
+            evt = rx_data_mailbox.get();
         }
+        
 
 
 
@@ -167,7 +178,7 @@
         MakePacket(irdatOUT,2);
         //pc.printf("UART_STATE: 0x%08X",*((unsigned int *)0x40010014));
 
-        Thread::wait(6000);
+        Thread::wait(20);
     }
 }
 
@@ -282,7 +293,12 @@
     uint32_t RBR = LPC_UART1->RBR;
 
 
-    irdatIN[0] = (char)RBR;
+    //irdatIN[0] = (char)RBR;
+
+    char* mail = rx_data_mailbox.alloc();
+    mail[0] = (char)RBR;
+    rx_data_mailbox.put(mail);
+
     /*if(device.readable())
         irdatIN[1] = (char) LPC_UART1->RBR;
     if(device.readable())