Class that configures the MCP2515 CAN controller.
More...
#include <MCP2515Configurator.hpp>
|
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 |
|
|
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.
|
|
Class that configures the MCP2515 CAN controller.
Definition at line 28 of file MCP2515Configurator.hpp.
◆ MCP2515Configurator()
MCP2515Configurator::MCP2515Configurator |
( |
ISPIController & | spiController | ) |
|
|
explicit |
◆ ~MCP2515Configurator()
MCP2515Configurator::~MCP2515Configurator |
( |
| ) |
|
|
default |
◆ 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.
◆ 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.
◆ 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.
◆ 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.
◆ 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.
◆ readCANMessage()
std::vector< uint8_t > MCP2515Configurator::readCANMessage |
( |
uint16_t & | frameID | ) |
|
Read a CAN message from the MCP2515.
- Parameters
-
frameID | The 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.
◆ readRegister()
uint8_t MCP2515Configurator::readRegister |
( |
uint8_t | address | ) |
|
|
private |
Read a value from a register.
- Parameters
-
address | The 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.
◆ 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.
◆ sendCANMessage()
void MCP2515Configurator::sendCANMessage |
( |
uint16_t | frameID, |
|
|
uint8_t * | CAN_TX_Buf, |
|
|
uint8_t | length1 ) |
Send a CAN message to the MCP2515.
- Parameters
-
frameID | The frame ID of the message. |
CAN_TX_Buf | The data of the message. |
length1 | The length of the data. |
This function sends a CAN message to the MCP2515.
Definition at line 178 of file MCP2515Configurator.cpp.
◆ sendCommand()
void MCP2515Configurator::sendCommand |
( |
uint8_t | command | ) |
|
|
private |
Send a command to the MCP2515.
- Parameters
-
command | The 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.
◆ setMode()
void MCP2515Configurator::setMode |
( |
uint8_t | mode | ) |
|
Set the mode for the MCP2515.
- Parameters
-
This function sets the mode for the MCP2515.
Definition at line 100 of file MCP2515Configurator.cpp.
◆ verifyMode()
bool MCP2515Configurator::verifyMode |
( |
uint8_t | expectedMode | ) |
|
Verify the mode of the MCP2515.
- Parameters
-
expectedMode | The 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.
◆ writeRegister()
void MCP2515Configurator::writeRegister |
( |
uint8_t | address, |
|
|
uint8_t | value ) |
|
private |
Write a value to a register.
- Parameters
-
address | The address of the register. |
value | The value to write. |
This function writes a value to a register.
Definition at line 121 of file MCP2515Configurator.cpp.
◆ CAN_RD_STATUS
uint8_t MCP2515Configurator::CAN_RD_STATUS = 0xA0 |
|
staticconstexpr |
◆ CAN_RTS_TXB0
uint8_t MCP2515Configurator::CAN_RTS_TXB0 = 0x81 |
|
staticconstexpr |
◆ CANCTRL
uint8_t MCP2515Configurator::CANCTRL = 0x0F |
|
staticconstexpr |
◆ CANINTE
uint8_t MCP2515Configurator::CANINTE = 0x2B |
|
staticconstexpr |
◆ CANINTF
uint8_t MCP2515Configurator::CANINTF = 0x2C |
|
staticconstexpr |
◆ CANSTAT
uint8_t MCP2515Configurator::CANSTAT = 0x0E |
|
staticconstexpr |
◆ CNF1
uint8_t MCP2515Configurator::CNF1 = 0x2A |
|
staticconstexpr |
◆ CNF2
uint8_t MCP2515Configurator::CNF2 = 0x29 |
|
staticconstexpr |
◆ CNF3
uint8_t MCP2515Configurator::CNF3 = 0x28 |
|
staticconstexpr |
◆ RESET_CMD
uint8_t MCP2515Configurator::RESET_CMD = 0xC0 |
|
staticconstexpr |
◆ RXB0CTRL
uint8_t MCP2515Configurator::RXB0CTRL = 0x60 |
|
staticconstexpr |
◆ RXB0SIDH
uint8_t MCP2515Configurator::RXB0SIDH = 0x61 |
|
staticconstexpr |
◆ RXB0SIDL
uint8_t MCP2515Configurator::RXB0SIDL = 0x62 |
|
staticconstexpr |
◆ spiController
◆ TXB0CTRL
uint8_t MCP2515Configurator::TXB0CTRL = 0x30 |
|
staticconstexpr |
◆ TXB0D0
uint8_t MCP2515Configurator::TXB0D0 = 0x36 |
|
staticconstexpr |
◆ TXB0DLC
uint8_t MCP2515Configurator::TXB0DLC = 0x35 |
|
staticconstexpr |
◆ TXB0EID0
uint8_t MCP2515Configurator::TXB0EID0 = 0x34 |
|
staticconstexpr |
◆ TXB0EID8
uint8_t MCP2515Configurator::TXB0EID8 = 0x33 |
|
staticconstexpr |
◆ TXB0SIDH
uint8_t MCP2515Configurator::TXB0SIDH = 0x31 |
|
staticconstexpr |
◆ TXB0SIDL
uint8_t MCP2515Configurator::TXB0SIDL = 0x32 |
|
staticconstexpr |
The documentation for this class was generated from the following files: