7 #ifndef __SerialPort_h__
8 #define __SerialPort_h__
10 #include "ErrorBase.h"
28 typedef enum {kParity_None=0, kParity_Odd=1, kParity_Even=2, kParity_Mark=3, kParity_Space=4} Parity;
29 typedef enum {kStopBits_One=10, kStopBits_OnePointFive=15, kStopBits_Two=20} StopBits;
30 typedef enum {kFlowControl_None=0, kFlowControl_XonXoff=1, kFlowControl_RtsCts=2, kFlowControl_DtrDsr=4} FlowControl;
31 typedef enum {kFlushOnAccess=1, kFlushWhenFull=2} WriteBufferMode;
33 SerialPort(uint32_t baudRate, uint8_t dataBits = 8, Parity parity = kParity_None, StopBits stopBits = kStopBits_One);
39 void Printf(
const char *writeFmt, ...);
40 void Scanf(
const char *readFmt, ...);
41 uint32_t
Read(
char *buffer, int32_t count);
42 uint32_t
Write(
const char *buffer, int32_t count);
55 uint32_t m_resourceManagerHandle;
56 uint32_t m_portHandle;
57 bool m_consoleModeEnabled;
void SetReadBufferSize(uint32_t size)
Definition: SerialPort.cpp:247
void SetFlowControl(FlowControl flowControl)
Definition: SerialPort.cpp:80
void Reset()
Definition: SerialPort.cpp:313
void Scanf(const char *readFmt,...)
Definition: SerialPort.cpp:162
void SetTimeout(float timeout)
Definition: SerialPort.cpp:226
~SerialPort()
Definition: SerialPort.cpp:65
void DisableTermination()
Definition: SerialPort.cpp:111
void Flush()
Definition: SerialPort.cpp:299
Definition: ErrorBase.h:37
SerialPort(uint32_t baudRate, uint8_t dataBits=8, Parity parity=kParity_None, StopBits stopBits=kStopBits_One)
Definition: SerialPort.cpp:22
uint32_t Write(const char *buffer, int32_t count)
Definition: SerialPort.cpp:207
void Printf(const char *writeFmt,...)
Definition: SerialPort.cpp:143
int32_t GetBytesReceived()
Definition: SerialPort.cpp:125
uint32_t Read(char *buffer, int32_t count)
Definition: SerialPort.cpp:181
void EnableTermination(char terminator= '\n')
Definition: SerialPort.cpp:98
void SetWriteBufferSize(uint32_t size)
Definition: SerialPort.cpp:264
Definition: SerialPort.h:25
void SetWriteBufferMode(WriteBufferMode mode)
Definition: SerialPort.cpp:284