ryo seki
/
serialSend5
a
uart2.cpp@0:62ac378df546, 2013-04-19 (annotated)
- Committer:
- akudohune
- Date:
- Fri Apr 19 09:14:08 2013 +0000
- Revision:
- 0:62ac378df546
- Child:
- 1:ed00e9c4ba6e
a
Who changed what in which revision?
User | Revision | Line number | New 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 | 0:62ac378df546 | 6 | extern BusOut mbedleds; |
akudohune | 0:62ac378df546 | 7 | |
akudohune | 0:62ac378df546 | 8 | int data2[5]; |
akudohune | 0:62ac378df546 | 9 | |
akudohune | 0:62ac378df546 | 10 | |
akudohune | 0:62ac378df546 | 11 | void dev2_rx() |
akudohune | 0:62ac378df546 | 12 | { |
akudohune | 0:62ac378df546 | 13 | static uint8_t count3; |
akudohune | 0:62ac378df546 | 14 | static uint8_t RecData2[RECEIVE2_DATA_NUM]; |
akudohune | 0:62ac378df546 | 15 | |
akudohune | 0:62ac378df546 | 16 | RecData2[count3] = device2.getc(); |
akudohune | 0:62ac378df546 | 17 | |
akudohune | 0:62ac378df546 | 18 | //mbedleds = 2; |
akudohune | 0:62ac378df546 | 19 | |
akudohune | 0:62ac378df546 | 20 | if(RecData2[KEY3] == KEYCODE4){ |
akudohune | 0:62ac378df546 | 21 | count3++; |
akudohune | 0:62ac378df546 | 22 | }else{ |
akudohune | 0:62ac378df546 | 23 | count3 = 0; |
akudohune | 0:62ac378df546 | 24 | } |
akudohune | 0:62ac378df546 | 25 | if(count3 >= RECEIVE2_DATA_NUM){ |
akudohune | 0:62ac378df546 | 26 | if(RecData2[CHECK3] == CHECKCODE4){ |
akudohune | 0:62ac378df546 | 27 | mbedleds = 1; |
akudohune | 0:62ac378df546 | 28 | data2[0] = RecData2[DATA31]; |
akudohune | 0:62ac378df546 | 29 | data2[1] = RecData2[DATA32]; |
akudohune | 0:62ac378df546 | 30 | data2[2] = RecData2[DATA33]; |
akudohune | 0:62ac378df546 | 31 | data2[3] = RecData2[DATA34]; |
akudohune | 0:62ac378df546 | 32 | data2[4] = RecData2[DATA35]; |
akudohune | 0:62ac378df546 | 33 | } |
akudohune | 0:62ac378df546 | 34 | count3 = 0; |
akudohune | 0:62ac378df546 | 35 | } |
akudohune | 0:62ac378df546 | 36 | } |
akudohune | 0:62ac378df546 | 37 | |
akudohune | 0:62ac378df546 | 38 | void dev2_tx() |
akudohune | 0:62ac378df546 | 39 | { |
akudohune | 0:62ac378df546 | 40 | |
akudohune | 0:62ac378df546 | 41 | static uint8_t count4; |
akudohune | 0:62ac378df546 | 42 | static uint8_t SendData2[SEND2_DATA_NUM]; |
akudohune | 0:62ac378df546 | 43 | |
akudohune | 0:62ac378df546 | 44 | if(count4 >= SEND2_DATA_NUM){ |
akudohune | 0:62ac378df546 | 45 | SendData2[KEY4] = KEYCODE3; |
akudohune | 0:62ac378df546 | 46 | SendData2[DATA41] = 33; |
akudohune | 0:62ac378df546 | 47 | SendData2[DATA42] = 57; |
akudohune | 0:62ac378df546 | 48 | SendData2[DATA43] = 52; |
akudohune | 0:62ac378df546 | 49 | SendData2[DATA44] = 33; |
akudohune | 0:62ac378df546 | 50 | SendData2[DATA45] = 38; |
akudohune | 0:62ac378df546 | 51 | SendData2[CHECK4] = CHECKCODE3; |
akudohune | 0:62ac378df546 | 52 | |
akudohune | 0:62ac378df546 | 53 | count4 = 0; |
akudohune | 0:62ac378df546 | 54 | |
akudohune | 0:62ac378df546 | 55 | } |
akudohune | 0:62ac378df546 | 56 | device2.putc(SendData2[count4]); |
akudohune | 0:62ac378df546 | 57 | |
akudohune | 0:62ac378df546 | 58 | count4++; |
akudohune | 0:62ac378df546 | 59 | } |