37#ifndef _FREERTOS_DRIVERS_ESP32_ESP32HARDWARETWAI_HXX_
38#define _FREERTOS_DRIVERS_ESP32_ESP32HARDWARETWAI_HXX_
40#include <hal/gpio_types.h>
42#include <soc/soc_caps.h>
50namespace openmrn_arduino
159 ,
size_t rx_buffer_size = config_can_rx_buffer_size()
160 ,
size_t tx_buffer_size = config_can_tx_buffer_size()
161 ,
const char *path =
"/dev/twai"
162 ,
int clock_out = GPIO_NUM_NC
163 ,
int bus_status = GPIO_NUM_NC
200#if SOC_CPU_CORES_NUM > 1
ESP32 Hardware TWAI (CAN) driver interface.
const int txPin_
GPIO pin connected to the external transceiver TX pin.
const int busStatusPin_
GPIO pin connected to an external bus status indicator.
const int extClockPin_
GPIO pin that generates an external clock signal.
const uint32_t preferredIsrCore_
Core which the TWAI ISR should be bound to.
Esp32HardwareTwai()
Default constructor.
static constexpr uint32_t DEFAULT_ISR_CORE
Default core for running the TWAI ISR.
const int rxPin_
GPIO pin connected to the external transceiver RX pin.
~Esp32HardwareTwai()
Destructor.
void get_driver_stats(esp32_twai_stats_t *stats)
Retrieves the current driver statistics.
const char * vfsPath_
VFS Mount point.
void hw_init()
Initializes the TWAI hardware and VFS adapter.
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
Removes default copy-constructor and assignment added by C++.
uint32_t tx_success
Number of frames that have been transmitted successfully by the low-level TWAI driver.
uint32_t rx_overrun
Number of frames that were lost due to RX FIFO overrun.
uint32_t rx_discard
Number of frames that were discarded that had too large of a DLC count.
uint32_t arb_loss
Number of arbitration losses that have been observed on the TWAI bus.
uint32_t rx_processed
Number of frames have been removed from rx_buf and sent to the OpenMRN stack.
uint32_t tx_processed
Number of frames that have been sent to the twai_tx_queue by the OpenMRN stack successfully.
uint32_t bus_error
Number of general bus errors that have been observed on the TWAI bus.
uint32_t rx_missed
Number of frames frames that could not be sent to rx_buf.
uint32_t tx_failed
Number of frames that have been could not be transmitted successfully by the low-level TWAI driver.
uint32_t rx_lost
Number of frames that were lost due to driver reset.