piMCP2515
A library for controlling an MCP2515 on the Raspberry Pi and Raspberry Pi Pico
Loading...
Searching...
No Matches
REQOP (Operating Mode) Functions

These functions handle REQOP (operating mode) functionality. More...

Functions

int mcp2515_reset (pi_mcp2515_t *pi_mcp2515)
 Issue a reset command to the MCP2515 via the SPI interface.
int mcp2515_reqop (pi_mcp2515_t *pi_mcp2515, const mcp2515_reqop_t reqop)
 Change the operating mode.
mcp2515_reqop_t mcp2515_reqop_get (pi_mcp2515_t *pi_mcp2515)
 Get the current operating mode.

Detailed Description

These functions handle REQOP (operating mode) functionality.

Function Documentation

◆ mcp2515_reqop()

int mcp2515_reqop ( pi_mcp2515_t * pi_mcp2515,
const mcp2515_reqop_t reqop )

Change the operating mode.

After the mode change, this code will then sleep for a 128 oscillator cycles delay before continuing operations as defined by the MCP2515 manual.

Parameters
pi_mcp2515the piMCP2515 handle.
reqopthe new operating mode. Acceptable values being:
  • PI_MCP2515_REQOP_MASK
  • PI_MCP2515_REQOP_NORMAL
  • PI_MCP2515_REQOP_SLEEP
  • PI_MCP2515_REQOP_LOOPBACK
  • PI_MCP2515_REQOP_LISTENONLY
  • PI_MCP2515_REQOP_CONFIG
  • PI_MCP2515_REQOP_POWERUP
Returns
zero if success, otherwise non-zero.

◆ mcp2515_reqop_get()

mcp2515_reqop_t mcp2515_reqop_get ( pi_mcp2515_t * pi_mcp2515)

Get the current operating mode.

Parameters
pi_mcp2515the piMCP2515 handle.
Returns
the current operating mode.

◆ mcp2515_reset()

int mcp2515_reset ( pi_mcp2515_t * pi_mcp2515)

Issue a reset command to the MCP2515 via the SPI interface.

Parameters
pi_mcp2515the piMCP2515 handle.
Returns
zero if success, otherwise non-zero.