TLE92466ED Driver 2.0.0
API reference
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
tle92466ed::Driver< CommType > Class Template Reference

Main TLE92466ED driver class. More...

#include <tle92466ed.hpp>

Public Member Functions

 Driver (CommType &comm) noexcept
 Construct driver with communication interface.
 
 ~Driver () noexcept
 Destructor - ensures clean shutdown.
 
 Driver (const Driver &)=delete
 
Driver & operator= (const Driver &)=delete
 
 Driver (Driver &&) noexcept=delete
 
Driver & operator= (Driver &&) noexcept=delete
 
DriverResult< void > Init (bool perform_hardware_reset=true) noexcept
 Initialize the driver and hardware.
 
DriverResult< void > EnterMissionMode () noexcept
 Enter Mission Mode (enables channel control)
 
DriverResult< void > EnterConfigMode () noexcept
 Enter Config Mode (allows configuration changes)
 
bool IsMissionMode () const noexcept
 Check if in mission mode.
 
bool IsConfigMode () const noexcept
 Check if in config mode.
 
DriverResult< void > ConfigureGlobal (const GlobalConfig &config) noexcept
 Configure global device settings.
 
DriverResult< void > SetCrcEnabled (bool enabled) noexcept
 Enable/disable CRC checking.
 
DriverResult< void > SetVbatThresholds (float uv_voltage, float ov_voltage) noexcept
 Set VBAT under/overvoltage thresholds from voltage values (High-Level API)
 
DriverResult< void > SetVbatThresholdsRaw (uint8_t uv_threshold, uint8_t ov_threshold) noexcept
 Set VBAT under/overvoltage thresholds (Low-Level API)
 
DriverResult< void > EnableChannel (Channel channel, bool enabled) noexcept
 Enable or disable a channel.
 
DriverResult< void > EnableChannels (uint8_t channel_mask) noexcept
 Enable or disable multiple channels.
 
DriverResult< void > EnableAllChannels () noexcept
 Enable all channels.
 
DriverResult< void > DisableAllChannels () noexcept
 Disable all channels.
 
DriverResult< void > SetChannelMode (Channel channel, ChannelMode mode) noexcept
 Set channel operation mode.
 
DriverResult< void > SetParallelOperation (ParallelPair pair, bool enabled) noexcept
 Configure channel for parallel operation.
 
DriverResult< void > SetCurrentSetpoint (Channel channel, uint16_t current_ma, bool parallel_mode=false) noexcept
 Set current setpoint for channel.
 
DriverResult< void > SetCurrentSetpointUa (Channel channel, uint32_t current_ua, bool parallel_mode=false) noexcept
 Set the ICC current setpoint in microamperes (full 15-bit TARGET resolution).
 
DriverResult< uint16_t > GetCurrentSetpoint (Channel channel, bool parallel_mode=false) noexcept
 Get current setpoint for channel.
 
DriverResult< void > ConfigurePwmPeriod (Channel channel, float period_us) noexcept
 Configure PWM period from desired period in microseconds (High-Level API)
 
DriverResult< void > ConfigurePwmPeriodRaw (Channel channel, uint8_t period_mantissa, uint8_t period_exponent, bool low_freq_range=false) noexcept
 Configure PWM parameters for ICC (Low-Level API)
 
DriverResult< void > ConfigureDither (Channel channel, float amplitude_ma, float frequency_hz, bool parallel_mode=false) noexcept
 Configure dither from amplitude and frequency (High-Level API)
 
DriverResult< void > ConfigureDitherRaw (Channel channel, uint16_t step_size, uint8_t num_steps, uint8_t flat_steps) noexcept
 Configure dither parameters (Low-Level API)
 
DriverResult< void > ConfigureDitherClock (Channel channel, float t_ref_clk_us, bool dither_pwm_sync=false, bool dither_setpoint_sync=false) noexcept
 Configure the per-channel dither reference clock (DITHER_CLK_DIV).
 
DriverResult< void > ConfigureChannel (Channel channel, const ChannelConfig &config) noexcept
 Configure channel slew rate and diagnostics.
 
DriverResult< DeviceStatus > GetDeviceStatus () noexcept
 Get global device status.
 
DriverResult< ChannelDiagnostics > GetChannelDiagnostics (Channel channel) noexcept
 Get channel diagnostic information.
 
DriverResult< uint16_t > GetAverageCurrent (Channel channel, bool parallel_mode=false) noexcept
 Get average load current for a channel, in milliamps.
 
DriverResult< uint16_t > GetDutyCycle (Channel channel) noexcept
 Get PWM duty cycle for a channel, in permyriad (0..10000).
 
DriverResult< uint16_t > GetVbatVoltage () noexcept
 Get VBAT voltage.
 
DriverResult< uint16_t > GetVioVoltage () noexcept
 Get VIO voltage.
 
DriverResult< uint16_t > GetVddVoltage () noexcept
 Get VDD voltage.
 
DriverResult< void > GetVbatThresholds (uint16_t &uv_threshold, uint16_t &ov_threshold) noexcept
 Get VBAT thresholds.
 
DriverResult< void > ClearFaults () noexcept
 Clear all fault flags.
 
DriverResult< bool > HasAnyFault () noexcept
 Check if any fault exists.
 
DriverResult< FaultReport > GetAllFaults () noexcept
 Get comprehensive fault report.
 
DriverResult< void > PrintAllFaults () noexcept
 Print all detected faults to log.
 
DriverResult< void > SoftwareReset () noexcept
 Software reset of the device.
 
DriverResult< void > ReloadSpiWatchdog (uint16_t reload_value) noexcept
 Reload SPI watchdog counter.
 
DriverResult< uint16_t > GetIcVersion () noexcept
 Read IC version and ID.
 
DriverResult< std::array< uint16_t, 3 > > GetChipId () noexcept
 Read unique chip ID.
 
DriverResult< bool > VerifyDevice () noexcept
 Verify device ID matches expected value.
 
bool IsInitialized () const noexcept
 Check if driver is initialized.
 
DriverResult< void > SetReset (bool reset) noexcept
 Hold device in reset or release reset.
 
DriverResult< void > HoldReset () noexcept
 Hold device in reset.
 
DriverResult< void > ReleaseReset () noexcept
 Release device from reset.
 
DriverResult< void > SetEnable (bool enable) noexcept
 Enable or disable output channels.
 
DriverResult< void > Enable () noexcept
 Enable output channels.
 
DriverResult< void > Disable () noexcept
 Disable output channels.
 
DriverResult< bool > IsFault (bool print_faults=false) noexcept
 Check if device fault is detected.
 
DriverResult< void > ConfigureClockSource (ClockSource source, uint32_t f_clk_Hz=0) noexcept
 Configure the device clock source (internal osc vs external+PLL).
 
DriverResult< SupplyVoltages > ReadAllSupplyVoltages () noexcept
 Atomic readout of VBAT, VIO, VDD and die temperature.
 
DriverResult< float > GetCentralTemperatureCelsius () noexcept
 Read only the central die temperature in \u00b0C.
 
DriverResult< void > SetVioLevel (VioLevel level) noexcept
 Select VIO voltage level (3.3 V or 5.0 V).
 
DriverResult< OperationState > GetOperationState () noexcept
 Read the coarse operational state.
 
DriverResult< void > EnterMissionModeChecked (uint32_t timeout_ms=10U) noexcept
 Enter Mission Mode and verify by polling FB_STAT.INIT_DONE.
 
DriverResult< SupplyMonitorSelfTestResult > RunSupplyMonitorSelfTest () noexcept
 Run the built-in supply-monitor self-test sequence.
 
DriverResult< void > SetIntegratorLimits (Channel channel, uint16_t lim_value_abs, uint8_t auto_lim_value_abs) noexcept
 Set ICC integrator clamp limits (INTEGRATOR_LIMIT, offset 0x03).
 
DriverResult< void > SetPwmControllerKi (Channel channel, uint8_t ki) noexcept
 Set the PWM controller proportional gain (KI, PERIOD.PWM_CTRL_PARAM).
 
DriverResult< void > SetMinIntegratorThreshold (Channel channel, int8_t min_int_thresh) noexcept
 Set the minimum integrator threshold (CTRL.MIN_INT_THRESH).
 
DriverResult< void > SetManualOnTimeMode (Channel channel, float on_time_us) noexcept
 Switch to manual on-time mode (DIRECT_DRIVE_SPI) with fixed TON.
 
DriverResult< void > SeedIntegratorThresholdFromFeedback (Channel channel) noexcept
 Seed the ICC integrator from the current feedback reading.
 
DriverResult< void > SetDitherAdvanced (Channel channel, const DitherSetup &setup, bool parallel_mode=false) noexcept
 High-level dither configuration (superset of ConfigureDither).
 
DriverResult< void > SetOlsgTimeout (Channel channel, uint8_t olsg_timeout_code) noexcept
 Configure open-load/short-to-ground watchdog timeout.
 
DriverResult< void > SetOffStateDiagnostics (Channel channel, bool oc_diag_enabled, uint8_t ol_th_fixed) noexcept
 Enable / disable per-channel off-state OC diagnosis and fixed OL threshold.
 
DriverResult< BistResult > RunSffBist (uint32_t timeout_ms=10U) noexcept
 Run the safe-state logic-BIST (SFF_BIST).
 
DriverResult< PinStatus > ReadPinStatus () noexcept
 Read the input pin status register (PIN_STAT).
 
DriverResult< void > SetFaultMask (MaskableFault fault, bool enable) noexcept
 Enable or mask a specific fault source from asserting FAULTN.
 
DriverResult< ChannelFeedback > ReadChannelFeedback (Channel channel, uint32_t timeout_ms=10U) noexcept
 Read a coherent feedback snapshot for one channel.
 
DriverResult< std::array< ChannelFeedback, 6 > > ReadAllChannelFeedback (uint32_t timeout_ms=20U) noexcept
 Read coherent feedback for all six channels in a single freeze window.
 
DriverResult< int32_t > GetCalibrationAvgCurrent_mA (Channel channel) noexcept
 Calibration-grade signed average current from FB_I_AVG_s16.
 
DriverResult< uint8_t > GetFeedbackUpdateMask () noexcept
 Read FB_UPD — bit N set when channel N has a completed window.
 
DriverResult< void > FreezeFeedback (uint8_t channel_mask) noexcept
 Set FB_FRZ to channel_mask (bit N freezes channel N).
 
DriverResult< void > ReleaseFeedbackFreeze () noexcept
 Clear FB_FRZ for every channel, resuming feedback updates.
 
DriverResult< CurrentFeedbackBatch > SampleChannelCurrents (uint8_t channel_mask) noexcept
 Average current for several channels in one pipelined burst.
 
DriverResult< void > ReadAllChannelErrorFlags (std::array< ChannelErrorFlags, 6 > &out) noexcept
 Latched error bits for all six channels.
 
DriverResult< bool > IsMeasurementClockRunning (Channel channel) noexcept
 True when DITHER_CLK_DIV encodes a running measurement clock.
 
DriverResult< bool > EnsureDitherRunning (Channel channel, float amplitude_ma, float frequency_hz, uint8_t max_attempts=3U) noexcept
 Configure dither and confirm the measurement clock took.
 
uint16_t GetChannelControlShadow () const noexcept
 Last CH_CTRL value this driver wrote (OP_MODE + EN_CHx).
 
DriverResult< void > SetFaultContributionMask (uint8_t channel_mask) noexcept
 Choose which channels may pull FAULTN via FAULT_MASK0/1.
 
DriverResult< uint32_t > ReadRegister (uint16_t address, bool verify_crc=false) noexcept
 Read 16-bit register.
 
DriverResult< void > ReadRegisterMulti (std::span< const uint16_t > addresses, std::span< uint32_t > values, uint16_t &valid_mask) noexcept
 Read several registers in one pipelined chain.
 
DriverResult< void > WriteRegister (uint16_t address, uint16_t value, bool verify_crc=false, bool verify_write=true) noexcept
 Write 16-bit register.
 
DriverResult< void > ModifyRegister (uint16_t address, uint16_t mask, uint16_t value) noexcept
 Modify register bits.
 

Static Public Member Functions

static constexpr uint32_t GetSystemClockHz () noexcept
 Get the nominal system clock (always 28 MHz after PLL lock).
 
static constexpr const char * GetDriverVersion () noexcept
 Get the compiled driver version string.
 
static constexpr uint8_t GetDriverVersionMajor () noexcept
 Get the compiled driver major version number.
 
static constexpr uint8_t GetDriverVersionMinor () noexcept
 Get the compiled driver minor version number.
 
static constexpr uint8_t GetDriverVersionPatch () noexcept
 Get the compiled driver patch version number.
 

Private Member Functions

DriverResult< SPIFrame > transferFrame (const SPIFrame &tx_frame, bool verify_crc=true) noexcept
 Transfer SPI frame with CRC calculation and verification.
 
constexpr bool isValidChannelInternal (Channel channel) const noexcept
 Validate channel number.
 
DriverResult< void > checkInitialized () const noexcept
 Check if driver is initialized.
 
DriverResult< void > checkMissionMode () const noexcept
 Check if in mission mode.
 
DriverResult< void > checkConfigMode () const noexcept
 Check if in config mode.
 
DriverResult< void > applyDefaultConfig () noexcept
 Apply default configuration after initialization.
 
DriverResult< void > clearFaultsInternal () noexcept
 Clear faults without checking initialization status (used during Init)
 
DriverResult< void > setVbatThresholdsInternal (float uv_voltage, float ov_voltage) noexcept
 Set VBAT thresholds without checking initialization status (used during Init)
 
DriverResult< void > checkSpiStatus (const SPIFrame &rx_frame) noexcept
 Parse SPI status from reply frame.
 
DriverResult< bool > isChannelParallel (Channel channel) noexcept
 Check if channel is currently in parallel mode.
 
DriverResult< bool > isSlaveChannel (Channel channel) noexcept
 Check if a channel is the slave half of an enabled parallel pair. Slave channels are CH2, CH3, CH5 when their pair is parallelized; most per-channel writes are rejected on the slave.
 
void diagnoseClockConfiguration () noexcept
 Diagnose clock configuration by reading CLK_DIV register.
 

Private Attributes

CommType & comm_
 Communication interface.
 
bool initialized_ {false}
 Initialization status.
 
bool mission_mode_ {false}
 Mission mode flag (vs config mode)
 
bool crc_enabled_ {false}
 CRC enable state (tracks GLOBAL_CONFIG::CRC_EN)
 
bool vio_5v_mode_ {false}
 VIO mode state (tracks GLOBAL_CONFIG::VIO_SEL, false=3.3V, true=5V)
 
uint16_t ch_ctrl_cache_ {0U}
 Cached CH_CTRL register value (reads return 0x0000)
 
uint16_t channel_enable_cache_ {0U}
 Cached channel enable state.
 
uint16_t cached_icvid_ {0U}
 ICVID latched at VerifyDevice (live re-read may flake)
 
std::array< uint16_t, 6 > channel_setpoints_
 Cached current setpoints.
 

Detailed Description

template<typename CommType>
class tle92466ed::Driver< CommType >

Main TLE92466ED driver class.

This is the primary driver class that provides complete control over the TLE92466ED IC. It manages SPI communication (32-bit with CRC), configuration, current control, monitoring, and diagnostics for all six output channels.

Thread Safety: This class is NOT thread-safe by default. External synchronization is required for multi-threaded access.

Resource Management: Uses RAII principles - init() must be called explicitly but cleanup is automatic.

Error Handling: Uses std::expected for robust error handling without exceptions.

Initialization Sequence:
  1. Construct driver with CommInterface reference
  2. Call init() to initialize hardware and verify device
  3. Call enter_mission_mode() to enable channel control
  4. Configure channels with set_channel_mode() and configure_channel()
  5. Set current with set_current_setpoint()
  6. Enable outputs with enable_channel()
  7. Monitor with get diagnostics functions

Constructor & Destructor Documentation

◆ Driver() [1/3]

template<typename CommType >
tle92466ed::Driver< CommType >::Driver ( CommType &  comm)
inlineexplicitnoexcept

Construct driver with communication interface.

Parameters
commReference to communication interface
Precondition
CommInterface must remain valid for the lifetime of the Driver
Postcondition
Driver is constructed but not initialized

◆ ~Driver()

template<typename CommType >
tle92466ed::Driver< CommType >::~Driver ( )
inlinenoexcept

Destructor - ensures clean shutdown.

◆ Driver() [2/3]

template<typename CommType >
tle92466ed::Driver< CommType >::Driver ( const Driver< CommType > &  )
delete

◆ Driver() [3/3]

template<typename CommType >
tle92466ed::Driver< CommType >::Driver ( Driver< CommType > &&  )
deletenoexcept

Member Function Documentation

◆ applyDefaultConfig()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::applyDefaultConfig ( )
privatenoexcept

Apply default configuration after initialization.

◆ checkConfigMode()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::checkConfigMode ( ) const
inlineprivatenoexcept

Check if in config mode.

◆ checkInitialized()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::checkInitialized ( ) const
inlineprivatenoexcept

Check if driver is initialized.

◆ checkMissionMode()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::checkMissionMode ( ) const
inlineprivatenoexcept

Check if in mission mode.

◆ checkSpiStatus()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::checkSpiStatus ( const SPIFrame &  rx_frame)
privatenoexcept

Parse SPI status from reply frame.

◆ ClearFaults()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::ClearFaults ( )
noexcept

Clear all fault flags.

Clears latched fault conditions. Does not clear active faults.

Returns
DriverResult<void> Success or error

◆ clearFaultsInternal()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::clearFaultsInternal ( )
privatenoexcept

Clear faults without checking initialization status (used during Init)

◆ ConfigureChannel()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::ConfigureChannel ( Channel  channel,
const ChannelConfig &  config 
)
noexcept

Configure channel slew rate and diagnostics.

Parameters
channelChannel to configure
configChannel configuration
Returns
DriverResult<void> Success or error

◆ ConfigureClockSource()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::ConfigureClockSource ( ClockSource  source,
uint32_t  f_clk_Hz = 0 
)
noexcept

Configure the device clock source (internal osc vs external+PLL).

Parameters
sourceDesired clock source.
f_clk_HzExternal clock rate in Hz (required if source is ExternalClockPll; ignored otherwise). Supported range is 1\u20138 MHz per datasheet \u00a74.1.
Returns
DriverResult<void> Success or error.

Writes CLK_DIV (0x0019) in Config Mode. Caller is responsible for waiting the datasheet-specified PLL lock time (\u2248500 \u00b5s).

◆ ConfigureDither()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::ConfigureDither ( Channel  channel,
float  amplitude_ma,
float  frequency_hz,
bool  parallel_mode = false 
)
noexcept

Configure dither from amplitude and frequency (High-Level API)

Parameters
channelChannel to configure
amplitude_maDesired dither amplitude in milliamperes
frequency_hzDesired dither frequency in Hz
parallel_modetrue if channel is in parallel mode (affects max current)
Returns
DriverResult<void> Success or error

Automatically calculates step_size, num_steps, and flat_steps to achieve the desired amplitude and frequency.

Formulas:

  • I_dither = STEPS × STEP_SIZE × 2A / 32767
  • T_dither = [4×STEPS + 2×FLAT] × t_ref_clk
Note
This is the recommended API for most users. Use ConfigureDitherRaw() only if you need direct control over register values.

◆ ConfigureDitherClock()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::ConfigureDitherClock ( Channel  channel,
float  t_ref_clk_us,
bool  dither_pwm_sync = false,
bool  dither_setpoint_sync = false 
)
noexcept

Configure the per-channel dither reference clock (DITHER_CLK_DIV).

Per datasheet §5.3.3.7, DITHER_CLK_DIV (offset 0x0004 within each channel bank) sets the dither reference clock used by both the dither generator and the averaged-feedback engine:

tref_clk = MANT × 2^EXP / fSYS

POR reset value is 0x0000 which makes tref_clk = 0, the dither period TDither = 0, and (in ICC mode) the measurement period Tmeas = TDither = 0 — so FB_DC / FB_I_AVG / FB_VBAT NEVER update. The high-level ConfigureDither() API calls this function automatically with values derived from the requested dither frequency. Use this API directly if you need a specific tref_clk (e.g. to control the FB update rate independently from the dither amplitude/period).

Parameters
channelChannel to configure
t_ref_clk_usDesired reference clock period in microseconds. The driver picks the closest representable MANT/EXP and logs the actual value used. Must be > 0; minimum 0.125 µs (1/fSYS).
dither_pwm_syncIf true, synchronise dither period start with PWM rising edge (DITHER_PWM_SYNC_EN).
dither_setpoint_syncIf true, restart dither period on every setpoint change (DITHER_SETPOINT_SYNC_EN); required for the lockstep-feedback mode described in datasheet §4.7.5.
Returns
DriverResult<void> Success or error

◆ ConfigureDitherRaw()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::ConfigureDitherRaw ( Channel  channel,
uint16_t  step_size,
uint8_t  num_steps,
uint8_t  flat_steps 
)
noexcept

Configure dither parameters (Low-Level API)

Parameters
channelChannel to configure
step_sizeDither step size (0-4095)
num_stepsNumber of steps in quarter period (0-255)
flat_stepsNumber of flat clock cycles at top/bottom (0-255)
Returns
DriverResult<void> Success or error

Formulas:

  • I_dither = STEPS × STEP_SIZE × 2A / 32767
  • T_dither = [4×STEPS + 2×FLAT] × t_ref_clk
Note
For most users, prefer ConfigureDither(amplitude_ma, frequency_hz) which automatically calculates these values from user-friendly parameters.

◆ ConfigureGlobal()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::ConfigureGlobal ( const GlobalConfig &  config)
noexcept

Configure global device settings.

Parameters
configGlobal configuration structure
Returns
DriverResult<void> Success or error
Return values
DriverError::NotInitializedDriver not initialized
DriverError::WrongModeMust be in Config Mode

◆ ConfigurePwmPeriod()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::ConfigurePwmPeriod ( Channel  channel,
float  period_us 
)
noexcept

Configure PWM period from desired period in microseconds (High-Level API)

Parameters
channelChannel to configure
period_usDesired PWM period in microseconds
Returns
DriverResult<void> Success or DriverError::InvalidParameter

The TLE92466ED's PWM frequency controller is specified to operate between 110 Hz and 4 kHz (datasheet Electrical Characteristics). In period_us terms that is a usable range of:

  • Standard range (LOW_FREQ_RANGE_EN = 0): 250 µs ≤ period_us ≤ 9090 µs (= 4 kHz .. 110 Hz)
  • Low-frequency range (LOW_FREQ_RANGE_EN = 1): 2000 µs ≤ period_us ≤ 72727 µs (= 500 Hz .. 13.75 Hz)

The driver auto-selects the appropriate range. Periods outside the combined min/max (250 µs – 72.7 ms) return InvalidParameter. Periods that fall in the gap between the two ranges (9.1 – 2 ms, i.e. 110 Hz – 500 Hz) are accepted but logged as a warning since the PWM-control loop is not specified there.

