Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: multiserial_test serial_check_controller receiverA receiver_transmitter ... more
Revision 19:0acb5961827b, committed 2014-10-14
- Comitter:
- bousiya03
- Date:
- Tue Oct 14 08:58:39 2014 +0000
- Parent:
- 18:c9d6422e6b33
- Child:
- 20:9e14b87bfdac
- Commit message:
- ??????????; ?????????????????????; ???????
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 Sun Oct 12 00:50:40 2014 +0000
+++ b/MultiSerial.cpp Tue Oct 14 08:58:39 2014 +0000
@@ -4,7 +4,7 @@
#include "mbed.h"
#include "MultiSerial.h"
-#include "Serial.h"
+#include "RawSerial.h"
MultiSerial::MultiSerial(PinName tx,PinName rx) : __serial__(tx,rx){
@@ -40,7 +40,7 @@
void MultiSerial::start_write(){
__stop_write = 0;
- __serial__.attach(this,&MultiSerial::TX,Serial::TxIrq);
+ __serial__.attach(this,&MultiSerial::TX,RawSerial::TxIrq);
__serial__.putc(1);
}
@@ -55,7 +55,7 @@
void MultiSerial::start_read(){
__stop_read = 0;
- __serial__.attach(this,&MultiSerial::RX,Serial::RxIrq);
+ __serial__.attach(this,&MultiSerial::RX,RawSerial::RxIrq);
uint8_t k = __serial__.getc();
__first_bit = k;
@@ -131,13 +131,19 @@
if(rx >= __readSize+2){
if(rxData[__readSize+1]==rx_checkcode){
-
+
+ __check_rx = 1;
+
for(int m=1;m<=__readSize;m++){
__readData[m-1] = rxData[m];
}
//使うデータ = 受け取ったデータ
- }
+ }else{
+
+ __check_rx=0;
+
+ }
rx=0;
}
}
@@ -153,4 +159,9 @@
return __first_bit;
}
+ uint8_t MultiSerial::check_rx(){
+
+ return __check_rx;
+
+ }
\ No newline at end of file
--- a/MultiSerial.h Sun Oct 12 00:50:40 2014 +0000
+++ b/MultiSerial.h Tue Oct 14 08:58:39 2014 +0000
@@ -103,6 +103,8 @@
uint8_t readable_check();
uint8_t re_first_bit();
+
+ uint8_t check_rx();
protected:
@@ -119,6 +121,8 @@
volatile uint8_t __stop_read;
volatile uint8_t __stop_write;
+ volatile uint8_t __check_rx;
+
volatile uint8_t __first_bit;
};