Inherit from Serial and use software buffers for TX and RX. This allows the UART peripherals to operate in a IRQ driven mode. Overrides most (but not all) stdio functions as Serial did
Dependencies: Buffer
Revision 13:e2a9eb801c48, committed 2020-09-29
- Comitter:
- harada_jpms
- Date:
- Tue Sep 29 23:56:04 2020 +0000
- Parent:
- 12:a0d37088b405
- Commit message:
- save
Changed in this revision
BufferedSerial.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r a0d37088b405 -r e2a9eb801c48 BufferedSerial.cpp --- a/BufferedSerial.cpp Mon Mar 07 21:10:27 2016 +0000 +++ b/BufferedSerial.cpp Tue Sep 29 23:56:04 2020 +0000 @@ -26,6 +26,8 @@ BufferedSerial::BufferedSerial(PinName tx, PinName rx, uint32_t buf_size, uint32_t tx_multiple, const char* name) : RawSerial(tx, rx) , _rxbuf(buf_size), _txbuf((uint32_t)(tx_multiple*buf_size)) { + RawSerial::baud( 115200 ); + RawSerial::attach(this, &BufferedSerial::rxIrq, Serial::RxIrq); this->_buf_size = buf_size; this->_tx_multiple = tx_multiple;