|
HF-MAX22200 Driver 0.1.0-dev
HF-MAX22200 C++ Driver
|
Namespaces | |
| namespace | CfgChReg |
| Channel configuration register bit field definitions. | |
| namespace | CfgDpmReg |
| CFG_DPM register bit field definitions. | |
| namespace | CommandReg |
| Command Register bit field definitions and helper functions. | |
| namespace | FaultReg |
| FAULT register bit field definitions. | |
| namespace | RegBank |
| Register bank addresses for MAX22200. | |
| namespace | StatusReg |
| STATUS register bit field definitions. | |
Classes | |
| struct | BoardConfig |
| Board/scale configuration for unit-based APIs. More... | |
| struct | ChannelConfig |
| Channel configuration structure. More... | |
| struct | DpmConfig |
| DPM (Detection of Plunger Movement) algorithm configuration. More... | |
| struct | DriverStatistics |
| Driver statistics structure. More... | |
| struct | DutyLimits |
| Duty cycle limits (δMIN, δMAX) for a given configuration. More... | |
| struct | FaultStatus |
| Per-channel fault information from FAULT register (0x09) More... | |
| class | MAX22200 |
| class | SpiInterface |
| CRTP-based template interface for SPI communication. More... | |
| struct | StatusConfig |
| STATUS register structure. More... | |
Typedefs | |
| using | ChannelConfigArray = std::array<ChannelConfig, NUM_CHANNELS_> |
| Array type for channel configurations. | |
| using | FaultCallback |
| Callback function type for fault events. | |
| using | StateChangeCallback |
| Callback function type for channel state changes. | |
Enumerations | |
| enum class | CtrlPin : uint8_t { ENABLE = 0 , FAULT , CMD } |
| Identifies the hardware control pins of the MAX22200. More... | |
| enum class | GpioSignal : uint8_t { INACTIVE = 0 , ACTIVE = 1 } |
| Abstract signal level for control pins. More... | |
| enum class | DriveMode : uint8_t { CDR = 0 , VDR = 1 } |
| Drive mode enumeration (VDRnCDR bit in CFG_CHx[7]) More... | |
| enum class | SideMode : uint8_t { LOW_SIDE = 0 , HIGH_SIDE = 1 } |
| High-side / Low-side selection (HSnLS bit in CFG_CHx[6]) More... | |
| enum class | ChannelMode : uint8_t { INDEPENDENT = 0 , PARALLEL = 1 , HBRIDGE = 2 } |
| Channel-pair mode (CMxy bits in STATUS[15:8]) More... | |
| enum class | ChopFreq : uint8_t { FMAIN_DIV4 = 0 , FMAIN_DIV3 = 1 , FMAIN_DIV2 = 2 , FMAIN = 3 } |
| Chopping frequency setting (FREQ_CFG bits in CFG_CHx[5:4]) More... | |
| enum class | FaultType : uint8_t { OCP = 0 , HHF = 1 , OLF = 2 , DPM = 3 , OVT = 4 , UVM = 5 , COMER = 6 } |
| Fault type enumeration. More... | |
| enum class | FullBridgeState : uint8_t { HiZ = 0 , Forward = 1 , Reverse = 2 , Brake = 3 } |
| Full-bridge state for a channel pair (datasheet Table 7) More... | |
| enum class | DriverStatus : uint8_t { OK = 0 , INITIALIZATION_ERROR , COMMUNICATION_ERROR , INVALID_PARAMETER , HARDWARE_FAULT , TIMEOUT } |
| Driver status enumeration. More... | |
| enum class | ChannelState : uint8_t { DISABLED = 0 , ENABLED , HIT_PHASE , HOLD_PHASE , FAULT } |
| Channel state enumeration. More... | |
Functions | |
| const char * | GetDriverVersion () noexcept |
| constexpr uint8_t | getChannelCfgBank (uint8_t channel) |
| uint32_t | getChopFreqKhz (bool master_clock_80khz, ChopFreq cf) |
| Get chopping frequency in kHz for conversion (FREQM + FREQ_CFG) | |
| 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. | |
| uint8_t | hitTimeMsToRaw (float ms, bool master_clock_80khz, ChopFreq cf) |
| Convert HIT time in ms to 8-bit raw value (0–255) | |
| float | getMaxHitTimeMs (bool master_clock_80khz, ChopFreq cf) |
| Maximum representable HIT time in ms for raw values 1–254 (255 = continuous). | |
| const char * | FaultTypeToStr (FaultType ft) |
| Human-readable fault type name (for logging and tests) | |
| const char * | DriverStatusToStr (DriverStatus s) |
| Return a human-readable string for DriverStatus (for logging and tests) | |
Variables | |
| constexpr uint8_t | NUM_CHANNELS_ = 8 |
| Number of channels on the MAX22200. | |
| constexpr uint32_t | MAX_SPI_FREQ_STANDALONE_ = 10000000 |
| Maximum SPI clock frequency without daisy chaining (Hz) | |
| constexpr uint32_t | MAX_SPI_FREQ_DAISY_CHAIN_ = 5000000 |
| Maximum SPI clock frequency with daisy chaining (Hz) | |
| using max22200::ChannelConfigArray = std::array<ChannelConfig, NUM_CHANNELS_> |
Array type for channel configurations.
Callback function type for fault events.
Callback function type for channel state changes.
|
strong |
Channel-pair mode (CMxy bits in STATUS[15:8])
Configures pairs of contiguous channels (0-1, 2-3, 4-5, 6-7) for different operating modes. These bits can only be written when both channels in the pair are OFF (ONCHx = 0, ONCHy = 0).
|
strong |
|
strong |
Chopping frequency setting (FREQ_CFG bits in CFG_CHx[5:4])
Selects the chopping frequency divider relative to the master frequency (FREQM). The actual chopping frequency fCHOP depends on both FREQM (STATUS[16]) and FREQ_CFG:
| FREQM | FREQ_CFG | fCHOP (kHz) | Period (μs) |
|---|---|---|---|
| 0 | 00 | 25 | 40 |
| 0 | 01 | 33.33 | 30 |
| 0 | 10 | 50 | 20 |
| 0 | 11 | 100 | 10 |
| 1 | 00 | 20 | 50 |
| 1 | 01 | 26.66 | 37.5 |
| 1 | 10 | 40 | 25 |
| 1 | 11 | 80 | 12.5 |
Minimum and maximum duty cycles (δMIN, δMAX) depend on FREQM, FREQ_CFG, and SRC:
SRC mode is only available for switching frequencies less than 50 kHz. When SRC = 1, use only FREQ_CFG that yields fCHOP < 50 kHz:
|
strong |
Identifies the hardware control pins of the MAX22200.
Used with GpioSet() / GpioRead() / GpioSetActive() / GpioSetInactive() to control the IC's dedicated GPIO pins through the SpiInterface.
The mapping from GpioSignal::ACTIVE / INACTIVE to physical HIGH / LOW is determined by the platform bus implementation, based on the board's active-level design:
| Enumerator | |
|---|---|
| ENABLE | Output enable (active-high on the physical pin) |
| FAULT | Fault status output (active-low, open-drain) |
| CMD | Command mode select (HIGH = SPI register, LOW = direct drive) |
|
strong |
Drive mode enumeration (VDRnCDR bit in CFG_CHx[7])
Determines how the channel regulates output current/voltage.
| Enumerator | |
|---|---|
| CDR | Current Drive Regulation (VDRnCDR = 0) — low-side only. |
| VDR | Voltage Drive Regulation (VDRnCDR = 1) — low-side or high-side. |
|
strong |
|
strong |
Fault type enumeration.
|
strong |
Full-bridge state for a channel pair (datasheet Table 7)
For a pair (x, y) = (0,1), (2,3), (4,5), or (6,7): ONCHy and ONCHx determine the bridge state. Forward uses CFG_CHy; Reverse uses CFG_CHx.
|
strong |
|
strong |
High-side / Low-side selection (HSnLS bit in CFG_CHx[6])
Determines whether the channel drives the load connected to the positive rail (low-side) or to ground (high-side).
| Enumerator | |
|---|---|
| LOW_SIDE | Low-side driver (HSnLS = 0) — supports CDR and VDR. |
| HIGH_SIDE | High-side driver (HSnLS = 1) — VDR only, no CDR/HFS/SRC/DPM. |
Convert current in mA to 7-bit raw value (0–127) for CDR.
| full_scale_current_ma | Full-scale current in mA (must be > 0) |
| ma | Desired current in mA |
|
inline |
Return a human-readable string for DriverStatus (for logging and tests)
| s | Status value |
Human-readable fault type name (for logging and tests)
| ft | FaultType value |
Get chopping frequency in kHz for conversion (FREQM + FREQ_CFG)
| master_clock_80khz | false = 100 kHz base, true = 80 kHz base |
| cf | Channel ChopFreq (FREQ_CFG) |
Maximum representable HIT time in ms for raw values 1–254 (255 = continuous).
| master_clock_80khz | false = 100 kHz base, true = 80 kHz base |
| cf | Chopping frequency (FREQ_CFG) |
Convert HIT time in ms to 8-bit raw value (0–255)
| ms | HIT time in ms (0 = no HIT; < 0 or very large = continuous, 255) |
| master_clock_80khz | false = 100 kHz base, true = 80 kHz base |
| cf | Chopping frequency (FREQ_CFG) |
Maximum SPI clock frequency with daisy chaining (Hz)
When multiple MAX22200 devices are connected in a daisy chain, the maximum SPI clock frequency is reduced to 5 MHz.
Maximum SPI clock frequency without daisy chaining (Hz)
Per datasheet: "The SPI supports daisy-chain configurations and can operate up to 5MHz" (with daisy chain), and "10MHz without Daisy Chain" (standalone).