a

Dependencies:   TextLCD mbed

Revision:
0:62ac378df546
Child:
1:ed00e9c4ba6e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uart2.cpp	Fri Apr 19 09:14:08 2013 +0000
@@ -0,0 +1,59 @@
+
+#include "mbed.h"
+#include "uart2.h"
+
+extern Serial device2;
+extern BusOut mbedleds; 
+
+int data2[5];
+
+
+void dev2_rx()
+{   
+    static uint8_t count3;
+    static uint8_t RecData2[RECEIVE2_DATA_NUM];
+    
+    RecData2[count3] = device2.getc();
+    
+    //mbedleds = 2;
+    
+    if(RecData2[KEY3] == KEYCODE4){
+        count3++;
+    }else{
+        count3 = 0;
+    }
+    if(count3 >= RECEIVE2_DATA_NUM){
+        if(RecData2[CHECK3] == CHECKCODE4){
+            mbedleds = 1;
+            data2[0] = RecData2[DATA31];
+            data2[1] = RecData2[DATA32];
+            data2[2] = RecData2[DATA33];
+            data2[3] = RecData2[DATA34];
+            data2[4] = RecData2[DATA35];
+        }
+        count3 = 0;
+    }  
+}
+
+void dev2_tx()
+{
+    
+    static uint8_t count4;
+    static uint8_t SendData2[SEND2_DATA_NUM];
+    
+    if(count4 >= SEND2_DATA_NUM){
+        SendData2[KEY4]   = KEYCODE3;
+        SendData2[DATA41] = 33;
+        SendData2[DATA42] = 57;
+        SendData2[DATA43] = 52;
+        SendData2[DATA44] = 33;
+        SendData2[DATA45] = 38;
+        SendData2[CHECK4] = CHECKCODE3;
+        
+        count4 = 0;
+        
+    }
+    device2.putc(SendData2[count4]);
+    
+    count4++;
+}