piMCP2515
A library for controlling an MCP2515 on the Raspberry Pi and Raspberry Pi Pico
Loading...
Searching...
No Matches
CAN Bus Functions

These functions handle CAN bus functionality. More...

Functions

int mcp2515_can_message_send (pi_mcp2515_t *pi_mcp2515, const pi_mcp2515_can_frame_t *can_frame)
 Send a CAN bus message.
int mcp2515_can_message_read (pi_mcp2515_t *pi_mcp2515, pi_mcp2515_can_frame_t *can_frame)
 Read a CAN bus message.
int mcp2515_can_message_read_rxb (pi_mcp2515_t *pi_mcp2515, mcp2515_rxb_t rxb, pi_mcp2515_can_frame_t *can_frame)
bool mcp2515_can_message_received (pi_mcp2515_t *pi_mcp2515)
 Check if there is a CAN bus message received.

Detailed Description

These functions handle CAN bus functionality.

Function Documentation

◆ mcp2515_can_message_read()

int mcp2515_can_message_read ( pi_mcp2515_t * pi_mcp2515,
pi_mcp2515_can_frame_t * can_frame )

Read a CAN bus message.

Parameters
pi_mcp2515the piMCP2515 handle.
can_framea pointer to the structure to store the received CAN bus frame.
Returns
zero if success, otherwise non-zero.

◆ mcp2515_can_message_received()

bool mcp2515_can_message_received ( pi_mcp2515_t * pi_mcp2515)

Check if there is a CAN bus message received.

The message can then be read with mcp2515_can_message_read.

Parameters
pi_mcp2515the piMCP2515 handle.
Returns
true if a message is received in one of the RX buffers.

◆ mcp2515_can_message_send()

int mcp2515_can_message_send ( pi_mcp2515_t * pi_mcp2515,
const pi_mcp2515_can_frame_t * can_frame )

Send a CAN bus message.

Parameters
pi_mcp2515the piMCP2515 handle.
can_framethe CAN bus frame to send.
Returns
zero if success, otherwise non-zero.