Just saving

This commit is contained in:
2025-07-10 17:23:22 +02:00
parent 222ffea568
commit c1622bb01c
11 changed files with 352 additions and 104 deletions

View File

@@ -1,23 +1,17 @@
#include <zephyr/dt-bindings/gpio/gpio.h>
/ {
/* VND7050AJ Sensor Multiplexer - Centralized configuration */
vnd7050aj_mux: sensor-multiplexer {
compatible = "vnd7050aj,sensor-mux";
vnd7050aj: vnd7050aj {
compatible = "vnd7050aj-valve-controller";
status = "okay";
/* Shared ADC configuration */
io-channels = <&adc1 1>; /* ADC1 channel 1 (PA0) */
io-channel-names = "sensor-input";
reference-mv = <3300>;
/* VND7050AJ GPIO pin definitions - shared by all sensors */
sen-gpios = <&gpiob 4 GPIO_ACTIVE_HIGH>; /* SEN (PB4) - Sense Enable */
s0-gpios = <&gpiob 6 GPIO_ACTIVE_HIGH>; /* S0 (PB6) - Mux select bit 0 */
s1-gpios = <&gpiob 5 GPIO_ACTIVE_HIGH>; /* S1 (PB5) - Mux select bit 1 */
/* Valve control pins (separate from sensor mux) */
in0-gpios = <&gpiob 7 GPIO_ACTIVE_HIGH>; /* IN0 (PB7) - Valve input 0 */
in1-gpios = <&gpiob 9 GPIO_ACTIVE_HIGH>; /* IN1 (PB9) - Valve input 1 */
rst-gpios = <&gpiob 3 GPIO_ACTIVE_HIGH>; /* RST (PB3) - Reset pin */
// VND7050AJ GPIO pin definitions
in0-gpios = <&gpiob 7 GPIO_ACTIVE_HIGH>; // IN0 (PB7) - Input 0 control signal
in1-gpios = <&gpiob 9 GPIO_ACTIVE_HIGH>; // IN1 (PB9) - Input 1 control signal
rst-gpios = <&gpiob 3 GPIO_ACTIVE_HIGH>; // RST (PB3) - Reset pin for VND7050AJ
sen-gpios = <&gpiob 4 GPIO_ACTIVE_HIGH>; // SEN (PB4) - Sense Enable for current monitoring
s0-gpios = <&gpiob 6 GPIO_ACTIVE_HIGH>; // S0 (PB6) - Status/Select 0 output from VND7050AJ
s1-gpios = <&gpiob 5 GPIO_ACTIVE_HIGH>; // S1 (PB5) - Status/Select 1 output from VND7050AJ
};
adc_sensors {
@@ -25,22 +19,49 @@
supply_voltage: supply-voltage {
compatible = "custom,supply-voltage";
sensor-mux = <&vnd7050aj_mux>; /* Reference to shared mux config */
/* Sensor-specific configuration */
io-channels = <&adc1 1>; /* ADC1 channel 1 (PA0) */
io-channel-names = "voltage";
reference-mv = <3300>;
voltage-divider-ratio = <4>; /* Adjust based on your voltage divider */
mux-channel = <0>; /* Channel 0: s1=0, s0=0 */
measurement-delay-ms = <5>; /* 5ms delay after GPIO setup */
/* GPIO control pins using VND7050AJ pins */
sen-gpios = <&gpiob 4 GPIO_ACTIVE_HIGH>; /* SEN (PB4) - enable sensor */
s0-gpios = <&gpiob 6 GPIO_ACTIVE_HIGH>; /* S0 (PB6) - mux select bit 0 */
s1-gpios = <&gpiob 5 GPIO_ACTIVE_HIGH>; /* S1 (PB5) - mux select bit 1 */
measurement-delay-ms = <5>; /* 5ms delay after GPIO setup */
};
motor_current: motor-current {
motor_current_open: motor-current-open {
compatible = "custom,motor-current";
sensor-mux = <&vnd7050aj_mux>; /* Reference to shared mux config */
io-channels = <&adc1 1>; /* Same ADC channel, different mux setting */
io-channel-names = "current";
reference-mv = <3300>;
current-sense-resistor-mohm = <1500000>; /* 1.5kΩ sense resistor in mΩ */
k-factor = <10>; /* Current sense amplification factor */
/* Sensor-specific configuration */
current-sense-resistor-mohm = <100>; /* 100mΩ sense resistor */
mux-channel = <1>; /* Channel 1: s1=0, s0=1 */
measurement-delay-ms = <10>; /* 10ms delay for current settling */
/* GPIO control pins using VND7050AJ pins */
sen-gpios = <&gpiob 4 GPIO_ACTIVE_HIGH>; /* SEN (PB4) - enable sensor */
s0-gpios = <&gpiob 6 GPIO_ACTIVE_HIGH>; /* S0 (PB6) - mux select bit 0 */
s1-gpios = <&gpiob 5 GPIO_ACTIVE_HIGH>; /* S1 (PB5) - mux select bit 1 */
measurement-delay-ms = <10>; /* 10ms delay for current settling */
};
motor_current_close: motor-current-close {
compatible = "custom,motor-current";
io-channels = <&adc1 1>; /* Same ADC channel, different mux setting */
io-channel-names = "current";
reference-mv = <3300>;
current-sense-resistor-mohm = <1500000>; /* 1.5kΩ sense resistor in mΩ */
k-factor = <10>; /* Current sense amplification factor */
/* GPIO control pins using VND7050AJ pins */
sen-gpios = <&gpiob 4 GPIO_ACTIVE_HIGH>; /* SEN (PB4) - enable sensor */
s0-gpios = <&gpiob 6 GPIO_ACTIVE_HIGH>; /* S0 (PB6) - mux select bit 0 */
s1-gpios = <&gpiob 5 GPIO_ACTIVE_HIGH>; /* S1 (PB5) - mux select bit 1 */
measurement-delay-ms = <10>; /* 10ms delay for current settling */
};
};
};