WPILibC++  2020.3.2-60-g3011ebe
CAN Stream Functions


struct  HAL_CANStreamMessage
 Storage for CAN Stream Messages. More...


#define HAL_CAN_IS_FRAME_REMOTE   0x80000000
#define HAL_CAN_IS_FRAME_11BIT   0x40000000
#define HAL_ERR_CANSessionMux_InvalidBuffer   -44086
#define HAL_ERR_CANSessionMux_MessageNotFound   -44087
#define HAL_WARN_CANSessionMux_NoToken   44087
#define HAL_ERR_CANSessionMux_NotAllowed   -44088
#define HAL_ERR_CANSessionMux_NotInitialized   -44089
#define HAL_ERR_CANSessionMux_SessionOverrun   44050


void HAL_CAN_SendMessage (uint32_t messageID, const uint8_t *data, uint8_t dataSize, int32_t periodMs, int32_t *status)
 Sends a CAN message. More...
void HAL_CAN_ReceiveMessage (uint32_t *messageID, uint32_t messageIDMask, uint8_t *data, uint8_t *dataSize, uint32_t *timeStamp, int32_t *status)
 Receives a CAN message. More...
void HAL_CAN_OpenStreamSession (uint32_t *sessionHandle, uint32_t messageID, uint32_t messageIDMask, uint32_t maxMessages, int32_t *status)
 Opens a CAN stream. More...
void HAL_CAN_CloseStreamSession (uint32_t sessionHandle)
 Closes a CAN stream. More...
void HAL_CAN_ReadStreamSession (uint32_t sessionHandle, struct HAL_CANStreamMessage *messages, uint32_t messagesToRead, uint32_t *messagesRead, int32_t *status)
 Reads a CAN stream message. More...
void HAL_CAN_GetCANStatus (float *percentBusUtilization, uint32_t *busOffCount, uint32_t *txFullCount, uint32_t *receiveErrorCount, uint32_t *transmitErrorCount, int32_t *status)
 Gets CAN status information. More...

Detailed Description

Function Documentation

◆ HAL_CAN_CloseStreamSession()

void HAL_CAN_CloseStreamSession ( uint32_t  sessionHandle)

Closes a CAN stream.

sessionHandlethe session to close

◆ HAL_CAN_GetCANStatus()

void HAL_CAN_GetCANStatus ( float *  percentBusUtilization,
uint32_t *  busOffCount,
uint32_t *  txFullCount,
uint32_t *  receiveErrorCount,
uint32_t *  transmitErrorCount,
int32_t *  status 

Gets CAN status information.

percentBusUtilizationthe bus utilization
busOffCountthe number of bus off errors
txFullCountthe number of tx full errors
receiveErrorCountthe number of receive errors
transmitErrorCountthe number of transmit errors

◆ HAL_CAN_OpenStreamSession()

void HAL_CAN_OpenStreamSession ( uint32_t *  sessionHandle,
uint32_t  messageID,
uint32_t  messageIDMask,
uint32_t  maxMessages,
int32_t *  status 

Opens a CAN stream.

sessionHandleoutput for the session handle
messageIDthe message ID to read
messageIDMaskthe mssage ID mask
maxMessagesthe maximum number of messages to stream

◆ HAL_CAN_ReadStreamSession()

void HAL_CAN_ReadStreamSession ( uint32_t  sessionHandle,
struct HAL_CANStreamMessage messages,
uint32_t  messagesToRead,
uint32_t *  messagesRead,
int32_t *  status 

Reads a CAN stream message.

sessionHandlethe session handle
messagesarray of messages
messagesToReadthe max number of messages to read
messageReadthe number of messages actually read

◆ HAL_CAN_ReceiveMessage()

void HAL_CAN_ReceiveMessage ( uint32_t *  messageID,
uint32_t  messageIDMask,
uint8_t *  data,
uint8_t *  dataSize,
uint32_t *  timeStamp,
int32_t *  status 

Receives a CAN message.

messageIDstore for the received message ID
messageIDMaskthe message ID mask to look for
datadata output (8 bytes)
dataSizedata length (0-8 bytes)
timeStampthe packet received timestamp (based off of CLOCK_MONOTONIC)

◆ HAL_CAN_SendMessage()

void HAL_CAN_SendMessage ( uint32_t  messageID,
const uint8_t *  data,
uint8_t  dataSize,
int32_t  periodMs,
int32_t *  status 

Sends a CAN message.

messageIDthe CAN ID to send
datathe data to send (0-8 bytes)
dataSizethe size of the data to send (0-8 bytes)
periodMsthe period to repeat the packet at. Use HAL_CAN_SEND_PERIOD_NO_REPEAT to not repeat.