modm API documentation
|
#include </tmp/tmpo0lsdol0/stm32g474vet7/modm-test/src/modm-test/mock/can_driver.hpp>
Public Types | |
enum | BusState : uint8_t { BusState::Connected = 0, BusState::ErrorWarning = 1, BusState::ErrorPassive = 2, Off = 3 } |
enum | Mode : uint8_t { Mode::Normal = 0b00, Mode::ListenOnly = 0b01, Mode::LoopBack = 0b10, Mode::ListenOnlyLoopBack = 0b11 } |
Possible modes of the CAN controller. More... | |
Public Member Functions | |
bool | isMessageAvailable () |
bool | getMessage (modm::can::Message &message) |
bool | isReadyToSend () |
bool | sendMessage (const modm::can::Message &message) |
Static Public Member Functions | |
static uint8_t | getReceiveErrorCounter () |
static uint8_t | getTransmitErrorCounter () |
static BusState | getBusState () |
static void | acknowledgeInterruptFlag () |
template<uint64_t available, uint64_t requested, percent_t tolerance> | |
static void | assertBaudrateInTolerance () |
template<double available, double requested, percent_t tolerance> | |
static void | assertDurationInTolerance () |
static void | configurePurpose () |
configures a peripheral for a specific purpose | |
template<class... Signals> | |
static void | connect () |
static bool | getInterruptFlag () |
Read an interrupt flag. | |
static void | getParameter () |
returns a parameter | |
template<class SystemClock , bitrate_t bitrate = 125_kbps, percent_t tolerance = 1_pct> | |
static void | initialize (Mode startupMode) |
static void | initialize () |
initializes the peripheral, must be called before use. | |
static void | setParameter () |
sets a parameter | |
Public Attributes | |
modm::LinkedList< modm::can::Message > | receiveList |
Messages which should be received. | |
modm::LinkedList< modm::can::Message > | sendList |
List of all messages send. | |
uint8_t | sendSlots |
number of messages which could be send | |
Static Public Attributes | |
static constexpr size_t | RxBufferSize = 16 |
Size of the receive buffer. | |
static constexpr size_t | TxBufferSize = 16 |
Size of the transmit buffer. | |
Mock CAN peripheral interface for unittests.
|
inheritedstrong |
|
inheritedstrong |
|
inheritedstatic |
Acknowledge an interrupt flag.
We use acknowledge here, since it describes the intention rather than the actual implementation.
|
inheritedinlinestatic |
Since baudrates are usually generated by prescaling a system clock, only several distinct values can be generated. This method checks if the user requested baudrate is within error tolerance of the system achievable baudrate.
|
inheritedstatic |
Configures the Tx and Rx signals and connects them.
Signals | One Tx and one Rx signal are required and can be passed out-of-order. |
|
inheritedstatic |
Initializes the hardware and sets the baudrate.
SystemClock | the currently active system clock |
bitrate | the desired bitrate in Hz |
tolerance | the allowed relative tolerance for the resulting baudrate |