tetete
Diff: AsyncSerial.cpp
- Revision:
- 13:e372a354d969
- Parent:
- 12:bfe3984fb2e5
- Child:
- 14:54cbbb00bd19
--- a/AsyncSerial.cpp Tue Aug 22 15:08:21 2017 +0000 +++ b/AsyncSerial.cpp Wed Aug 23 01:11:52 2017 +0000 @@ -4,11 +4,12 @@ @brief Asynchronous (Non-brocking) Serial Communication library with variable length software ring buffer (FIFO). You can use also RawSerial Library's method. You can set the baudrate of the serial communication when instantiating. @author T.Kawamura - @version 1.2 + @version 1.3 @date 2017-03-29 T.Kawamura Written for C++/mbed. @date 2017-03-30 T.Kawamura Bug Fixed: Cannot use format(), baud(). @date 2017-06-17 T.Kawamura Update: FIFO Buffer Fixed. + @see Copyright (C) 2017 T.Kawamura. Released under the MIT license. @@ -29,15 +30,17 @@ fifo_tx = new FIFO<uint8_t>(buffer_size); fifo_rx = new FIFO<uint8_t>(buffer_size); - led->write(1); - + // Debug + //led->write(1); + //led->write(0); // Went off + //Initialize ISR - ///serial->attach(this, &AsyncSerial::ISR_TX, serial->TxIrq); - ///serial->attach(this, &AsyncSerial::ISR_RX, serial->RxIrq); - serial->attach(callback(this, &AsyncSerial::ISR_TX), serial->TxIrq); - serial->attach(callback(this, &AsyncSerial::ISR_RX), serial->RxIrq); + serial->attach(callback(this, &AsyncSerial::ISR_TX), SerialBase::TxIrq); + serial->attach(callback(this, &AsyncSerial::ISR_RX), SerialBase::RxIrq); - led->write(0); + // Debug + //led->write(0); // Didnt go off + fifo_tx->clear(); fifo_rx->clear(); @@ -56,7 +59,7 @@ void AsyncSerial::ISR_TX(void){ int data; - + if( fifo_tx->available() > 0 ){ data = (int)fifo_tx->get(); serial->putc(data);