HF-MAX22200 Driver 0.1.0-dev
HF-MAX22200 C++ Driver
Loading...
Searching...
No Matches
esp32_max22200_test_config.hpp
Go to the documentation of this file.
1
13#pragma once
14
15#include <cstdint>
16
17//==============================================================================
18// COMPILE-TIME CONFIGURATION FLAGS
19//==============================================================================
20
34#ifndef ESP32_MAX22200_ENABLE_DETAILED_SPI_LOGGING
35#define ESP32_MAX22200_ENABLE_DETAILED_SPI_LOGGING 0
36#endif
37
51#ifndef ESP32_MAX22200_ENABLE_VERBOSE_BUS_LOGGING
52#define ESP32_MAX22200_ENABLE_VERBOSE_BUS_LOGGING 1
53#endif
54
56
62struct SPIPins {
63 static constexpr uint8_t MISO = 35;
64 static constexpr uint8_t MOSI = 37;
65 static constexpr uint8_t SCLK = 36;
66 static constexpr uint8_t CS = 38;
67};
68
76 static constexpr int8_t ENABLE = 2;
77 static constexpr int8_t FAULT = 42;
78 static constexpr int8_t CMD = 39;
79 static constexpr int8_t TRIGA = 40;
80 static constexpr int8_t TRIGB = 41;
81};
82
94struct SPIParams {
95 static constexpr uint32_t FREQUENCY = 1000000;
96 static constexpr uint8_t MODE = 0;
97 static constexpr uint8_t QUEUE_SIZE = 1;
98 static constexpr uint8_t CS_ENA_PRETRANS = 1;
99 static constexpr uint8_t CS_ENA_POSTTRANS = 1;
100};
101
110 static constexpr float RREF_KOHM = 15.0f;
111 static constexpr bool HFS = false;
112 static constexpr uint8_t NUM_CHANNELS = 8;
113 static constexpr uint32_t MAX_CURRENT_MA = 800;
114 static constexpr uint8_t MAX_DUTY_PERCENT = 90;
115};
116
125 static constexpr bool USE_CDR = false;
126 static constexpr float HIT_TIME_MS = 100.0f;
127
129 static constexpr float HIT_CURRENT_MA = 500.0f;
130 static constexpr float HOLD_CURRENT_MA = 250.0f;
131
133 static constexpr float HIT_PERCENT = 100.0f;
134 static constexpr float HOLD_PERCENT = 50.0f;
135
136 static constexpr uint8_t CHANNEL = 0;
137};
138
148 static constexpr uint32_t SEQUENTIAL_HIT_MS = 200;
149 static constexpr uint32_t SEQUENTIAL_GAP_MS = 80;
150 static constexpr uint32_t PARALLEL_HOLD_MS = 500;
151 static constexpr uint32_t PATTERN_PAUSE_MS = 400;
153 static constexpr uint32_t LOOP_COUNT = 10;
154};
155
156} // namespace MAX22200_TestConfig
157
158//==============================================================================
159// Compile-time validation
160//==============================================================================
161
162static_assert(MAX22200_TestConfig::SPIParams::FREQUENCY <= 10000000,
163 "SPI frequency exceeds MAX22200 standalone maximum of 10MHz");
164
165static_assert(MAX22200_TestConfig::SPIParams::MODE == 0,
166 "MAX22200 requires SPI Mode 0 (CPOL=0, CPHA=0) per datasheet");
167
169 "NUM_CHANNELS must be 1..8 (MAX22200 has 8 channels)");
170
174#define MAX22200_VALIDATE_GPIO(pin) \
175 static_assert((pin) >= 0 && (pin) <= 48, "Invalid GPIO pin number for ESP32-C6")
Definition esp32_max22200_test_config.hpp:55
Board configuration for tests (single board: RREF via short = 15 kΩ)
Definition esp32_max22200_test_config.hpp:109
static constexpr float RREF_KOHM
RREF in kΩ (short default = 15 kΩ → IFS = 1000 mA)
Definition esp32_max22200_test_config.hpp:110
static constexpr uint32_t MAX_CURRENT_MA
Optional safety limit (0 = no limit)
Definition esp32_max22200_test_config.hpp:113
static constexpr uint8_t MAX_DUTY_PERCENT
Optional for VDR (0 = no limit)
Definition esp32_max22200_test_config.hpp:114
static constexpr bool HFS
Half full-scale (false = full-scale)
Definition esp32_max22200_test_config.hpp:111
static constexpr uint8_t NUM_CHANNELS
Channels exposed on this board (MAX22200 has 8 max)
Definition esp32_max22200_test_config.hpp:112
Parker C21 valve Hit and Hold (compile-time CDR vs VDR)
Definition esp32_max22200_test_config.hpp:124
static constexpr float HIT_CURRENT_MA
CDR mode: hit and hold current in mA (board IFS must be >= these)
Definition esp32_max22200_test_config.hpp:129
static constexpr bool USE_CDR
true = CDR (current), false = VDR (PWM duty)
Definition esp32_max22200_test_config.hpp:125
static constexpr float HIT_TIME_MS
Min hit time per C21 (ms)
Definition esp32_max22200_test_config.hpp:126
static constexpr uint8_t CHANNEL
Channel used for C21 (low-side)
Definition esp32_max22200_test_config.hpp:136
static constexpr float HOLD_CURRENT_MA
Definition esp32_max22200_test_config.hpp:130
static constexpr float HOLD_PERCENT
Definition esp32_max22200_test_config.hpp:134
static constexpr float HIT_PERCENT
VDR mode only: duty cycle 0–100%.
Definition esp32_max22200_test_config.hpp:133
Control GPIO Pins for MAX22200.
Definition esp32_max22200_test_config.hpp:75
static constexpr int8_t TRIGA
TRIGA trigger input.
Definition esp32_max22200_test_config.hpp:79
static constexpr int8_t FAULT
Fault output (nFAULT, active-low, open-drain)
Definition esp32_max22200_test_config.hpp:77
static constexpr int8_t TRIGB
TRIGB trigger input.
Definition esp32_max22200_test_config.hpp:80
static constexpr int8_t ENABLE
Enable pin (active-high)
Definition esp32_max22200_test_config.hpp:76
static constexpr int8_t CMD
CMD pin (HIGH=Command Reg write, LOW=data transfer)
Definition esp32_max22200_test_config.hpp:78
SPI Communication Parameters.
Definition esp32_max22200_test_config.hpp:94
static constexpr uint8_t CS_ENA_PRETRANS
CS setup cycles before transaction.
Definition esp32_max22200_test_config.hpp:98
static constexpr uint8_t QUEUE_SIZE
Transaction queue size.
Definition esp32_max22200_test_config.hpp:97
static constexpr uint8_t MODE
SPI Mode 0 (CPOL=0, CPHA=0) per datasheet.
Definition esp32_max22200_test_config.hpp:96
static constexpr uint32_t FREQUENCY
1MHz SPI frequency
Definition esp32_max22200_test_config.hpp:95
static constexpr uint8_t CS_ENA_POSTTRANS
CS hold cycles after transaction.
Definition esp32_max22200_test_config.hpp:99
SPI pin assignment for MAX22200 (SDI/SDO/SCK/CSB)
Definition esp32_max22200_test_config.hpp:62
static constexpr uint8_t SCLK
GPIO36 - SPI Clock (SCK)
Definition esp32_max22200_test_config.hpp:65
static constexpr uint8_t MOSI
GPIO37 - SPI MOSI (SDI to MAX22200)
Definition esp32_max22200_test_config.hpp:64
static constexpr uint8_t MISO
GPIO35 - SPI MISO (SDO from MAX22200)
Definition esp32_max22200_test_config.hpp:63
static constexpr uint8_t CS
GPIO38 - Chip Select (CSB, active low)
Definition esp32_max22200_test_config.hpp:66
Solenoid valve test pattern timing (used by max22200_solenoid_valve_test)
Definition esp32_max22200_test_config.hpp:147
static constexpr uint32_t PATTERN_PAUSE_MS
Pause (ms) between pattern runs.
Definition esp32_max22200_test_config.hpp:151
static constexpr uint32_t SEQUENTIAL_GAP_MS
Delay (ms) between channels in sequential pattern.
Definition esp32_max22200_test_config.hpp:149
static constexpr uint32_t SEQUENTIAL_HIT_MS
Time (ms) each channel is on in sequential pattern.
Definition esp32_max22200_test_config.hpp:148
static constexpr uint32_t LOOP_COUNT
Definition esp32_max22200_test_config.hpp:153
static constexpr uint32_t PARALLEL_HOLD_MS
Time (ms) all channels on in parallel pattern.
Definition esp32_max22200_test_config.hpp:150