WPILibC++
2019.1.1-beta-2-17-g6f0c185
|
Functions | |
HAL_ENUM (HAL_SerialPort) | |
void | HAL_InitializeSerialPort (HAL_SerialPort port, int32_t *status) |
Initializes a serial port. More... | |
void | HAL_InitializeSerialPortDirect (HAL_SerialPort port, const char *portName, int32_t *status) |
Initializes a serial port with a direct name. More... | |
void | HAL_SetSerialBaudRate (HAL_SerialPort port, int32_t baud, int32_t *status) |
Sets the baud rate of a serial port. More... | |
void | HAL_SetSerialDataBits (HAL_SerialPort port, int32_t bits, int32_t *status) |
Sets the number of data bits on a serial port. More... | |
void | HAL_SetSerialParity (HAL_SerialPort port, int32_t parity, int32_t *status) |
Sets the number of parity bits on a serial port. More... | |
void | HAL_SetSerialStopBits (HAL_SerialPort port, int32_t stopBits, int32_t *status) |
Sets the number of stop bits on a serial port. More... | |
void | HAL_SetSerialWriteMode (HAL_SerialPort port, int32_t mode, int32_t *status) |
Sets the write mode on a serial port. More... | |
void | HAL_SetSerialFlowControl (HAL_SerialPort port, int32_t flow, int32_t *status) |
Sets the flow control mode of a serial port. More... | |
void | HAL_SetSerialTimeout (HAL_SerialPort port, double timeout, int32_t *status) |
Sets the minimum serial read timeout of a port. More... | |
void | HAL_EnableSerialTermination (HAL_SerialPort port, char terminator, int32_t *status) |
Sets the termination character that terminates a read. More... | |
void | HAL_DisableSerialTermination (HAL_SerialPort port, int32_t *status) |
Disables a termination character for reads. More... | |
void | HAL_SetSerialReadBufferSize (HAL_SerialPort port, int32_t size, int32_t *status) |
Sets the size of the read buffer. More... | |
void | HAL_SetSerialWriteBufferSize (HAL_SerialPort port, int32_t size, int32_t *status) |
Sets the size of the write buffer. More... | |
int32_t | HAL_GetSerialBytesReceived (HAL_SerialPort port, int32_t *status) |
Gets the number of bytes currently in the read buffer. More... | |
int32_t | HAL_ReadSerial (HAL_SerialPort port, char *buffer, int32_t count, int32_t *status) |
Reads data from the serial port. More... | |
int32_t | HAL_WriteSerial (HAL_SerialPort port, const char *buffer, int32_t count, int32_t *status) |
Writes data to the serial port. More... | |
void | HAL_FlushSerial (HAL_SerialPort port, int32_t *status) |
Flushes the serial write buffer out to the port. More... | |
void | HAL_ClearSerial (HAL_SerialPort port, int32_t *status) |
Clears the receive buffer of the serial port. More... | |
void | HAL_CloseSerial (HAL_SerialPort port, int32_t *status) |
Closes a serial port. More... | |
void HAL_ClearSerial | ( | HAL_SerialPort | port, |
int32_t * | status | ||
) |
Clears the receive buffer of the serial port.
port | the serial port |
void HAL_CloseSerial | ( | HAL_SerialPort | port, |
int32_t * | status | ||
) |
Closes a serial port.
port | the serial port to close |
void HAL_DisableSerialTermination | ( | HAL_SerialPort | port, |
int32_t * | status | ||
) |
Disables a termination character for reads.
port | the serial port |
void HAL_EnableSerialTermination | ( | HAL_SerialPort | port, |
char | terminator, | ||
int32_t * | status | ||
) |
Sets the termination character that terminates a read.
By default this is disabled.
port | the serial port |
terminator | the termination character to set |
void HAL_FlushSerial | ( | HAL_SerialPort | port, |
int32_t * | status | ||
) |
Flushes the serial write buffer out to the port.
port | the serial port |
int32_t HAL_GetSerialBytesReceived | ( | HAL_SerialPort | port, |
int32_t * | status | ||
) |
Gets the number of bytes currently in the read buffer.
port | the serial port |
void HAL_InitializeSerialPort | ( | HAL_SerialPort | port, |
int32_t * | status | ||
) |
Initializes a serial port.
The channels are either the onboard RS232, the mxp uart, or 2 USB ports. The top port is USB1, the bottom port is USB2.
port | the serial port to initialize |
void HAL_InitializeSerialPortDirect | ( | HAL_SerialPort | port, |
const char * | portName, | ||
int32_t * | status | ||
) |
Initializes a serial port with a direct name.
This name is the VISA name for a specific port (find this in the web dash). Note these are not always consistent between roboRIO reboots.
port | the serial port to initialize |
portName | the VISA port name |
int32_t HAL_ReadSerial | ( | HAL_SerialPort | port, |
char * | buffer, | ||
int32_t | count, | ||
int32_t * | status | ||
) |
Reads data from the serial port.
Will wait for either timeout (if set), the termination char (if set), or the count to be full. Whichever one comes first.
port | the serial port |
count | the number of bytes maximum to read |
void HAL_SetSerialBaudRate | ( | HAL_SerialPort | port, |
int32_t | baud, | ||
int32_t * | status | ||
) |
Sets the baud rate of a serial port.
Any value between 0 and 0xFFFFFFFF may be used. Default is 9600.
port | the serial port |
baud | the baud rate to set |
void HAL_SetSerialDataBits | ( | HAL_SerialPort | port, |
int32_t | bits, | ||
int32_t * | status | ||
) |
Sets the number of data bits on a serial port.
Defaults to 8.
port | the serial port |
bits | the number of data bits (5-8) |
void HAL_SetSerialFlowControl | ( | HAL_SerialPort | port, |
int32_t | flow, | ||
int32_t * | status | ||
) |
Sets the flow control mode of a serial port.
Valid values are: 0: None (default) 1: XON-XOFF 2: RTS-CTS 3: DTR-DSR
port | the serial port |
flow | the mode to set (see remarks for valid values) |
void HAL_SetSerialParity | ( | HAL_SerialPort | port, |
int32_t | parity, | ||
int32_t * | status | ||
) |
Sets the number of parity bits on a serial port.
Valid values are: 0: None (default) 1: Odd 2: Even 3: Mark - Means exists and always 1 4: Space - Means exists and always 0
port | the serial port |
parity | the parity bit mode (see remarks for valid values) |
void HAL_SetSerialReadBufferSize | ( | HAL_SerialPort | port, |
int32_t | size, | ||
int32_t * | status | ||
) |
Sets the size of the read buffer.
port | the serial port |
size | the read buffer size |
void HAL_SetSerialStopBits | ( | HAL_SerialPort | port, |
int32_t | stopBits, | ||
int32_t * | status | ||
) |
Sets the number of stop bits on a serial port.
Valid values are: 10: One stop bit (default) 15: One and a half stop bits 20: Two stop bits
port | the serial port |
stopBits | the stop bit value (see remarks for valid values) |
void HAL_SetSerialTimeout | ( | HAL_SerialPort | port, |
double | timeout, | ||
int32_t * | status | ||
) |
Sets the minimum serial read timeout of a port.
port | the serial port |
timeout | the timeout in milliseconds |
void HAL_SetSerialWriteBufferSize | ( | HAL_SerialPort | port, |
int32_t | size, | ||
int32_t * | status | ||
) |
Sets the size of the write buffer.
port | the serial port |
size | the write buffer size |
void HAL_SetSerialWriteMode | ( | HAL_SerialPort | port, |
int32_t | mode, | ||
int32_t * | status | ||
) |
Sets the write mode on a serial port.
Valid values are: 1: Flush on access 2: Flush when full (default)
port | the serial port |
mode | the mode to set (see remarks for valid values) |
int32_t HAL_WriteSerial | ( | HAL_SerialPort | port, |
const char * | buffer, | ||
int32_t | count, | ||
int32_t * | status | ||
) |
Writes data to the serial port.
port | the serial port |
buffer | the buffer to write |
count | the number of bytes to write from the buffer |