xpcc
xpcc::Mcp2515< SPI, CS, INT > Class Template Reference

Driver for the MPC2515 CAN controller. More...

#include <xpcc/driver/can/mcp2515.hpp>

Inheritance diagram for xpcc::Mcp2515< SPI, CS, INT >:
xpcc::Can xpcc::Peripheral

Static Public Member Functions

static bool initialize (uint32_t bitrate)
 
static void setFilter (accessor::Flash< uint8_t > filter)
 
static void setMode (Can::Mode mode)
 
static bool isMessageAvailable ()
 
static bool getMessage (can::Message &message)
 
static bool isReadyToSend ()
 
static bool sendMessage (const can::Message &message)
 
static BusState getBusState ()
 
- Static Public Member Functions inherited from xpcc::Can
template<class SystemClock , uint32_t bitrate = Bitrate::kBps125, uint16_t tolerance = Tolerance::OnePercent>
static void initialize (Mode startupMode)
 Initializes the hardware and sets the baudrate. More...
 
static bool isMessageAvailable ()
 Returns true if a message can be retrieved by calling getMessage.
 
static bool getMessage (can::Message &message)
 Returns true if a message was copied into the message buffer.
 
static bool isReadyToSend ()
 The CAN controller has a free slot to send a new message. More...
 
static bool sendMessage (const can::Message &message)
 Send a message over the CAN. More...
 
static uint8_t getReceiveErrorCounter ()
 Get Receive Error Counter.
 
static uint8_t getTransmitErrorCounter ()
 Get Transmit Error Counter.
 
static BusState getBusState ()
 
- Static Public Member Functions inherited from xpcc::Peripheral
template<uint32_t available, uint32_t requested, uint16_t tolerance>
static void assertBaudrateInTolerance ()
 Since baudrates are usually generated by prescaling a system clock, only several distinct values can be generated. More...
 

Protected Types

enum  SpiCommand {
  RESET,
  READ,
  READ_RX,
  WRITE,
  WRITE_TX,
  RTS,
  READ_STATUS,
  RX_STATUS,
  BIT_MODIFY
}
 

Static Protected Member Functions

static void writeRegister (uint8_t address, uint8_t data)
 
static uint8_t readRegister (uint8_t address)
 
static void bitModify (uint8_t address, uint8_t mask, uint8_t data)
 
static uint8_t readStatus (uint8_t type)
 
static void writeIdentifier (const uint32_t &identifier, bool isExtendedFrame)
 
static bool readIdentifier (uint32_t &identifier)
 

Static Protected Attributes

static SPI spi
 
static CS chipSelect
 
static INT interruptPin
 

Additional Inherited Members

- Public Types inherited from xpcc::Can
enum  Mode : uint8_t {
  Mode::Normal,
  Mode::ListenOnly,
  Mode::LoopBack,
  Mode::ListenOnlyLoopBack
}
 Possible modes of the CAN controller. More...
 
enum  Bitrate : uint32_t {
  kBps10,
  kBps20,
  kBps50,
  kBps100,
  kBps125,
  kBps250,
  kBps500,
  MBps1
}
 Supported CAN bitrates; maybe different on a per device basis.
 
enum  BusState : uint8_t {
  BusState::Connected,
  BusState::ErrorWarning,
  BusState::ErrorPassive,
  Off
}
 

Detailed Description

template<typename SPI, typename CS, typename INT>
class xpcc::Mcp2515< SPI, CS, INT >

Template Parameters
SPISPI interface
CSChip select pin
INTInterrupt pin

If you want to activate the internal pull-up for the INT pin you need to do this by yourself before calling the initialize method!

Author
Fabian Greif

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