HF-Core Platform 0.1.0-dev
Hardware-Agnostic Handler Layer & RTOS Utilities for HardFOC
Loading...
Searching...
No Matches
Tle92466edHandler Class Reference

Unified handler for TLE92466ED six-channel solenoid driver. More...

#include <Tle92466edHandler.h>

Collaboration diagram for Tle92466edHandler:
[legend]

Classes

struct  is_driver_result
 Type trait to detect tle92466ed::DriverResult<T> types. More...
 
struct  is_driver_result< tle92466ed::DriverResult< T > >
 

Public Types

using DriverType = tle92466ed::Driver<HalSpiTle92466edComm>
 Driver type alias.
 

Public Member Functions

 Tle92466edHandler (BaseSpi &spi, BaseGpio &resn, BaseGpio &en, BaseGpio *faultn=nullptr) noexcept
 Construct TLE92466ED handler.
 
 ~Tle92466edHandler () noexcept
 
 Tle92466edHandler (const Tle92466edHandler &)=delete
 
Tle92466edHandleroperator= (const Tle92466edHandler &)=delete
 
 Tle92466edHandler (Tle92466edHandler &&)=delete
 
Tle92466edHandleroperator= (Tle92466edHandler &&)=delete
 
tle92466ed::DriverResult< void > Initialize () noexcept
 Initialize driver (hardware reset + SPI init + enter config mode).
 
bool EnsureInitialized () noexcept
 Ensure driver is initialized (lazy init entrypoint).
 
tle92466ed::DriverResult< void > Initialize (const tle92466ed::GlobalConfig &config) noexcept
 Initialize with global configuration.
 
tle92466ed::DriverResult< void > Deinitialize () noexcept
 Deinitialize — disable channels and shut down.
 
bool IsInitialized () const noexcept
 Check if initialized.
 
tle92466ed::DriverResult< void > ConfigureChannel (uint8_t channel, const tle92466ed::ChannelConfig &config) noexcept
 Configure a channel.
 
tle92466ed::DriverResult< void > EnableChannel (uint8_t channel) noexcept
 Enable a channel.
 
tle92466ed::DriverResult< void > DisableChannel (uint8_t channel) noexcept
 Disable a channel.
 
tle92466ed::DriverResult< void > EnableAllChannels () noexcept
 Enable all channels.
 
tle92466ed::DriverResult< void > DisableAllChannels () noexcept
 Disable all channels.
 
tle92466ed::DriverResult< void > SetChannelCurrent (uint8_t channel, uint16_t current_ma) noexcept
 Set channel current setpoint.
 
tle92466ed::DriverResult< void > ConfigurePwmRaw (uint8_t channel, uint8_t mantissa, uint8_t exponent, bool low_freq_range=false) noexcept
 Configure raw PWM period for a channel.
 
tle92466ed::DriverResult< void > EnterMissionMode () noexcept
 Enter mission mode (enable outputs after configuration).
 
tle92466ed::DriverResult< void > EnterConfigMode () noexcept
 Enter config mode (for register writes).
 
bool IsMissionMode () noexcept
 Check if in mission mode.
 
tle92466ed::DriverResult< void > GetStatus (tle92466ed::DeviceStatus &status) noexcept
 Get device status.
 
tle92466ed::DriverResult< void > GetChannelDiagnostics (uint8_t channel, tle92466ed::ChannelDiagnostics &diag) noexcept
 Get channel diagnostics.
 
tle92466ed::DriverResult< void > GetFaultReport (tle92466ed::FaultReport &report) noexcept
 Get comprehensive fault report.
 
tle92466ed::DriverResult< void > ClearFaults () noexcept
 Clear all fault flags.
 
bool HasFault () noexcept
 Check if any fault is present.
 
tle92466ed::DriverResult< void > KickWatchdog (uint16_t reload_value=1000) noexcept
 Reload the SPI watchdog.
 
uint32_t GetChipId () noexcept
 Get chip ID (returns 0 on error).
 
uint32_t GetIcVersion () noexcept
 Get IC version (returns 0 on error).
 
DriverTypeGetDriver () noexcept
 Get the underlying driver for advanced operations.
 
const DriverTypeGetDriver () const noexcept
 
void DumpDiagnostics () noexcept
 Dump diagnostics to logger.
 

Static Public Attributes

static constexpr uint8_t kNumChannels = 6
 

Private Member Functions

bool EnsureInitializedLocked () noexcept
 
template<typename Fn >
auto withDriver (Fn &&fn) noexcept
 Execute a lambda with a locked, initialized driver.
 

