DA fork of BufferedSerial
Dependencies: Buffer
Fork of BufferedSerial by
Revision 13:70554b829bdd, committed 2018-08-06
- Comitter:
- nprof50
- Date:
- Mon Aug 06 17:29:07 2018 +0000
- Parent:
- 12:a0d37088b405
- Commit message:
- Updated BufferedSerial library to accept baud rate (now default 115200)
Changed in this revision
BufferedSerial.cpp | Show annotated file Show diff for this revision Revisions of this file |
BufferedSerial.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/BufferedSerial.cpp Mon Mar 07 21:10:27 2016 +0000 +++ b/BufferedSerial.cpp Mon Aug 06 17:29:07 2018 +0000 @@ -23,8 +23,8 @@ #include "BufferedSerial.h" #include <stdarg.h> -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)) +BufferedSerial::BufferedSerial(PinName tx, PinName rx, int baud, uint32_t buf_size, uint32_t tx_multiple, const char* name) + : RawSerial(tx, rx, baud) , _rxbuf(buf_size), _txbuf((uint32_t)(tx_multiple*buf_size)) { RawSerial::attach(this, &BufferedSerial::rxIrq, Serial::RxIrq); this->_buf_size = buf_size;
--- a/BufferedSerial.h Mon Mar 07 21:10:27 2016 +0000 +++ b/BufferedSerial.h Mon Aug 06 17:29:07 2018 +0000 @@ -84,12 +84,13 @@ /** Create a BufferedSerial port, connected to the specified transmit and receive pins * @param tx Transmit pin * @param rx Receive pin + * @param baud Baud rate // CUSTOM * @param buf_size printf() buffer size * @param tx_multiple amount of max printf() present in the internal ring buffer at one time * @param name optional name * @note Either tx or rx may be specified as NC if unused */ - BufferedSerial(PinName tx, PinName rx, uint32_t buf_size = 256, uint32_t tx_multiple = 4,const char* name=NULL); + BufferedSerial(PinName tx, PinName rx, int baud = MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE, uint32_t buf_size = 256, uint32_t tx_multiple = 4,const char* name=NULL); /** Destroy a BufferedSerial port */