uint8_t型とunsigned char型に対応した多バイトシリアル通信用ライブラリ

Dependents:   multiserial_test serial_check_controller receiverA receiver_transmitter ... more

Revision:
24:0ca02e8c37e5
Parent:
23:8209d99397b8
Child:
25:1df5616cc007
--- a/MultiSerial.cpp	Tue Oct 14 12:16:15 2014 +0000
+++ b/MultiSerial.cpp	Tue Oct 14 12:22:02 2014 +0000
@@ -49,13 +49,13 @@
             static uint8_t tx_checkcode = 0;
             
             if(tx >= __writeSize+2){
-                txData[KEY] = __writeKey;
+                txData[0] = __writeKey;
 
                 for(int k = 1;k <= __writeSize;k++){
                     txData[k] = __writeData[k-1];
                 }
                 
-                for(i = KEY+1, tx_checkcode = 0; i<__writeSize+1; i++){
+                for(i = 1, tx_checkcode = 0; i<__writeSize+1; i++){
                     tx_checkcode ^= txData[i];
                 }
                 
@@ -67,20 +67,19 @@
         }
 
         void MultiSerial::RX(void){
-        
-            
+              
             static uint8_t rx = 0, i;
             static uint8_t rxData[MAX_DATA_NUM] = {__readKey};
             static uint8_t rx_checkcode = 0;
 
             rxData[rx] = __serial__.getc();
 
-            if(rxData[KEY] == __readKey){
+            if(rxData[0] == __readKey){
                 rx++;
             }
 
             if(rx == __readSize+1){
-                for(i = KEY+1, rx_checkcode = 0; i < __readSize+1; i++){
+                for(i = 1, rx_checkcode = 0; i < __readSize+1; i++){
                     rx_checkcode ^= rxData[i];
                 }
             }