|
| enum class | hf_valve_err_t : uint8_t {
VALVE_SUCCESS = 0
, VALVE_ERR_NOT_INITIALIZED = 1
, VALVE_ERR_DRIVER_NOT_AVAILABLE = 2
, VALVE_ERR_INVALID_CHANNEL = 3
,
VALVE_ERR_CHANNEL_TYPE_MISMATCH = 4
, VALVE_ERR_INVALID_PARAMETER = 5
, VALVE_ERR_NULL_POINTER = 6
, VALVE_ERR_SPI_BUS_ERROR = 10
,
VALVE_ERR_SPI_TIMEOUT = 11
, VALVE_ERR_SPI_TRANSFER_FAILED = 12
, VALVE_ERR_SPI_CRC_ERROR = 13
, VALVE_ERR_SPI_FRAME_ERROR = 14
,
VALVE_ERR_HARDWARE_FAULT = 20
, VALVE_ERR_DEVICE_NOT_RESPONDING = 21
, VALVE_ERR_WRONG_DEVICE_ID = 22
, VALVE_ERR_REGISTER_ERROR = 23
,
VALVE_ERR_CONFIGURATION_ERROR = 24
, VALVE_ERR_WRONG_MODE = 25
, VALVE_ERR_WRITE_TO_READ_ONLY = 26
, VALVE_ERR_TIMEOUT = 27
,
VALVE_ERR_MUTEX_TIMEOUT = 30
, VALVE_ERR_DEPENDENCY_NOT_READY = 31
, VALVE_ERR_UNKNOWN = 255
} |
| | Unified valve error codes for the HardFOC Flux V1 platform. More...
|
| |
| enum class | ValveDriverType : uint8_t { MAX22200 = 0
, TLE92466 = 1
, UNKNOWN = 0xFF
} |
| | Identifies which driver IC backend a valve channel belongs to. More...
|
| |
| enum class | ValveChannel : uint8_t {
SOL_CH0 = 0
, SOL_CH1 = 1
, SOL_CH2 = 2
, SOL_CH3 = 3
,
SOL_CH4 = 4
, SOL_CH5 = 5
, SOL_CH6 = 6
, SOL_CH7 = 7
,
PROP_CH0 = 8
, PROP_CH1 = 9
, PROP_CH2 = 10
, PROP_CH3 = 11
,
PROP_CH4 = 12
, PROP_CH5 = 13
, CHANNEL_COUNT = 14
} |
| | Unified valve channel identifier — covers all 14 channels. More...
|
| |
Unified valve management system for the HardFOC Flux V1 platform.
Manages all valve outputs on the Flux board through two driver ICs:
- MAX22200 — 8-channel octal solenoid/motor driver
- On/off solenoid control with CDR (current drive regulation)
- HIT/HOLD current profiles for fast actuation
- Best for: standard on/off solenoid valves
- TLE92466ED — 6-channel low-side driver with current regulation
- Proportional current control per channel
- PWM-based control for proportional valves
- Best for: proportional solenoid valves, PWM-controlled actuators
The ValveManager provides a unified, type-safe API to configure and control all 14 valve channels through a single interface. Each channel is identified by a compile-time enum and its driver type is resolved at registration.
Design principles:
- All channel descriptors live in fixed-size arrays.
- Both handlers are members (
std::optional, constructed in place during EnsureInitialized()): no heap allocation, before or after init.
- Fail-closed bring-up:
EnsureInitialized() succeeds only when every fitted driver IC came up. Otherwise the manager stays uninitialised, every channel operation is refused, and GetManagerError() says why. A bank that did come up stays reachable through its handler accessor, for diagnosis only.
- O(1) index-based channel lookup; string lookups scan a small constexpr table.
- Thread-safe via RtosMutex on state-changing operations.
- Author
- HardFOC Team
- Date
- 2026
- Version
- 1.0