241 const float fmain_khz = master_clock_80khz ? 80.0f : 100.0f;
247 default:
return fmain_khz / 4.0f;
258 if (full_scale_current_ma == 0)
return 0;
259 if (ma >= full_scale_current_ma)
return 127;
260 uint32_t raw = (ma * 127u + full_scale_current_ma / 2u) / full_scale_current_ma;
261 return raw > 127u ? 127u :
static_cast<uint8_t
>(raw);
274 if (!(percent > 0.0f))
return 0;
275 if (percent >= 100.0f)
return 100;
276 const uint32_t raw =
static_cast<uint32_t
>(percent + 0.5f);
277 return raw > 100u ? 100u :
static_cast<uint8_t
>(raw);
286 return raw >= 100u ? 100.0f :
static_cast<float>(raw);
298 if (ms < 0.0f || ms >= 1000000.0f)
return 255;
299 if (ms == 0.0f)
return 0;
300 float fchop_hz =
static_cast<float>(fchop_khz) * 1000.0f;
301 uint32_t raw =
static_cast<uint32_t
>((ms / 1000.0f) * fchop_hz / 40.0f + 0.5f);
302 if (raw > 254u)
return 255;
303 if (raw == 0u)
return 1;
304 return static_cast<uint8_t
>(raw);
314 const uint32_t fchop_khz =
getChopFreqKhz(master_clock_80khz, cf);
315 const float fchop_hz =
static_cast<float>(fchop_khz) * 1000.0f;
316 return (254.0f * 40.0f / fchop_hz) * 1000.0f;
346 default:
return "Unknown fault";
497 uint32_t
toRegister(uint32_t board_ifs_ma = 0,
bool master_clock_80khz =
false)
const {
500 ? (board_ifs_ma / 2u)
509 }
else if (
hit_setpoint >=
static_cast<float>(ifs_ma)) {
512 uint32_t ma =
static_cast<uint32_t
>(
hit_setpoint + 0.5f);
566 void fromRegister(uint32_t val, uint32_t board_ifs_ma,
bool master_clock_80khz_param) {
585 ? (board_ifs_ma / 2u)
587 if (effective_ifs > 0) {
588 hit_setpoint = (
static_cast<float>(hit_raw) / 127.0f) *
static_cast<float>(effective_ifs);
589 hold_setpoint = (
static_cast<float>(hold_raw) / 127.0f) *
static_cast<float>(effective_ifs);
601 if (hit_time_raw == 0) {
603 }
else if (hit_time_raw == 255) {
607 float fchop_hz =
static_cast<float>(fchop_khz) * 1000.0f;
608 hit_time_ms = (
static_cast<float>(hit_time_raw) * 40.0f / fchop_hz) * 1000.0f;
808 for (uint8_t i = 0; i < 8; i++) {
892 for (uint8_t i = 0; i < 8; i++) {
1004 return "INITIALIZATION_ERROR";
1006 return "COMMUNICATION_ERROR";
1008 return "INVALID_PARAMETER";
1010 return "HARDWARE_FAULT";
1112 const float kfs = hfs ? 7.5f : 15.0f;
Register definitions and constants for MAX22200 IC.
constexpr uint32_t DPM_EN_BIT
DPM_EN bit (0=disabled, 1=enabled)
Definition max22200_registers.hpp:408
constexpr uint32_t HITT_SHIFT
HIT time bit shift.
Definition max22200_registers.hpp:388
constexpr uint32_t HOLD_SHIFT
HOLD current bit shift.
Definition max22200_registers.hpp:377
constexpr uint32_t OL_EN_BIT
OL_EN bit (0=disabled, 1=enabled)
Definition max22200_registers.hpp:405
constexpr uint32_t SRC_BIT
SRC bit (0=fast, 1=slew-rate controlled)
Definition max22200_registers.hpp:402
constexpr uint32_t FREQ_CFG_SHIFT
FREQ_CFG bit shift.
Definition max22200_registers.hpp:398
constexpr uint32_t HIT_SHIFT
HIT current bit shift.
Definition max22200_registers.hpp:384
constexpr uint32_t VDRNCDR_BIT
VDRnCDR bit (0=CDR, 1=VDR)
Definition max22200_registers.hpp:392
constexpr uint32_t TRGNSPI_BIT
TRGnSPI bit (0=SPI ONCH, 1=TRIG pin)
Definition max22200_registers.hpp:381
constexpr uint32_t HHF_EN_BIT
HHF_EN bit (0=disabled, 1=enabled)
Definition max22200_registers.hpp:411
constexpr uint32_t HFS_BIT
HFS bit (0=1x full-scale, 1=0.5x half-scale)
Definition max22200_registers.hpp:374
constexpr uint32_t HSNLS_BIT
HSnLS bit (0=low-side, 1=high-side)
Definition max22200_registers.hpp:395
constexpr uint32_t DPM_TDEB_SHIFT
DPM_TDEB bit shift (bits 7:4)
Definition max22200_registers.hpp:526
constexpr uint32_t DPM_ISTART_SHIFT
DPM_ISTART bit shift (bits 14:8)
Definition max22200_registers.hpp:524
constexpr uint32_t DPM_IPTH_SHIFT
DPM_IPTH bit shift (bits 3:0)
Definition max22200_registers.hpp:528
constexpr uint32_t OCP_SHIFT
OCP bit shift (bits 31:24)
Definition max22200_registers.hpp:455
constexpr uint32_t DPM_SHIFT
DPM bit shift (bits 7:0)
Definition max22200_registers.hpp:461
constexpr uint32_t OLF_SHIFT
OLF bit shift (bits 15:8)
Definition max22200_registers.hpp:459
constexpr uint32_t HHF_SHIFT
HHF bit shift (bits 23:16)
Definition max22200_registers.hpp:457
constexpr uint32_t M_UVM_BIT
UVM fault mask.
Definition max22200_registers.hpp:245
constexpr uint32_t OVT_BIT
Overtemperature fault flag (read-only)
Definition max22200_registers.hpp:259
constexpr uint32_t M_OVT_BIT
OVT fault mask (1=masked, 0=signaled)
Definition max22200_registers.hpp:239
constexpr uint32_t CM32_SHIFT
CM32 bit shift (bits 11:10)
Definition max22200_registers.hpp:253
constexpr uint32_t M_DPM_BIT
DPM fault mask.
Definition max22200_registers.hpp:243
constexpr uint32_t CM54_SHIFT
CM54 bit shift (bits 13:12)
Definition max22200_registers.hpp:251
constexpr uint32_t HHF_BIT
HIT current not reached flag (read-only)
Definition max22200_registers.hpp:262
constexpr uint32_t M_HHF_BIT
HHF fault mask.
Definition max22200_registers.hpp:242
constexpr uint32_t OCP_BIT
Overcurrent fault flag (read-only)
Definition max22200_registers.hpp:260
constexpr uint32_t M_COMF_BIT
Communication fault mask (reset value = 1, masked by default)
Definition max22200_registers.hpp:244
constexpr uint32_t OLF_BIT
Open-load fault flag (read-only)
Definition max22200_registers.hpp:261
constexpr uint32_t CM76_SHIFT
CM76 bit shift (bits 15:14)
Definition max22200_registers.hpp:249
constexpr uint32_t M_OCP_BIT
OCP fault mask.
Definition max22200_registers.hpp:240
constexpr uint32_t ACTIVE_BIT
Global enable bit (write: 0=low-power, 1=normal operation)
Definition max22200_registers.hpp:268
constexpr uint32_t FREQM_BIT
Master frequency (0=100kHz, 1=80kHz)
Definition max22200_registers.hpp:246
constexpr uint32_t CM10_SHIFT
CM10 bit shift (bits 9:8)
Definition max22200_registers.hpp:255
constexpr uint32_t DPM_BIT
Plunger movement detection flag (read-only)
Definition max22200_registers.hpp:263
constexpr uint32_t UVM_BIT
Undervoltage flag (read-only, set at POR, cleared by read)
Definition max22200_registers.hpp:267
constexpr uint32_t COMER_BIT
Definition max22200_registers.hpp:264
constexpr uint32_t ONCH_SHIFT
ONCH bit shift (bits 31:24)
Definition max22200_registers.hpp:235
constexpr uint32_t M_OLF_BIT
OLF fault mask.
Definition max22200_registers.hpp:241
Definition max22200.hpp:78
uint8_t currentMaToRaw(uint32_t full_scale_current_ma, uint32_t ma)
Convert current in mA to 7-bit raw value (0–127) for CDR.
Definition max22200_types.hpp:257
const char * DriverStatusToStr(DriverStatus s)
Return a human-readable string for DriverStatus (for logging and tests)
Definition max22200_types.hpp:999
std::array< ChannelConfig, NUM_CHANNELS_ > ChannelConfigArray
Array type for channel configurations.
Definition max22200_types.hpp:1035
DriveMode
Drive mode enumeration (VDRnCDR bit in CFG_CHx[7])
Definition max22200_types.hpp:98
@ VDR
Voltage Drive Regulation (VDRnCDR = 1) — low-side or high-side.
@ CDR
Current Drive Regulation (VDRnCDR = 0) — low-side only.
ChannelMode
Channel-pair mode (CMxy bits in STATUS[15:8])
Definition max22200_types.hpp:159
@ HBRIDGE
Channels in H-bridge mode (CMxy = 10) — bidirectional drive.
@ INDEPENDENT
Channels independently controlled (CMxy = 00)
@ PARALLEL
Channels in parallel mode (CMxy = 01) — double current.
void(*)(uint8_t channel, FaultType fault_type, void *user_data) FaultCallback
Callback function type for fault events.
Definition max22200_types.hpp:1048
ChannelState
Logical channel state for application callbacks.
Definition max22200_types.hpp:1024
@ DISABLED
Channel OFF (ONCHx = 0)
@ HIT_PHASE
Application-defined: channel in HIT excitation window.
@ ENABLED
Channel ON, not necessarily in HIT or HOLD phase.
@ HOLD_PHASE
Application-defined: channel in HOLD regulation.
const char * FaultTypeToStr(FaultType ft)
Human-readable fault type name (for logging and tests)
Definition max22200_types.hpp:337
uint8_t dutyPercentToRaw(float percent)
Convert a VDR duty cycle in percent to the 7-bit HIT/HOLD field.
Definition max22200_types.hpp:273
SideMode
High-side / Low-side selection (HSnLS bit in CFG_CHx[6])
Definition max22200_types.hpp:123
@ HIGH_SIDE
High-side driver (HSnLS = 1) — VDR only, no CDR/HFS/SRC/DPM.
@ LOW_SIDE
Low-side driver (HSnLS = 0) — supports CDR and VDR.
uint8_t hitTimeMsToRaw(float ms, bool master_clock_80khz, ChopFreq cf)
Convert HIT time in ms to 8-bit raw value (0–255)
Definition max22200_types.hpp:296
DriverStatus
Driver operation result codes.
Definition max22200_types.hpp:985
@ TIMEOUT
Reserved for timed operations (not currently returned)
@ HARDWARE_FAULT
Reserved for hardware fault detection (not currently returned)
@ INITIALIZATION_ERROR
SPI/GPIO setup or ENABLE sequencing failed during init.
@ COMMUNICATION_ERROR
SPI transfer failed or COMER fault byte (0x04) detected.
@ OK
Operation completed successfully.
@ INVALID_PARAMETER
Channel index, IFS, or unit conversion argument out of range.
FullBridgeState
Full-bridge state for a channel pair (datasheet Table 7)
Definition max22200_types.hpp:973
@ Forward
ONCHx=1, ONCHy=0 — forward (control from CFG_CHy)
@ Reverse
ONCHx=0, ONCHy=1 — reverse (control from CFG_CHx)
@ Brake
ONCHx=1, ONCHy=1 — brake (both outputs driven to GND)
@ HiZ
ONCHx=0, ONCHy=0 — high impedance (both switches off)
uint32_t getChopFreqKhz(bool master_clock_80khz, ChopFreq cf)
Get chopping frequency in kHz for conversion (FREQM + FREQ_CFG)
Definition max22200_types.hpp:224
FaultType
Fault type enumeration.
Definition max22200_types.hpp:322
@ HHF
HIT current not reached (HHF)
@ OCP
Overcurrent protection (OCP)
@ UVM
Undervoltage lockout (UVM, from STATUS)
@ OVT
Overtemperature (OVT, from STATUS)
@ OLF
Open-load detection (OLF)
@ DPM
Detection of plunger movement (DPM)
@ COMER
Communication error (COMER, from STATUS)
void(*)(uint8_t channel, ChannelState old_state, ChannelState new_state, void *user_data) StateChangeCallback
Callback function type for channel state changes.
Definition max22200_types.hpp:1061
float getChopFreqKhzExact(bool master_clock_80khz, ChopFreq cf)
Exact chopping frequency in kHz (FREQM + FREQ_CFG, datasheet Table 1)
Definition max22200_types.hpp:240
float dutyRawToPercent(uint8_t raw)
Convert the 7-bit VDR HIT/HOLD field to a duty cycle in percent (datasheet Table 3)
Definition max22200_types.hpp:285
ChopFreq
Chopping frequency setting (FREQ_CFG bits in CFG_CHx[5:4])
Definition max22200_types.hpp:211
@ FMAIN_DIV2
FreqMain / 2 (fCHOP = 50kHz if FREQM=0, 40kHz if FREQM=1). With SRC=1 use only if FREQM=1 (40kHz).
@ FMAIN
FreqMain (fCHOP = 100kHz if FREQM=0, 80kHz if FREQM=1). Not valid with SRC=1.
@ FMAIN_DIV4
FreqMain / 4 (fCHOP = 25kHz if FREQM=0, 20kHz if FREQM=1). Valid with SRC=1.
@ FMAIN_DIV3
FreqMain / 3 (fCHOP = 33.33kHz if FREQM=0, 26.66kHz if FREQM=1). Valid with SRC=1.
constexpr uint8_t NUM_CHANNELS_
Number of channels on the MAX22200.
Definition max22200_registers.hpp:60
float getMaxHitTimeMs(bool master_clock_80khz, ChopFreq cf)
Maximum representable HIT time in ms for raw values 1–254 (255 = continuous).
Definition max22200_types.hpp:313
@ FAULT
nFAULT pin — active-low open-drain fault output (read via GpioRead)
Board/scale configuration for unit-based APIs.
Definition max22200_types.hpp:1089
uint32_t full_scale_current_ma
Full-scale current in mA (from RREF: IFS = KFS×1000/RREF)
Definition max22200_types.hpp:1090
BoardConfig()
Definition max22200_types.hpp:1094
BoardConfig(float rref_kohm, bool hfs)
Construct BoardConfig from RREF resistor value.
Definition max22200_types.hpp:1110
uint32_t max_current_ma
Max current limit in mA (0 = no limit, applies to all channels)
Definition max22200_types.hpp:1091
bool hasMaxCurrentLimit() const
True if a max current limit is configured (0 = no limit)
Definition max22200_types.hpp:1117
bool hasIfsConfigured() const
True if IFS is configured (non-zero)
Definition max22200_types.hpp:1121
uint8_t max_duty_percent
Max duty limit in percent (0 = no limit, applies to VDR mode)
Definition max22200_types.hpp:1092
bool hasMaxDutyLimit() const
True if a max duty limit is configured (0 = no limit)
Definition max22200_types.hpp:1119
uint32_t getMaxCurrentLimitMa() const
Max current limit in mA (0 = no limit)
Definition max22200_types.hpp:1125
uint32_t getFullScaleCurrentMa() const
Full-scale current in mA (IFS from RREF)
Definition max22200_types.hpp:1123
uint8_t getMaxDutyLimitPercent() const
Max duty limit in percent (0 = no limit)
Definition max22200_types.hpp:1127
Channel configuration structure.
Definition max22200_types.hpp:402
float hold_setpoint
HOLD setpoint: CDR = mA, VDR = duty % (0–100)
Definition max22200_types.hpp:407
bool isPlungerMovementDetectionEnabled() const
true when plunger movement detection (DPM_EN) is enabled
Definition max22200_types.hpp:637
void set_hold_ma(float ma)
Set HOLD setpoint in mA (CDR mode)
Definition max22200_types.hpp:474
bool isTriggeredByPin() const
true when channel is controlled via TRIGA/TRIGB pin (TRGnSPI = 1)
Definition max22200_types.hpp:629
float hold_duty_percent() const
HOLD duty cycle in percent (VDR); same storage as hold_setpoint.
Definition max22200_types.hpp:486
bool open_load_detection_enabled
Open-load detection enable.
Definition max22200_types.hpp:421
bool isCdr() const
true when drive_mode is CDR
Definition max22200_types.hpp:615
void fromRegister(uint32_t val, uint32_t board_ifs_ma, bool master_clock_80khz_param)
Parse a 32-bit register value into user units.
Definition max22200_types.hpp:566
float hold_ma() const
HOLD setpoint in mA (CDR) or percent (VDR)
Definition max22200_types.hpp:482
bool half_full_scale
Definition max22200_types.hpp:413
uint32_t toRegister(uint32_t board_ifs_ma=0, bool master_clock_80khz=false) const
Build 32-bit register value from user units.
Definition max22200_types.hpp:497
bool isSlewRateControlEnabled() const
true when SRC (slew rate control) is enabled
Definition max22200_types.hpp:633
static ChannelConfig makeSolenoidCdr(float hit_ma, float hold_ma, float hit_time_ms)
Preset: solenoid in CDR mode (low-side, currents in mA)
Definition max22200_types.hpp:442
bool trigger_from_pin
Definition max22200_types.hpp:415
float hit_ma() const
HIT setpoint in mA (CDR) or percent (VDR)
Definition max22200_types.hpp:480
void set_hit_duty_percent(float pct)
Set HIT duty cycle in percent (VDR mode, 0–100)
Definition max22200_types.hpp:476
bool hit_current_check_enabled
HIT current check enable (HHF fault if IHIT not reached)
Definition max22200_types.hpp:423
bool isHitCurrentCheckEnabled() const
true when HIT current check (HHF_EN) is enabled
Definition max22200_types.hpp:639
float hit_duty_percent() const
HIT duty cycle in percent (VDR); same storage as hit_setpoint.
Definition max22200_types.hpp:484
void set_hit_ma(float ma)
Set HIT setpoint in mA (CDR mode)
Definition max22200_types.hpp:472
float hit_time_ms
Definition max22200_types.hpp:408
bool hasHitTime() const
true when hit_time_ms > 0 (finite HIT window)
Definition max22200_types.hpp:623
SideMode side_mode
Side mode: LOW_SIDE (CDR/VDR) or HIGH_SIDE (VDR only)
Definition max22200_types.hpp:418
bool plunger_movement_detection_enabled
Plunger movement detection enable (low-side only)
Definition max22200_types.hpp:422
bool slew_rate_control_enabled
Slew rate control enable; reduces EMI; fCHOP < 50 kHz.
Definition max22200_types.hpp:420
bool isTriggeredBySpi() const
true when channel is controlled via SPI ONCH (TRGnSPI = 0)
Definition max22200_types.hpp:627
bool isVdr() const
true when drive_mode is VDR
Definition max22200_types.hpp:617
bool isHalfFullScale() const
true when HFS bit is set (half full-scale, low-side only)
Definition max22200_types.hpp:631
bool isHighSide() const
true when side_mode is HIGH_SIDE
Definition max22200_types.hpp:621
bool isLowSide() const
true when side_mode is LOW_SIDE
Definition max22200_types.hpp:619
ChopFreq getChopFreq() const
Chopping frequency config (FREQ_CFG); see ChopFreq enum.
Definition max22200_types.hpp:641
DriveMode drive_mode
Drive mode: CDR (current) or VDR (voltage)
Definition max22200_types.hpp:417
ChannelConfig()
Default constructor — safe defaults.
Definition max22200_types.hpp:428
float hit_setpoint
HIT setpoint: CDR = mA, VDR = duty % (0–100)
Definition max22200_types.hpp:406
ChopFreq chop_freq
Chopping frequency divider (FREQ_CFG[1:0])
Definition max22200_types.hpp:419
bool isOpenLoadDetectionEnabled() const
true when open-load detection (OL_EN) is enabled
Definition max22200_types.hpp:635
bool isContinuousHit() const
true when hit_time_ms indicates continuous HIT (negative or very large)
Definition max22200_types.hpp:625
void set_hold_duty_percent(float pct)
Set HOLD duty cycle in percent (VDR mode, 0–100)
Definition max22200_types.hpp:478
static ChannelConfig makeSolenoidVdr(float hit_pct, float hold_pct, float hit_time_ms)
Preset: solenoid in VDR mode (low-side, duty percent)
Definition max22200_types.hpp:459
DPM (Detection of Plunger Movement) algorithm configuration.
Definition max22200_types.hpp:940
uint8_t getPlungerMovementCurrentThreshold() const
Definition max22200_types.hpp:964
uint8_t getPlungerMovementStartCurrent() const
Definition max22200_types.hpp:962
uint8_t plunger_movement_start_current
DPM_ISTART (0-127) — starting current for dip search.
Definition max22200_types.hpp:941
uint32_t toRegister() const
Encode writable CFG_DPM fields to a 32-bit register value.
Definition max22200_types.hpp:949
uint8_t plunger_movement_debounce_time
DPM_TDEB (0-15) — min dip duration in chopping periods.
Definition max22200_types.hpp:942
uint8_t plunger_movement_current_threshold
DPM_IPTH (0-15) — min dip amplitude threshold.
Definition max22200_types.hpp:943
uint8_t getPlungerMovementDebounceTime() const
Definition max22200_types.hpp:963
void fromRegister(uint32_t val)
Parse a 32-bit CFG_DPM register value.
Definition max22200_types.hpp:956
DpmConfig()
Definition max22200_types.hpp:945
Driver runtime statistics.
Definition max22200_types.hpp:1165
DriverStatistics()
Definition max22200_types.hpp:1172
float getSuccessRate() const
Definition max22200_types.hpp:1176
uint32_t fault_events
Reserved (not incremented by current driver)
Definition max22200_types.hpp:1168
uint32_t total_transfers
Total SPI operations attempted.
Definition max22200_types.hpp:1166
uint32_t getFailedTransfers() const
Failed SPI or validation operations.
Definition max22200_types.hpp:1188
bool hasFailures() const
true if failed_transfers > 0
Definition max22200_types.hpp:1182
uint32_t state_changes
Reserved (not incremented by current driver)
Definition max22200_types.hpp:1169
uint32_t uptime_ms
Reserved (not incremented by current driver)
Definition max22200_types.hpp:1170
uint32_t getUptimeMs() const
Uptime counter in ms (reserved, always 0 in current driver)
Definition max22200_types.hpp:1194
uint32_t failed_transfers
SPI or parameter failures counted by updateStatistics()
Definition max22200_types.hpp:1167
uint32_t getFaultEvents() const
Fault event counter (reserved, always 0 in current driver)
Definition max22200_types.hpp:1190
bool isHealthy() const
true if failed_transfers == 0
Definition max22200_types.hpp:1184
uint32_t getTotalTransfers() const
Total SPI transfer attempts.
Definition max22200_types.hpp:1186
uint32_t getStateChanges() const
State change counter (reserved, always 0 in current driver)
Definition max22200_types.hpp:1192
Duty cycle limits (δMIN, δMAX) for a given configuration.
Definition max22200_types.hpp:1136
uint8_t max_percent
Maximum duty cycle in percent (δMAX)
Definition max22200_types.hpp:1138
uint8_t getMaxPercent() const
Maximum duty cycle in percent (δMAX)
Definition max22200_types.hpp:1145
uint8_t getMinPercent() const
Minimum duty cycle in percent (δMIN)
Definition max22200_types.hpp:1143
DutyLimits()
Definition max22200_types.hpp:1140
bool inRange(float percent) const
True if percent is within [min_percent, max_percent].
Definition max22200_types.hpp:1147
uint8_t min_percent
Minimum duty cycle in percent (δMIN)
Definition max22200_types.hpp:1137
float clamp(float percent) const
Clamp percent to [min_percent, max_percent].
Definition max22200_types.hpp:1151
Per-channel fault information from FAULT register (0x09)
Definition max22200_types.hpp:859
bool hasOpenLoadFaultOnChannel(uint8_t ch) const
Definition max22200_types.hpp:917
uint8_t overcurrent_channel_mask
OCP per-channel bitmask (bit N = channel N)
Definition max22200_types.hpp:860
bool hasOvercurrent() const
Definition max22200_types.hpp:903
bool hasPlungerMovementFaultOnChannel(uint8_t ch) const
Definition max22200_types.hpp:920
bool hasPlungerMovementFault() const
Definition max22200_types.hpp:906
FaultStatus()
Definition max22200_types.hpp:865
bool hasOpenLoadFault() const
Definition max22200_types.hpp:905
bool hasOvercurrentOnChannel(uint8_t ch) const
Definition max22200_types.hpp:911
bool hasHitNotReached() const
Definition max22200_types.hpp:904
bool hasFault() const
Check if any per-channel fault is active.
Definition max22200_types.hpp:882
uint8_t plunger_movement_fault_channel_mask
DPM per-channel bitmask (bit N = channel N)
Definition max22200_types.hpp:863
void fromRegister(uint32_t val)
Parse a 32-bit FAULT register value into per-channel bitmasks.
Definition max22200_types.hpp:872
uint8_t channelsWithAnyFault() const
Definition max22200_types.hpp:923
uint8_t getFaultCount() const
Count total per-channel faults.
Definition max22200_types.hpp:890
uint8_t open_load_fault_channel_mask
OLF per-channel bitmask (bit N = channel N)
Definition max22200_types.hpp:862
bool hasHitNotReachedOnChannel(uint8_t ch) const
Definition max22200_types.hpp:914
bool hasFaultOnChannel(uint8_t ch) const
Definition max22200_types.hpp:907
uint8_t hit_not_reached_channel_mask
HHF per-channel bitmask (bit N = channel N)
Definition max22200_types.hpp:861
STATUS register structure.
Definition max22200_types.hpp:683
ChannelMode getChannelPairMode54() const
Definition max22200_types.hpp:826
bool hasPlungerMovementFault() const
Definition max22200_types.hpp:799
ChannelMode getChannelPairMode76() const
Definition max22200_types.hpp:825
bool hit_not_reached_masked
HHF fault mask; when true HHF does not assert FAULT pin.
Definition max22200_types.hpp:693
ChannelMode channel_pair_mode_10
CH0/CH1 pair mode.
Definition max22200_types.hpp:703
bool open_load_fault
OLF fault flag (read-only); load disconnected if OL enabled.
Definition max22200_types.hpp:711
bool hasUndervoltage() const
Definition max22200_types.hpp:801
bool hit_not_reached
HHF fault flag (read-only); IHIT not reached by end of tHIT.
Definition max22200_types.hpp:712
void fromRegister(uint32_t val)
Parse a 32-bit STATUS register value into this structure.
Definition max22200_types.hpp:760
bool hasOvercurrent() const
Definition max22200_types.hpp:796
bool overcurrent
OCP fault flag (read-only); output exceeded OCP level.
Definition max22200_types.hpp:710
bool is80KHzBase() const
Definition max22200_types.hpp:822
bool isOvertemperatureMasked() const
Definition max22200_types.hpp:814
bool isChannelOn(uint8_t ch) const
Definition max22200_types.hpp:803
ChannelMode channel_pair_mode_76
CH6/CH7 pair mode; change only when both CH6 and CH7 are OFF.
Definition max22200_types.hpp:700
bool isOvercurrentMasked() const
Definition max22200_types.hpp:815
bool is100KHzBase() const
Definition max22200_types.hpp:823
bool isHitNotReachedMasked() const
Definition max22200_types.hpp:817
uint8_t getChannelsOnMask() const
Definition max22200_types.hpp:829
ChannelMode getChannelPairMode32() const
Definition max22200_types.hpp:827
bool hasHitNotReached() const
Definition max22200_types.hpp:798
uint8_t channelCountOn() const
Definition max22200_types.hpp:806
bool master_clock_80khz
Master clock base (false=100kHz, true=80kHz); affects fCHOP.
Definition max22200_types.hpp:697
bool hasOvertemperature() const
Definition max22200_types.hpp:795
bool open_load_fault_masked
OLF fault mask; when true OLF does not assert FAULT pin.
Definition max22200_types.hpp:692
bool undervoltage_masked
UVM fault mask; when true UVM does not assert FAULT pin.
Definition max22200_types.hpp:696
bool communication_error
COMER flag (read-only); SPI error detected.
Definition max22200_types.hpp:714
bool communication_error_masked
COMER mask (default=true); when true COMER does not assert FAULT pin.
Definition max22200_types.hpp:695
bool isUndervoltageMasked() const
Definition max22200_types.hpp:820
bool hasOpenLoadFault() const
Definition max22200_types.hpp:797
bool overcurrent_masked
OCP fault mask; when true OCP does not assert FAULT pin.
Definition max22200_types.hpp:691
bool undervoltage
UVM fault flag (read-only); clear by reading STATUS at init.
Definition max22200_types.hpp:715
bool isActive() const
Definition max22200_types.hpp:802
bool hasCommunicationError() const
Definition max22200_types.hpp:800
bool overtemperature
OVT fault flag (read-only); die over temp.
Definition max22200_types.hpp:709
ChannelMode channel_pair_mode_54
CH4/CH5 pair mode.
Definition max22200_types.hpp:701
ChannelMode channel_pair_mode_32
CH2/CH3 pair mode.
Definition max22200_types.hpp:702
bool overtemperature_masked
OVT fault mask; when true OVT does not assert FAULT pin.
Definition max22200_types.hpp:690
bool isCommunicationErrorMasked() const
Definition max22200_types.hpp:819
uint8_t channels_on_mask
Definition max22200_types.hpp:685
bool plunger_movement_fault
DPM fault flag (read-only); no valid plunger movement.
Definition max22200_types.hpp:713
bool isOpenLoadFaultMasked() const
Definition max22200_types.hpp:816
uint32_t toRegister() const
Build 32-bit STATUS register value from writable fields.
Definition max22200_types.hpp:737
bool isPlungerMovementFaultMasked() const
Definition max22200_types.hpp:818
ChannelMode getChannelPairMode10() const
Definition max22200_types.hpp:828
bool active
Global enable (0=low-power, 1=normal); set to 1 during init.
Definition max22200_types.hpp:706
bool plunger_movement_fault_masked
DPM fault mask; when true DPM does not assert FAULT pin.
Definition max22200_types.hpp:694
StatusConfig()
Default constructor.
Definition max22200_types.hpp:720
bool hasFault() const
Check if any global fault flag in byte 0 is active.
Definition max22200_types.hpp:788