|
HF-MAX22200 Driver 0.1.0-dev
HF-MAX22200 C++ Driver
|
Portable C++20 driver for the MAX22200 octal solenoid and motor driver with SPI interface
📖 📚🌐 Live Complete Documentation - Interactive guides, examples, and step-by-step tutorials
HF-MAX22200 is a portable C++20 driver for the MAX22200 octal (eight-channel) solenoid and motor driver IC. The MAX22200 features eight half-bridges, each capable of handling up to 36V and 1A RMS, with integrated current sensing, current/voltage regulation, and comprehensive protection features.
The driver uses a CRTP-based SpiInterface for hardware abstraction, allowing it to run on any platform (ESP32, STM32, Arduino, etc.) with zero runtime overhead. It implements all major features from the MAX22200 datasheet including channel configuration, current/voltage regulation modes, integrated current sensing (ICS), fault detection, and callback support for event-driven programming.
For detailed setup, see Installation and Quick Start Guide.
For detailed installation instructions, see docs/installation.md.
| Method | Description |
|---|---|
Initialize() / Deinitialize() | Initialize or shut down (ENABLE, STATUS ACTIVE) |
ConfigureChannel() | Configure a channel (CFG_CHx) |
EnableChannel() / DisableChannel() | Turn a channel on or off |
EnableAllChannels() / DisableAllChannels() | Turn all channels on or off |
SetChannelsOn(mask) | Set which channels are on (bitmask) |
ReadStatus() / WriteStatus() | Read/write STATUS (ONCH, fault masks, ACTIVE) |
ReadFaultRegister() / ClearAllFaults() | Read or clear per-channel faults (OCP, HHF, OLF, DPM) |
SetBoardConfig() | Set IFS and limits for mA/% APIs |
SetHitCurrentMa() / GetHitCurrentMa() | Set/get current in mA (CDR) |
ConfigureDpm() | Configure plunger movement detection in mA/ms |
EnableDevice() / DisableDevice() | ENABLE pin on/off |
SetFaultCallback() | Fault event callback; use FaultTypeToStr() for names |
GetStatistics() | Driver statistics |
For complete API documentation, see docs/api_reference.md.
For ESP32 examples, see the examples/esp32 directory. Additional examples for other platforms are available in the examples directory.
Detailed example walkthroughs are available in docs/examples.md.
For complete documentation, see the docs directory.
| Resource | Link |
|---|---|
| ADI/Maxim MAX22200 product page | https://www.analog.com/en/products/max22200.html |
| MAX22200 datasheet (ADI) | https://www.analog.com/media/en/technical-documentation/data-sheets/max22200.pdf |
| ESP-IDF SPI master | https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-reference/peripherals/spi_master.html |
| C++20 language reference | https://en.cppreference.com/w/cpp/20 |
Pull requests and suggestions are welcome! Please follow the existing code style and include tests for new features.
This project is licensed under the GNU General Public License v3.0. See the [LICENSE](LICENSE) file for details.