|
HF-MAX22200 Driver 0.1.0-dev
HF-MAX22200 C++ Driver
|
Channel configuration structure. More...
#include <max22200_types.hpp>
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) | |
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.
CDR Mode:
hit_setpoint and hold_setpoint are in milliamps (mA)set_hit_ma() / set_hold_ma() or assign directly; hit_ma() / hold_ma() to readVDR Mode:
hit_setpoint and hold_setpoint are duty cycle percentages (0-100)set_hit_duty_percent() / set_hold_duty_percent() or assign directly; hit_duty_percent() / hold_duty_percent() to readHIT Time:
hit_time_ms is in milliseconds0.0f = no HIT time< 0.0f or >= 1000000.0f = continuous (infinite)chop_freq for conversion to 8-bit register value. The driver supplies this from STATUS (FREQM) when calling toRegister/fromRegister; not stored on config.toRegister(board_ifs_ma, master_clock_80khz) computes raw from user units. Driver passes board IFS and cached STATUS master clock in ConfigureChannel.fromRegister(val, board_ifs_ma, master_clock_80khz) converts raw → user units; IFS and master clock are not stored on config.drive_mode and side_mode can only be changed when:drive_mode = CDR) is only supported in low-side mode (side_mode = LOW_SIDE)side_mode = HIGH_SIDE) only supports VDR modehalf_full_scale is only available for low-side applications. When HFS=1, effective IFS for that channel is half of board IFS (datasheet KFS 7.5k vs 15k). toRegister/fromRegister use this effective IFS for CDR mA ↔ raw conversion so setpoints stay in real mA.GetChannelConfig() passes board IFS into fromRegister(); IFS is not stored on ChannelConfig.
|
inline |
Default constructor — safe defaults.
|
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.
| val | 32-bit register value from CFG_CHx |
| board_ifs_ma | Board IFS in mA (for CDR raw→mA conversion) |
| master_clock_80khz_param | Master clock 80 kHz base (for hit_time conversion) |
|
inline |
Chopping frequency config (FREQ_CFG); see ChopFreq enum.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
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.
|
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().
|
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.
| board_ifs_ma | Board IFS in mA (required for CDR when > 0; 0 yields raw 0 in CDR). |
| master_clock_80khz | Master clock base from STATUS FREQM (false = 100 kHz, true = 80 kHz); used for hit_time conversion. |
| ChopFreq max22200::ChannelConfig::chop_freq |
Chopping frequency divider (FREQ_CFG[1:0])
| DriveMode max22200::ChannelConfig::drive_mode |
Drive mode: CDR (current) or VDR (voltage)
| bool max22200::ChannelConfig::half_full_scale |
Half full-scale (false=1x, true=0.5x IFS) When true: IFS halved, RON doubled; low-side only
| bool max22200::ChannelConfig::hit_current_check_enabled |
HIT current check enable (HHF fault if IHIT not reached)
| float max22200::ChannelConfig::hit_setpoint |
HIT setpoint: CDR = mA, VDR = duty % (0–100)
| float max22200::ChannelConfig::hit_time_ms |
HIT time in milliseconds 0.0 = no HIT time < 0.0 or >= 1000000.0 = continuous (infinite)
| float max22200::ChannelConfig::hold_setpoint |
HOLD setpoint: CDR = mA, VDR = duty % (0–100)
| bool max22200::ChannelConfig::open_load_detection_enabled |
Open-load detection enable.
| bool max22200::ChannelConfig::plunger_movement_detection_enabled |
Plunger movement detection enable (low-side only)
| SideMode max22200::ChannelConfig::side_mode |
Side mode: LOW_SIDE (CDR/VDR) or HIGH_SIDE (VDR only)
| bool max22200::ChannelConfig::slew_rate_control_enabled |
Slew rate control enable; reduces EMI; fCHOP < 50 kHz.
| bool max22200::ChannelConfig::trigger_from_pin |
Trigger source (false=SPI ONCH, true=TRIG pin) When true: Channel controlled by TRIGA/TRIGB pins