89 lines
3.6 KiB
Plaintext
89 lines
3.6 KiB
Plaintext
#include <zephyr/dt-bindings/gpio/gpio.h>
|
|
|
|
/ {
|
|
vnd7050aj: vnd7050aj {
|
|
compatible = "vnd7050aj-valve-controller";
|
|
status = "okay";
|
|
|
|
// 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 {
|
|
compatible = "adc-sensors";
|
|
|
|
supply_voltage: supply-voltage {
|
|
compatible = "custom,supply-voltage";
|
|
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 */
|
|
sensor-mux = <&vnd7050aj>; /* Reference to VND7050AJ mux */
|
|
mux-channel = <3>; /* VCC sense channel */
|
|
measurement-delay-ms = <5>; /* 5ms delay after GPIO setup */
|
|
};
|
|
|
|
motor_current_open: motor-current-open {
|
|
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 */
|
|
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 */
|
|
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 */
|
|
};
|
|
};
|
|
};
|
|
|
|
&adc1 { // ADC1 wird für PA0 verwendet
|
|
status = "okay"; // ADC1 aktivieren
|
|
pinctrl-0 = <&adc1_in1_pa0>; // Pinmux für PA0 als ADC1_IN1
|
|
pinctrl-names = "default";
|
|
st,adc-clock-source = "SYNC";
|
|
st,adc-prescaler = <4>;
|
|
#address-cells = <1>;
|
|
#size-cells = <0>;
|
|
};
|
|
|
|
&pinctrl {
|
|
// Pinmux für PA0 als ADC1_IN1 (Analogmodus)
|
|
adc1_in1_pa0: adc1_in1_pa0 {
|
|
pinmux = <STM32_PINMUX('A', 0, ANALOG)>; // PA0 in den Analogmodus setzen
|
|
};
|
|
};
|
|
|
|
&zephyr_udc0 {
|
|
cdc_acm_uart0: cdc_acm_uart0 {
|
|
compatible = "zephyr,cdc-acm-uart";
|
|
|
|
modbus0 {
|
|
compatible = "zephyr,modbus-serial";
|
|
status = "okay";
|
|
};
|
|
};
|
|
};
|
|
|
|
&usart1 {
|
|
/delete-node/ modbus0;
|
|
}; |