Hotwheels-Cluster 1.2
Creation of Cluster APP for SEA:ME project.
 
Loading...
Searching...
No Matches
MCP2515Configurator Class Reference

Class that configures the MCP2515 CAN controller. More...

#include <MCP2515Configurator.hpp>

Public Member Functions

 MCP2515Configurator (ISPIController &spiController)
 Construct a new MCP2515Configurator::MCP2515Configurator object.
 
 ~MCP2515Configurator ()=default
 
bool resetChip ()
 clean up the resources used by the MCP2515Configurator.
 
void configureBaudRate ()
 Configure the baud rate for the MCP2515.
 
void configureTXBuffer ()
 Configure the TX buffer for the MCP2515.
 
void configureRXBuffer ()
 Configure the RX buffer for the MCP2515.
 
void configureFiltersAndMasks ()
 Configure the filters and masks for the MCP2515.
 
void configureInterrupts ()
 Configure the interrupts for the MCP2515.
 
void setMode (uint8_t mode)
 Set the mode for the MCP2515.
 
bool verifyMode (uint8_t expectedMode)
 Verify the mode of the MCP2515.
 
std::vector< uint8_t > readCANMessage (uint16_t &frameID)
 Read a CAN message from the MCP2515.
 
void sendCANMessage (uint16_t frameID, uint8_t *CAN_TX_Buf, uint8_t length1)
 Send a CAN message to the MCP2515.
 

Static Public Attributes

static constexpr uint8_t RESET_CMD = 0xC0
 
static constexpr uint8_t CANCTRL = 0x0F
 
static constexpr uint8_t CANSTAT = 0x0E
 
static constexpr uint8_t CNF1 = 0x2A
 
static constexpr uint8_t CNF2 = 0x29
 
static constexpr uint8_t CNF3 = 0x28
 
static constexpr uint8_t TXB0CTRL = 0x30
 
static constexpr uint8_t RXB0CTRL = 0x60
 
static constexpr uint8_t CANINTF = 0x2C
 
static constexpr uint8_t CANINTE = 0x2B
 
static constexpr uint8_t RXB0SIDH = 0x61
 
static constexpr uint8_t RXB0SIDL = 0x62
 
static constexpr uint8_t CAN_RD_STATUS = 0xA0
 
static constexpr uint8_t TXB0SIDH = 0x31
 
static constexpr uint8_t TXB0SIDL = 0x32
 
static constexpr uint8_t TXB0EID8 = 0x33
 
static constexpr uint8_t TXB0EID0 = 0x34
 
static constexpr uint8_t TXB0DLC = 0x35
 
static constexpr uint8_t TXB0D0 = 0x36
 
static constexpr uint8_t CAN_RTS_TXB0 = 0x81
 

Private Member Functions

void writeRegister (uint8_t address, uint8_t value)
 Write a value to a register.
 
uint8_t readRegister (uint8_t address)
 Read a value from a register.
 
void sendCommand (uint8_t command)
 Send a command to the MCP2515.
 

Private Attributes

ISPIControllerspiController
 Reference to the SPI controller.
 

Detailed Description

Class that configures the MCP2515 CAN controller.

Definition at line 28 of file MCP2515Configurator.hpp.

Constructor & Destructor Documentation

◆ MCP2515Configurator()

MCP2515Configurator::MCP2515Configurator ( ISPIController & spiController)
explicit

Construct a new MCP2515Configurator::MCP2515Configurator object.

Parameters
spiControllerThe SPI controller to use for communication.

This constructor initializes the MCP2515Configurator object with the specified SPI controller.

Definition at line 35 of file MCP2515Configurator.cpp.

◆ ~MCP2515Configurator()

MCP2515Configurator::~MCP2515Configurator ( )
default

Member Function Documentation

◆ configureBaudRate()

void MCP2515Configurator::configureBaudRate ( )

Configure the baud rate for the MCP2515.

This function sets the baud rate for the MCP2515.

