![]() |
WPILibC++ 2027.0.0-alpha-2
|
Classes | |
struct | HAL_CANMessage |
struct | HAL_CANReceiveMessage |
Macros | |
#define | HAL_CAN_SEND_PERIOD_NO_REPEAT 0 |
Flag for sending a CAN message once. | |
#define | HAL_CAN_SEND_PERIOD_STOP_REPEATING -1 |
Flag for stopping periodic CAN message sends. | |
#define | HAL_CAN_IS_FRAME_REMOTE 0x40000000 |
Mask for "is frame remote" in message ID. | |
#define | HAL_CAN_IS_FRAME_11BIT 0x80000000 |
Mask for "is frame 11 bits" in message ID. | |
Functions | |
HAL_CANHandle | HAL_InitializeCAN (int32_t busId, HAL_CANManufacturer manufacturer, int32_t deviceId, HAL_CANDeviceType deviceType, int32_t *status) |
Initializes a CAN device. | |
void | HAL_CleanCAN (HAL_CANHandle handle) |
Frees a CAN device. | |
void | HAL_WriteCANPacket (HAL_CANHandle handle, int32_t apiId, const struct HAL_CANMessage *message, int32_t *status) |
Writes a packet to the CAN device with a specific ID. | |
void | HAL_WriteCANPacketRepeating (HAL_CANHandle handle, int32_t apiId, const struct HAL_CANMessage *message, int32_t repeatMs, int32_t *status) |
Writes a repeating packet to the CAN device with a specific ID. | |
void | HAL_WriteCANRTRFrame (HAL_CANHandle handle, int32_t apiId, const struct HAL_CANMessage *message, int32_t *status) |
Writes an RTR frame of the specified length to the CAN device with the specific ID. | |
void | HAL_StopCANPacketRepeating (HAL_CANHandle handle, int32_t apiId, int32_t *status) |
Stops a repeating packet with a specific ID. | |
void | HAL_ReadCANPacketNew (HAL_CANHandle handle, int32_t apiId, struct HAL_CANReceiveMessage *message, int32_t *status) |
Reads a new CAN packet. | |
void | HAL_ReadCANPacketLatest (HAL_CANHandle handle, int32_t apiId, struct HAL_CANReceiveMessage *message, int32_t *status) |
Reads a CAN packet. | |
void | HAL_ReadCANPacketTimeout (HAL_CANHandle handle, int32_t apiId, struct HAL_CANReceiveMessage *message, int32_t timeoutMs, int32_t *status) |
Reads a CAN packet. | |
#define HAL_CAN_IS_FRAME_11BIT 0x80000000 |
Mask for "is frame 11 bits" in message ID.
#define HAL_CAN_IS_FRAME_REMOTE 0x40000000 |
Mask for "is frame remote" in message ID.
#define HAL_CAN_SEND_PERIOD_NO_REPEAT 0 |
Flag for sending a CAN message once.
#define HAL_CAN_SEND_PERIOD_STOP_REPEATING -1 |
Flag for stopping periodic CAN message sends.
enum HAL_CANDeviceType : int32_t |
The CAN device type.
Teams should use HAL_CAN_Dev_kMiscellaneous
enum HAL_CANFlags : int32_t |
enum HAL_CANManufacturer : int32_t |
The CAN manufacturer ID.
Teams should use HAL_CAN_Man_kTeamUse.
void HAL_CleanCAN | ( | HAL_CANHandle | handle | ) |
Frees a CAN device.
handle | the CAN handle |
HAL_CANHandle HAL_InitializeCAN | ( | int32_t | busId, |
HAL_CANManufacturer | manufacturer, | ||
int32_t | deviceId, | ||
HAL_CANDeviceType | deviceType, | ||
int32_t * | status ) |
Initializes a CAN device.
These follow the FIRST standard CAN layout. https://docs.wpilib.org/en/stable/docs/software/can-devices/can-addressing.html
[in] | busId | the bus id |
[in] | manufacturer | the can manufacturer |
[in] | deviceId | the device ID (0-63) |
[in] | deviceType | the device type |
[out] | status | Error status variable. 0 on success. |
void HAL_ReadCANPacketLatest | ( | HAL_CANHandle | handle, |
int32_t | apiId, | ||
struct HAL_CANReceiveMessage * | message, | ||
int32_t * | status ) |
Reads a CAN packet.
The will continuously return the last packet received, without accounting for packet age.
[in] | handle | the CAN handle |
[in] | apiId | the ID to read (0-1023) |
[out] | message | the message received. |
[out] | status | Error status variable. 0 on success. |
void HAL_ReadCANPacketNew | ( | HAL_CANHandle | handle, |
int32_t | apiId, | ||
struct HAL_CANReceiveMessage * | message, | ||
int32_t * | status ) |
Reads a new CAN packet.
This will only return properly once per packet received. Multiple calls without receiving another packet will return an error code.
[in] | handle | the CAN handle |
[in] | apiId | the ID to read (0-1023) |
[out] | message | the message received. |
[out] | status | Error status variable. 0 on success. |
void HAL_ReadCANPacketTimeout | ( | HAL_CANHandle | handle, |
int32_t | apiId, | ||
struct HAL_CANReceiveMessage * | message, | ||
int32_t | timeoutMs, | ||
int32_t * | status ) |
Reads a CAN packet.
The will return the last packet received until the packet is older then the requested timeout. Then it will return an error code.
[in] | handle | the CAN handle |
[in] | apiId | the ID to read (0-1023) |
[out] | message | the message received. |
[out] | timeoutMs | the timeout time for the packet |
[out] | status | Error status variable. 0 on success. |
void HAL_StopCANPacketRepeating | ( | HAL_CANHandle | handle, |
int32_t | apiId, | ||
int32_t * | status ) |
Stops a repeating packet with a specific ID.
This ID is 10 bits.
[in] | handle | the CAN handle |
[in] | apiId | the ID to stop repeating (0-1023) |
[out] | status | Error status variable. 0 on success. |
void HAL_WriteCANPacket | ( | HAL_CANHandle | handle, |
int32_t | apiId, | ||
const struct HAL_CANMessage * | message, | ||
int32_t * | status ) |
Writes a packet to the CAN device with a specific ID.
This ID is 10 bits.
[in] | handle | the CAN handle |
[in] | apiId | the ID to write (0-1023) |
[in] | message | the message |
[out] | status | Error status variable. 0 on success. |
void HAL_WriteCANPacketRepeating | ( | HAL_CANHandle | handle, |
int32_t | apiId, | ||
const struct HAL_CANMessage * | message, | ||
int32_t | repeatMs, | ||
int32_t * | status ) |
Writes a repeating packet to the CAN device with a specific ID.
This ID is 10 bits.
The device will automatically repeat the packet at the specified interval
[in] | handle | the CAN handle |
[in] | apiId | the ID to write (0-1023) |
[in] | message | the message |
[in] | repeatMs | the period to repeat in ms |
[out] | status | Error status variable. 0 on success. |
void HAL_WriteCANRTRFrame | ( | HAL_CANHandle | handle, |
int32_t | apiId, | ||
const struct HAL_CANMessage * | message, | ||
int32_t * | status ) |
Writes an RTR frame of the specified length to the CAN device with the specific ID.
By spec, the length must be equal to the length sent by the other device, otherwise behavior is unspecified.
[in] | handle | the CAN handle |
[in] | apiId | the ID to write (0-1023) |
[in] | message | the message |
[out] | status | Error status variable. 0 on success. |