Implement VND7050AJ supply voltage reading function
- Added devicetree overlay for VND7050AJ with GPIO and ADC configuration - Created custom devicetree binding for VND7050AJ valve controller - Implemented valve_get_supply_voltage() function with proper pin control: - RST=HIGH to enable VND7050AJ - S0=1, S1=1 for supply voltage sensing mode - SEN=1 to enable MULTISENSE output - ADC reading on PA0 (ADC1_IN1) with 12-bit resolution - Fixed supply voltage calculation (VCC/8 per datasheet) - Added comprehensive debug logging for all steps - Tested and verified ADC functionality - Current reading: 5.1V (may be limited by hardware power supply) Files modified: - software/lib/valve/valve.c: Main implementation - software/apps/slave_node/boards/weact_stm32g431_core.overlay: DT config - software/apps/slave_node/dts/bindings/vnd7050aj-valve-controller.yaml: DT binding - software/apps/slave_node/src/main.c: Test code - software/apps/slave_node/prj.conf: ADC driver enablement
This commit is contained in:
@@ -23,22 +23,22 @@
|
||||
pinctrl-names = "default";
|
||||
};
|
||||
|
||||
&adc1 { // ADC1 wird für PA0 verwendet
|
||||
status = "okay"; // ADC1 aktivieren
|
||||
pinctrl-0 = <&adc1_in1_pa0>; // Pinmux für PA0 als ADC1_IN1
|
||||
&adc1 {
|
||||
status = "okay";
|
||||
pinctrl-0 = <&adc1_in1_pa0>;
|
||||
pinctrl-names = "default";
|
||||
st,adc-clock-source = "SYNC";
|
||||
st,adc-prescaler = <4>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
// Definition des ADC-Kanals für MULTISENSE (PA0)
|
||||
channel@1 { // ADC1_IN1 ist Kanal 1
|
||||
reg = <1>; // Kanalnummer
|
||||
channel@1 {
|
||||
reg = <1>;
|
||||
zephyr,gain = "ADC_GAIN_1";
|
||||
zephyr,reference = "ADC_REF_INTERNAL";
|
||||
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
|
||||
zephyr,resolution = <12>;
|
||||
zephyr,vref-mv = <3300>;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user