ryo seki
/
serialSend5
a
Diff: uart2.cpp
- Revision:
- 1:ed00e9c4ba6e
- Parent:
- 0:62ac378df546
--- a/uart2.cpp Fri Apr 19 09:14:08 2013 +0000 +++ b/uart2.cpp Tue Apr 30 09:06:57 2013 +0000 @@ -3,28 +3,32 @@ #include "uart2.h" extern Serial device2; -extern BusOut mbedleds; +extern BusOut mbedleds; -int data2[5]; +extern uint8_t data[4]; + +uint8_t data2[5]; void dev2_rx() { - static uint8_t count3; + static uint8_t count3 = 0; 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; + //mbedleds = 8; + mbedleds = 15; data2[0] = RecData2[DATA31]; data2[1] = RecData2[DATA32]; data2[2] = RecData2[DATA33]; @@ -37,14 +41,13 @@ void dev2_tx() { - - static uint8_t count4; + static uint8_t count4 = 0; static uint8_t SendData2[SEND2_DATA_NUM]; if(count4 >= SEND2_DATA_NUM){ SendData2[KEY4] = KEYCODE3; SendData2[DATA41] = 33; - SendData2[DATA42] = 57; + SendData2[DATA42] = data[2]; SendData2[DATA43] = 52; SendData2[DATA44] = 33; SendData2[DATA45] = 38;