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

These functions handle manipulating values in the MCP2515's registers. More...

Functions

int mcp2515_register_read (pi_mcp2515_t *pi_mcp2515, uint8_t *data, uint8_t len, mcp2515_rgstr_t rgstr)
 Read a value from a specified register.
int mcp2515_register_write (pi_mcp2515_t *pi_mcp2515, uint8_t values[], uint8_t len, mcp2515_rgstr_t rgstr)
 Write a value to the specified register.
int mcp2515_register_bitmod (pi_mcp2515_t *pi_mcp2515, const uint8_t data, const uint8_t mask, const mcp2515_rgstr_t rgstr)
 Change the value of a register via an SPI bit modify.

Detailed Description

These functions handle manipulating values in the MCP2515's registers.

Function Documentation

◆ mcp2515_register_bitmod()

int mcp2515_register_bitmod ( pi_mcp2515_t * pi_mcp2515,
const uint8_t data,
const uint8_t mask,
const mcp2515_rgstr_t rgstr )

Change the value of a register via an SPI bit modify.

Parameters
pi_mcp2515the piMCP2515 handle.
datathe data to use for the bitmod.
maskthe mask to apply where only bits with a 1 value will be updated in the register with the data values.
rgstrthe register to perform the bitmod against.
Returns
zero if success, otherwise non-zero.

◆ mcp2515_register_read()

int mcp2515_register_read ( pi_mcp2515_t * pi_mcp2515,
uint8_t * data,
uint8_t len,
mcp2515_rgstr_t rgstr )

Read a value from a specified register.

Parameters
pi_mcp2515the piMCP2515 handle.
datathe destination to copy the read data to.
lenthe length of the destination buffer.
rgstrthe register to read.
Returns
zero if success, otherwise non-zero.

◆ mcp2515_register_write()

int mcp2515_register_write ( pi_mcp2515_t * pi_mcp2515,
uint8_t values[],
uint8_t len,
mcp2515_rgstr_t rgstr )

Write a value to the specified register.

Parameters
pi_mcp2515the piMCP2515 handle.
valuesthe data to write to the register.
lenthe length of the data to write.
rgstrthe register to write to.
Returns
zero if success, otherwise non-zero.