|
HF-MAX22200 Driver 0.1.0-dev
HF-MAX22200 C++ Driver
|
#include <max22200.hpp>
Public Member Functions | |
| MAX22200 (SpiType &spi_interface) | |
| Constructor (SPI only; set board config later with SetBoardConfig()) | |
| MAX22200 (SpiType &spi_interface, const BoardConfig &board_config) | |
| Constructor with board config (SPI + IFS/limits) | |
| ~MAX22200 () | |
| Destructor — calls Deinitialize() if initialized. | |
| MAX22200 (const MAX22200 &)=delete | |
| MAX22200 & | operator= (const MAX22200 &)=delete |
| MAX22200 (MAX22200 &&)=default | |
| MAX22200 & | operator= (MAX22200 &&)=delete |
| DriverStatus | Initialize () |
| Initialize the driver per datasheet flowchart (Figure 6) | |
| DriverStatus | Deinitialize () |
| Deinitialize — disable channels, ACTIVE=0, ENABLE low. | |
| bool | IsInitialized () const |
| Check if driver is initialized. | |
| DriverStatus | ReadStatus (StatusConfig &status) const |
| Read the full 32-bit STATUS register. | |
| DriverStatus | WriteStatus (const StatusConfig &status) |
| Write the STATUS register (writable bits only) | |
| DriverStatus | ConfigureChannel (uint8_t channel, const ChannelConfig &config) |
| Configure a channel (write full 32-bit CFG_CHx register) | |
| DriverStatus | GetChannelConfig (uint8_t channel, ChannelConfig &config) const |
| Read a channel's configuration. | |
| DriverStatus | ConfigureAllChannels (const ChannelConfigArray &configs) |
| Configure all channels. | |
| DriverStatus | GetAllChannelConfigs (ChannelConfigArray &configs) const |
| Get all channel configurations. | |
| DriverStatus | EnableChannel (uint8_t channel) |
| Turn on a channel (set ONCHx = 1) | |
| DriverStatus | DisableChannel (uint8_t channel) |
| Turn off a channel (set ONCHx = 0) | |
| DriverStatus | SetChannelEnabled (uint8_t channel, bool enable) |
| Set a channel on or off (convenience when toggling from a variable) | |
| DriverStatus | EnableAllChannels () |
| Turn on all channels. | |
| DriverStatus | DisableAllChannels () |
| Turn off all channels. | |
| DriverStatus | SetAllChannelsEnabled (bool enable) |
| Set all channels on or off at once (convenience when toggling from a variable) | |
| DriverStatus | SetChannelsOn (uint8_t channel_mask) |
| DriverStatus | SetFullBridgeState (uint8_t pair_index, FullBridgeState state) |
| Set full-bridge state for a channel pair (datasheet Table 7) | |
| DriverStatus | ReadFaultRegister (FaultStatus &faults) const |
| Read per-channel fault register (FAULT) | |
| DriverStatus | ClearAllFaults () |
| Clear all fault flags (read FAULT register and discard) | |
| DriverStatus | ClearChannelFaults (uint8_t channel_mask, FaultStatus *out_faults=nullptr) const |
| Clear fault flags for selected channels only (MAX22200A) | |
| DriverStatus | ReadFaultRegisterSelectiveClear (uint8_t ocp_mask, uint8_t hhf_mask, uint8_t olf_mask, uint8_t dpm_mask, FaultStatus &faults) const |
| [Advanced] Read FAULT register with per-type selective clear (MAX22200A) | |
| DriverStatus | ReadFaultFlags (StatusConfig &status) const |
| Read fault flags from STATUS register. | |
| DriverStatus | ClearFaultFlags () |
| Clear fault flags by reading STATUS register. | |
| DriverStatus | ConfigureDpm (float start_current_ma, float dip_threshold_ma, float debounce_ms) |
| Configure DPM in real units (easy API) | |
| DriverStatus | ReadDpmConfig (DpmConfig &config) const |
| Read DPM algorithm configuration (CFG_DPM register) | |
| DriverStatus | WriteDpmConfig (const DpmConfig &config) |
| Write DPM algorithm configuration (CFG_DPM register) | |
| DriverStatus | SetDpmEnabledChannels (uint8_t channel_mask) |
| DriverStatus | EnableDevice () |
| Enable device (ENABLE pin high); SPI and channels can be used. | |
| DriverStatus | DisableDevice () |
| Disable device (ENABLE pin low); low-power state. | |
| DriverStatus | SetDeviceEnable (bool enable) |
| Set ENABLE pin state (true = on, false = off) | |
| DriverStatus | GetFaultPinState (bool &fault_active) const |
| Read nFAULT pin state (true = fault active, false = no fault) | |
| DriverStatus | ReadRegister32 (uint8_t bank, uint32_t &value) const |
| Read a 32-bit register by bank address. | |
| DriverStatus | WriteRegister32 (uint8_t bank, uint32_t value) |
| Write a 32-bit register by bank address. | |
| DriverStatus | ReadRegister8 (uint8_t bank, uint8_t &value) const |
| Read 8-bit MSB of a register (fast 8-bit mode) | |
| DriverStatus | WriteRegister8 (uint8_t bank, uint8_t value) |
| Write 8-bit MSB of a register (fast 8-bit mode) | |
| uint8_t | GetLastFaultByte () const |
| DriverStatistics | GetStatistics () const |
| void | ResetStatistics () |
| void | SetFaultCallback (FaultCallback callback, void *user_data) |
| void | SetStateChangeCallback (StateChangeCallback callback, void *user_data) |
| void | SetBoardConfig (const BoardConfig &config) |
| Set board configuration (IFS, max current, max duty) | |
| BoardConfig | GetBoardConfig () const |
| Get current board configuration. | |
| DriverStatus | SetHitCurrentMa (uint8_t channel, uint32_t ma) |
| Set HIT current in milliamps (CDR mode) | |
| DriverStatus | SetHoldCurrentMa (uint8_t channel, uint32_t ma) |
| Set HOLD current in milliamps (CDR mode) | |
| DriverStatus | SetHitCurrentA (uint8_t channel, float amps) |
| Set HIT current in Amps (CDR mode) | |
| DriverStatus | SetHoldCurrentA (uint8_t channel, float amps) |
| Set HOLD current in Amps (CDR mode) | |
| DriverStatus | SetHitCurrentPercent (uint8_t channel, float percent) |
| Set HIT current as percentage of IFS (CDR mode) | |
| DriverStatus | SetHoldCurrentPercent (uint8_t channel, float percent) |
| Set HOLD current as percentage of IFS (CDR mode) | |
| DriverStatus | GetHitCurrentMa (uint8_t channel, uint32_t &ma) const |
| Get HIT current in milliamps (CDR mode) | |
| DriverStatus | GetHoldCurrentMa (uint8_t channel, uint32_t &ma) const |
| Get HOLD current in milliamps (CDR mode) | |
| DriverStatus | GetHitCurrentPercent (uint8_t channel, float &percent) const |
| Get HIT current as percentage of IFS (CDR mode) | |
| DriverStatus | GetHoldCurrentPercent (uint8_t channel, float &percent) const |
| Get HOLD current as percentage of IFS (CDR mode) | |
| DriverStatus | SetHitDutyPercent (uint8_t channel, float percent) |
| Set HIT duty cycle in percent (VDR mode) | |
| DriverStatus | SetHoldDutyPercent (uint8_t channel, float percent) |
| Set HOLD duty cycle in percent (VDR mode) | |
| DriverStatus | GetHitDutyPercent (uint8_t channel, float &percent) const |
| Get HIT duty cycle in percent (VDR mode) | |
| DriverStatus | GetHoldDutyPercent (uint8_t channel, float &percent) const |
| Get HOLD duty cycle in percent (VDR mode) | |
| DriverStatus | GetDutyLimits (uint8_t channel, DutyLimits &limits) const |
| Get duty cycle limits for a channel (uses channel's chop_freq and SRC) | |
| DriverStatus | SetHitTimeMs (uint8_t channel, float ms) |
| Set HIT time in milliseconds. | |
| DriverStatus | GetHitTimeMs (uint8_t channel, float &ms) const |
| Get HIT time in milliseconds. | |
| DriverStatus | ConfigureChannelCdr (uint8_t channel, uint32_t hit_ma, uint32_t hold_ma, float hit_time_ms, SideMode side_mode=SideMode::LOW_SIDE, ChopFreq chop_freq=ChopFreq::FMAIN_DIV4, bool slew_rate_control_enabled=false, bool open_load_detection_enabled=false, bool plunger_movement_detection_enabled=false, bool hit_current_check_enabled=false) |
| Configure channel in real units (CDR mode) | |
| DriverStatus | ConfigureChannelVdr (uint8_t channel, float hit_duty_percent, float hold_duty_percent, float hit_time_ms, SideMode side_mode=SideMode::LOW_SIDE, ChopFreq chop_freq=ChopFreq::FMAIN_DIV4, bool slew_rate_control_enabled=false, bool open_load_detection_enabled=false, bool plunger_movement_detection_enabled=false, bool hit_current_check_enabled=false) |
| Configure channel in real units (VDR mode) | |
Static Public Member Functions | |
| static DriverStatus | GetDutyLimits (bool master_clock_80khz, ChopFreq chop_freq, bool slew_rate_control_enabled, DutyLimits &limits) |
| Get duty cycle limits (δMIN, δMAX) for a configuration. | |
| static bool | IsValidChannel (uint8_t channel) |
| 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. | |
|
explicit |
Constructor (SPI only; set board config later with SetBoardConfig())
Use when board config is unknown at construction (e.g. loaded from NVS or another source after the driver is created). Unit APIs (SetHitCurrentMa, ConfigureChannel with CDR, etc.) require IFS to be set (SetBoardConfig with RREF) and will return INVALID_PARAMETER if board IFS is 0.
| spi_interface | Reference to SPI interface implementation |
| max22200::MAX22200< SpiType >::MAX22200 | ( | SpiType & | spi_interface, |
| const BoardConfig & | board_config ) |
Constructor with board config (SPI + IFS/limits)
Use when the board is known at construction (e.g. fixed RREF). The driver is immediately valid for unit-based APIs without calling SetBoardConfig().
| spi_interface | Reference to SPI interface implementation |
| board_config | Board configuration (IFS from RREF, optional limits) |
| max22200::MAX22200< SpiType >::~MAX22200 | ( | ) |
Destructor — calls Deinitialize() if initialized.
|
delete |
|
default |
| DriverStatus max22200::MAX22200< SpiType >::ClearAllFaults | ( | ) |
Clear all fault flags (read FAULT register and discard)
Clears OCP, HHF, OLF, and DPM for all channels and deasserts nFAULT. Use when you only need to clear and do not need the fault snapshot.
| DriverStatus max22200::MAX22200< SpiType >::ClearChannelFaults | ( | uint8_t | channel_mask, |
| FaultStatus * | out_faults = nullptr ) const |
Clear fault flags for selected channels only (MAX22200A)
On MAX22200A, clears OCP/HHF/OLF/DPM only for channels whose bit is set in channel_mask. On MAX22200, the device clears all flags on any read (same as ClearAllFaults).
| channel_mask | Bit N = 1 to clear faults for channel N (0–7) |
| out_faults | Optional: if non-null, filled with FAULT state after clear |
| DriverStatus max22200::MAX22200< SpiType >::ClearFaultFlags | ( | ) |
Clear fault flags by reading STATUS register.
| DriverStatus max22200::MAX22200< SpiType >::ConfigureAllChannels | ( | const ChannelConfigArray & | configs | ) |
Configure all channels.
| DriverStatus max22200::MAX22200< SpiType >::ConfigureChannel | ( | uint8_t | channel, |
| const ChannelConfig & | config ) |
Configure a channel (write full 32-bit CFG_CHx register)
Writes the complete 32-bit configuration register for the specified channel. This includes all drive parameters: HIT/HOLD currents, timing, drive mode, etc.
| channel | Channel number (0-7) |
| config | Channel configuration structure |
| DriverStatus max22200::MAX22200< SpiType >::ConfigureChannelCdr | ( | uint8_t | channel, |
| uint32_t | hit_ma, | ||
| uint32_t | hold_ma, | ||
| float | hit_time_ms, | ||
| SideMode | side_mode = SideMode::LOW_SIDE, | ||
| ChopFreq | chop_freq = ChopFreq::FMAIN_DIV4, | ||
| bool | slew_rate_control_enabled = false, | ||
| bool | open_load_detection_enabled = false, | ||
| bool | plunger_movement_detection_enabled = false, | ||
| bool | hit_current_check_enabled = false ) |
Configure channel in real units (CDR mode)
Convenience method that sets all channel parameters using real units (mA, ms) instead of raw register values. Units: hit_ma (mA), hold_ma (mA), hit_time_ms (ms).
| channel | Channel number (0-7) |
| hit_ma | HIT current in milliamps |
| hold_ma | HOLD current in milliamps |
| hit_time_ms | HIT time in milliseconds (-1 = continuous) |
| side_mode | Low-side or high-side (default: LOW_SIDE) |
| chop_freq | Chopping frequency (default: FMAIN_DIV4) |
| slew_rate_control_enabled | Slew rate control (default: false) |
| open_load_detection_enabled | Open load detection (default: false) |
| plunger_movement_detection_enabled | DPM detection (default: false) |
| hit_current_check_enabled | HIT current check (default: false) |
| DriverStatus max22200::MAX22200< SpiType >::ConfigureChannelVdr | ( | uint8_t | channel, |
| float | hit_duty_percent, | ||
| float | hold_duty_percent, | ||
| float | hit_time_ms, | ||
| SideMode | side_mode = SideMode::LOW_SIDE, | ||
| ChopFreq | chop_freq = ChopFreq::FMAIN_DIV4, | ||
| bool | slew_rate_control_enabled = false, | ||
| bool | open_load_detection_enabled = false, | ||
| bool | plunger_movement_detection_enabled = false, | ||
| bool | hit_current_check_enabled = false ) |
Configure channel in real units (VDR mode)
Convenience method for VDR mode using duty cycle percentages. Units: hit_duty_percent (%), hold_duty_percent (%), hit_time_ms (ms).
| channel | Channel number (0-7) |
| hit_duty_percent | HIT duty cycle in percent (0-100) |
| hold_duty_percent | HOLD duty cycle in percent (0-100) |
| hit_time_ms | HIT time in milliseconds (-1 = continuous) |
| side_mode | Low-side or high-side |
| chop_freq | Chopping frequency |
| slew_rate_control_enabled | Slew rate control |
| open_load_detection_enabled | Open load detection |
| plunger_movement_detection_enabled | DPM detection (low-side only) |
| hit_current_check_enabled | HIT current check |
| DriverStatus max22200::MAX22200< SpiType >::ConfigureDpm | ( | float | start_current_ma, |
| float | dip_threshold_ma, | ||
| float | debounce_ms ) |
Configure DPM in real units (easy API)
Sets start current, dip threshold, and debounce time. Uses board IFS for current conversion and cached STATUS (FREQM) + FMAIN_DIV4 for debounce fCHOP. Call SetBoardConfig() first so IFS is set; call ReadStatus or Initialize so cache is valid.
| start_current_ma | Current (mA) above which DPM monitors for dip |
| dip_threshold_ma | Minimum dip amplitude (mA) to count as valid |
| debounce_ms | Min dip duration (ms); converted to chopping periods using actual fCHOP |
| DriverStatus max22200::MAX22200< SpiType >::Deinitialize | ( | ) |
Deinitialize — disable channels, ACTIVE=0, ENABLE low.
Performs a clean shutdown sequence:
After Deinitialize(), the device consumes < 11μA from VM.
| DriverStatus max22200::MAX22200< SpiType >::DisableAllChannels | ( | ) |
Turn off all channels.
| DriverStatus max22200::MAX22200< SpiType >::DisableChannel | ( | uint8_t | channel | ) |
Turn off a channel (set ONCHx = 0)
| channel | Channel number (0-7) |
| DriverStatus max22200::MAX22200< SpiType >::DisableDevice | ( | ) |
Disable device (ENABLE pin low); low-power state.
| DriverStatus max22200::MAX22200< SpiType >::EnableAllChannels | ( | ) |
Turn on all channels.
| DriverStatus max22200::MAX22200< SpiType >::EnableChannel | ( | uint8_t | channel | ) |
Turn on a channel (set ONCHx = 1)
Sets the ONCHx bit so the channel is active (delivering current).
| channel | Channel number (0-7) |
| DriverStatus max22200::MAX22200< SpiType >::EnableDevice | ( | ) |
Enable device (ENABLE pin high); SPI and channels can be used.
| DriverStatus max22200::MAX22200< SpiType >::GetAllChannelConfigs | ( | ChannelConfigArray & | configs | ) | const |
Get all channel configurations.
| BoardConfig max22200::MAX22200< SpiType >::GetBoardConfig | ( | ) | const |
Get current board configuration.
| DriverStatus max22200::MAX22200< SpiType >::GetChannelConfig | ( | uint8_t | channel, |
| ChannelConfig & | config ) const |
Read a channel's configuration.
| channel | Channel number (0-7) |
| config | Reference to store configuration |
|
inlinestaticconstexprnoexcept |
Get the compiled driver version string.
|
inlinestaticconstexprnoexcept |
Get the compiled driver major version number.
|
inlinestaticconstexprnoexcept |
Get the compiled driver minor version number.
|
inlinestaticconstexprnoexcept |
Get the compiled driver patch version number.
|
static |
Get duty cycle limits (δMIN, δMAX) for a configuration.
Returns the minimum and maximum duty cycle percentages based on FREQM, FREQ_CFG, and SRC settings (datasheet Table 2).
| master_clock_80khz | Master clock 80 kHz base (from STATUS register) |
| chop_freq | Chopping frequency divider |
| slew_rate_control_enabled | Slew rate control enabled |
| limits | Output: min_percent and max_percent |
| DriverStatus max22200::MAX22200< SpiType >::GetDutyLimits | ( | uint8_t | channel, |
| DutyLimits & | limits ) const |
Get duty cycle limits for a channel (uses channel's chop_freq and SRC)
Reads the channel config and uses cached STATUS (FREQM) to return δMIN/δMAX. Convenience wrapper when configuring VDR on a specific channel.
| channel | Channel number (0-7) |
| limits | Output: min_percent and max_percent |
| DriverStatus max22200::MAX22200< SpiType >::GetFaultPinState | ( | bool & | fault_active | ) | const |
Read nFAULT pin state (true = fault active, false = no fault)
| DriverStatus max22200::MAX22200< SpiType >::GetHitCurrentMa | ( | uint8_t | channel, |
| uint32_t & | ma ) const |
Get HIT current in milliamps (CDR mode)
Reads channel config and converts: ma = (hit_current / 127.0) × IFS_ma
| DriverStatus max22200::MAX22200< SpiType >::GetHitCurrentPercent | ( | uint8_t | channel, |
| float & | percent ) const |
Get HIT current as percentage of IFS (CDR mode)
| DriverStatus max22200::MAX22200< SpiType >::GetHitDutyPercent | ( | uint8_t | channel, |
| float & | percent ) const |
Get HIT duty cycle in percent (VDR mode)
Reads channel config: percent = (hit_current / 127.0) × 100
| DriverStatus max22200::MAX22200< SpiType >::GetHitTimeMs | ( | uint8_t | channel, |
| float & | ms ) const |
Get HIT time in milliseconds.
Reads channel config and STATUS (FREQM): ms = (HIT_T × 40 / fCHOP) × 1000
| DriverStatus max22200::MAX22200< SpiType >::GetHoldCurrentMa | ( | uint8_t | channel, |
| uint32_t & | ma ) const |
Get HOLD current in milliamps (CDR mode)
| DriverStatus max22200::MAX22200< SpiType >::GetHoldCurrentPercent | ( | uint8_t | channel, |
| float & | percent ) const |
Get HOLD current as percentage of IFS (CDR mode)
| DriverStatus max22200::MAX22200< SpiType >::GetHoldDutyPercent | ( | uint8_t | channel, |
| float & | percent ) const |
Get HOLD duty cycle in percent (VDR mode)
| uint8_t max22200::MAX22200< SpiType >::GetLastFaultByte | ( | ) | const |
| DriverStatistics max22200::MAX22200< SpiType >::GetStatistics | ( | ) | const |
| DriverStatus max22200::MAX22200< SpiType >::Initialize | ( | ) |
Initialize the driver per datasheet flowchart (Figure 6)
Performs the complete initialization sequence as specified in the MAX22200 datasheet Programming Flow Chart:
| bool max22200::MAX22200< SpiType >::IsInitialized | ( | ) | const |
Check if driver is initialized.
|
inlinestatic |
|
delete |
|
delete |
| DriverStatus max22200::MAX22200< SpiType >::ReadDpmConfig | ( | DpmConfig & | config | ) | const |
Read DPM algorithm configuration (CFG_DPM register)
DPM settings are global and apply to all channels that have DPM_EN set.
| config | Reference to DpmConfig to populate |
| DriverStatus max22200::MAX22200< SpiType >::ReadFaultFlags | ( | StatusConfig & | status | ) | const |
Read fault flags from STATUS register.
| DriverStatus max22200::MAX22200< SpiType >::ReadFaultRegister | ( | FaultStatus & | faults | ) | const |
Read per-channel fault register (FAULT)
Reads the FAULT register (OCP, HHF, OLF, DPM per channel). Reading also clears the flags and deasserts nFAULT when no other faults remain.
| faults | Reference to FaultStatus to populate |
| DriverStatus max22200::MAX22200< SpiType >::ReadFaultRegisterSelectiveClear | ( | uint8_t | ocp_mask, |
| uint8_t | hhf_mask, | ||
| uint8_t | olf_mask, | ||
| uint8_t | dpm_mask, | ||
| FaultStatus & | faults ) const |
[Advanced] Read FAULT register with per-type selective clear (MAX22200A)
For MAX22200A only: separate masks for OCP, HHF, OLF, DPM let you clear only certain fault types per channel. On MAX22200, SDI is ignored and all flags are cleared. Prefer ClearAllFaults() or ClearChannelFaults() for normal use.
| ocp_mask | Channel mask for OCP bits to clear (bit N = channel N) |
| hhf_mask | Channel mask for HHF bits to clear |
| olf_mask | Channel mask for OLF bits to clear |
| dpm_mask | Channel mask for DPM bits to clear |
| faults | Populated with FAULT register value after the read |
| DriverStatus max22200::MAX22200< SpiType >::ReadRegister32 | ( | uint8_t | bank, |
| uint32_t & | value ) const |
Read a 32-bit register by bank address.
| DriverStatus max22200::MAX22200< SpiType >::ReadRegister8 | ( | uint8_t | bank, |
| uint8_t & | value ) const |
Read 8-bit MSB of a register (fast 8-bit mode)
| DriverStatus max22200::MAX22200< SpiType >::ReadStatus | ( | StatusConfig & | status | ) | const |
Read the full 32-bit STATUS register.
| void max22200::MAX22200< SpiType >::ResetStatistics | ( | ) |
| DriverStatus max22200::MAX22200< SpiType >::SetAllChannelsEnabled | ( | bool | enable | ) |
Set all channels on or off at once (convenience when toggling from a variable)
| enable | true = all on, false = all off |
| void max22200::MAX22200< SpiType >::SetBoardConfig | ( | const BoardConfig & | config | ) |
Set board configuration (IFS, max current, max duty)
Configures the full-scale current and optional safety limits used by convenience APIs (SetHitCurrentMa, SetHitDutyPercent, etc.). Can be called at any time to change limits; IFS is required for unit-based APIs.
| config | Board configuration (IFS in mA, optional max limits) |
| DriverStatus max22200::MAX22200< SpiType >::SetChannelEnabled | ( | uint8_t | channel, |
| bool | enable ) |
Set a channel on or off (convenience when toggling from a variable)
| channel | Channel number (0-7) |
| enable | true = on, false = off |
| DriverStatus max22200::MAX22200< SpiType >::SetChannelsOn | ( | uint8_t | channel_mask | ) |
| DriverStatus max22200::MAX22200< SpiType >::SetDeviceEnable | ( | bool | enable | ) |
Set ENABLE pin state (true = on, false = off)
Prefer EnableDevice() / DisableDevice() for clarity.
| DriverStatus max22200::MAX22200< SpiType >::SetDpmEnabledChannels | ( | uint8_t | channel_mask | ) |
| void max22200::MAX22200< SpiType >::SetFaultCallback | ( | FaultCallback | callback, |
| void * | user_data ) |
| DriverStatus max22200::MAX22200< SpiType >::SetFullBridgeState | ( | uint8_t | pair_index, |
| FullBridgeState | state ) |
Set full-bridge state for a channel pair (datasheet Table 7)
Updates ONCHx and ONCHy for the given pair to achieve HiZ, Forward, Reverse, or Brake. Other channels' ONCH bits are preserved.
| pair_index | Pair index 0–3 (0 = ch0–ch1, 1 = ch2–ch3, 2 = ch4–ch5, 3 = ch6–ch7) |
| state | FullBridgeState::HiZ, Forward, Reverse, or Brake |
| DriverStatus max22200::MAX22200< SpiType >::SetHitCurrentA | ( | uint8_t | channel, |
| float | amps ) |
Set HIT current in Amps (CDR mode)
Convenience wrapper: converts A to mA and calls SetHitCurrentMa.
| DriverStatus max22200::MAX22200< SpiType >::SetHitCurrentMa | ( | uint8_t | channel, |
| uint32_t | ma ) |
Set HIT current in milliamps (CDR mode)
Converts mA to 7-bit register value: raw = round((ma / IFS_ma) × 127). Clamps to max_current_ma if set, then to 0-127.
| channel | Channel number (0-7) |
| ma | Current in milliamps |
| DriverStatus max22200::MAX22200< SpiType >::SetHitCurrentPercent | ( | uint8_t | channel, |
| float | percent ) |
Set HIT current as percentage of IFS (CDR mode)
| channel | Channel number (0-7) |
| percent | Percentage (0-100) |
| DriverStatus max22200::MAX22200< SpiType >::SetHitDutyPercent | ( | uint8_t | channel, |
| float | percent ) |
Set HIT duty cycle in percent (VDR mode)
Converts percent to 7-bit: raw = round((pct / 100) × 127). Clamps to max_duty_percent if set, then to [δMIN, δMAX] based on FREQM, FREQ_CFG, and SRC settings.
| channel | Channel number (0-7) |
| percent | Duty cycle in percent (0-100) |
| DriverStatus max22200::MAX22200< SpiType >::SetHitTimeMs | ( | uint8_t | channel, |
| float | ms ) |
Set HIT time in milliseconds.
Converts ms to 8-bit register value: HIT_T = round((ms / 1000) × fCHOP / 40). Needs FREQM (from STATUS) and channel's chop_freq to compute fCHOP.
| channel | Channel number (0-7) |
| ms | HIT time in milliseconds (0 = no HIT, -1 or 0xFFFF = continuous) |
| DriverStatus max22200::MAX22200< SpiType >::SetHoldCurrentA | ( | uint8_t | channel, |
| float | amps ) |
Set HOLD current in Amps (CDR mode)
| DriverStatus max22200::MAX22200< SpiType >::SetHoldCurrentMa | ( | uint8_t | channel, |
| uint32_t | ma ) |
Set HOLD current in milliamps (CDR mode)
| DriverStatus max22200::MAX22200< SpiType >::SetHoldCurrentPercent | ( | uint8_t | channel, |
| float | percent ) |
Set HOLD current as percentage of IFS (CDR mode)
| DriverStatus max22200::MAX22200< SpiType >::SetHoldDutyPercent | ( | uint8_t | channel, |
| float | percent ) |
Set HOLD duty cycle in percent (VDR mode)
| void max22200::MAX22200< SpiType >::SetStateChangeCallback | ( | StateChangeCallback | callback, |
| void * | user_data ) |
| DriverStatus max22200::MAX22200< SpiType >::WriteDpmConfig | ( | const DpmConfig & | config | ) |
Write DPM algorithm configuration (CFG_DPM register)
| config | DPM configuration (plunger_movement_start_current, plunger_movement_debounce_time, plunger_movement_current_threshold) |
| DriverStatus max22200::MAX22200< SpiType >::WriteRegister32 | ( | uint8_t | bank, |
| uint32_t | value ) |
Write a 32-bit register by bank address.
| DriverStatus max22200::MAX22200< SpiType >::WriteRegister8 | ( | uint8_t | bank, |
| uint8_t | value ) |
Write 8-bit MSB of a register (fast 8-bit mode)
| DriverStatus max22200::MAX22200< SpiType >::WriteStatus | ( | const StatusConfig & | status | ) |
Write the STATUS register (writable bits only)