9#ifndef MCP2515_CAN_INTERFACE_HPP
10#define MCP2515_CAN_INTERFACE_HPP
47 void close()
override;
General constants used throughout this library.
An abstraction between this CAN stack and any hardware layer.
A base class for a CAN driver. Can be derived into your platform's required interface.
A classical CAN frame, with 8 data bytes.
An abstract base class for a CAN driver.
A CAN frame for interfacing with a hardware layer, like socket CAN or other interface.
A CAN Driver for the MCP2515 CAN controller.
std::uint8_t rxIndex
The index of the rx buffer to read from next.
static constexpr std::uint32_t RECEIVE_MESSAGE_READ_RATE
Hardcoded time in ms between polling the MCP2515 module for new messages, mostly arbitrary.
bool reset()
Resets the MCP2515.
bool write_frame(const isobus::CANMessageFrame &canFrame) override
Writes a frame to the bus (synchronous)
bool write_register(const MCPRegister address, const std::uint8_t data)
write a single byte register of the mcp2515
MCPMode
The different modes of the MCP2515 associated with their internal bits.
MCPRegister
Some essential registers of the MCP2515.
const std::uint8_t cfg2
Configuration value for CFG2 register.
void close() override
Closes the socket.
bool write_reset()
Reset the mcp2515 internally.
const std::uint8_t cfg1
Configuration value for CFG1 register.
std::uint8_t txIndex
The index of the tx buffer to write to next, start with 2 as it is the buffer with the highest priori...
std::uint8_t txPriority
The priority of the next tx frame.
bool get_is_valid() const override
Returns if the socket connection is valid.
const std::uint8_t cfg3
Configuration value for CFG3 register.
bool read_register(const MCPRegister address, std::uint8_t &data)
read a single byte register of the mcp2515
bool set_mode(const MCPMode mode)
set the mode of the mcp2515
bool modify_register(const MCPRegister address, const std::uint8_t mask, const std::uint8_t data)
modify a register of the mcp2515
virtual ~MCP2515CANInterface()
The destructor for SocketCANInterface.
bool read_frame(isobus::CANMessageFrame &canFrame) override
Returns a frame from the hardware (synchronous), or false if no frame can be read.
SPIHardwarePlugin * transactionHandler
The SPI transaction handler.
bool get_read_status(std::uint8_t &status)
Read the rx status of the mcp2515.
MCP2515CANInterface(SPIHardwarePlugin *transactionHandler, const std::uint8_t cfg1, const std::uint8_t cfg2, const std::uint8_t cfg3)
Constructor for the socket CAN driver.
void open() override
Connects to the socket.
MCPInstruction
Some essential instructions of the MCP2515.
bool initialized
If the mcp2515 has been initialized and no errors have occurred.
An abstract base class for SPI communication.
This namespace encompasses all of the ISO11783 stack's functionality to reduce global namespace pollu...
A base class for SPI communication between hardware devices. Can be derived into your platform's requ...