PicoLowLevel
MCP2515 Class Reference

#include <mcp2515.h>

Inheritance diagram for MCP2515:
Collaboration diagram for MCP2515:

Public Types

enum  ERROR {
  ERROR_OK = 0 , ERROR_FAIL = 1 , ERROR_ALLTXBUSY = 2 , ERROR_FAILINIT = 3 ,
  ERROR_FAILTX = 4 , ERROR_NOMSG = 5
}
 
enum  MASK { MASK0 , MASK1 }
 
enum  RXF {
  RXF0 = 0 , RXF1 = 1 , RXF2 = 2 , RXF3 = 3 ,
  RXF4 = 4 , RXF5 = 5
}
 
enum  RXBn { RXB0 = 0 , RXB1 = 1 }
 
enum  TXBn { TXB0 = 0 , TXB1 = 1 , TXB2 = 2 }
 
enum  CANINTF : uint8_t {
  CANINTF_RX0IF = 0x01 , CANINTF_RX1IF = 0x02 , CANINTF_TX0IF = 0x04 , CANINTF_TX1IF = 0x08 ,
  CANINTF_TX2IF = 0x10 , CANINTF_ERRIF = 0x20 , CANINTF_WAKIF = 0x40 , CANINTF_MERRF = 0x80
}
 
enum  EFLG : uint8_t {
  EFLG_RX1OVR = (1<<7) , EFLG_RX0OVR = (1<<6) , EFLG_TXBO = (1<<5) , EFLG_TXEP = (1<<4) ,
  EFLG_RXEP = (1<<3) , EFLG_TXWAR = (1<<2) , EFLG_RXWAR = (1<<1) , EFLG_EWARN = (1<<0)
}
 

Public Member Functions

 MCP2515 (const uint8_t _CS, const uint32_t _SPI_CLOCK=DEFAULT_SPI_CLOCK, SPIClass *_SPI=nullptr)
 
ERROR reset (void)
 
ERROR setConfigMode ()
 
ERROR setListenOnlyMode ()
 
ERROR setSleepMode ()
 
ERROR setLoopbackMode ()
 
ERROR setNormalMode ()
 
ERROR setClkOut (const CAN_CLKOUT divisor)
 
ERROR setBitrate (const CAN_SPEED canSpeed)
 
ERROR setBitrate (const CAN_SPEED canSpeed, const CAN_CLOCK canClock)
 
ERROR setFilterMask (const MASK num, const bool ext, const uint32_t ulData)
 
ERROR setFilter (const RXF num, const bool ext, const uint32_t ulData)
 
ERROR sendMessage (const TXBn txbn, const struct can_frame *frame)
 
ERROR sendMessage (const struct can_frame *frame)
 
ERROR readMessage (const RXBn rxbn, struct can_frame *frame)
 
ERROR readMessage (struct can_frame *frame)
 
bool checkReceive (void)
 
bool checkError (void)
 
uint8_t getErrorFlags (void)
 
void clearRXnOVRFlags (void)
 
uint8_t getInterrupts (void)
 
uint8_t getInterruptMask (void)
 
void clearInterrupts (void)
 
void clearTXInterrupts (void)
 
uint8_t getStatus (void)
 
void clearRXnOVR (void)
 
void clearMERR ()
 
void clearERRIF ()
 
uint8_t errorCountRX (void)
 
uint8_t errorCountTX (void)
 

Member Enumeration Documentation

◆ CANINTF

enum MCP2515::CANINTF : uint8_t
Enumerator
CANINTF_RX0IF 
CANINTF_RX1IF 
CANINTF_TX0IF 
CANINTF_TX1IF 
CANINTF_TX2IF 
CANINTF_ERRIF 
CANINTF_WAKIF 
CANINTF_MERRF 

◆ EFLG

enum MCP2515::EFLG : uint8_t
Enumerator
EFLG_RX1OVR 
EFLG_RX0OVR 
EFLG_TXBO 
EFLG_TXEP 
EFLG_RXEP 
EFLG_TXWAR 
EFLG_RXWAR 
EFLG_EWARN 

◆ ERROR

Enumerator
ERROR_OK 
ERROR_FAIL 
ERROR_ALLTXBUSY 
ERROR_FAILINIT 
ERROR_FAILTX 
ERROR_NOMSG 

◆ MASK

Enumerator
MASK0 
MASK1 

◆ RXBn

Enumerator
RXB0 
RXB1 

◆ RXF

Enumerator
RXF0 
RXF1 
RXF2 
RXF3 
RXF4 
RXF5 

◆ TXBn

Enumerator
TXB0 
TXB1 
TXB2 

Constructor & Destructor Documentation

◆ MCP2515()

MCP2515::MCP2515 ( const uint8_t  _CS,
const uint32_t  _SPI_CLOCK = DEFAULT_SPI_CLOCK,
SPIClass *  _SPI = nullptr 
)

Member Function Documentation

◆ checkError()

bool MCP2515::checkError ( void  )
Here is the call graph for this function:

◆ checkReceive()

bool MCP2515::checkReceive ( void  )
Here is the call graph for this function:

◆ clearERRIF()

void MCP2515::clearERRIF ( )

◆ clearInterrupts()

void MCP2515::clearInterrupts ( void  )
Here is the caller graph for this function:

◆ clearMERR()

void MCP2515::clearMERR ( )

◆ clearRXnOVR()

void MCP2515::clearRXnOVR ( void  )
Here is the call graph for this function:

◆ clearRXnOVRFlags()

void MCP2515::clearRXnOVRFlags ( void  )
Here is the caller graph for this function:

◆ clearTXInterrupts()

void MCP2515::clearTXInterrupts ( void  )

◆ errorCountRX()

uint8_t MCP2515::errorCountRX ( void  )

◆ errorCountTX()

uint8_t MCP2515::errorCountTX ( void  )

◆ getErrorFlags()

uint8_t MCP2515::getErrorFlags ( void  )
Here is the caller graph for this function:

◆ getInterruptMask()

uint8_t MCP2515::getInterruptMask ( void  )

◆ getInterrupts()

uint8_t MCP2515::getInterrupts ( void  )

◆ getStatus()

uint8_t MCP2515::getStatus ( void  )
Here is the caller graph for this function:

◆ readMessage() [1/2]

MCP2515::ERROR MCP2515::readMessage ( const RXBn  rxbn,
struct can_frame frame 
)
Here is the caller graph for this function:

◆ readMessage() [2/2]

MCP2515::ERROR MCP2515::readMessage ( struct can_frame frame)
Here is the call graph for this function:

◆ reset()

MCP2515::ERROR MCP2515::reset ( void  )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendMessage() [1/2]

MCP2515::ERROR MCP2515::sendMessage ( const struct can_frame frame)
Here is the call graph for this function:

◆ sendMessage() [2/2]

MCP2515::ERROR MCP2515::sendMessage ( const TXBn  txbn,
const struct can_frame frame 
)
Here is the caller graph for this function:

◆ setBitrate() [1/2]

MCP2515::ERROR MCP2515::setBitrate ( const CAN_SPEED  canSpeed)
Here is the caller graph for this function:

◆ setBitrate() [2/2]

MCP2515::ERROR MCP2515::setBitrate ( const CAN_SPEED  canSpeed,
const CAN_CLOCK  canClock 
)
Here is the call graph for this function:

◆ setClkOut()

MCP2515::ERROR MCP2515::setClkOut ( const CAN_CLKOUT  divisor)

◆ setConfigMode()

MCP2515::ERROR MCP2515::setConfigMode ( )
Here is the caller graph for this function:

◆ setFilter()

MCP2515::ERROR MCP2515::setFilter ( const RXF  num,
const bool  ext,
const uint32_t  ulData 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setFilterMask()

MCP2515::ERROR MCP2515::setFilterMask ( const MASK  num,
const bool  ext,
const uint32_t  ulData 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setListenOnlyMode()

MCP2515::ERROR MCP2515::setListenOnlyMode ( )

◆ setLoopbackMode()

MCP2515::ERROR MCP2515::setLoopbackMode ( )

◆ setNormalMode()

MCP2515::ERROR MCP2515::setNormalMode ( )
Here is the caller graph for this function:

◆ setSleepMode()

MCP2515::ERROR MCP2515::setSleepMode ( )

The documentation for this class was generated from the following files: