a

Dependencies:   TextLCD mbed

Committer:
akudohune
Date:
Tue Apr 30 09:06:57 2013 +0000
Revision:
1:ed00e9c4ba6e
Parent:
0:62ac378df546
ooo

Who changed what in which revision?

UserRevisionLine numberNew contents of line
akudohune 0:62ac378df546 1
akudohune 0:62ac378df546 2 #include "mbed.h"
akudohune 0:62ac378df546 3 #include "uart2.h"
akudohune 0:62ac378df546 4
akudohune 0:62ac378df546 5 extern Serial device2;
akudohune 1:ed00e9c4ba6e 6 extern BusOut mbedleds;
akudohune 0:62ac378df546 7
akudohune 1:ed00e9c4ba6e 8 extern uint8_t data[4];
akudohune 1:ed00e9c4ba6e 9
akudohune 1:ed00e9c4ba6e 10 uint8_t data2[5];
akudohune 0:62ac378df546 11
akudohune 0:62ac378df546 12
akudohune 0:62ac378df546 13 void dev2_rx()
akudohune 0:62ac378df546 14 {
akudohune 1:ed00e9c4ba6e 15 static uint8_t count3 = 0;
akudohune 0:62ac378df546 16 static uint8_t RecData2[RECEIVE2_DATA_NUM];
akudohune 0:62ac378df546 17
akudohune 0:62ac378df546 18 RecData2[count3] = device2.getc();
akudohune 0:62ac378df546 19
akudohune 1:ed00e9c4ba6e 20
akudohune 0:62ac378df546 21
akudohune 0:62ac378df546 22 if(RecData2[KEY3] == KEYCODE4){
akudohune 0:62ac378df546 23 count3++;
akudohune 1:ed00e9c4ba6e 24
akudohune 0:62ac378df546 25 }else{
akudohune 0:62ac378df546 26 count3 = 0;
akudohune 0:62ac378df546 27 }
akudohune 0:62ac378df546 28 if(count3 >= RECEIVE2_DATA_NUM){
akudohune 0:62ac378df546 29 if(RecData2[CHECK3] == CHECKCODE4){
akudohune 1:ed00e9c4ba6e 30 //mbedleds = 8;
akudohune 1:ed00e9c4ba6e 31 mbedleds = 15;
akudohune 0:62ac378df546 32 data2[0] = RecData2[DATA31];
akudohune 0:62ac378df546 33 data2[1] = RecData2[DATA32];
akudohune 0:62ac378df546 34 data2[2] = RecData2[DATA33];
akudohune 0:62ac378df546 35 data2[3] = RecData2[DATA34];
akudohune 0:62ac378df546 36 data2[4] = RecData2[DATA35];
akudohune 0:62ac378df546 37 }
akudohune 0:62ac378df546 38 count3 = 0;
akudohune 0:62ac378df546 39 }
akudohune 0:62ac378df546 40 }
akudohune 0:62ac378df546 41
akudohune 0:62ac378df546 42 void dev2_tx()
akudohune 0:62ac378df546 43 {
akudohune 1:ed00e9c4ba6e 44 static uint8_t count4 = 0;
akudohune 0:62ac378df546 45 static uint8_t SendData2[SEND2_DATA_NUM];
akudohune 0:62ac378df546 46
akudohune 0:62ac378df546 47 if(count4 >= SEND2_DATA_NUM){
akudohune 0:62ac378df546 48 SendData2[KEY4] = KEYCODE3;
akudohune 0:62ac378df546 49 SendData2[DATA41] = 33;
akudohune 1:ed00e9c4ba6e 50 SendData2[DATA42] = data[2];
akudohune 0:62ac378df546 51 SendData2[DATA43] = 52;
akudohune 0:62ac378df546 52 SendData2[DATA44] = 33;
akudohune 0:62ac378df546 53 SendData2[DATA45] = 38;
akudohune 0:62ac378df546 54 SendData2[CHECK4] = CHECKCODE3;
akudohune 0:62ac378df546 55
akudohune 0:62ac378df546 56 count4 = 0;
akudohune 0:62ac378df546 57
akudohune 0:62ac378df546 58 }
akudohune 0:62ac378df546 59 device2.putc(SendData2[count4]);
akudohune 0:62ac378df546 60
akudohune 0:62ac378df546 61 count4++;
akudohune 0:62ac378df546 62 }