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

Dependents:   multiserial_test serial_check_controller receiverA receiver_transmitter ... more

Files at this revision

API Documentation at this revision

Comitter:
bousiya03
Date:
Tue Oct 14 12:16:15 2014 +0000
Parent:
22:549436141003
Child:
24:0ca02e8c37e5
Commit message:
??????????????; dettach????????

Changed in this revision

MultiSerial.cpp Show annotated file Show diff for this revision Revisions of this file
MultiSerial.h Show annotated file Show diff for this revision Revisions of this file
--- a/MultiSerial.cpp	Tue Oct 14 12:00:22 2014 +0000
+++ b/MultiSerial.cpp	Tue Oct 14 12:16:15 2014 +0000
@@ -11,22 +11,13 @@
     
         void MultiSerial::start_write(){
             
-            __stop_write = 0;
             __serial__.attach(this,&MultiSerial::TX,RawSerial::TxIrq);
             __serial__.putc(1);
             
             }
-            
-        void MultiSerial::stop_write(){
-            
-            __stop_write  = 1;
-            
-            }
-            
-            
+               
         void MultiSerial::start_read(){
-            
-            __stop_read = 0;
+
             __serial__.attach(this,&MultiSerial::RX,RawSerial::RxIrq);
             uint8_t k = __serial__.getc();
             
@@ -34,11 +25,6 @@
             
             }
             
-        void MultiSerial::stop_read(){
-            
-            __stop_read = 1;
-            
-            }
 
         void MultiSerial::read_data(uint8_t* readData,uint8_t readKey){
 
@@ -58,16 +44,14 @@
 
         void MultiSerial::TX(void){
 
-            if(__stop_write == 1){return;} 
-
-            static uint8_t tx=__writeSize+2, i;
+            static uint8_t tx = __writeSize+2, i;
             static uint8_t txData[MAX_DATA_NUM] = {__writeKey};   
-            static uint8_t tx_checkcode=0;
+            static uint8_t tx_checkcode = 0;
             
             if(tx >= __writeSize+2){
                 txData[KEY] = __writeKey;
 
-                for(int k=1;k<=__writeSize;k++){
+                for(int k = 1;k <= __writeSize;k++){
                     txData[k] = __writeData[k-1];
                 }
                 
@@ -83,8 +67,7 @@
         }
 
         void MultiSerial::RX(void){
-            
-            if(__stop_read == 1){return;}
+        
             
             static uint8_t rx = 0, i;
             static uint8_t rxData[MAX_DATA_NUM] = {__readKey};
@@ -122,11 +105,6 @@
             
             return __serial__.readable();
             }
-
-        uint8_t MultiSerial::re_first_bit(){
-            
-            return __first_bit;
-            }
             
         void MultiSerial::check_rx_wait(){ 
                 
--- a/MultiSerial.h	Tue Oct 14 12:00:22 2014 +0000
+++ b/MultiSerial.h	Tue Oct 14 12:16:15 2014 +0000
@@ -94,16 +94,11 @@
         
         void    start_read();
         
-        void    stop_read();
-        
         void    start_write();
         
-        void    stop_write();
         
         uint8_t readable_check();
         
-        uint8_t re_first_bit();
-        
         void    check_rx_wait();
 
     protected:
@@ -118,9 +113,6 @@
         volatile    uint8_t     __writeSize;
         volatile    uint8_t     __writeKey;
         
-        volatile    uint8_t     __stop_read;
-        volatile    uint8_t     __stop_write;
-        
         volatile    uint8_t     __check_rx;
         
         volatile    uint8_t     __first_bit;