WPILibC++  2019.2.1-25-g182758c
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
CANAPI.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2018 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 
84 void HAL_StopCANPacketRepeating(HAL_CANHandle handle, int32_t apiId,
85  int32_t* status);
86 
100 void HAL_ReadCANPacketNew(HAL_CANHandle handle, int32_t apiId, uint8_t* data,
101  int32_t* length, uint64_t* receivedTimestamp,
102  int32_t* status);
103 
115 void HAL_ReadCANPacketLatest(HAL_CANHandle handle, int32_t apiId, uint8_t* data,
116  int32_t* length, uint64_t* receivedTimestamp,
117  int32_t* status);
118 
132 void HAL_ReadCANPacketTimeout(HAL_CANHandle handle, int32_t apiId,
133  uint8_t* data, int32_t* length,
134  uint64_t* receivedTimestamp, int32_t timeoutMs,
135  int32_t* status);
136 
154 void HAL_ReadCANPeriodicPacket(HAL_CANHandle handle, int32_t apiId,
155  uint8_t* data, int32_t* length,
156  uint64_t* receivedTimestamp, int32_t timeoutMs,
157  int32_t periodMs, int32_t* status);
158 
159 #ifdef __cplusplus
160 } // extern "C"
161 #endif
162 
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.
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.
void HAL_StopCANPacketRepeating(HAL_CANHandle handle, int32_t apiId, int32_t *status)
Stops a repeating packet with a specific ID.
HAL_CANHandle HAL_InitializeCAN(HAL_CANManufacturer manufacturer, int32_t deviceId, HAL_CANDeviceType deviceType, int32_t *status)
Initializes a CAN device.
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.
void HAL_ReadCANPeriodicPacket(HAL_CANHandle handle, int32_t apiId, uint8_t *data, int32_t *length, uint64_t *receivedTimestamp, int32_t timeoutMs, int32_t periodMs, int32_t *status)
Reads a CAN packet.
void HAL_CleanCAN(HAL_CANHandle handle)
Frees a CAN device.
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.
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.