25#ifndef TLE92466ED_HAL_HPP
26#define TLE92466ED_HAL_HPP
202 std::span<const uint32_t> tx_data,
203 std::span<uint32_t> rx_data) noexcept = 0;
275 [[nodiscard]] virtual
bool is_ready() const noexcept = 0;
318 HAL& operator=(
HAL&&) noexcept = default;
332concept
HALInterface = std::is_base_of_v<
HAL, T> && requires(T hal, uint32_t data, SPIConfig cfg) {
333 { hal.init() } -> std::same_as<HALResult<void>>;
334 { hal.transfer32(data) } -> std::same_as<HALResult<uint32_t>>;
335 { hal.chip_select() } -> std::same_as<HALResult<void>>;
336 { hal.chip_deselect() } -> std::same_as<HALResult<void>>;
337 { hal.is_ready() } -> std::same_as<bool>;
338 { hal.configure(cfg) } -> std::same_as<HALResult<void>>;
Abstract Hardware Abstraction Layer (HAL) base class.
Definition TLE92466ED_HAL.hpp:124
HAL()=default
Protected constructor to prevent direct instantiation.
virtual HALResult< void > transfer_multi(std::span< const uint32_t > tx_data, std::span< uint32_t > rx_data) noexcept=0
Transfer multiple 32-bit words via SPI.
virtual HALError get_last_error() const noexcept=0
Get the last error that occurred.
virtual HALResult< void > clear_errors() noexcept=0
Clear any pending errors.
virtual HALResult< uint32_t > transfer32(uint32_t tx_data) noexcept=0
Transfer 32-bit data via SPI (full-duplex)
virtual HALResult< void > delay(uint32_t microseconds) noexcept=0
Delay for specified duration.
virtual ~HAL()=default
Virtual destructor for polymorphic behavior.
virtual HALResult< void > deinit() noexcept=0
Deinitialize the hardware interface.
virtual HALResult< void > init() noexcept=0
Initialize the hardware interface.
virtual HALResult< void > configure(const SPIConfig &config) noexcept=0
Configure SPI parameters.
virtual HALResult< void > chip_select() noexcept=0
Assert (activate) chip select.
virtual bool is_ready() const noexcept=0
Check if hardware is ready for communication.
virtual HALResult< void > chip_deselect() noexcept=0
Deassert (deactivate) chip select.
Concept to verify a type implements the HAL interface.
Definition TLE92466ED_HAL.hpp:332
Definition TLE92466ED.hpp:80
@ InvalidParameter
Invalid parameter value.
@ CRCError
CRC mismatch in SPI communication.
HALError
Error codes for HAL operations.
Definition TLE92466ED_HAL.hpp:41
@ BusError
SPI bus communication error.
@ HardwareNotReady
Hardware not initialized or ready.
@ BufferOverflow
Buffer size exceeded.
@ ChipselectError
Chip select control failed.
@ TransferError
Data transfer failed.
@ UnknownError
Unknown error occurred.
@ Timeout
Operation timed out.
std::expected< T, HALError > HALResult
Result type for HAL operations using std::expected (C++23)
Definition TLE92466ED_HAL.hpp:62
SPI transaction configuration.
Definition TLE92466ED_HAL.hpp:69
uint8_t bits_per_word
Bits per word (8-bit, transfer 4 bytes for 32-bit frame)
Definition TLE92466ED_HAL.hpp:72
uint32_t frequency
SPI clock frequency in Hz (max 10 MHz for TLE92466ED)
Definition TLE92466ED_HAL.hpp:70
bool msb_first
MSB first transmission.
Definition TLE92466ED_HAL.hpp:73
uint32_t timeout_ms
Transaction timeout in milliseconds.
Definition TLE92466ED_HAL.hpp:74
uint8_t mode
SPI mode (CPOL=0, CPHA=0 for TLE92466ED)
Definition TLE92466ED_HAL.hpp:71