25#include <interfaces-impl/arch_registers_impl.h>
49 static constexpr unsigned int RX_BUF_SIZE = 32;
50 static constexpr unsigned int TX_STATUS_BUF_SIZE = 32;
53 static constexpr float BR_ERR_WEIGHT = 10;
54 static constexpr float SP_ERR_WEIGHT = 1;
55 static constexpr float N_ERR_WEIGHT = 1 / 50;
57 static constexpr uint8_t NUM_FILTER_BANKS = 28;
143 std::chrono::milliseconds timeout = std::chrono::milliseconds::zero());
210 static BitTiming calcBitTiming(AutoBitTiming config);
221 uint32_t txMailboxSeq[3] = {0};
223 uint8_t isInit =
false;
224 uint8_t filterIndex = 0;
225 Thread* waiting =
nullptr;
Low level CanBus driver, with support for both peripherals (CAN1 and CAN2) on stm32f4 microcontroller...
uint32_t send(CanPacket packet)
Sends a packet on the bus. This function blocks until the message has been successfully put into a TX...
void handleRXInterrupt(int fifo)
Handles an incoming RX interrupt. ONLY to be called from the Canbus RX interrupt handler routine.
IRQCircularBuffer< CanTXResult, TX_STATUS_BUF_SIZE > & getTXResultBuffer()
Returns a reference to the buffer containing transfer results and statistics.
IRQCircularBuffer< CanRXPacket, RX_BUF_SIZE > & getRXBuffer()
Returns a reference to the buffer containing received packets.
bool addFilter(FilterBank filter)
Adds a new filter to the bus, or returns false if there are no more filter banks available.
~CanbusDriver()
Disables the peripheral clock.
uint32_t getTXMailboxSequence(uint8_t i)
Gets the sequence number of the message in the ith tx mailbox.
void wakeTXThread()
Wakes the transmission thread. ONLY to be called from the Canbus TX interrupt handler routine.
bool init(std::chrono::milliseconds timeout=std::chrono::milliseconds::zero())
Exits initialization mode and starts CanBus operation.
CAN_TypeDef * getCAN()
Returns the CanBus peripheral assigned to this instance.
Driver for the VN100S IMU.
Struct defining high level bit timing requirements. Register values will then be calculated automatic...
uint32_t baudRate
Canbus baud rate in bps (BITS PER SECOND). CANOpen standard values are preferred but not mandatory: 1...
float samplePoint
Sample point in percentage of the bit length. Eg: 0.875.
Struct specifying exact bit timing registers values.
Configuration struct for basic CanBus operation.
Base class for a Canbus filter bank.