Private Attributes

bool initialized_ {false}
 
RtosMutex mutex_
 
std::unique_ptr< HalSpiTle92466edCommcomm_
 
std::unique_ptr< DriverTypedriver_
 

Detailed Description

Unified handler for TLE92466ED six-channel solenoid driver.

Provides thread-safe access to all TLE92466ED driver features:

  • Channel enable/disable and current control
  • PWM configuration per channel
  • Fault monitoring and diagnostics
  • Watchdog management
  • Device status and temperature reading

Member Typedef Documentation

◆ DriverType

Driver type alias.

Constructor & Destructor Documentation

◆ Tle92466edHandler() [1/3]

Tle92466edHandler::Tle92466edHandler ( BaseSpi & spi,
BaseGpio & resn,
BaseGpio & en,
BaseGpio * faultn = nullptr )
noexcept

Construct TLE92466ED handler.

Parameters
spiReference to pre-configured BaseSpi.
resnBaseGpio for RESN pin (active LOW reset).
enBaseGpio for EN pin (active HIGH enable).
faultnOptional BaseGpio for FAULTN (active LOW fault indicator).
Here is the call graph for this function:

◆ ~Tle92466edHandler()

Tle92466edHandler::~Tle92466edHandler ( )
noexcept
Here is the call graph for this function:

◆ Tle92466edHandler() [2/3]

Tle92466edHandler::Tle92466edHandler ( const Tle92466edHandler & )
delete

◆ Tle92466edHandler() [3/3]

Tle92466edHandler::Tle92466edHandler ( Tle92466edHandler && )
delete

Member Function Documentation

◆ ClearFaults()

tle92466ed::DriverResult< void > Tle92466edHandler::ClearFaults ( )
noexcept

Clear all fault flags.

Here is the call graph for this function:

◆ ConfigureChannel()

tle92466ed::DriverResult< void > Tle92466edHandler::ConfigureChannel ( uint8_t channel,
const tle92466ed::ChannelConfig & config )
noexcept

Configure a channel.

Parameters
channelChannel number (0-5).
configChannel configuration.
Here is the call graph for this function:

◆ ConfigurePwmRaw()

tle92466ed::DriverResult< void > Tle92466edHandler::ConfigurePwmRaw ( uint8_t channel,
uint8_t mantissa,
uint8_t exponent,
bool low_freq_range = false )
noexcept

Configure raw PWM period for a channel.

Parameters
channelChannel number (0-5).
mantissaPWM period mantissa.
exponentPWM period exponent.
low_freq_rangeUse low frequency range.
Here is the call graph for this function:

◆ Deinitialize()

tle92466ed::DriverResult< void > Tle92466edHandler::Deinitialize ( )
noexcept

Deinitialize — disable channels and shut down.

Returns
DriverResult with void on success, DriverError on failure.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ DisableAllChannels()

tle92466ed::DriverResult< void > Tle92466edHandler::DisableAllChannels ( )
noexcept

Disable all channels.

Here is the call graph for this function:

◆ DisableChannel()

tle92466ed::DriverResult< void > Tle92466edHandler::DisableChannel ( uint8_t channel)
noexcept

Disable a channel.

Here is the call graph for this function:

◆ DumpDiagnostics()

void Tle92466edHandler::DumpDiagnostics ( )
noexcept

Dump diagnostics to logger.

Here is the call graph for this function:

◆ EnableAllChannels()

tle92466ed::DriverResult< void > Tle92466edHandler::EnableAllChannels ( )
noexcept

Enable all channels.

Here is the call graph for this function:

◆ EnableChannel()

tle92466ed::DriverResult< void > Tle92466edHandler::EnableChannel ( uint8_t channel)
noexcept

Enable a channel.

Here is the call graph for this function:

◆ EnsureInitialized()

bool Tle92466edHandler::EnsureInitialized ( )
noexcept

Ensure driver is initialized (lazy init entrypoint).

Returns
true if initialized and ready.
Here is the call graph for this function:

◆ EnsureInitializedLocked()

bool Tle92466edHandler::EnsureInitializedLocked ( )
privatenoexcept
Here is the call graph for this function:
Here is the caller graph for this function:

◆ EnterConfigMode()

tle92466ed::DriverResult< void > Tle92466edHandler::EnterConfigMode ( )
noexcept

Enter config mode (for register writes).

Here is the call graph for this function:

◆ EnterMissionMode()