Definition at line 55 of file MCP2515Configurator.cpp.

Here is the call graph for this function:

◆ configureFiltersAndMasks()

void MCP2515Configurator::configureFiltersAndMasks ( )

Configure the filters and masks for the MCP2515.

This function configures the filters and masks for the MCP2515.

Definition at line 82 of file MCP2515Configurator.cpp.

Here is the call graph for this function:

◆ configureInterrupts()

void MCP2515Configurator::configureInterrupts ( )

Configure the interrupts for the MCP2515.

This function configures the interrupts for the MCP2515.

Definition at line 91 of file MCP2515Configurator.cpp.

Here is the call graph for this function:

◆ configureRXBuffer()

void MCP2515Configurator::configureRXBuffer ( )

Configure the RX buffer for the MCP2515.

This function configures the RX buffer for the MCP2515.

Definition at line 73 of file MCP2515Configurator.cpp.

Here is the call graph for this function:

◆ configureTXBuffer()

void MCP2515Configurator::configureTXBuffer ( )

Configure the TX buffer for the MCP2515.

This function configures the TX buffer for the MCP2515.

Definition at line 65 of file MCP2515Configurator.cpp.

Here is the call graph for this function:

◆ readCANMessage()

std::vector< uint8_t > MCP2515Configurator::readCANMessage ( uint16_t & frameID)

Read a CAN message from the MCP2515.

Parameters
frameIDThe frame ID of the message.
Returns
The data of the message.

This function reads a CAN message from the MCP2515.

Definition at line 152 of file MCP2515Configurator.cpp.

Here is the call graph for this function:

◆ readRegister()

uint8_t MCP2515Configurator::readRegister ( uint8_t address)
private

Read a value from a register.

Parameters
addressThe address of the register.
Returns
The value read from the register.

This function reads a value from a register.

Definition at line 131 of file MCP2515Configurator.cpp.

Here is the caller graph for this function:

◆ resetChip()

bool MCP2515Configurator::resetChip ( )

clean up the resources used by the MCP2515Configurator.

Returns
The chip in configuration mode.

This function cleans up the resources used putting the MCP2515 to default configuration.

Definition at line 44 of file MCP2515Configurator.cpp.

Here is the call graph for this function:

◆ sendCANMessage()

void MCP2515Configurator::sendCANMessage ( uint16_t frameID,
uint8_t * CAN_TX_Buf,
uint8_t length1 )

Send a CAN message to the MCP2515.

Parameters
frameIDThe frame ID of the message.
CAN_TX_BufThe data of the message.
length1The length of the data.

This function sends a CAN message to the MCP2515.

Definition at line 178 of file MCP2515Configurator.cpp.

Here is the call graph for this function:

◆ sendCommand()

void MCP2515Configurator::sendCommand ( uint8_t command)
private

Send a command to the MCP2515.

Parameters
commandThe command to send.
Returns
The response from the MCP2515.

This function sends a command to the MCP2515

Definition at line 141 of file MCP2515Configurator.cpp.

Here is the caller graph for this function:

◆ setMode()

void MCP2515Configurator::setMode ( uint8_t mode)

Set the mode for the MCP2515.

Parameters
modeThe mode to set.

This function sets the mode for the MCP2515.

Definition at line 100 of file MCP2515Configurator.cpp.

Here is the call graph for this function:

◆ verifyMode()

bool MCP2515Configurator::verifyMode ( uint8_t expectedMode)

Verify the mode of the MCP2515.

Parameters
expectedModeThe expected mode.
Returns
True if the mode is as expected, false otherwise.

This function verifies the mode of the MCP2515.

Definition at line 110 of file MCP2515Configurator.cpp.

Here is the call graph for this function:

◆ writeRegister()

void MCP2515Configurator::writeRegister ( uint8_t address,
uint8_t value )
private

Write a value to a register.

Parameters
addressThe address of the register.
valueThe value to write.

This function writes a value to a register.

Definition at line 121 of file MCP2515Configurator.cpp.

Here is the caller graph for this function:

Field Documentation

◆ CAN_RD_STATUS

uint8_t MCP2515Configurator::CAN_RD_STATUS = 0xA0
staticconstexpr

Definition at line 58 of file MCP2515Configurator.hpp.

◆ CAN_RTS_TXB0

uint8_t MCP2515Configurator::CAN_RTS_TXB0 = 0x81
staticconstexpr

Definition at line 65 of file MCP2515Configurator.hpp.

◆ CANCTRL

uint8_t MCP2515Configurator::CANCTRL = 0x0F
staticconstexpr

Definition at line 46 of file MCP2515Configurator.hpp.

◆ CANINTE

uint8_t MCP2515Configurator::CANINTE = 0x2B
staticconstexpr

Definition at line 54 of file MCP2515Configurator.hpp.

◆ CANINTF

uint8_t MCP2515Configurator::CANINTF = 0x2C
staticconstexpr

Definition at line 53 of file MCP2515Configurator.hpp.

◆ CANSTAT

uint8_t MCP2515Configurator::CANSTAT = 0x0E
staticconstexpr

Definition at line 47 of file MCP2515Configurator.hpp.

◆ CNF1

uint8_t MCP2515Configurator::CNF1 = 0x2A
staticconstexpr

Definition at line 48 of file MCP2515Configurator.hpp.

◆ CNF2

uint8_t MCP2515Configurator::CNF2 = 0x29
staticconstexpr

Definition at line 49 of file MCP2515Configurator.hpp.

◆ CNF3

uint8_t MCP2515Configurator::CNF3 = 0x28
staticconstexpr

Definition at line 50 of file MCP2515Configurator.hpp.

◆ RESET_CMD

uint8_t MCP2515Configurator::RESET_CMD = 0xC0
staticconstexpr

Definition at line 45 of file MCP2515Configurator.hpp.

◆ RXB0CTRL

uint8_t MCP2515Configurator::RXB0CTRL = 0x60
staticconstexpr

Definition at line 52 of file MCP2515Configurator.hpp.

◆ RXB0SIDH

uint8_t MCP2515Configurator::RXB0SIDH = 0x61
staticconstexpr

Definition at line 55 of file MCP2515Configurator.hpp.

◆ RXB0SIDL

uint8_t MCP2515Configurator::RXB0SIDL = 0x62
staticconstexpr

Definition at line 56 of file MCP2515Configurator.hpp.

◆ spiController

ISPIController& MCP2515Configurator::spiController
private

Reference to the SPI controller.

Definition at line 69 of file MCP2515Configurator.hpp.

◆ TXB0CTRL

uint8_t MCP2515Configurator::TXB0CTRL = 0x30
staticconstexpr

Definition at line 51 of file MCP2515Configurator.hpp.

◆ TXB0D0

uint8_t MCP2515Configurator::TXB0D0 = 0x36
staticconstexpr

Definition at line 64 of file MCP2515Configurator.hpp.

◆ TXB0DLC

uint8_t MCP2515Configurator::TXB0DLC = 0x35
staticconstexpr

Definition at line 63 of file MCP2515Configurator.hpp.

◆ TXB0EID0

uint8_t MCP2515Configurator::TXB0EID0 = 0x34
staticconstexpr

Definition at line 62 of file MCP2515Configurator.hpp.

◆ TXB0EID8

uint8_t MCP2515Configurator::TXB0EID8 = 0x33
staticconstexpr

Definition at line 61 of file MCP2515Configurator.hpp.

◆ TXB0SIDH

uint8_t MCP2515Configurator::TXB0SIDH = 0x31
staticconstexpr

Definition at line 59 of file MCP2515Configurator.hpp.

◆ TXB0SIDL

uint8_t MCP2515Configurator::TXB0SIDL = 0x32
staticconstexpr

Definition at line 60 of file MCP2515Configurator.hpp.


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