MAX22200 Driver
API reference
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
max22200::ChannelConfig Struct Reference

Channel configuration structure. More...

#include <max22200_types.hpp>

Public Member Functions

 ChannelConfig ()
 Default constructor — safe defaults.
 
void set_hit_ma (float ma)
 Set HIT setpoint in mA (CDR mode)
 
void set_hold_ma (float ma)
 Set HOLD setpoint in mA (CDR mode)
 
void set_hit_duty_percent (float pct)
 Set HIT duty cycle in percent (VDR mode, 0–100)
 
void set_hold_duty_percent (float pct)
 Set HOLD duty cycle in percent (VDR mode, 0–100)
 
float hit_ma () const
 HIT setpoint in mA (CDR) or percent (VDR)
 
float hold_ma () const
 HOLD setpoint in mA (CDR) or percent (VDR)
 
float hit_duty_percent () const
 HIT duty cycle in percent (VDR); same storage as hit_setpoint.
 
float hold_duty_percent () const
 HOLD duty cycle in percent (VDR); same storage as hold_setpoint.
 
uint32_t toRegister (uint32_t board_ifs_ma=0, bool master_clock_80khz=false) const
 Build 32-bit register value from user units.
 
void fromRegister (uint32_t val, uint32_t board_ifs_ma, bool master_clock_80khz_param)
 Parse a 32-bit register value into user units.
 
bool isCdr () const
 true when drive_mode is CDR
 
bool isVdr () const
 true when drive_mode is VDR
 
bool isLowSide () const
 true when side_mode is LOW_SIDE
 
bool isHighSide () const
 true when side_mode is HIGH_SIDE
 
bool hasHitTime () const
 true when hit_time_ms > 0 (finite HIT window)
 
bool isContinuousHit () const
 true when hit_time_ms indicates continuous HIT (negative or very large)
 
bool isTriggeredBySpi () const
 true when channel is controlled via SPI ONCH (TRGnSPI = 0)
 
bool isTriggeredByPin () const
 true when channel is controlled via TRIGA/TRIGB pin (TRGnSPI = 1)
 
bool isHalfFullScale () const
 true when HFS bit is set (half full-scale, low-side only)
 
bool isSlewRateControlEnabled () const
 true when SRC (slew rate control) is enabled
 
bool isOpenLoadDetectionEnabled () const
 true when open-load detection (OL_EN) is enabled
 
bool isPlungerMovementDetectionEnabled () const
 true when plunger movement detection (DPM_EN) is enabled
 
bool isHitCurrentCheckEnabled () const
 true when HIT current check (HHF_EN) is enabled
 
ChopFreq getChopFreq () const
 Chopping frequency config (FREQ_CFG); see ChopFreq enum.
 

Static Public Member Functions

static ChannelConfig makeSolenoidCdr (float hit_ma, float hold_ma, float hit_time_ms)
 Preset: solenoid in CDR mode (low-side, currents in mA)
 
static ChannelConfig makeSolenoidVdr (float hit_pct, float hold_pct, float hit_time_ms)
 Preset: solenoid in VDR mode (low-side, duty percent)
 

Public Attributes

float hit_setpoint
 HIT setpoint: CDR = mA, VDR = duty % (0–100)
 
float hold_setpoint
 HOLD setpoint: CDR = mA, VDR = duty % (0–100)
 
float hit_time_ms
 
bool half_full_scale
 
bool trigger_from_pin
 
DriveMode drive_mode
 Drive mode: CDR (current) or VDR (voltage)
 
SideMode side_mode
 Side mode: LOW_SIDE (CDR/VDR) or HIGH_SIDE (VDR only)
 
ChopFreq chop_freq
 Chopping frequency divider (FREQ_CFG[1:0])
 
bool slew_rate_control_enabled
 Slew rate control enable; reduces EMI; fCHOP < 50 kHz.
 
bool open_load_detection_enabled
 Open-load detection enable.
 
bool plunger_movement_detection_enabled
 Plunger movement detection enable (low-side only)
 
bool hit_current_check_enabled
 HIT current check enable (HHF fault if IHIT not reached)
 

Detailed Description

Channel configuration structure.

Stores configuration in user units (mA for CDR, % for VDR, ms for hit time) and automatically computes register values when toRegister() is called.

User Units (Primary Storage)

CDR Mode:

VDR Mode:

HIT Time:

Register Conversion

Restrictions

Note
See max22200_registers.hpp for detailed bit field definitions.
The driver's GetChannelConfig() passes board IFS into fromRegister(); IFS is not stored on ChannelConfig.

Constructor & Destructor Documentation

◆ ChannelConfig()

max22200::ChannelConfig::ChannelConfig ( )
inline

Default constructor — safe defaults.

Member Function Documentation

◆ fromRegister()

void max22200::ChannelConfig::fromRegister ( uint32_t  val,
uint32_t  board_ifs_ma,
bool  master_clock_80khz_param 
)
inline

Parse a 32-bit register value into user units.

Converts raw to mA (CDR) or % (VDR) and hit_time_ms. IFS is not stored on config.

Parameters
val32-bit register value from CFG_CHx
board_ifs_maBoard IFS in mA (for CDR raw→mA conversion)
master_clock_80khz_paramMaster clock 80 kHz base (for hit_time conversion)

◆ getChopFreq()

ChopFreq max22200::ChannelConfig::getChopFreq ( ) const
inline

Chopping frequency config (FREQ_CFG); see ChopFreq enum.

◆ hasHitTime()

bool max22200::ChannelConfig::hasHitTime ( ) const
inline

true when hit_time_ms > 0 (finite HIT window)

◆ hit_duty_percent()

float max22200::ChannelConfig::hit_duty_percent ( ) const
inline

HIT duty cycle in percent (VDR); same storage as hit_setpoint.

◆ hit_ma()

float max22200::ChannelConfig::hit_ma ( ) const
inline

HIT setpoint in mA (CDR) or percent (VDR)

◆ hold_duty_percent()

float max22200::ChannelConfig::hold_duty_percent ( ) const
inline

HOLD duty cycle in percent (VDR); same storage as hold_setpoint.

◆ hold_ma()

float max22200::ChannelConfig::hold_ma ( ) const
inline

HOLD setpoint in mA (CDR) or percent (VDR)

◆ isCdr()

bool max22200::ChannelConfig::isCdr ( ) const
inline

true when drive_mode is CDR

◆ isContinuousHit()

bool max22200::ChannelConfig::isContinuousHit ( ) const
inline

true when hit_time_ms indicates continuous HIT (negative or very large)

◆ isHalfFullScale()

bool max22200::ChannelConfig::isHalfFullScale ( ) const
inline

true when HFS bit is set (half full-scale, low-side only)

◆ isHighSide()

bool max22200::ChannelConfig::isHighSide ( ) const
inline

true when side_mode is HIGH_SIDE

◆ isHitCurrentCheckEnabled()

bool max22200::ChannelConfig::isHitCurrentCheckEnabled ( ) const
inline

true when HIT current check (HHF_EN) is enabled

◆ isLowSide()

bool max22200::ChannelConfig::isLowSide ( ) const
inline

true when side_mode is LOW_SIDE

◆ isOpenLoadDetectionEnabled()

bool max22200::ChannelConfig::isOpenLoadDetectionEnabled ( ) const
inline

true when open-load detection (OL_EN) is enabled

◆ isPlungerMovementDetectionEnabled()

bool max22200::ChannelConfig::isPlungerMovementDetectionEnabled ( ) const
inline

true when plunger movement detection (DPM_EN) is enabled

◆ isSlewRateControlEnabled()

bool max22200::ChannelConfig::isSlewRateControlEnabled ( ) const
inline

true when SRC (slew rate control) is enabled

◆ isTriggeredByPin()

bool max22200::ChannelConfig::isTriggeredByPin ( ) const
inline

true when channel is controlled via TRIGA/TRIGB pin (TRGnSPI = 1)

◆ isTriggeredBySpi()

bool max22200::ChannelConfig::isTriggeredBySpi ( ) const
inline

true when channel is controlled via SPI ONCH (TRGnSPI = 0)

◆ isVdr()

bool max22200::ChannelConfig::isVdr ( ) const
inline

true when drive_mode is VDR

◆ makeSolenoidCdr()