Formulas: T_pwm = PERIOD_MANT × 2^PERIOD_EXP × (1/f_sys) Low-range: T_pwm = PERIOD_MANT × 8 × 2^PERIOD_EXP × (1/f_sys) f_sys ≈ 8 MHz

Note
Reaching the ultrasonic range (>20 kHz) is not possible with this chip family — 4 kHz is the hardware ceiling.
This is the recommended API for most users. Use ConfigurePwmPeriodRaw() only if you need direct control over register values.
See also
PERIOD::kSpecMinPeriod_us, PERIOD::kSpecMaxPeriod_us, PERIOD::kSpecLowRangeMinPeriod_us, PERIOD::kSpecLowRangeMaxPeriod_us

◆ ConfigurePwmPeriodRaw()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::ConfigurePwmPeriodRaw ( Channel  channel,
uint8_t  period_mantissa,
uint8_t  period_exponent,
bool  low_freq_range = false 
)
noexcept

Configure PWM parameters for ICC (Low-Level API)

Parameters
channelChannel to configure
period_mantissaPWM period mantissa (0-255)
period_exponentPWM period exponent (0-7; larger returns InvalidParameter)
low_freq_rangeEnable low frequency range (8x multiplier)
Returns
DriverResult<void> Success or error

PWM period: t_PWM = mantissa * 2^exponent * (1/f_sys) If low_freq_range: t_PWM = mantissa * 8 * 2^exponent * (1/f_sys)

Note
For most users, prefer ConfigurePwmPeriod(period_us) which automatically calculates these values from a desired period.

◆ diagnoseClockConfiguration()

template<typename CommType >
void tle92466ed::Driver< CommType >::diagnoseClockConfiguration ( )
privatenoexcept

Diagnose clock configuration by reading CLK_DIV register.

Reads and logs the CLK_DIV register to help diagnose clock-related critical faults. This is called during initialization.

◆ Disable()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::Disable ( )
inlinenoexcept

Disable output channels.

Convenience function to disable outputs. Equivalent to SetEnable(false).

Returns
DriverResult<void> Success or error

◆ DisableAllChannels()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::DisableAllChannels ( )
noexcept

Disable all channels.

◆ Enable()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::Enable ( )
inlinenoexcept

Enable output channels.

Convenience function to enable outputs. Equivalent to SetEnable(true).

Returns
DriverResult<void> Success or error

◆ EnableAllChannels()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::EnableAllChannels ( )
noexcept

Enable all channels.

◆ EnableChannel()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::EnableChannel ( Channel  channel,
bool  enabled 
)
noexcept

Enable or disable a channel.

Parameters
channelChannel to control
enabledtrue to enable, false to disable
Returns
DriverResult<void> Success or error
Return values
DriverError::WrongModeMust be in Mission Mode

◆ EnableChannels()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::EnableChannels ( uint8_t  channel_mask)
noexcept

Enable or disable multiple channels.

Parameters
channel_maskBitmask where bit N enables channel N
Returns
DriverResult<void> Success or error

◆ EnsureDitherRunning()

template<typename CommType >
DriverResult< bool > tle92466ed::Driver< CommType >::EnsureDitherRunning ( Channel  channel,
float  amplitude_ma,
float  frequency_hz,
uint8_t  max_attempts = 3U 
)
noexcept

Configure dither and confirm the measurement clock took.

