WPILibC++
2018.4.1-20180921134745-1191-g456d3e1
|
Functions | |
HAL_ENUM (HAL_CANDeviceType) | |
The CAN device type. More... | |
HAL_ENUM (HAL_CANManufacturer) | |
The CAN manufacturer ID. More... | |
HAL_CANHandle | HAL_InitializeCAN (HAL_CANManufacturer manufacturer, int32_t deviceId, HAL_CANDeviceType deviceType, int32_t *status) |
Initializes a CAN device. More... | |
void | HAL_CleanCAN (HAL_CANHandle handle) |
Frees a CAN device. More... | |
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. More... | |
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. More... | |
void | HAL_StopCANPacketRepeating (HAL_CANHandle handle, int32_t apiId, int32_t *status) |
Stops a repeating packet with a specific ID. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
void HAL_CleanCAN | ( | HAL_CANHandle | handle | ) |
Frees a CAN device.
handle | the CAN handle |
HAL_ENUM | ( | HAL_CANDeviceType | ) |
The CAN device type.
Teams should use HAL_CAN_Dev_kMiscellaneous
HAL_ENUM | ( | HAL_CANManufacturer | ) |
The CAN manufacturer ID.
Teams should use HAL_CAN_Man_kTeamUse.
HAL_CANHandle HAL_InitializeCAN | ( | HAL_CANManufacturer | manufacturer, |
int32_t | deviceId, | ||
HAL_CANDeviceType | deviceType, | ||
int32_t * | status | ||
) |
Initializes a CAN device.
These follow the FIRST standard CAN layout. Link TBD
manufacturer | the can manufacturer |
deviceId | the device ID (0-63) |
deviceType | the device type |
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.
The will continuously return the last packet received, without accounting for packet age.
handle | the CAN handle |
apiId | the ID to read (0-1023) |
data | the packet data (8 bytes) |
length | the received length (0-8 bytes) |
receivedTimestamp | the packet received timestamp (based off of CLOCK_MONOTONIC) |
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.
This will only return properly once per packet received. Multiple calls without receiving another packet will return an error code.
handle | the CAN handle |
apiId | the ID to read (0-1023) |
data | the packet data (8 bytes) |
length | the received length (0-8 bytes) |
receivedTimestamp | the packet received timestamp (based off of CLOCK_MONOTONIC) |
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.
The will return the last packet received until the packet is older then the requested timeout. Then it will return an error code.
handle | the CAN handle |
apiId | the ID to read (0-1023) |
data | the packet data (8 bytes) |
length | the received length (0-8 bytes) |
receivedTimestamp | the packet received timestamp (based off of CLOCK_MONOTONIC) |
timeoutMs | the timeout time for the 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.
The will return the last packet received until the packet is older then the requested timeout. Then it will return an error code. The period parameter is used when you know the packet is sent at specific intervals, so calls will not attempt to read a new packet from the network until that period has passed. We do not recommend users use this API unless they know the implications.
handle | the CAN handle |
apiId | the ID to read (0-1023) |
data | the packet data (8 bytes) |
length | the received length (0-8 bytes) |
receivedTimestamp | the packet received timestamp (based off of CLOCK_MONOTONIC) |
timeoutMs | the timeout time for the packet |
periodMs | the standard period for the packet |
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.
handle | the CAN handle |
apiId | the ID to stop repeating (0-1023) |
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.
This ID is 10 bits.
handle | the CAN handle |
data | the data to write (0-8 bytes) |
length | the length of data (0-8) |
apiId | the ID to write (0-1023 bits) |
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.
This ID is 10 bits.
The RoboRIO will automatically repeat the packet at the specified interval
handle | the CAN handle |
data | the data to write (0-8 bytes) |
length | the length of data (0-8) |
apiId | the ID to write (0-1023) |
repeatMs | the period to repeat in ms |