Compare commits
No commits in common. "b62c79c2da37ae4c098156e76e4230c5aa9c7fb8" and "3f0d5a76c65cfbec12781dd59f3deaf34dedf1a1" have entirely different histories.
b62c79c2da
...
3f0d5a76c6
|
|
@ -1,5 +0,0 @@
|
||||||
{
|
|
||||||
"files.associations": {
|
|
||||||
"fwu.h": "c"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
cmake_minimum_required(VERSION 3.20)
|
|
||||||
|
|
||||||
project(fwu)
|
|
||||||
|
|
||||||
target_sources(fwu PRIVATE src/fwu.c)
|
|
||||||
target_include_directories(fwu PUBLIC include)
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
cmake_minimum_required(VERSION 3.20)
|
|
||||||
|
|
||||||
project(modbus_server)
|
|
||||||
|
|
||||||
target_sources(modbus_server PRIVATE src/modbus_server.c)
|
|
||||||
target_include_directories(modbus_server PUBLIC include)
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
cmake_minimum_required(VERSION 3.20)
|
|
||||||
|
|
||||||
project(valve)
|
|
||||||
|
|
||||||
target_sources(valve PRIVATE src/valve.c)
|
|
||||||
target_include_directories(valve PUBLIC include)
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
cmake_minimum_required(VERSION 3.13.1)
|
||||||
|
|
||||||
|
project(software)
|
||||||
|
|
||||||
|
add_subdirectory(modules/modbus_server)
|
||||||
|
add_subdirectory(modules/valve)
|
||||||
|
add_subdirectory(modules/fwu)
|
||||||
|
add_subdirectory(apps/stm32g431_tests)
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
rsource "lib/Kconfig"
|
|
||||||
|
|
@ -1,8 +1,27 @@
|
||||||
cmake_minimum_required(VERSION 3.20)
|
cmake_minimum_required(VERSION 3.20)
|
||||||
|
|
||||||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
|
# Point BOARD_ROOT and DTS_ROOT to the 'software' directory, which contains 'boards'.
|
||||||
|
list(APPEND BOARD_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../..)
|
||||||
|
|
||||||
project(slave_node LANGUAGES C)
|
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
|
||||||
zephyr_include_directories(../../include)
|
project(slave_node)
|
||||||
add_subdirectory(../../lib lib)
|
|
||||||
target_sources(app PRIVATE src/main.c)
|
list(APPEND KCONFIG_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/../../modules/modbus_server/Kconfig)
|
||||||
|
list(APPEND KCONFIG_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/../../modules/valve/Kconfig)
|
||||||
|
list(APPEND KCONFIG_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/../../modules/fwu/Kconfig)
|
||||||
|
|
||||||
|
target_include_directories(app PRIVATE
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/../../modules/valve/include
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/../../modules/modbus_server/include
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/../../modules/fwu/include
|
||||||
|
)
|
||||||
|
|
||||||
|
# Add the source files from the app and the libraries
|
||||||
|
target_sources(app PRIVATE
|
||||||
|
src/main.c
|
||||||
|
src/shell_modbus.c
|
||||||
|
src/shell_system.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/../../modules/valve/src/valve.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/../../modules/modbus_server/src/modbus_server.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/../../modules/fwu/src/fwu.c
|
||||||
|
)
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
rsource "../../lib/Kconfig"
|
|
||||||
source "Kconfig.zephyr"
|
|
||||||
|
|
@ -3,5 +3,4 @@ CONFIG_UART_CONSOLE=n
|
||||||
|
|
||||||
# Enable RTT console
|
# Enable RTT console
|
||||||
CONFIG_RTT_CONSOLE=y
|
CONFIG_RTT_CONSOLE=y
|
||||||
CONFIG_USE_SEGGER_RTT=y
|
CONFIG_USE_SEGGER_RTT=y
|
||||||
CONFIG_SHELL_BACKEND_RTT=y
|
|
||||||
|
|
@ -1,50 +1,9 @@
|
||||||
/ {
|
|
||||||
vnd7050aj {
|
|
||||||
compatible = "gpio-leds"; // Using generic GPIO compatible
|
|
||||||
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
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
&usart1 {
|
&usart1 {
|
||||||
modbus0 {
|
modbus0 {
|
||||||
compatible = "zephyr,modbus-serial";
|
compatible = "zephyr,modbus-serial";
|
||||||
status = "okay";
|
status = "okay";
|
||||||
};
|
};
|
||||||
status = "okay";
|
status = "okay";
|
||||||
pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>; // PA9=TX, PA10=RX for Modbus communication
|
pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>;
|
||||||
pinctrl-names = "default";
|
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
|
|
||||||
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
|
|
||||||
zephyr,gain = "ADC_GAIN_1";
|
|
||||||
zephyr,reference = "ADC_REF_INTERNAL";
|
|
||||||
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
|
|
||||||
zephyr,resolution = <12>;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
&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
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
@ -4,6 +4,7 @@ CONFIG_LOG=y
|
||||||
|
|
||||||
# Enable Shell
|
# Enable Shell
|
||||||
CONFIG_SHELL=y
|
CONFIG_SHELL=y
|
||||||
|
CONFIG_SHELL_BACKEND_RTT=y
|
||||||
CONFIG_REBOOT=y
|
CONFIG_REBOOT=y
|
||||||
|
|
||||||
# Enable Settings Subsystem
|
# Enable Settings Subsystem
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
#include <zephyr/kernel.h>
|
#include <zephyr/kernel.h>
|
||||||
#include <zephyr/settings/settings.h>
|
#include <zephyr/settings/settings.h>
|
||||||
#include <zephyr/logging/log.h>
|
#include <zephyr/logging/log.h>
|
||||||
#include <lib/modbus_server.h>
|
#include <modbus_server.h>
|
||||||
#include <lib/valve.h>
|
#include <valve.h>
|
||||||
#include <lib/fwu.h>
|
#include <fwu.h>
|
||||||
|
|
||||||
LOG_MODULE_REGISTER(main, LOG_LEVEL_INF);
|
LOG_MODULE_REGISTER(main, LOG_LEVEL_INF);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#include <zephyr/shell/shell.h>
|
#include <zephyr/shell/shell.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <lib/modbus_server.h>
|
#include <modbus_server.h>
|
||||||
#include <lib/valve.h>
|
#include <valve.h>
|
||||||
|
|
||||||
static int cmd_modbus_set_baud(const struct shell *sh, size_t argc, char **argv)
|
static int cmd_modbus_set_baud(const struct shell *sh, size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
add_subdirectory_ifdef(CONFIG_LIB_FWU fwu)
|
|
||||||
add_subdirectory_ifdef(CONFIG_LIB_MODBUS_SERVER modbus_server)
|
|
||||||
add_subdirectory_ifdef(CONFIG_LIB_VALVE valve)
|
|
||||||
add_subdirectory_ifdef(CONFIG_SHELL_SYSTEM shell_system)
|
|
||||||
add_subdirectory_ifdef(CONFIG_SHELL_MODBUS shell_modbus)
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
menu "Irrigation system software libraries"
|
|
||||||
|
|
||||||
rsource "fwu/Kconfig"
|
|
||||||
rsource "modbus_server/Kconfig"
|
|
||||||
rsource "valve/Kconfig"
|
|
||||||
rsource "shell_system/Kconfig"
|
|
||||||
rsource "shell_modbus/Kconfig"
|
|
||||||
endmenu
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
zephyr_library_sources(fwu.c)
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
zephyr_library_sources(modbus_server.c)
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
config LIB_MODBUS_SERVER
|
|
||||||
bool "Enable Modbus Server Library"
|
|
||||||
default y
|
|
||||||
help
|
|
||||||
Enable the Modbus Server Library.
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
zephyr_library_sources(shell_modbus.c)
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
config SHELL_MODBUS
|
|
||||||
bool "Enable Shell Modbus"
|
|
||||||
default y
|
|
||||||
help
|
|
||||||
Enable the modnbus shell commands.
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
zephyr_library_sources(shell_system.c)
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
config SHELL_SYSTEM
|
|
||||||
bool "Enable Shell System"
|
|
||||||
default y
|
|
||||||
help
|
|
||||||
Enable the system commands.
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
zephyr_library_sources(valve.c)
|
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
cmake_minimum_required(VERSION 3.13.1)
|
||||||
|
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
|
||||||
|
|
||||||
|
project(fwu)
|
||||||
|
|
||||||
|
target_sources(app PRIVATE src/fwu.c)
|
||||||
|
target_include_directories(app PUBLIC include)
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
config LIB_FWU
|
config FWU
|
||||||
bool "Enable Firmware Update Library"
|
bool "Enable Firmware Update Library"
|
||||||
default y
|
default y
|
||||||
help
|
help
|
||||||
Enable the Firmware Update Library.
|
Enable the Firmware Update module.
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
|
#include "fwu.h"
|
||||||
#include <zephyr/kernel.h>
|
#include <zephyr/kernel.h>
|
||||||
#include <zephyr/sys/crc.h>
|
#include <zephyr/sys/crc.h>
|
||||||
#include <zephyr/sys/byteorder.h>
|
#include <zephyr/sys/byteorder.h>
|
||||||
#include <zephyr/logging/log.h>
|
#include <zephyr/logging/log.h>
|
||||||
#include <lib/fwu.h>
|
|
||||||
|
|
||||||
LOG_MODULE_REGISTER(fwu, LOG_LEVEL_INF);
|
LOG_MODULE_REGISTER(fwu, LOG_LEVEL_INF);
|
||||||
|
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
cmake_minimum_required(VERSION 3.13.1)
|
||||||
|
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
|
||||||
|
|
||||||
|
project(modbus_server)
|
||||||
|
|
||||||
|
target_sources(app PRIVATE src/modbus_server.c)
|
||||||
|
target_include_directories(app PUBLIC include)
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
config MODBUS_SERVER
|
||||||
|
bool "Enable Modbus Server Library"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Enable the Modbus Server module.
|
||||||
|
|
@ -5,9 +5,9 @@
|
||||||
#include <zephyr/logging/log.h>
|
#include <zephyr/logging/log.h>
|
||||||
#include <zephyr/settings/settings.h>
|
#include <zephyr/settings/settings.h>
|
||||||
#include <zephyr/sys/reboot.h>
|
#include <zephyr/sys/reboot.h>
|
||||||
#include <lib/modbus_server.h>
|
#include "modbus_server.h"
|
||||||
#include <lib/valve.h>
|
#include "valve.h"
|
||||||
#include <lib/fwu.h>
|
#include "fwu.h"
|
||||||
|
|
||||||
#include <zephyr/usb/usb_device.h>
|
#include <zephyr/usb/usb_device.h>
|
||||||
|
|
||||||
|
|
@ -135,7 +135,7 @@ static int input_reg_rd(uint16_t addr, uint16_t *reg)
|
||||||
*reg = (0 << 8) | 0;
|
*reg = (0 << 8) | 0;
|
||||||
break;
|
break;
|
||||||
case REG_INPUT_FIRMWARE_VERSION_PATCH:
|
case REG_INPUT_FIRMWARE_VERSION_PATCH:
|
||||||
*reg = 2;
|
*reg = 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
*reg = 0;
|
*reg = 0;
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
cmake_minimum_required(VERSION 3.13.1)
|
||||||
|
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
|
||||||
|
|
||||||
|
project(valve)
|
||||||
|
|
||||||
|
target_sources(app PRIVATE src/valve.c)
|
||||||
|
target_include_directories(app PUBLIC include)
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
config LIB_VALVE
|
config VALVE
|
||||||
bool "Enable Valve Library"
|
bool "Enable Valve Library"
|
||||||
default y
|
default y
|
||||||
help
|
help
|
||||||
Enable the Valve Library.
|
Enable the Valve module.
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
|
#include "valve.h"
|
||||||
#include <zephyr/kernel.h>
|
#include <zephyr/kernel.h>
|
||||||
#include <zephyr/settings/settings.h>
|
#include <zephyr/settings/settings.h>
|
||||||
#include <zephyr/logging/log.h>
|
#include <zephyr/logging/log.h>
|
||||||
#include <lib/valve.h>
|
|
||||||
|
|
||||||
LOG_MODULE_REGISTER(valve, LOG_LEVEL_INF);
|
LOG_MODULE_REGISTER(valve, LOG_LEVEL_INF);
|
||||||
|
|
||||||
Loading…
Reference in New Issue