tle92466ed::DriverResult< void > Tle92466edHandler::EnterMissionMode ( )
noexcept

Enter mission mode (enable outputs after configuration).

Here is the call graph for this function:

◆ GetChannelDiagnostics()

tle92466ed::DriverResult< void > Tle92466edHandler::GetChannelDiagnostics ( uint8_t channel,
tle92466ed::ChannelDiagnostics & diag )
noexcept

Get channel diagnostics.

Parameters
channelChannel number (0-5).
[out]diagDiagnostics structure to fill.
Here is the call graph for this function:

◆ GetChipId()

uint32_t Tle92466edHandler::GetChipId ( )
noexcept

Get chip ID (returns 0 on error).

Here is the call graph for this function:

◆ GetDriver() [1/2]

const Tle92466edHandler::DriverType * Tle92466edHandler::GetDriver ( ) const
noexcept
Here is the call graph for this function:

◆ GetDriver() [2/2]

Tle92466edHandler::DriverType * Tle92466edHandler::GetDriver ( )
noexcept

Get the underlying driver for advanced operations.

Returns
Pointer to driver, or nullptr if not initialized.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetFaultReport()

tle92466ed::DriverResult< void > Tle92466edHandler::GetFaultReport ( tle92466ed::FaultReport & report)
noexcept

Get comprehensive fault report.

Parameters
[out]reportFault report structure to fill.

◆ GetIcVersion()

uint32_t Tle92466edHandler::GetIcVersion ( )
noexcept

Get IC version (returns 0 on error).

Here is the call graph for this function:

◆ GetStatus()

tle92466ed::DriverResult< void > Tle92466edHandler::GetStatus ( tle92466ed::DeviceStatus & status)
noexcept

Get device status.

Parameters
[out]statusDevice status structure to fill.

◆ HasFault()

bool Tle92466edHandler::HasFault ( )
noexcept

Check if any fault is present.

Here is the call graph for this function:

◆ Initialize() [1/2]

tle92466ed::DriverResult< void > Tle92466edHandler::Initialize ( )
noexcept

Initialize driver (hardware reset + SPI init + enter config mode).

Returns
DriverResult with void on success, DriverError on failure.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Initialize() [2/2]

tle92466ed::DriverResult< void > Tle92466edHandler::Initialize ( const tle92466ed::GlobalConfig & config)
noexcept

Initialize with global configuration.

Parameters
configGlobal device configuration.
Returns
DriverResult with void on success, DriverError on failure.
Here is the call graph for this function:

◆ IsInitialized()

bool Tle92466edHandler::IsInitialized ( ) const
inlinenoexcept

Check if initialized.

◆ IsMissionMode()

bool Tle92466edHandler::IsMissionMode ( )
noexcept

Check if in mission mode.

Here is the call graph for this function:

◆ KickWatchdog()

tle92466ed::DriverResult< void > Tle92466edHandler::KickWatchdog ( uint16_t reload_value = 1000)
noexcept

Reload the SPI watchdog.

Parameters
reload_valueWatchdog reload value (default 1000).

◆ operator=() [1/2]

Tle92466edHandler & Tle92466edHandler::operator= ( const Tle92466edHandler & )
delete

◆ operator=() [2/2]

Tle92466edHandler & Tle92466edHandler::operator= ( Tle92466edHandler && )
delete

◆ SetChannelCurrent()

tle92466ed::DriverResult< void > Tle92466edHandler::SetChannelCurrent ( uint8_t channel,
uint16_t current_ma )
noexcept

Set channel current setpoint.

Parameters
channelChannel number (0-5).
current_maCurrent in milliamps.
Here is the call graph for this function:

◆ withDriver()

template<typename Fn >
auto Tle92466edHandler::withDriver ( Fn && fn)
inlineprivatenoexcept

Execute a lambda with a locked, initialized driver.

Acquires the mutex, ensures initialization, and invokes fn(*driver_). Returns a default-constructed R on failure, or for DriverResult types, returns an error indicating the driver is not initialized.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ comm_

std::unique_ptr<HalSpiTle92466edComm> Tle92466edHandler::comm_
private

◆ driver_

std::unique_ptr<DriverType> Tle92466edHandler::driver_
private

◆ initialized_

bool Tle92466edHandler::initialized_ {false}
private

◆ kNumChannels

constexpr uint8_t Tle92466edHandler::kNumChannels = 6
staticconstexpr

◆ mutex_

RtosMutex Tle92466edHandler::mutex_
mutableprivate

The documentation for this class was generated from the following files: