WPILibC++  2020.3.2
CANAPI.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2018-2019 FIRST. 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 #include "hal/CANAPITypes.h"
13 #include "hal/Types.h"
14 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
35 HAL_CANHandle HAL_InitializeCAN(HAL_CANManufacturer manufacturer,
36  int32_t deviceId, HAL_CANDeviceType deviceType,
37  int32_t* status);
38 
44 void HAL_CleanCAN(HAL_CANHandle handle);
45 
56 void HAL_WriteCANPacket(HAL_CANHandle handle, const uint8_t* data,
57  int32_t length, int32_t apiId, int32_t* status);
58 
72 void HAL_WriteCANPacketRepeating(HAL_CANHandle handle, const uint8_t* data,
73  int32_t length, int32_t apiId,
74  int32_t repeatMs, int32_t* status);
75 
87 void HAL_WriteCANRTRFrame(HAL_CANHandle handle, int32_t length, int32_t apiId,
88  int32_t* status);
89 
98 void HAL_StopCANPacketRepeating(HAL_CANHandle handle, int32_t apiId,
99  int32_t* status);
100 
114 void HAL_ReadCANPacketNew(HAL_CANHandle handle, int32_t apiId, uint8_t* data,
115  int32_t* length, uint64_t* receivedTimestamp,
116  int32_t* status);
117 
129 void HAL_ReadCANPacketLatest(HAL_CANHandle handle, int32_t apiId, uint8_t* data,
130  int32_t* length, uint64_t* receivedTimestamp,
131  int32_t* status);
132 
146 void HAL_ReadCANPacketTimeout(HAL_CANHandle handle, int32_t apiId,
147  uint8_t* data, int32_t* length,
148  uint64_t* receivedTimestamp, int32_t timeoutMs,
149  int32_t* status);
150 
151 #ifdef __cplusplus
152 } // extern "C"
153 #endif
154 
HAL_WriteCANPacket
void HAL_WriteCANPacket(HAL_CANHandle handle, const uint8_t *data, int32_t length, int32_t apiId, int32_t *status)
Writes a packet to the CAN device with a specific ID.
HAL_WriteCANRTRFrame
void HAL_WriteCANRTRFrame(HAL_CANHandle handle, int32_t length, int32_t apiId, int32_t *status)
Writes an RTR frame of the specified length to the CAN device with the specific ID.
HAL_StopCANPacketRepeating
void HAL_StopCANPacketRepeating(HAL_CANHandle handle, int32_t apiId, int32_t *status)
Stops a repeating packet with a specific ID.
HAL_ReadCANPacketTimeout
void HAL_ReadCANPacketTimeout(HAL_CANHandle handle, int32_t apiId, uint8_t *data, int32_t *length, uint64_t *receivedTimestamp, int32_t timeoutMs, int32_t *status)
Reads a CAN packet.
HAL_ReadCANPacketNew
void HAL_ReadCANPacketNew(HAL_CANHandle handle, int32_t apiId, uint8_t *data, int32_t *length, uint64_t *receivedTimestamp, int32_t *status)
Reads a new CAN packet.
HAL_CleanCAN
void HAL_CleanCAN(HAL_CANHandle handle)
Frees a CAN device.
HAL_ReadCANPacketLatest
void HAL_ReadCANPacketLatest(HAL_CANHandle handle, int32_t apiId, uint8_t *data, int32_t *length, uint64_t *receivedTimestamp, int32_t *status)
Reads a CAN packet.
HAL_InitializeCAN
HAL_CANHandle HAL_InitializeCAN(HAL_CANManufacturer manufacturer, int32_t deviceId, HAL_CANDeviceType deviceType, int32_t *status)
Initializes a CAN device.
HAL_WriteCANPacketRepeating
void HAL_WriteCANPacketRepeating(HAL_CANHandle handle, const uint8_t *data, int32_t length, int32_t apiId, int32_t repeatMs, int32_t *status)
Writes a repeating packet to the CAN device with a specific ID.