Refactor VND7050AJ sensor configuration to eliminate redundancy
- Create centralized sensor multiplexer node (vnd7050aj_mux) with shared configuration - Consolidate ADC channel, GPIO pins, and reference voltage in single location - Update sensor bindings to reference centralized mux via sensor-mux property - Add channel-based sensor selection using mux-channel property (0-3) - Refactor ADC sensor library to use centralized GPIO and channel control - Update valve library to use new vnd7050aj_mux node reference - Eliminate duplicate ADC/GPIO definitions between voltage and current sensors - Ensure configuration consistency and prevent mismatched settings Benefits: - Single source of truth for VND7050AJ hardware configuration - Impossible to have inconsistent GPIO/ADC settings between sensors - Simplified maintenance and scalability for additional sensors - Clean channel-based multiplexer selection interface
This commit is contained in:
@@ -17,12 +17,12 @@
|
||||
LOG_MODULE_REGISTER(valve, LOG_LEVEL_INF);
|
||||
|
||||
static const struct valve_gpios valve_gpios = {
|
||||
.in0 = GPIO_DT_SPEC_GET(DT_NODELABEL(vnd7050aj), in0_gpios),
|
||||
.in1 = GPIO_DT_SPEC_GET(DT_NODELABEL(vnd7050aj), in1_gpios),
|
||||
.rst = GPIO_DT_SPEC_GET(DT_NODELABEL(vnd7050aj), rst_gpios),
|
||||
.sen = GPIO_DT_SPEC_GET(DT_NODELABEL(vnd7050aj), sen_gpios),
|
||||
.s0 = GPIO_DT_SPEC_GET(DT_NODELABEL(vnd7050aj), s0_gpios),
|
||||
.s1 = GPIO_DT_SPEC_GET(DT_NODELABEL(vnd7050aj), s1_gpios),
|
||||
.in0 = GPIO_DT_SPEC_GET(DT_NODELABEL(vnd7050aj_mux), in0_gpios),
|
||||
.in1 = GPIO_DT_SPEC_GET(DT_NODELABEL(vnd7050aj_mux), in1_gpios),
|
||||
.rst = GPIO_DT_SPEC_GET(DT_NODELABEL(vnd7050aj_mux), rst_gpios),
|
||||
.sen = GPIO_DT_SPEC_GET(DT_NODELABEL(vnd7050aj_mux), sen_gpios),
|
||||
.s0 = GPIO_DT_SPEC_GET(DT_NODELABEL(vnd7050aj_mux), s0_gpios),
|
||||
.s1 = GPIO_DT_SPEC_GET(DT_NODELABEL(vnd7050aj_mux), s1_gpios),
|
||||
};
|
||||
|
||||
static enum valve_state current_state = VALVE_STATE_CLOSED;
|
||||
|
||||
Reference in New Issue
Block a user