Macros | Functions
comm_can.h File Reference
#include "conf_general.h"

Go to the source code of this file.

Macros

#define CAN_STATUS_MSG_INT_MS   1
 
#define CAN_STATUS_MSGS_TO_STORE   10
 

Functions

void comm_can_init (void)
 
void comm_can_transmit (uint32_t id, uint8_t *data, uint8_t len)
 
void comm_can_send_buffer (uint8_t controller_id, uint8_t *data, unsigned int len, bool send)
 
void comm_can_set_duty (uint8_t controller_id, float duty)
 
void comm_can_set_current (uint8_t controller_id, float current)
 
void comm_can_set_current_brake (uint8_t controller_id, float current)
 
void comm_can_set_rpm (uint8_t controller_id, float rpm)
 
void comm_can_set_pos (uint8_t controller_id, float pos)
 
can_status_msgcomm_can_get_status_msg_index (int index)
 
can_status_msgcomm_can_get_status_msg_id (int id)
 

Macro Definition Documentation

#define CAN_STATUS_MSG_INT_MS   1
#define CAN_STATUS_MSGS_TO_STORE   10

Function Documentation

can_status_msg* comm_can_get_status_msg_id ( int  id)

Get status message by id.

Parameters
idId of the controller that sent the status message.
Returns
The message or 0 for an invalid id.
can_status_msg* comm_can_get_status_msg_index ( int  index)

Get status message by index.

Parameters
indexIndex in the array
Returns
The message or 0 for an invalid index.
void comm_can_init ( void  )
void comm_can_send_buffer ( uint8_t  controller_id,
uint8_t *  data,
unsigned int  len,
bool  send 
)

Send a buffer up to RX_BUFFER_SIZE bytes as fragments. If the buffer is 6 bytes or less it will be sent in a single CAN frame, otherwise it will be split into several frames.

Parameters
controller_idThe controller id to send to.
dataThe payload.
lenThe payload length.
sendIf true, this packet will be passed to the send function of commands. Otherwise, it will be passed to the process function.
void comm_can_set_current ( uint8_t  controller_id,
float  current 
)
void comm_can_set_current_brake ( uint8_t  controller_id,
float  current 
)
void comm_can_set_duty ( uint8_t  controller_id,
float  duty 
)
void comm_can_set_pos ( uint8_t  controller_id,
float  pos 
)
void comm_can_set_rpm ( uint8_t  controller_id,
float  rpm 
)
void comm_can_transmit ( uint32_t  id,
uint8_t *  data,
uint8_t  len 
)