static ChannelConfig max22200::ChannelConfig::makeSolenoidCdr ( float  hit_ma,
float  hold_ma,
float  hit_time_ms 
)
inlinestatic

Preset: solenoid in CDR mode (low-side, currents in mA)

Sets drive_mode=CDR, side_mode=LOW_SIDE, chop_freq=FMAIN_DIV4 and common defaults. Call SetBoardConfig() before ConfigureChannel(); driver supplies IFS and FREQM.

◆ makeSolenoidVdr()

static ChannelConfig max22200::ChannelConfig::makeSolenoidVdr ( float  hit_pct,
float  hold_pct,
float  hit_time_ms 
)
inlinestatic

Preset: solenoid in VDR mode (low-side, duty percent)

Sets drive_mode=VDR, side_mode=LOW_SIDE, chop_freq=FMAIN_DIV4 and common defaults. hit_pct and hold_pct are 0–100. Call SetBoardConfig() before ConfigureChannel().

◆ set_hit_duty_percent()

void max22200::ChannelConfig::set_hit_duty_percent ( float  pct)
inline

Set HIT duty cycle in percent (VDR mode, 0–100)

◆ set_hit_ma()

void max22200::ChannelConfig::set_hit_ma ( float  ma)
inline

Set HIT setpoint in mA (CDR mode)

◆ set_hold_duty_percent()

void max22200::ChannelConfig::set_hold_duty_percent ( float  pct)
inline

Set HOLD duty cycle in percent (VDR mode, 0–100)

◆ set_hold_ma()

void max22200::ChannelConfig::set_hold_ma ( float  ma)
inline

Set HOLD setpoint in mA (CDR mode)

◆ toRegister()

uint32_t max22200::ChannelConfig::toRegister ( uint32_t  board_ifs_ma = 0,
bool  master_clock_80khz = false 
) const
inline

Build 32-bit register value from user units.

For CDR, pass board IFS in mA (from SetBoardConfig). Driver calls this with board IFS and master clock from cached STATUS in ConfigureChannel.

Parameters
board_ifs_maBoard IFS in mA (required for CDR when > 0; 0 yields raw 0 in CDR).
master_clock_80khzMaster clock base from STATUS FREQM (false = 100 kHz, true = 80 kHz); used for hit_time conversion.

Member Data Documentation

◆ chop_freq

ChopFreq max22200::ChannelConfig::chop_freq

Chopping frequency divider (FREQ_CFG[1:0])

◆ drive_mode

DriveMode max22200::ChannelConfig::drive_mode

Drive mode: CDR (current) or VDR (voltage)

◆ half_full_scale

bool max22200::ChannelConfig::half_full_scale

Half full-scale (false=1x, true=0.5x IFS) When true: IFS halved, RON doubled; low-side only

◆ hit_current_check_enabled

bool max22200::ChannelConfig::hit_current_check_enabled

HIT current check enable (HHF fault if IHIT not reached)

◆ hit_setpoint

float max22200::ChannelConfig::hit_setpoint

HIT setpoint: CDR = mA, VDR = duty % (0–100)

◆ hit_time_ms

float max22200::ChannelConfig::hit_time_ms

HIT time in milliseconds 0.0 = no HIT time < 0.0 or >= 1000000.0 = continuous (infinite)

◆ hold_setpoint

float max22200::ChannelConfig::hold_setpoint

HOLD setpoint: CDR = mA, VDR = duty % (0–100)

◆ open_load_detection_enabled

bool max22200::ChannelConfig::open_load_detection_enabled

Open-load detection enable.

◆ plunger_movement_detection_enabled

bool max22200::ChannelConfig::plunger_movement_detection_enabled

Plunger movement detection enable (low-side only)

◆ side_mode

SideMode max22200::ChannelConfig::side_mode

Side mode: LOW_SIDE (CDR/VDR) or HIGH_SIDE (VDR only)

◆ slew_rate_control_enabled

bool max22200::ChannelConfig::slew_rate_control_enabled

Slew rate control enable; reduces EMI; fCHOP < 50 kHz.

◆ trigger_from_pin

bool max22200::ChannelConfig::trigger_from_pin

Trigger source (false=SPI ONCH, true=TRIG pin) When true: Channel controlled by TRIGA/TRIGB pins


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