distortos  v0.7.0
object-oriented C++ RTOS for microcontrollers
UartBase.hpp
Go to the documentation of this file.
1 
12 #ifndef INCLUDE_DISTORTOS_DEVICES_COMMUNICATION_UARTBASE_HPP_
13 #define INCLUDE_DISTORTOS_DEVICES_COMMUNICATION_UARTBASE_HPP_
14 
15 #include <bitset>
16 
17 namespace distortos
18 {
19 
20 namespace devices
21 {
22 
30 class UartBase
31 {
32 public:
33 
35  enum ErrorBits
36  {
45 
48  };
49 
51  using ErrorSet = std::bitset<errorBitsMax>;
52 
57  virtual ~UartBase() = default;
58 
67  virtual void readCompleteEvent(size_t bytesRead) = 0;
68 
78  virtual void receiveErrorEvent(ErrorSet errorSet) = 0;
79 
86  virtual void transmitCompleteEvent() = 0;
87 
94  virtual void transmitStartEvent() = 0;
95 
105  virtual void writeCompleteEvent(size_t bytesWritten) = 0;
106 };
107 
108 } // namespace devices
109 
110 } // namespace distortos
111 
112 #endif // INCLUDE_DISTORTOS_DEVICES_COMMUNICATION_UARTBASE_HPP_
virtual ~UartBase()=default
UartBase's destructor.
ErrorBits
indexes of error bits in ErrorSet
Definition: UartBase.hpp:35
parity error
Definition: UartBase.hpp:44
virtual void receiveErrorEvent(ErrorSet errorSet)=0
"Receive error" event
virtual void transmitStartEvent()=0
"Transmit start" event
overrun error
Definition: UartBase.hpp:42
virtual void transmitCompleteEvent()=0
"Transmit complete" event
Definition: UartBase.hpp:30
Top-level namespace of distortos project.
Definition: buttons.hpp:33
virtual void writeCompleteEvent(size_t bytesWritten)=0
"Write complete" event
noise error
Definition: UartBase.hpp:40
number of supported error bits - must be last!
Definition: UartBase.hpp:47
virtual void readCompleteEvent(size_t bytesRead)=0
"Read complete" event
framing error
Definition: UartBase.hpp:38
std::bitset< errorBitsMax > ErrorSet
set of error bits
Definition: UartBase.hpp:51