Parameters
channelChannel to configure.
amplitude_maDither amplitude; 0 skips dither programming.
frequency_hzDither frequency.
max_attemptsConfigure/read-back attempts before giving up.
Returns
true when DITHER_CLK_DIV read back as running; false when it never confirmed (the caller decides whether to proceed anyway — the clock may still be running from a POR or an earlier write that this device's SPI read cannot confirm).

◆ EnterConfigMode()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::EnterConfigMode ( )
noexcept

Enter Config Mode (allows configuration changes)

Transitions from Mission Mode to Config Mode. All channel outputs are automatically disabled when entering Config Mode.

Returns
DriverResult<void> Success or error

◆ EnterMissionMode()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::EnterMissionMode ( )
noexcept

Enter Mission Mode (enables channel control)

Transitions from Config Mode to Mission Mode. Channel outputs can only be enabled in Mission Mode. Most configuration registers can only be written in Config Mode.

Returns
DriverResult<void> Success or error
Return values
DriverError::NotInitializedDriver not initialized

◆ EnterMissionModeChecked()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::EnterMissionModeChecked ( uint32_t  timeout_ms = 10U)
noexcept

Enter Mission Mode and verify by polling FB_STAT.INIT_DONE.

Parameters
timeout_msMaximum time to wait for INIT_DONE.

◆ FreezeFeedback()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::FreezeFeedback ( uint8_t  channel_mask)
noexcept

Set FB_FRZ to channel_mask (bit N freezes channel N).

Note
Freezing holds FB_DC, FB_VBAT, FB_I_AVG, FB_PERIOD_MIN_MAX and FB_IMIN_IMAX. FB_I_AVG_s16 is free-running and unaffected (§4.10.5).

◆ GetAllFaults()

template<typename CommType >
DriverResult< FaultReport > tle92466ed::Driver< CommType >::GetAllFaults ( )
noexcept

Get comprehensive fault report.

Reads all fault registers (GLOBAL_DIAG0, GLOBAL_DIAG1, GLOBAL_DIAG2) and all channel fault registers to provide a complete fault report.

Returns
DriverResult<FaultReport> Complete fault report or error

◆ GetAverageCurrent()

template<typename CommType >
DriverResult< uint16_t > tle92466ed::Driver< CommType >::GetAverageCurrent ( Channel  channel,
bool  parallel_mode = false 
)
noexcept

Get average load current for a channel, in milliamps.

Reads the compressed mantissa/exponent feedback path (FB_I_AVG and FB_DC, both 22-bit reply frames) and decodes Iavg = 4 A × <I_AVG_MANT> / <TP_MANT> per datasheet §4.10.2. Issues two pipelined SPI reads per register (four frames total).

Before decoding, validates the measurement window via FB_FEEDBACK::HasValidMeasurementWindow() (minimum FB_FEEDBACK::kMinValidTpMant in TP_MANT from FB_DC).

Parameters
channelChannel to query
parallel_modeCurrently unused — the mantissa-ratio formula is identical for parallel-paired channels; kept for API stability.
Returns
Average load current in mA on success.
Return values
DriverError::FeedbackNotReadyTP_MANT too small for a trustworthy mantissa ratio (averaging window not established, feedback frozen, or corrupted pipelined reply).
DriverError::InvalidChannelChannel out of range.
DriverError::NotInitializedDriver not initialized.
Note
Uses FB_I_AVG (mantissa ratio with TP_MANT from FB_DC), not FB_I_AVG_s16. For calibration-grade signed current see GetCalibrationAvgCurrent_mA().
Negative load current (recirculation) is clamped to 0 in this legacy unsigned return type.
Warning
This path freezes the channel and polls FB_UPD with Delay() for up to ~8 ms. It is a diagnostic / console helper. Real-time control must use SampleChannelCurrents, which never blocks.
See also
FB_FEEDBACK::kMinValidTpMant, FB_FEEDBACK::HasValidMeasurementWindow
SampleChannelCurrents

◆ GetCalibrationAvgCurrent_mA()

template<typename CommType >
DriverResult< int32_t > tle92466ed::Driver< CommType >::GetCalibrationAvgCurrent_mA ( Channel  channel)
noexcept

Calibration-grade signed average current from FB_I_AVG_s16.

Reads the per-channel FB_I_AVG_s16 register (offset 0x0204) and decodes the 17-bit signed field via FB_I_AVG_s16::ToMilliamps(). This path is distinct from GetAverageCurrent(), which uses the compressed FB_I_AVG mantissa ratio with TP_MANT from FB_DC.

Parameters
channelChannel to query.
Returns
Signed average current in mA, or error.
Note
FB_I_AVG_s16 is intended for calibration workflows. The datasheet notes the frame may not be valid while the channel is still settling, so this returns DriverError::FeedbackNotReady when the register still holds the mid-scale placeholder (FB_I_AVG_s16::IsSettlingFrame).
Warning
That placeholder check is the only validity gate here. Unlike GetAverageCurrent() this accessor does not confirm the channel has an established measurement window, so prefer GetAverageCurrent() for control and telemetry and keep this one for calibration.
See also
FB_I_AVG_s16, GetAverageCurrent()

◆ GetCentralTemperatureCelsius()

template<typename CommType >
DriverResult< float > tle92466ed::Driver< CommType >::GetCentralTemperatureCelsius ( )
noexcept

Read only the central die temperature in \u00b0C.

◆ GetChannelControlShadow()

template<typename CommType >
uint16_t tle92466ed::Driver< CommType >::GetChannelControlShadow ( ) const
inlinenoexcept

Last CH_CTRL value this driver wrote (OP_MODE + EN_CHx).

CH_CTRL reads back as 0x0000 on some parts/buses, so the driver keeps an authoritative shadow. Callers must use this instead of keeping a second shadow of their own.

◆ GetChannelDiagnostics()

template<typename CommType >
DriverResult< ChannelDiagnostics > tle92466ed::Driver< CommType >::GetChannelDiagnostics ( Channel  channel)
noexcept

Get channel diagnostic information.

Parameters
channelChannel to query
Returns
DriverResult<ChannelDiagnostics> Diagnostics or error

◆ GetChipId()

template<typename CommType >
DriverResult< std::array< uint16_t, 3 > > tle92466ed::Driver< CommType >::GetChipId ( )
noexcept

Read unique chip ID.

Returns
DriverResult<std::array<uint16_t, 3>> Three 16-bit ID registers

◆ GetCurrentSetpoint()

template<typename CommType >
DriverResult< uint16_t > tle92466ed::Driver< CommType >::GetCurrentSetpoint ( Channel  channel,
bool  parallel_mode = false 
)
noexcept

Get current setpoint for channel.

Parameters
channelChannel to query
parallel_modetrue if channel is in parallel mode
Returns
DriverResult<uint16_t> Current in mA or error

◆ GetDeviceStatus()

template<typename CommType >
DriverResult< DeviceStatus > tle92466ed::Driver< CommType >::GetDeviceStatus ( )
noexcept

Get global device status.

Returns
DriverResult<DeviceStatus> Device status or error

◆ GetDriverVersion()

template<typename CommType >
static constexpr const char * tle92466ed::Driver< CommType >::GetDriverVersion ( )
inlinestaticconstexprnoexcept

Get the compiled driver version string.

◆ GetDriverVersionMajor()

template<typename CommType >
static constexpr uint8_t tle92466ed::Driver< CommType >::GetDriverVersionMajor ( )
inlinestaticconstexprnoexcept

Get the compiled driver major version number.

◆ GetDriverVersionMinor()

template<typename CommType >
static constexpr uint8_t tle92466ed::Driver< CommType >::GetDriverVersionMinor ( )
inlinestaticconstexprnoexcept

Get the compiled driver minor version number.

◆ GetDriverVersionPatch()

template<typename CommType >
static constexpr uint8_t tle92466ed::Driver< CommType >::GetDriverVersionPatch ( )
inlinestaticconstexprnoexcept

Get the compiled driver patch version number.

◆ GetDutyCycle()

template<typename CommType >
DriverResult< uint16_t > tle92466ed::Driver< CommType >::GetDutyCycle ( Channel  channel)
noexcept

Get PWM duty cycle for a channel, in permyriad (0..10000).

Reads FB_DC (22-bit reply) and decodes DC = <TO_MANT> / <TP_MANT> per datasheet §4.10.2, then scales to permyriad so the legacy uint16_t return type retains 0.01 % precision.

Parameters
channelChannel to query
Returns
Duty cycle in permyriad (0 = 0.00 %, 10000 = 100.00 %).
Note
Does not return DriverError::FeedbackNotReady. When TP_MANT is 0 or the window is invalid, the decoded duty is 0 permyriad. Use GetAverageCurrent() or ReadChannelFeedback() when an explicit not-ready indication is required.

◆ GetFeedbackUpdateMask()

template<typename CommType >
DriverResult< uint8_t > tle92466ed::Driver< CommType >::GetFeedbackUpdateMask ( )
noexcept

Read FB_UPD — bit N set when channel N has a completed window.

One central 16-bit read covers all six channels (datasheet §5.3.2.10). This is the chip's own "is the data fresh" signal and the first step of the Figure 22 readout; polling it beats guessing at Tmeas with a wall clock, and it costs one register access for the whole device.

◆ GetIcVersion()

template<typename CommType >
DriverResult< uint16_t > tle92466ed::Driver< CommType >::GetIcVersion ( )
noexcept

Read IC version and ID.

Returns
DriverResult<uint16_t> ICVID register value

◆ GetOperationState()

template<typename CommType >
DriverResult< OperationState > tle92466ed::Driver< CommType >::GetOperationState ( )
noexcept

Read the coarse operational state.

◆ GetSystemClockHz()

template<typename CommType >
static constexpr uint32_t tle92466ed::Driver< CommType >::GetSystemClockHz ( )
inlinestaticconstexprnoexcept

Get the nominal system clock (always 28 MHz after PLL lock).

◆ GetVbatThresholds()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::GetVbatThresholds ( uint16_t &  uv_threshold,
uint16_t &  ov_threshold 
)
noexcept

Get VBAT thresholds.

Parameters
uv_thresholdOutput parameter for UV threshold in millivolts
ov_thresholdOutput parameter for OV threshold in millivolts
Returns
DriverResult<void> Success or error

◆ GetVbatVoltage()

template<typename CommType >
DriverResult< uint16_t > tle92466ed::Driver< CommType >::GetVbatVoltage ( )
noexcept

Get VBAT voltage.

Returns
DriverResult<uint16_t> VBAT in millivolts or error

◆ GetVddVoltage()

template<typename CommType >
DriverResult< uint16_t > tle92466ed::Driver< CommType >::GetVddVoltage ( )
noexcept

Get VDD voltage.

Returns
DriverResult<uint16_t> VDD in millivolts or error

◆ GetVioVoltage()

template<typename CommType >
DriverResult< uint16_t > tle92466ed::Driver< CommType >::GetVioVoltage ( )
noexcept

Get VIO voltage.

Returns
DriverResult<uint16_t> VIO in millivolts or error

◆ HasAnyFault()

template<typename CommType >
DriverResult< bool > tle92466ed::Driver< CommType >::HasAnyFault ( )
noexcept

Check if any fault exists.

Returns
DriverResult<bool> true if any fault exists

◆ HoldReset()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::HoldReset ( )
inlinenoexcept

Hold device in reset.

Convenience function to hold device in reset state. Equivalent to SetReset(true).

Returns
DriverResult<void> Success or error

◆ Init()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::Init ( bool  perform_hardware_reset = true)
noexcept

Initialize the driver and hardware.

Performs complete initialization sequence:

  1. Initialize CommInterface (SPI peripheral)
  2. Verify device communication
  3. Read and verify device ID
  4. Apply default configuration (in Config Mode)
  5. Clear any power-on faults

After init(), device is in Config Mode. Call enter_mission_mode() to enable outputs.

Parameters
perform_hardware_resetWhen true (default), pulse RESN low then release before SPI identity. When false, leave RESN released (HIGH) and only re-run EN settle + SPI verify — used by shared-bus retries so the eval RESET LED is not hammered every few hundred ms.
Returns
DriverResult<void> Success or error code
Return values
DriverError::HardwareErrorCommInterface initialization failed
DriverError::DeviceNotRespondingNo SPI response
DriverError::WrongDeviceIDDevice ID mismatch

◆ isChannelParallel()

template<typename CommType >
DriverResult< bool > tle92466ed::Driver< CommType >::isChannelParallel ( Channel  channel)
privatenoexcept

Check if channel is currently in parallel mode.

Parameters
channelChannel to check
Returns
DriverResult<bool> true if channel is paralleled, false otherwise

◆ IsConfigMode()

template<typename CommType >
bool tle92466ed::Driver< CommType >::IsConfigMode ( ) const
inlinenoexcept

Check if in config mode.

Returns
true if in config mode, false if in mission mode

◆ IsFault()

template<typename CommType >
DriverResult< bool > tle92466ed::Driver< CommType >::IsFault ( bool  print_faults = false)
noexcept

Check if device fault is detected.

Reads the FAULTN pin to check if a fault condition is present. FAULTN is an active-low signal, so LOW = fault detected.

Parameters
print_faultsIf true and fault is detected, automatically calls PrintAllFaults() to display detailed fault information. Default: false (no automatic printing)
Returns
DriverResult<bool> true if fault detected, false if no fault, or error
Return values
DriverError::HardwareErrorGPIO read failed
Note
This reads the hardware FAULTN pin. When a fault is detected, print_faults is true, and the driver is initialized, detailed fault information is automatically printed via PrintAllFaults().

◆ IsInitialized()

template<typename CommType >
bool tle92466ed::Driver< CommType >::IsInitialized ( ) const
inlinenoexcept

Check if driver is initialized.

Returns
true if initialized and ready

◆ IsMeasurementClockRunning()

template<typename CommType >
DriverResult< bool > tle92466ed::Driver< CommType >::IsMeasurementClockRunning ( Channel  channel)
noexcept

True when DITHER_CLK_DIV encodes a running measurement clock.

The POR value is 0, which makes tref_clk — and therefore Tmeas — zero, so FB_DC / FB_I_AVG / FB_VBAT never update. Confirming this before trusting feedback is a chip invariant, not caller policy.

◆ IsMissionMode()

template<typename CommType >
bool tle92466ed::Driver< CommType >::IsMissionMode ( ) const
inlinenoexcept

Check if in mission mode.

Returns
true if in mission mode, false if in config mode

◆ isSlaveChannel()

template<typename CommType >
DriverResult< bool > tle92466ed::Driver< CommType >::isSlaveChannel ( Channel  channel)
privatenoexcept

Check if a channel is the slave half of an enabled parallel pair. Slave channels are CH2, CH3, CH5 when their pair is parallelized; most per-channel writes are rejected on the slave.

◆ isValidChannelInternal()

template<typename CommType >
constexpr bool tle92466ed::Driver< CommType >::isValidChannelInternal ( Channel  channel) const
inlineconstexprprivatenoexcept

Validate channel number.

◆ ModifyRegister()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::ModifyRegister ( uint16_t  address,
uint16_t  mask,
uint16_t  value 
)
noexcept

Modify register bits.

Parameters
addressRegister address
maskBit mask for modification
valueNew bit values
Returns
DriverResult<void> Success or error

◆ operator=() [1/2]

template<typename CommType >
Driver & tle92466ed::Driver< CommType >::operator= ( const Driver< CommType > &  )
delete

◆ operator=() [2/2]

template<typename CommType >
Driver & tle92466ed::Driver< CommType >::operator= ( Driver< CommType > &&  )
deletenoexcept

◆ PrintAllFaults()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::PrintAllFaults ( )
noexcept

Print all detected faults to log.

Reads all faults and prints them in a formatted, easy-to-read format. Only prints faults that are actually detected.

Returns
DriverResult<void> Success or error

◆ ReadAllChannelErrorFlags()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::ReadAllChannelErrorFlags ( std::array< ChannelErrorFlags, 6 > &  out)
noexcept

Latched error bits for all six channels.

DIAG_ERR_CHGR0..2 each cover a channel pair, so this is one pipelined burst of three reads for the whole device.

Warning
Do not merge this into the same chain as the 22-bit feedback registers. These are 16-bit replies; interleaving widths in one pipeline desynchronised the reply slots on the bench and left every isolated coil misclassified.

◆ ReadAllChannelFeedback()

template<typename CommType >
DriverResult< std::array< ChannelFeedback, 6 > > tle92466ed::Driver< CommType >::ReadAllChannelFeedback ( uint32_t  timeout_ms = 20U)
noexcept

Read coherent feedback for all six channels in a single freeze window.

Parameters
timeout_msMaximum time to wait for each channel's FB_UPD poll.
Returns
Array of six ChannelFeedback structures or error.

◆ ReadAllSupplyVoltages()

template<typename CommType >
DriverResult< SupplyVoltages > tle92466ed::Driver< CommType >::ReadAllSupplyVoltages ( )
noexcept

Atomic readout of VBAT, VIO, VDD and die temperature.

Reads FB_VOLTAGE1 and FB_VOLTAGE2 and decodes them via the VOLTAGE_FEEDBACK namespace helpers. Result is stable even while the device is operating in Mission Mode.

◆ ReadChannelFeedback()

template<typename CommType >
DriverResult< ChannelFeedback > tle92466ed::Driver< CommType >::ReadChannelFeedback ( Channel  channel,
uint32_t  timeout_ms = 10U 
)
noexcept

Read a coherent feedback snapshot for one channel.

Workflow (datasheet §4.10.5):

  1. Freeze feedback for this channel (FB_FRZ).
  2. Poll FB_UPD for the update bit for this channel.
  3. Read FB_DC / FB_VBAT / FB_I_AVG / FB_IMIN_IMAX / FB_PERIOD_MIN_MAX / FB_INT_THRESH.
  4. Release the freeze.

avg_current_mA is decoded from FB_I_AVG + FB_DC via the mantissa ratio (FB_FEEDBACK::ComputeAverageCurrent_mA). It does not gate on HasValidMeasurementWindow() — callers must interpret near-zero TP_MANT themselves or prefer GetAverageCurrent() for explicit FeedbackNotReady handling.

Parameters
channelChannel to read.
timeout_msMaximum time to wait for FB_UPD.
Returns
Coherent ChannelFeedback snapshot or error.
Return values
DriverError::TimeoutErrorUpdate bit did not assert in time.

◆ ReadPinStatus()

template<typename CommType >
DriverResult< PinStatus > tle92466ed::Driver< CommType >::ReadPinStatus ( )
noexcept

Read the input pin status register (PIN_STAT).

◆ ReadRegister()

template<typename CommType >
DriverResult< uint32_t > tle92466ed::Driver< CommType >::ReadRegister ( uint16_t  address,
bool  verify_crc = false 
)
noexcept

Read 16-bit register.

Parameters
addressRegister address (10-bit)
verify_crcOverride CRC verification (default: uses internal CRC enable state)
Returns
DriverResult<uint32_t> Register value (16-bit or 22-bit depending on reply mode) or error
Note
If verify_crc is not explicitly provided, uses internal CRC enable state which tracks GLOBAL_CONFIG::CRC_EN. Set to false to override (e.g., during init).

◆ ReadRegisterMulti()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::ReadRegisterMulti ( std::span< const uint16_t >  addresses,
std::span< uint32_t >  values,
uint16_t &  valid_mask 
)
noexcept

Read several registers in one pipelined chain.

Parameters
[in]addressesRegister addresses (at most CommType::kMaxPipelinedReads).
[out]valuesDecoded values; entries that failed validation are 0.
[out]valid_maskBit i set when values[i] is trustworthy.

N reads cost N+2 SPI frames here instead of 3N, because the pipeline is opened once for the whole burst. Individual replies are still validated independently, so a single corrupt frame costs one entry rather than the batch.

Warning
Every address in one call must answer with the same reply width. Mixing 16-bit and 22-bit registers in a single chain desynchronised reply slots on the bench.

◆ ReleaseFeedbackFreeze()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::ReleaseFeedbackFreeze ( )
noexcept

Clear FB_FRZ for every channel, resuming feedback updates.

Note
Also clears the corresponding FB_UPD bits (§4.10.5).

◆ ReleaseReset()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::ReleaseReset ( )
inlinenoexcept

Release device from reset.

Convenience function to release device from reset state. Equivalent to SetReset(false).

Returns
DriverResult<void> Success or error

◆ ReloadSpiWatchdog()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::ReloadSpiWatchdog ( uint16_t  reload_value)
noexcept

Reload SPI watchdog counter.

Must be called periodically when SPI watchdog is enabled to prevent watchdog timeout.

Parameters
reload_valueReload value (watchdog period)
Returns
DriverResult<void> Success or error

◆ RunSffBist()

template<typename CommType >
DriverResult< BistResult > tle92466ed::Driver< CommType >::RunSffBist ( uint32_t  timeout_ms = 10U)
noexcept

Run the safe-state logic-BIST (SFF_BIST).

◆ RunSupplyMonitorSelfTest()

template<typename CommType >
DriverResult< SupplyMonitorSelfTestResult > tle92466ed::Driver< CommType >::RunSupplyMonitorSelfTest ( )
noexcept

Run the built-in supply-monitor self-test sequence.

Exercises the UV/OV swap, the 1.5 V monitor UV/OV trips and the over-temperature test logic. Restores the original GLOBAL_CONFIG on exit. Device must be in Config Mode.

◆ SampleChannelCurrents()

template<typename CommType >
DriverResult< CurrentFeedbackBatch > tle92466ed::Driver< CommType >::SampleChannelCurrents ( uint8_t  channel_mask)
noexcept

Average current for several channels in one pipelined burst.

Parameters
channel_maskBit N requests channel N (bits above 5 ignored).
Returns
Batch with per-channel current and the masks describing what was actually usable. Never blocks and never polls.

Figure 22 wants a freeze around the FB_DC / FB_I_AVG pair. On the desk Mid eval FB_FRZ is unreadable (and an un-acked freeze sticks, aborting Tmeas for the rest of the session). This path therefore:

  1. writes FB_FRZ=0 (clear a stuck freeze),
  2. reads FB_UPD for telemetry only,
  3. one anchored pipelined burst (ICVID / FB_I_AVG / FB_DC per channel) for every requested channel; TP_MANT gates decode,
  4. writes FB_FRZ=0 again.

A chain whose ICVID anchors do not verify is discarded whole — a spliced neighbour current is never published as this channel's. Host: tests/host/test_tle_anchored_chain.cpp.

Warning
Unlike ReadChannelFeedback this does not wait for FB_UPD. It is meant to be called at the control-loop rate: whatever is ready is sampled, the rest is picked up next tick. That is what makes it usable from a 2 ms thread that also owns actuator writes.

◆ SeedIntegratorThresholdFromFeedback()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::SeedIntegratorThresholdFromFeedback ( Channel  channel)
noexcept

Seed the ICC integrator from the current feedback reading.

Reads FB_INT_THRESH and writes it back to CTRL_INT_THRESH.INT_THRESH so that a subsequent setpoint change doesn't wind up the integrator.

◆ SetChannelMode()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::SetChannelMode ( Channel  channel,
ChannelMode  mode 
)
noexcept

Set channel operation mode.

Parameters
channelChannel to configure
modeOperation mode (ICC, Direct Drive, etc.)
Returns
DriverResult<void> Success or error
Return values
DriverError::WrongModeMust be in Config Mode

◆ SetCrcEnabled()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::SetCrcEnabled ( bool  enabled)
noexcept

Enable/disable CRC checking.

Parameters
enabledtrue to enable CRC
Returns
DriverResult<void> Success or error

◆ SetCurrentSetpoint()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::SetCurrentSetpoint ( Channel  channel,
uint16_t  current_ma,
bool  parallel_mode = false 
)
noexcept

Set current setpoint for channel.

Parameters
channelChannel to configure
current_maDesired current in milliamperes (0-2000 single, 0-4000 parallel)
parallel_modeSet true if channel is in parallel mode
Returns
DriverResult<void> Success or error
Note
Current is regulated by the Integrated Current Controller (ICC)
Resolution: 15-bit (0.061mA per LSB in single mode)
Current Limits (from datasheet):
  • Single channel: 1.5A typical continuous, 2.0A absolute maximum
  • Parallel channels: 2.7A typical continuous, 4.0A absolute maximum
Warning
Setting currents above typical continuous ratings may result in thermal limiting, reduced accuracy, or current regulation at the device's natural limit rather than the requested setpoint.

◆ SetCurrentSetpointUa()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::SetCurrentSetpointUa ( Channel  channel,
uint32_t  current_ua,
bool  parallel_mode = false 
)
noexcept

Set the ICC current setpoint in microamperes (full 15-bit TARGET resolution).

Parameters
channelChannel.
current_uaTarget in µA (≤ 2 000 000 single / 4 000 000 parallel).
parallel_modeParallel-channel scaling.

Same write/verify path as SetCurrentSetpoint, which now delegates here with current_ma * 1000.

◆ SetDitherAdvanced()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::SetDitherAdvanced ( Channel  channel,
const DitherSetup &  setup,
bool  parallel_mode = false 
)
noexcept

High-level dither configuration (superset of ConfigureDither).

Programs DITHER_CLK_DIV + DITHER_STEP + DITHER_CTRL atomically to realize the requested amplitude/frequency and sync/fast-measure options. Clears any residual deep-dither / fast-meas flags.

◆ SetEnable()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::SetEnable ( bool  enable)
noexcept

Enable or disable output channels.

Controls the EN (enable) pin. When disabled, all output channels are disabled regardless of channel enable register settings.

Parameters
enableIf true, enable outputs (EN HIGH). If false, disable outputs (EN LOW).
Returns
DriverResult<void> Success or error
Return values
DriverError::HardwareErrorGPIO control failed
Note
This affects all channels. Individual channel control is via EnableChannel().
EN only affects output channels, not SPI communication.

◆ SetFaultContributionMask()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::SetFaultContributionMask ( uint8_t  channel_mask)
noexcept

Choose which channels may pull FAULTN via FAULT_MASK0/1.

Parameters
channel_maskBit N = channel N contributes to FAULTN.

Which channels are populated is product wiring, so the mask is an argument; how that maps onto FAULT_MASK0/1 bit positions is chip protocol and stays here.

◆ SetFaultMask()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::SetFaultMask ( MaskableFault  fault,
bool  enable 
)
noexcept

Enable or mask a specific fault source from asserting FAULTN.

◆ SetIntegratorLimits()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::SetIntegratorLimits ( Channel  channel,
uint16_t  lim_value_abs,
uint8_t  auto_lim_value_abs 
)
noexcept

Set ICC integrator clamp limits (INTEGRATOR_LIMIT, offset 0x03).

Parameters
channelChannel to configure.
lim_value_absPrimary integrator limit magnitude (0\u20131023).
auto_lim_value_absAuto-limit setpoint delta magnitude (0\u201331).

The driver enforces the datasheet constraint that auto_lim_value_abs must be greater than MIN_INT_THRESH+3 (as currently cached in the channel's CTRL register).

◆ SetManualOnTimeMode()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::SetManualOnTimeMode ( Channel  channel,
float  on_time_us 
)
noexcept

Switch to manual on-time mode (DIRECT_DRIVE_SPI) with fixed TON.

Parameters
channelChannel to configure.
on_time_usDesired constant on-time in microseconds.

Writes TON.TON_MANT and sets CTRL_INT_THRESH.PERIOD_MANT=0 which disables the ICC integrator update path.

◆ SetMinIntegratorThreshold()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::SetMinIntegratorThreshold ( Channel  channel,
int8_t  min_int_thresh 
)
noexcept

Set the minimum integrator threshold (CTRL.MIN_INT_THRESH).

Parameters
channelChannel to configure.
min_int_threshSigned 8-bit minimum integrator threshold.

◆ SetOffStateDiagnostics()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::SetOffStateDiagnostics ( Channel  channel,
bool  oc_diag_enabled,
uint8_t  ol_th_fixed 
)
noexcept

Enable / disable per-channel off-state OC diagnosis and fixed OL threshold.

Parameters
channelChannel to configure.
oc_diag_enabledtrue to enable OC diagnosis while channel is OFF
ol_th_fixedFixed open-load threshold (0\u201363; 0 = disabled)

◆ SetOlsgTimeout()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::SetOlsgTimeout ( Channel  channel,
uint8_t  olsg_timeout_code 
)
noexcept

Configure open-load/short-to-ground watchdog timeout.

Parameters
channelChannel to configure.
olsg_timeout_code6-bit OLSG timeout value (0\u201363).

◆ SetParallelOperation()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::SetParallelOperation ( ParallelPair  pair,
bool  enabled 
)
noexcept

Configure channel for parallel operation.

Parameters
pairParallel pair to configure (0/3, 1/2, or 4/5)
enabledtrue to enable parallel operation
Returns
DriverResult<void> Success or error
Return values
DriverError::WrongModeMust be in Config Mode

◆ SetPwmControllerKi()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::SetPwmControllerKi ( Channel  channel,
uint8_t  ki 
)
noexcept

Set the PWM controller proportional gain (KI, PERIOD.PWM_CTRL_PARAM).

Parameters
channelChannel to configure.
ki4-bit PWM controller parameter (0\u201315).

◆ SetReset()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::SetReset ( bool  reset)
noexcept

Hold device in reset or release reset.

Controls the RESN (reset) pin. When in reset, the device is held in a reset state and all registers are reset to default values.

Parameters
resetIf true, hold device in reset (RESN LOW). If false, release reset (RESN HIGH).
Returns
DriverResult<void> Success or error
Return values
DriverError::HardwareErrorGPIO control failed
Note
RESN must be released (reset=false) for SPI communication to work.
Holding device in reset will disable all channels and reset registers.

◆ SetVbatThresholds()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::SetVbatThresholds ( float  uv_voltage,
float  ov_voltage 
)
noexcept

Set VBAT under/overvoltage thresholds from voltage values (High-Level API)

Parameters
uv_voltageUV threshold voltage in volts (0V to ~41.4V)
ov_voltageOV threshold voltage in volts (0V to ~41.4V)
Returns
DriverResult<void> Success or error

Automatically calculates register values from voltage. Formula: register_value = voltage / 0.16208V

Note
This is the recommended API for most users. Use SetVbatThresholdsRaw() only if you need direct control over register values.

◆ setVbatThresholdsInternal()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::setVbatThresholdsInternal ( float  uv_voltage,
float  ov_voltage 
)
privatenoexcept

Set VBAT thresholds without checking initialization status (used during Init)

Parameters
uv_voltageUnder-voltage threshold in volts
ov_voltageOver-voltage threshold in volts
Returns
DriverResult<void> Success or error

◆ SetVbatThresholdsRaw()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::SetVbatThresholdsRaw ( uint8_t  uv_threshold,
uint8_t  ov_threshold 
)
noexcept

Set VBAT under/overvoltage thresholds (Low-Level API)

Parameters
uv_thresholdUV threshold register value (0-255, V_BAT_UV = value * 0.16208V)
ov_thresholdOV threshold register value (0-255, V_BAT_OV = value * 0.16208V)
Returns
DriverResult<void> Success or error
Note
For most users, prefer SetVbatThresholds(uv_voltage, ov_voltage) which automatically calculates these values from voltage.

◆ SetVioLevel()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::SetVioLevel ( VioLevel  level)
noexcept

Select VIO voltage level (3.3 V or 5.0 V).

Updates GLOBAL_CONFIG.VIO_SEL and caches the selection so that subsequent supply-voltage decodes pick the correct LSB. Must be called in Config Mode.

◆ SoftwareReset()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::SoftwareReset ( )
noexcept

Software reset of the device.

Resets all registers to default values. init() must be called again.

Returns
DriverResult<void> Success or error

◆ transferFrame()

template<typename CommType >
DriverResult< SPIFrame > tle92466ed::Driver< CommType >::transferFrame ( const SPIFrame &  tx_frame,
bool  verify_crc = true 
)
privatenoexcept

Transfer SPI frame with CRC calculation and verification.

Delegates to comm_.Read() / comm_.Write(), each of which performs the chip's two-frame pipelined transaction via TransferMulti().

◆ VerifyDevice()

template<typename CommType >
DriverResult< bool > tle92466ed::Driver< CommType >::VerifyDevice ( )
noexcept

Verify device ID matches expected value.

Returns
DriverResult<bool> true if ID matches

◆ WriteRegister()

template<typename CommType >
DriverResult< void > tle92466ed::Driver< CommType >::WriteRegister ( uint16_t  address,
uint16_t  value,
bool  verify_crc = false,
bool  verify_write = true 
)
noexcept

Write 16-bit register.

Parameters
addressRegister address (10-bit)
valueValue to write (16-bit)
verify_crcOverride CRC verification (default: uses internal CRC enable state)
verify_writeIf true, read back register to verify write succeeded (default: true)
Returns
DriverResult<void> Success or error
Note
If verify_crc is not explicitly provided, uses internal CRC enable state which tracks GLOBAL_CONFIG::CRC_EN. Set to false to override (e.g., during init).
If verify_write is true, reads back the register after write and logs a warning if the read value doesn't match. Some registers may be write-only (e.g., GLOBAL_CONFIG), in which case verification will fail gracefully.

Member Data Documentation

◆ cached_icvid_

template<typename CommType >
uint16_t tle92466ed::Driver< CommType >::cached_icvid_ {0U}
private

ICVID latched at VerifyDevice (live re-read may flake)

◆ ch_ctrl_cache_

template<typename CommType >
uint16_t tle92466ed::Driver< CommType >::ch_ctrl_cache_ {0U}
private

Cached CH_CTRL register value (reads return 0x0000)

◆ channel_enable_cache_

template<typename CommType >
uint16_t tle92466ed::Driver< CommType >::channel_enable_cache_ {0U}
private

Cached channel enable state.

◆ channel_setpoints_

template<typename CommType >
std::array<uint16_t, 6> tle92466ed::Driver< CommType >::channel_setpoints_
private

Cached current setpoints.

◆ comm_

template<typename CommType >
CommType& tle92466ed::Driver< CommType >::comm_
private

Communication interface.

◆ crc_enabled_

template<typename CommType >
bool tle92466ed::Driver< CommType >::crc_enabled_ {false}
private

CRC enable state (tracks GLOBAL_CONFIG::CRC_EN)

◆ initialized_

template<typename CommType >
bool tle92466ed::Driver< CommType >::initialized_ {false}
private

Initialization status.

◆ mission_mode_

template<typename CommType >
bool tle92466ed::Driver< CommType >::mission_mode_ {false}
private

Mission mode flag (vs config mode)

◆ vio_5v_mode_

template<typename CommType >
bool tle92466ed::Driver< CommType >::vio_5v_mode_ {false}
private

VIO mode state (tracks GLOBAL_CONFIG::VIO_SEL, false=3.3V, true=5V)


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