tetete
Diff: AsyncSerial.cpp
- Revision:
- 12:bfe3984fb2e5
- Parent:
- 10:1baa8e833ac6
- Child:
- 13:e372a354d969
--- a/AsyncSerial.cpp Tue Aug 22 07:30:07 2017 +0000 +++ b/AsyncSerial.cpp Tue Aug 22 15:08:21 2017 +0000 @@ -19,6 +19,9 @@ #include "AsyncSerial.hpp" AsyncSerial::AsyncSerial(PinName txpin, PinName rxpin, uint32_t baudrate, uint32_t buffer_size){ + + led = new DigitalOut(LED1); + // RawSerial port init serial = new RawSerial(txpin, rxpin, baudrate); @@ -26,15 +29,20 @@ fifo_tx = new FIFO<uint8_t>(buffer_size); fifo_rx = new FIFO<uint8_t>(buffer_size); + led->write(1); + //Initialize ISR - serial->attach(this, &AsyncSerial::ISR_TX, serial->TxIrq); - serial->attach(this, &AsyncSerial::ISR_RX, serial->RxIrq); - + ///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); + + led->write(0); fifo_tx->clear(); fifo_rx->clear(); Is_Serial_Sending = false; - + return; } @@ -177,8 +185,8 @@ serial->format(bits, parity, stop_bits); - 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); } void AsyncSerial::baud(int baudrate){ @@ -187,7 +195,7 @@ serial->baud(baudrate); - 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); }