Internal Interface Wrap
API reference
Loading...
Searching...
No Matches
Classes | Typedefs | Enumerations
EspCan.h File Reference

ESP32 CAN (TWAI) implementation for the HardFOC system - ESP-IDF v5.5 Compatible. More...

#include "McuSelect.h"
#include "esp_twai.h"
#include "esp_twai_onchip.h"
#include "freertos/FreeRTOS.h"
#include "freertos/semphr.h"
#include "BaseCan.h"
#include "HfSpscRing.h"
#include "PlatformMutex.h"
#include "utils/EspTypes_CAN.h"
#include <atomic>
#include <memory>
Include dependency graph for EspCan.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  hf_esp_can_config_t
 ESP32 TWAI node configuration structure for ESP-IDF v5.5. More...
 
struct  hf_esp_can_timing_config_t
 Advanced bit timing configuration for fine-tuning. More...
 
struct  hf_esp_can_filter_config_t
 CAN message filter configuration for hardware filtering. More...
 
struct  hf_esp_can_error_info_t
 Comprehensive error information structure for error callbacks. More...
 
struct  hf_esp_can_state_info_t
 Bus state information for state change callbacks. More...
 
struct  hf_esp_can_tx_info_t
 Transmission completion information. More...
 
class  EspCan
 ESP32 CAN (TWAI) implementation using ESP-IDF v5.5+ node-based API. More...
 
struct  EspCan::TxSlot
 

Typedefs

using hf_esp_can_receive_callback_t = void(*)(const hf_can_message_t &message, void *user_data)
 User callback function types with user data support.
 
using hf_esp_can_error_callback_t = void(*)(const hf_esp_can_error_info_t &error_info, void *user_data)
 
using hf_esp_can_state_callback_t = void(*)(const hf_esp_can_state_info_t &state_info, void *user_data)
 
using hf_esp_can_tx_callback_t = void(*)(const hf_esp_can_tx_info_t &tx_info, void *user_data)
 

Enumerations

enum class  hf_esp_can_rx_mode_t : uint8_t { AUTO = 0 , QUEUE_ALWAYS = 1 }
 Where EspCan delivers received frames. More...
 

Detailed Description

ESP32 CAN (TWAI) implementation for the HardFOC system - ESP-IDF v5.5 Compatible.

This file contains the ESP32 CAN (TWAI) implementation that extends the BaseCan abstract class. It provides a clean, minimal, and robust CAN interface using the modern ESP-IDF v5.5+ handle-based TWAI node API with comprehensive testing support for ESP32 with external SN65 transceiver.

Key Features:

Author
Nebiyu Tadesse
Date
2025
Note
This implementation requires ESP-IDF v5.5 or later
Each EspCan instance represents a single TWAI node
Higher-level applications should instantiate multiple EspCan objects for multi-controller boards

Typedef Documentation

◆ hf_esp_can_error_callback_t

◆ hf_esp_can_receive_callback_t

User callback function types with user data support.

◆ hf_esp_can_state_callback_t

◆ hf_esp_can_tx_callback_t

Enumeration Type Documentation

◆ hf_esp_can_rx_mode_t

Where EspCan delivers received frames.

Received frames are taken from the controller in the TWAI RX interrupt. Receive callbacks run in that ISR context.

Enumerator
AUTO 

A registered receive callback gets each frame; with no callback the frame goes into the RX ring for ReceiveMessage(). Default.

QUEUE_ALWAYS 

Every frame goes into the RX ring; a registered callback is also called.