Extended MaximInterface
Dependents: mbed_DS28EC20_GPIO
Diff: Links/Uart.hpp
- Revision:
- 3:f818ea5172ed
- Parent:
- 0:f77ad7f72d04
- Child:
- 6:a8c83a2e6fa4
diff -r dbc089c57059 -r f818ea5172ed Links/Uart.hpp --- a/Links/Uart.hpp Mon Nov 06 17:46:41 2017 -0600 +++ b/Links/Uart.hpp Thu Jan 11 13:50:39 2018 -0600 @@ -41,6 +41,7 @@ namespace MaximInterface { +/// Universal asynchronous receiver-transmitter interface. class Uart { public: enum ErrorValue { @@ -50,13 +51,31 @@ virtual ~Uart() {} - virtual error_code setBaud(int_least32_t baud) = 0; + /// Set the baud rate of the port in Hz. + virtual error_code setBaudRate(int_least32_t baudRate) = 0; + + /// Generate a break condition on the port for a small amount of time. virtual error_code sendBreak() = 0; + + /// Clear all received data that was buffered. virtual error_code clearReadBuffer() = 0; + + /// Writes a byte of data to the port. virtual error_code writeByte(uint_least8_t data) = 0; + + /// Writes a block of data to the port. MaximInterface_EXPORT virtual error_code writeBlock(const uint_least8_t * data, size_t dataLen); + + /// Reads a byte of data from the port. Block until data is received or a + /// timeout is reached. + /// @param[out] data Data read from the port if successful. virtual error_code readByte(uint_least8_t & data) = 0; + + /// Read a block of data from the port. Block until data is received or a + /// timeout is reached. + /// @param[out] data Data read from the port if successful. + /// @para dataLen Number of bytes to read and length of data. MaximInterface_EXPORT virtual error_code readBlock(uint_least8_t * data, size_t dataLen);