Asynchronous (Non-blocking) Serial Communication library with variable length software ring buffer (FIFO). You can use primary method of the RawSerial Library. Operability confirmed on mbed 2.0. (Rev.146)
Dependents: InvertedPendulum2017 SerialConnect mbed_2018 mbed_2019_rx3 ... more
Revision 15:278f7f125495, committed 2018-07-24
- Comitter:
- babylonica
- Date:
- Tue Jul 24 02:38:17 2018 +0000
- Parent:
- 14:54cbbb00bd19
- Commit message:
- Minor fixes;
Changed in this revision
AsyncSerial.cpp | Show annotated file Show diff for this revision Revisions of this file |
AsyncSerial.hpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 54cbbb00bd19 -r 278f7f125495 AsyncSerial.cpp --- a/AsyncSerial.cpp Mon Aug 28 12:25:37 2017 +0000 +++ b/AsyncSerial.cpp Tue Jul 24 02:38:17 2018 +0000 @@ -20,20 +20,12 @@ #include "AsyncSerial.hpp" AsyncSerial::AsyncSerial(PinName txpin, PinName rxpin, uint32_t baudrate, uint32_t buffer_size){ - - //led = new DigitalOut(LED2); - // RawSerial port init serial = new RawSerial(txpin, rxpin, baudrate); // FIFO init fifo_tx = new FIFO<uint8_t>(buffer_size); fifo_rx = new FIFO<uint8_t>(buffer_size); - - // Debug - //led->write(1); - //led->write(0); // Went off - fifo_tx->clear(); fifo_rx->clear(); @@ -44,17 +36,13 @@ serial->attach(callback(this, &AsyncSerial::ISR_TX), SerialBase::TxIrq); serial->attach(callback(this, &AsyncSerial::ISR_RX), SerialBase::RxIrq); - // Debug - //led->write(0); // Didnt go off - return; } AsyncSerial::~AsyncSerial(){ serial->attach(NULL, serial->TxIrq); serial->attach(NULL, serial->RxIrq); - led->write(1); - + delete serial; return; }
diff -r 54cbbb00bd19 -r 278f7f125495 AsyncSerial.hpp --- a/AsyncSerial.hpp Mon Aug 28 12:25:37 2017 +0000 +++ b/AsyncSerial.hpp Tue Jul 24 02:38:17 2018 +0000 @@ -34,11 +34,8 @@ */ class AsyncSerial{ private: - - DigitalOut *led; - - - + //DigitalOut *led; + // Serial port RawSerial *serial;