Brian Silverman | f7f267a | 2017-02-04 16:16:08 -0800 | [diff] [blame^] | 1 | /*----------------------------------------------------------------------------*/ |
| 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 | |
| 12 | enum 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 |
| 20 | extern "C" { |
| 21 | #endif |
| 22 | |
| 23 | void HAL_InitializeSerialPort(HAL_SerialPort port, int32_t* status); |
| 24 | void HAL_SetSerialBaudRate(HAL_SerialPort port, int32_t baud, int32_t* status); |
| 25 | void HAL_SetSerialDataBits(HAL_SerialPort port, int32_t bits, int32_t* status); |
| 26 | void HAL_SetSerialParity(HAL_SerialPort port, int32_t parity, int32_t* status); |
| 27 | void HAL_SetSerialStopBits(HAL_SerialPort port, int32_t stopBits, |
| 28 | int32_t* status); |
| 29 | void HAL_SetSerialWriteMode(HAL_SerialPort port, int32_t mode, int32_t* status); |
| 30 | void HAL_SetSerialFlowControl(HAL_SerialPort port, int32_t flow, |
| 31 | int32_t* status); |
| 32 | void HAL_SetSerialTimeout(HAL_SerialPort port, double timeout, int32_t* status); |
| 33 | void HAL_EnableSerialTermination(HAL_SerialPort port, char terminator, |
| 34 | int32_t* status); |
| 35 | void HAL_DisableSerialTermination(HAL_SerialPort port, int32_t* status); |
| 36 | void HAL_SetSerialReadBufferSize(HAL_SerialPort port, int32_t size, |
| 37 | int32_t* status); |
| 38 | void HAL_SetSerialWriteBufferSize(HAL_SerialPort port, int32_t size, |
| 39 | int32_t* status); |
| 40 | int32_t HAL_GetSerialBytesReceived(HAL_SerialPort port, int32_t* status); |
| 41 | int32_t HAL_ReadSerial(HAL_SerialPort port, char* buffer, int32_t count, |
| 42 | int32_t* status); |
| 43 | int32_t HAL_WriteSerial(HAL_SerialPort port, const char* buffer, int32_t count, |
| 44 | int32_t* status); |
| 45 | void HAL_FlushSerial(HAL_SerialPort port, int32_t* status); |
| 46 | void HAL_ClearSerial(HAL_SerialPort port, int32_t* status); |
| 47 | void HAL_CloseSerial(HAL_SerialPort port, int32_t* status); |
| 48 | #ifdef __cplusplus |
| 49 | } |
| 50 | #endif |