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
Fork of BufferedSerial by
Diff: BufferedSerial.h
- Revision:
- 11:8037db39ea31
- Parent:
- 10:9ee15ae3d1a3
--- a/BufferedSerial.h Wed Jan 07 18:37:11 2015 +0000 +++ b/BufferedSerial.h Wed Nov 04 10:00:40 2015 +0000 @@ -75,7 +75,7 @@ { private: Buffer <char> _rxbuf; - Buffer <char> _txbuf; + uint32_t _buf_size; uint32_t _tx_multiple; @@ -84,6 +84,8 @@ void prime(void); public: + Buffer <char> _txbuf; + /** Create a BufferedSerial port, connected to the specified transmit and receive pins * @param tx Transmit pin * @param rx Receive pin @@ -107,6 +109,7 @@ * @return 1 always has room and can overwrite previous content if too small / slow */ virtual int writeable(void); + /** Get a single byte from the BufferedSerial Port. * Should check readable() before calling this.