12 #include <wpi/StringRef.h>
13 #include <wpi/Twine.h>
14 #include <wpi/deprecated.h>
16 #include "frc/ErrorBase.h"
44 kStopBits_OnePointFive = 15,
49 kFlowControl_None = 0,
50 kFlowControl_XonXoff = 1,
51 kFlowControl_RtsCts = 2,
52 kFlowControl_DtrDsr = 4
55 enum WriteBufferMode { kFlushOnAccess = 1, kFlushWhenFull = 2 };
57 enum Port { kOnboard = 0, kMXP = 1, kUSB = 2, kUSB1 = 2, kUSB2 = 3 };
70 SerialPort(
int baudRate, Port port = kOnboard,
int dataBits = 8,
71 Parity parity = kParity_None, StopBits stopBits = kStopBits_One);
85 WPI_DEPRECATED(
"Will be removed for 2019")
87 int dataBits = 8, Parity parity = kParity_None,
88 StopBits stopBits = kStopBits_One);
132 int Read(
char* buffer,
int count);
141 int Write(
const char* buffer,
int count);
217 int m_resourceManagerHandle = 0;
218 int m_portHandle = 0;
219 bool m_consoleModeEnabled =
false;
WPILib FRC namespace.
Definition: SPIAccelerometerSim.h:18
Driver for the RS-232 serial port on the roboRIO.
Definition: SerialPort.h:32
int Read(char *buffer, int count)
Read raw bytes out of the buffer.
void Flush()
Force the output buffer to be written to the port.
void SetTimeout(double timeout)
Configure the timeout of the serial port.
int Write(const char *buffer, int count)
Write raw bytes to the buffer.
SerialPort(int baudRate, Port port=kOnboard, int dataBits=8, Parity parity=kParity_None, StopBits stopBits=kStopBits_One)
Create an instance of a Serial Port class.
void DisableTermination()
Disable termination behavior.
void SetWriteBufferSize(int size)
Specify the size of the output buffer.
void Reset()
Reset the serial port driver to a known state.
void EnableTermination(char terminator= '\n')
Enable termination and specify the termination character.
int GetBytesReceived()
Get the number of bytes currently available to read from the serial port.
void SetFlowControl(FlowControl flowControl)
Set the type of flow control to enable on this port.
Base class for most objects.
Definition: ErrorBase.h:74
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
void SetWriteBufferMode(WriteBufferMode mode)
Specify the flushing behavior of the output buffer.
void SetReadBufferSize(int size)
Specify the size of the input buffer.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:79