17#include "driver/spi_master.h"
18#include "driver/gpio.h"
36 spi_host_device_t
host = SPI2_HOST;
66 auto initialize() noexcept -> std::expected<
void, HALError>;
75 std::span<uint8_t> rxData) noexcept
76 -> std::expected<
void, HALError> override;
101 static constexpr const char*
TAG =
"ESP32C6_HAL";
107 auto initializeSPI() noexcept -> std::expected<
void, HALError>;
113 auto
addSPIDevice() noexcept -> std::expected<
void, HALError>;
128 config.
host = SPI2_HOST;
132 config.
cs_pin = SPIPins::CS;
134 config.
mode = SPIParams::MODE;
137 return std::make_unique<ESP32C6_HAL>(config);
auto createTLE92466ED_HAL() -> std::unique_ptr< ESP32C6_HAL >
Create a configured ESP32C6_HAL instance for TLE92466ED.
Definition ESP32C6_HAL.hpp:122
Hardware configuration for TLE92466ED driver on ESP32-C6.
Hardware Abstraction Layer (HAL) base class for TLE92466ED driver.
ESP32-C6 implementation of the TLE92466ED HAL interface.
Definition ESP32C6_HAL.hpp:30
auto getConfig() const noexcept -> const SPIConfig &
Get the current SPI configuration.
Definition ESP32C6_HAL.hpp:88
static constexpr const char * TAG
Logging tag.
Definition ESP32C6_HAL.hpp:101
auto addSPIDevice() noexcept -> std::expected< void, HALError >
Add SPI device to the bus.
Definition ESP32C6_HAL.cpp:92
~ESP32C6_HAL() override
Destructor - cleans up SPI resources.
Definition ESP32C6_HAL.cpp:25
bool initialized_
Initialization state.
Definition ESP32C6_HAL.hpp:99
void delayMicroseconds(uint32_t us) noexcept override
Microsecond delay implementation.
Definition ESP32C6_HAL.cpp:155
auto initialize() noexcept -> std::expected< void, HALError >
Initialize the HAL (must be called before use)
Definition ESP32C6_HAL.cpp:39
auto isInitialized() const noexcept -> bool
Check if HAL is initialized.
Definition ESP32C6_HAL.hpp:94
SPIConfig config_
SPI configuration.
Definition ESP32C6_HAL.hpp:97
spi_device_handle_t spi_device_
SPI device handle.
Definition ESP32C6_HAL.hpp:98
auto spiTransfer(std::span< const uint8_t > txData, std::span< uint8_t > rxData) noexcept -> std::expected< void, HALError > override
Perform SPI transfer (32-bit frames for TLE92466ED)
Definition ESP32C6_HAL.cpp:121
auto initializeSPI() noexcept -> std::expected< void, HALError >
Initialize SPI bus.
Definition ESP32C6_HAL.cpp:65
ESP32C6_HAL()
Constructor with default SPI configuration.
Definition ESP32C6_HAL.hpp:49
Definition TLE92466ED_Config.hpp:17
SPI configuration structure for ESP32-C6.
Definition ESP32C6_HAL.hpp:35
int miso_pin
MISO pin (GPIO2)
Definition ESP32C6_HAL.hpp:37
int frequency
SPI frequency (1MHz)
Definition ESP32C6_HAL.hpp:41
int mode
SPI mode (0 = CPOL=0, CPHA=0)
Definition ESP32C6_HAL.hpp:42
int mosi_pin
MOSI pin (GPIO7)
Definition ESP32C6_HAL.hpp:38
spi_host_device_t host
SPI host (SPI2_HOST for ESP32-C6)
Definition ESP32C6_HAL.hpp:36
int sclk_pin
SCLK pin (GPIO6)
Definition ESP32C6_HAL.hpp:39
int queue_size
Transaction queue size.
Definition ESP32C6_HAL.hpp:43
int cs_pin
CS pin (GPIO10)
Definition ESP32C6_HAL.hpp:40