- Fix voltage divider devicetree configuration to reference ADC controller directly instead of channel node
- Switch from ADC API to sensor API for voltage divider usage
- Add required sensor and voltage divider configuration options
- Remove unnecessary zephyr,user node that was causing compilation issues
- The voltage divider now properly uses sensor framework and builds successfully
Hardware setup:
- Uses ADC1 channel 1 on pin PA0
- Voltage divider with 2.2kΩ output and 3.2kΩ total resistance
- Provides voltage readings through sensor API accounting for divider ratio
- 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
- Initialize RST pin as active to keep VND7050AJ out of reset state
- Clarify S0/S1 pins as output select pins with descriptive comments
- Add initialization logging to show configured max open/close times
- Ensure proper valve controller startup sequence
This commit implements the real valve control using the GPIOs connected to the VND7050AJ driver.
- The `weact_stm32g431_core.overlay` is updated with a specific compatible string and a device tree label for the valve controller.
- `valve.h` is extended to include GPIO device specifications.
- `valve.c` now initializes and controls the GPIOs for opening and closing the valve, including the reset logic. The IN0 and IN1 pins are interlocked to prevent simultaneous activation. The RST pin is activated before each movement and deactivated afterward.
This replaces the previous virtual/simulated valve logic with actual hardware control.
This commit introduces a major refactoring of the project structure to align
with Zephyr's recommended multi-application and library organization.
Key changes include:
- Relocation of custom modules from 'software/modules/' to 'software/lib/'.
- Introduction of a central 'software/CMakeLists.txt' to manage application
and library subdirectories.
- Creation of new Kconfig files for 'software/' and 'software/apps/slave_node/'
to define project-wide and application-specific configurations.
- Removal of the 'gateway' and 'stm32g431_tests' applications.
- Removal of 'shell_modbus.c' and 'shell_system.c' from 'slave_node' application's
direct source files, indicating a shift towards library-based shell commands.
- Updates to 'software/apps/slave_node/CMakeLists.txt', 'prj.conf', and
'boards/bluepill_f103rb.conf' to reflect the new structure and dependencies.