blob: 3b5aa9298c4597393bfcf9efc9e1c049ebb7b2a2 [file] [log] [blame]
Brian Silvermanf7f267a2017-02-04 16:16:08 -08001/*----------------------------------------------------------------------------*/
2/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
3/* Open Source Software - may be modified and shared by FRC teams. The code */
4/* must be accompanied by the FIRST BSD license file in the root directory of */
5/* the project. */
6/*----------------------------------------------------------------------------*/
7
8#pragma once
9
10#include <stdint.h>
11
12enum HAL_SerialPort : int32_t {
13 HAL_SerialPort_Onboard = 0,
14 HAL_SerialPort_MXP = 1,
15 HAL_SerialPort_USB1 = 2,
16 HAL_SerialPort_USB2 = 3
17};
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23void HAL_InitializeSerialPort(HAL_SerialPort port, int32_t* status);
24void HAL_SetSerialBaudRate(HAL_SerialPort port, int32_t baud, int32_t* status);
25void HAL_SetSerialDataBits(HAL_SerialPort port, int32_t bits, int32_t* status);
26void HAL_SetSerialParity(HAL_SerialPort port, int32_t parity, int32_t* status);
27void HAL_SetSerialStopBits(HAL_SerialPort port, int32_t stopBits,
28 int32_t* status);
29void HAL_SetSerialWriteMode(HAL_SerialPort port, int32_t mode, int32_t* status);
30void HAL_SetSerialFlowControl(HAL_SerialPort port, int32_t flow,
31 int32_t* status);
32void HAL_SetSerialTimeout(HAL_SerialPort port, double timeout, int32_t* status);
33void HAL_EnableSerialTermination(HAL_SerialPort port, char terminator,
34 int32_t* status);
35void HAL_DisableSerialTermination(HAL_SerialPort port, int32_t* status);
36void HAL_SetSerialReadBufferSize(HAL_SerialPort port, int32_t size,
37 int32_t* status);
38void HAL_SetSerialWriteBufferSize(HAL_SerialPort port, int32_t size,
39 int32_t* status);
40int32_t HAL_GetSerialBytesReceived(HAL_SerialPort port, int32_t* status);
41int32_t HAL_ReadSerial(HAL_SerialPort port, char* buffer, int32_t count,
42 int32_t* status);
43int32_t HAL_WriteSerial(HAL_SerialPort port, const char* buffer, int32_t count,
44 int32_t* status);
45void HAL_FlushSerial(HAL_SerialPort port, int32_t* status);
46void HAL_ClearSerial(HAL_SerialPort port, int32_t* status);
47void HAL_CloseSerial(HAL_SerialPort port, int32_t* status);
48#ifdef __cplusplus
49}
50#endif