tetete
Diff: AsyncSerial.hpp
- Revision:
- 10:1baa8e833ac6
- Parent:
- 9:709719dddd3e
- Child:
- 12:bfe3984fb2e5
--- a/AsyncSerial.hpp Fri Jun 23 08:07:17 2017 +0000 +++ b/AsyncSerial.hpp Tue Aug 22 07:30:07 2017 +0000 @@ -32,15 +32,17 @@ @class AsyncSerial @brief Asynchronous Serial Communication with FIFO */ -class AsyncSerial : public RawSerial{ +class AsyncSerial{ private: - - // FIFO is uint8_t(unsigned char) buffer; - FIFO<uint8_t> fifo_tx; - FIFO<uint8_t> fifo_rx; - + // Serial port + RawSerial *serial; + + // FIFO is uint8_t(unsigned char) buffer + FIFO<uint8_t> *fifo_tx; + FIFO<uint8_t> *fifo_rx; + bool Is_Serial_Sending; - + void ISR_TX(void); void ISR_RX(void); @@ -122,11 +124,17 @@ virtual int write(const uint8_t *buffer, int length); /** - @brief Clear the rx buffer by compulsion. + @brief Abort the on-going read transfer. @param No parameters. */ - virtual void flush(void); - + virtual void abort_read(void); + + /** + @brief Abort the on-going write transfer. + @param No parameters. + */ + virtual void abort_write(void); + /** @brief Wait until finish all sending. @param No parameters. @@ -139,14 +147,14 @@ @param parity Parity @param stop_bits Stop bits (1 or 2) */ - virtual void format(int bits=8, Parity parity=SerialBase::None, int stop_bits=1); + virtual void format(int bits=8, RawSerial::Parity parity=RawSerial::None, int stop_bits=1); /** @brief Set baud rate. @param baudrate baudrate (bps). */ virtual void baud(int baudrate); - + }; #endif