From 22605d699235aa0a27906cf344017a33ddf75c2f Mon Sep 17 00:00:00 2001 From: xlemmingx Date: Thu, 5 Jun 2025 09:25:37 +0200 Subject: [PATCH] initial commit --- .gitignore | 5 + .vscode/extensions.json | 10 + .vscode/settings.json | 18 ++ boards/g2h_lorawan_heat_control.json | 43 ++++ include/README | 37 +++ lib/README | 46 ++++ platformio.ini | 14 ++ src/main.c | 41 ++++ test/README | 11 + zephyr/CMakeLists.txt | 9 + .../Kconfig.g2h_lorawan_heat_control | 5 + .../arduino_r3_connector.dtsi | 40 ++++ .../st/g2h_lorawan_heat_control/board.cmake | 8 + .../st/g2h_lorawan_heat_control/board.yml | 6 + .../g2h_lorawan_heat_control.dts | 212 ++++++++++++++++++ .../g2h_lorawan_heat_control.dtsi | 8 + .../g2h_lorawan_heat_control.yaml | 26 +++ .../g2h_lorawan_heat_control_defconfig | 15 ++ .../st_morpho_connector.dtsi | 58 +++++ .../support/openocd.cfg | 11 + zephyr/dts/bindings/power-switch.yaml | 10 + zephyr/g2h_lorawan_heat_control.overlay | 6 + zephyr/prj.conf | 3 + 23 files changed, 642 insertions(+) create mode 100644 .gitignore create mode 100644 .vscode/extensions.json create mode 100644 .vscode/settings.json create mode 100644 boards/g2h_lorawan_heat_control.json create mode 100644 include/README create mode 100644 lib/README create mode 100644 platformio.ini create mode 100644 src/main.c create mode 100644 test/README create mode 100644 zephyr/CMakeLists.txt create mode 100644 zephyr/boards/st/g2h_lorawan_heat_control/Kconfig.g2h_lorawan_heat_control create mode 100644 zephyr/boards/st/g2h_lorawan_heat_control/arduino_r3_connector.dtsi create mode 100644 zephyr/boards/st/g2h_lorawan_heat_control/board.cmake create mode 100644 zephyr/boards/st/g2h_lorawan_heat_control/board.yml create mode 100644 zephyr/boards/st/g2h_lorawan_heat_control/g2h_lorawan_heat_control.dts create mode 100644 zephyr/boards/st/g2h_lorawan_heat_control/g2h_lorawan_heat_control.dtsi create mode 100644 zephyr/boards/st/g2h_lorawan_heat_control/g2h_lorawan_heat_control.yaml create mode 100644 zephyr/boards/st/g2h_lorawan_heat_control/g2h_lorawan_heat_control_defconfig create mode 100644 zephyr/boards/st/g2h_lorawan_heat_control/st_morpho_connector.dtsi create mode 100644 zephyr/boards/st/g2h_lorawan_heat_control/support/openocd.cfg create mode 100644 zephyr/dts/bindings/power-switch.yaml create mode 100644 zephyr/g2h_lorawan_heat_control.overlay create mode 100644 zephyr/prj.conf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..89cc49c --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.pio +.vscode/.browse.c_cpp.db* +.vscode/c_cpp_properties.json +.vscode/launch.json +.vscode/ipch diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..080e70d --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,10 @@ +{ + // See http://go.microsoft.com/fwlink/?LinkId=827846 + // for the documentation about the extensions.json format + "recommendations": [ + "platformio.platformio-ide" + ], + "unwantedRecommendations": [ + "ms-vscode.cpptools-extension-pack" + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..5bb08ba --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,18 @@ +{ + "files.associations": { + "devicetree.h": "c", + "lorawan.h": "c", + "kernel.h": "c", + "device.h": "c", + "log.h": "c", + "mlx90614.h": "c", + "sensor.h": "c", + "sht4x.h": "c", + "array": "c", + "string_view": "c", + "initializer_list": "c", + "stm32-pinctrl-common.h": "c", + "printk.h": "c" + }, + "cmake.sourceDirectory": "C:/Users/xlemmingx/Documents/PlatformIO/Projects/embedded_raumsenor_lorawan/zephyr" +} \ No newline at end of file diff --git a/boards/g2h_lorawan_heat_control.json b/boards/g2h_lorawan_heat_control.json new file mode 100644 index 0000000..7e23a61 --- /dev/null +++ b/boards/g2h_lorawan_heat_control.json @@ -0,0 +1,43 @@ +{ + "build": { + "core": "stm32", + "cpu": "cortex-m4", + "extra_flags": "-DSTM32WL -DSTM32WLxx -DSTM32WLE5xx", + "f_cpu": "48000000L", + "framework_extra_flags": { + "arduino": "-DUSE_CM4_STARTUP_FILE" + }, + "mcu": "stm32wl55jc", + "product_line": "STM32WL55xx", + "variant": "STM32WLxx/WL54JCI_WL55JCI_WLE4J(8-B-C)I_WLE5J(8-B-C)I" + }, + "debug": { + "default_tools": [ + "stlink" + ], + "jlink_device": "STM32WL55JC", + "onboard_tools": [ + "stlink" + ], + "openocd_target": "stm32wlx", + "svd_path": "STM32WL5x_CM4.svd" + }, + "frameworks": [ + "arduino", + "zephyr" + ], + "name": "G2H LoraWAN Heat Control", + "upload": { + "maximum_ram_size": 65536, + "maximum_size": 262144, + "protocol": "stlink", + "protocols": [ + "jlink", + "cmsis-dap", + "stlink", + "mbed" + ] + }, + "url": "https://www.st.com/en/evaluation-tools/nucleo-wl55jc.html", + "vendor": "ST" +} diff --git a/include/README b/include/README new file mode 100644 index 0000000..49819c0 --- /dev/null +++ b/include/README @@ -0,0 +1,37 @@ + +This directory is intended for project header files. + +A header file is a file containing C declarations and macro definitions +to be shared between several project source files. You request the use of a +header file in your project source file (C, C++, etc) located in `src` folder +by including it, with the C preprocessing directive `#include'. + +```src/main.c + +#include "header.h" + +int main (void) +{ + ... +} +``` + +Including a header file produces the same results as copying the header file +into each source file that needs it. Such copying would be time-consuming +and error-prone. With a header file, the related declarations appear +in only one place. If they need to be changed, they can be changed in one +place, and programs that include the header file will automatically use the +new version when next recompiled. The header file eliminates the labor of +finding and changing all the copies as well as the risk that a failure to +find one copy will result in inconsistencies within a program. + +In C, the convention is to give header files names that end with `.h'. + +Read more about using header files in official GCC documentation: + +* Include Syntax +* Include Operation +* Once-Only Headers +* Computed Includes + +https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html diff --git a/lib/README b/lib/README new file mode 100644 index 0000000..9379397 --- /dev/null +++ b/lib/README @@ -0,0 +1,46 @@ + +This directory is intended for project specific (private) libraries. +PlatformIO will compile them to static libraries and link into the executable file. + +The source code of each library should be placed in a separate directory +("lib/your_library_name/[Code]"). + +For example, see the structure of the following example libraries `Foo` and `Bar`: + +|--lib +| | +| |--Bar +| | |--docs +| | |--examples +| | |--src +| | |- Bar.c +| | |- Bar.h +| | |- library.json (optional. for custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html +| | +| |--Foo +| | |- Foo.c +| | |- Foo.h +| | +| |- README --> THIS FILE +| +|- platformio.ini +|--src + |- main.c + +Example contents of `src/main.c` using Foo and Bar: +``` +#include +#include + +int main (void) +{ + ... +} + +``` + +The PlatformIO Library Dependency Finder will find automatically dependent +libraries by scanning project source files. + +More information about PlatformIO Library Dependency Finder +- https://docs.platformio.org/page/librarymanager/ldf.html diff --git a/platformio.ini b/platformio.ini new file mode 100644 index 0000000..4637da5 --- /dev/null +++ b/platformio.ini @@ -0,0 +1,14 @@ +; PlatformIO Project Configuration File +; +; Build options: build flags, source filter +; Upload options: custom upload port, speed and extra flags +; Library options: dependencies, extra library storages +; Advanced options: extra scripting +; +; Please visit documentation for the other options and examples +; https://docs.platformio.org/page/projectconf.html + +[env:g2h_lorawan_heat_control] +platform = ststm32 +board = g2h_lorawan_heat_control +framework = zephyr diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..ff5364a --- /dev/null +++ b/src/main.c @@ -0,0 +1,41 @@ +#include +#include +#include +#include +#include + +void get_unique_dev_eui(uint8_t *dev_eui) +{ + uint32_t uid_l = HAL_GetUIDw0(); + uint32_t uid_h = HAL_GetUIDw1(); + + dev_eui[0] = (uid_h >> 24) & 0xFF; + dev_eui[1] = (uid_h >> 16) & 0xFF; + dev_eui[2] = (uid_h >> 8) & 0xFF; + dev_eui[3] = (uid_h) & 0xFF; + dev_eui[4] = (uid_l >> 24) & 0xFF; + dev_eui[5] = (uid_l >> 16) & 0xFF; + dev_eui[6] = (uid_l >> 8) & 0xFF; + dev_eui[7] = (uid_l) & 0xFF; +} + +/* MAIN */ +int main(void) +{ + + while (true) + { + uint8_t deveui[8]; + + get_unique_dev_eui(deveui); + printk("DevEUI: "); + for (int i = 0; i < 8; i++) + { + printk("%02X", deveui[i]); + } + printk("\n"); + + /* Delay until next cycle */ + k_sleep(K_SECONDS(10)); + } +} \ No newline at end of file diff --git a/test/README b/test/README new file mode 100644 index 0000000..9b1e87b --- /dev/null +++ b/test/README @@ -0,0 +1,11 @@ + +This directory is intended for PlatformIO Test Runner and project tests. + +Unit Testing is a software testing method by which individual units of +source code, sets of one or more MCU program modules together with associated +control data, usage procedures, and operating procedures, are tested to +determine whether they are fit for use. Unit testing finds problems early +in the development cycle. + +More information about PlatformIO Unit Testing: +- https://docs.platformio.org/en/latest/advanced/unit-testing/index.html diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt new file mode 100644 index 0000000..3de8eed --- /dev/null +++ b/zephyr/CMakeLists.txt @@ -0,0 +1,9 @@ +# Path to out-of-tree boards definitions +set (BOARD_ROOT "${CMAKE_CURRENT_SOURCE_DIR}") + +cmake_minimum_required(VERSION 3.13.1) +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(embedded_raumsenor_lorawan) + +FILE(GLOB app_sources ../src/*.c*) +target_sources(app PRIVATE ${app_sources}) diff --git a/zephyr/boards/st/g2h_lorawan_heat_control/Kconfig.g2h_lorawan_heat_control b/zephyr/boards/st/g2h_lorawan_heat_control/Kconfig.g2h_lorawan_heat_control new file mode 100644 index 0000000..b330d59 --- /dev/null +++ b/zephyr/boards/st/g2h_lorawan_heat_control/Kconfig.g2h_lorawan_heat_control @@ -0,0 +1,5 @@ +# Copyright (c) 2020 STMicroelectronics +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_G2H_LORAWAN_HEAT_CONTROL + select SOC_STM32WL55XX diff --git a/zephyr/boards/st/g2h_lorawan_heat_control/arduino_r3_connector.dtsi b/zephyr/boards/st/g2h_lorawan_heat_control/arduino_r3_connector.dtsi new file mode 100644 index 0000000..93c9694 --- /dev/null +++ b/zephyr/boards/st/g2h_lorawan_heat_control/arduino_r3_connector.dtsi @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2020 STMicroelectronics + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + arduino_header: connector { + compatible = "arduino-header-r3"; + #gpio-cells = <2>; + gpio-map-mask = <0xffffffff 0xffffffc0>; + gpio-map-pass-thru = <0 0x3f>; + gpio-map = <0 0 &gpiob 1 0>, /* A0 */ + <1 0 &gpiob 2 0>, /* A1 */ + <2 0 &gpioa 10 0>, /* A2 */ + <3 0 &gpiob 4 0>, /* A3 */ + <4 0 &gpiob 14 0>, /* A4 */ + <5 0 &gpiob 13 0>, /* A5 */ + <6 0 &gpiob 7 0>, /* D0 */ + <7 0 &gpiob 6 0>, /* D1 */ + <8 0 &gpiob 12 0>, /* D2 */ + <9 0 &gpiob 3 0>, /* D3 */ + <10 0 &gpiob 5 0>, /* D4 */ + <11 0 &gpiob 8 0>, /* D5 */ + <12 0 &gpiob 10 0>, /* D6 */ + <13 0 &gpioc 1 0>, /* D7 */ + <14 0 &gpioc 2 0>, /* D8 */ + <15 0 &gpioa 9 0>, /* D9 */ + <16 0 &gpioa 4 0>, /* D10 */ + <17 0 &gpioa 7 0>, /* D11 */ + <18 0 &gpioa 6 0>, /* D12 */ + <19 0 &gpioa 5 0>, /* D13 */ + <20 0 &gpiob 11 0>, /* D14 */ + <21 0 &gpiob 12 0>; /* D15 */ + }; +}; + +arduino_serial: &usart1 {}; +arduino_i2c: &i2c2 {}; +arduino_spi: &spi1 {}; diff --git a/zephyr/boards/st/g2h_lorawan_heat_control/board.cmake b/zephyr/boards/st/g2h_lorawan_heat_control/board.cmake new file mode 100644 index 0000000..716846e --- /dev/null +++ b/zephyr/boards/st/g2h_lorawan_heat_control/board.cmake @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: Apache-2.0 + +# keep first +board_runner_args(stm32cubeprogrammer "--port=swd" "--reset-mode=hw") + +# keep first +include(${ZEPHYR_BASE}/boards/common/stm32cubeprogrammer.board.cmake) +include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake) diff --git a/zephyr/boards/st/g2h_lorawan_heat_control/board.yml b/zephyr/boards/st/g2h_lorawan_heat_control/board.yml new file mode 100644 index 0000000..d2d5e3a --- /dev/null +++ b/zephyr/boards/st/g2h_lorawan_heat_control/board.yml @@ -0,0 +1,6 @@ +board: + name: g2h_lorawan_heat_control + full_name: G2H LoraWAN Heat Control + vendor: st + socs: + - name: stm32wl55xx diff --git a/zephyr/boards/st/g2h_lorawan_heat_control/g2h_lorawan_heat_control.dts b/zephyr/boards/st/g2h_lorawan_heat_control/g2h_lorawan_heat_control.dts new file mode 100644 index 0000000..2b6204b --- /dev/null +++ b/zephyr/boards/st/g2h_lorawan_heat_control/g2h_lorawan_heat_control.dts @@ -0,0 +1,212 @@ +/* + * Copyright (c) 2020-2024 STMicroelectronics + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include +#include +#include "arduino_r3_connector.dtsi" +#include "st_morpho_connector.dtsi" +#include +//#include "g2h_lorawan_heat_control.dtsi" + +/ { + model = "G2H LoraWAN Heat control based on STM32WL55JC-NUCLEO"; + compatible = "st,stm32wl55-nucleo,g2h_lorawan_heat_control"; + + chosen { + zephyr,console = &lpuart1; + zephyr,shell-uart = &lpuart1; + zephyr,sram = &sram0; + zephyr,flash = &flash0; + zephyr,code-partition = &slot0_partition; + }; + + aliases { + lora0 = &lora; + watchdog0 = &iwdg; + die-temp0 = &die_temp; + }; +}; + +&clk_lsi { + status = "okay"; +}; + +stm32_lp_tick_source: &lptim1 { + clocks = <&rcc STM32_CLOCK_BUS_APB1 0x80000000>, + <&rcc STM32_SRC_LSI LPTIM1_SEL(1)>; + status = "okay"; +}; + +&clk_hsi { + status = "okay"; +}; + +&clk_lse { + status = "okay"; +}; + +&pll { + div-m = <1>; + mul-n = <6>; + div-r = <2>; + div-q = <2>; + clocks = <&clk_hsi>; + status = "okay"; +}; + +&rcc { + clocks = <&pll>; + clock-frequency = ; + cpu1-prescaler = <1>; + cpu2-prescaler = <1>; + ahb3-prescaler = <1>; + apb1-prescaler = <1>; + apb2-prescaler = <1>; +}; + +&lpuart1 { + pinctrl-0 = <&lpuart1_tx_pa2 &lpuart1_rx_pa3>; + pinctrl-names = "default"; + current-speed = <115200>; + status = "okay"; +}; + +&i2c1 { + status = "okay"; + pinctrl-0 = <&i2c1_scl_pa9 &i2c1_sda_pa10>; + pinctrl-names = "default"; + status = "okay"; + clock-frequency = ; + + sht4x: sht4x@44 { + status = "okay"; + compatible = "sensirion,sht4x"; + label = "SHT4X Integrated Temp Sensor"; + reg = <0x44>; + repeatability = <2>; + }; + + mlx90614: mlx90614@5A { + status = "okay"; + compatible = "melexis,mlx90614"; + label = "MLX90614 Infrared Temp Sensor"; + reg = <0x5A>; + }; + +}; + +&spi1 { + pinctrl-0 = <&spi1_nss_pa4 &spi1_sck_pa5 + &spi1_miso_pa6 &spi1_mosi_pa7>; + pinctrl-names = "default"; + status = "okay"; +}; + + +&dac1 { + pinctrl-0 = <&dac_out1_pa10>; + pinctrl-names = "default"; + status = "okay"; +}; + +&timers2 { + status = "okay"; + pwm2: pwm { + status = "okay"; + pinctrl-0 = <&tim2_ch4_pb11>; + pinctrl-names = "default"; + }; +}; + + +&adc1 { + pinctrl-0 = <&adc_in5_pb1 &adc_in0_pb13>; + pinctrl-names = "default"; + st,adc-clock-source = "SYNC"; + st,adc-prescaler = <4>; + status = "okay"; +}; + +&die_temp { + status = "okay"; +}; + +&aes { + status = "okay"; +}; + +&rng { + status = "okay"; +}; + +&iwdg { + status = "okay"; +}; + +&subghzspi { + status = "okay"; + lora: radio@0 { + status = "okay"; + tx-enable-gpios = <&gpioc 4 GPIO_ACTIVE_LOW>; /* FE_CTRL1 */ + rx-enable-gpios = <&gpioc 5 GPIO_ACTIVE_LOW>; /* FE_CTRL2 */ + dio3-tcxo-voltage = ; + tcxo-power-startup-delay-ms = <5>; + /* High-power output is selected as a consequence of using + * tx/rx-enable-gpio to control FE_CTRL1 and FE_CTRL2. Low-power + * output would require both FE_CTRL1 and FE_CTRL2 to be high, + * which is not currently supported by the driver. + */ + power-amplifier-output = "rfo-hp"; + rfo-lp-max-power = <15>; + rfo-hp-max-power = <22>; + }; +}; + +&flash0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x00000000 DT_SIZE_K(32)>; + read-only; + }; + slot0_partition: partition@8000 { + label = "image-0"; + reg = <0x00008000 DT_SIZE_K(104)>; + }; + slot1_partition: partition@22000 { + label = "image-1"; + reg = <0x00022000 DT_SIZE_K(104)>; + }; + + /* + * Set 16kB of storage (8x2kB pages) at the end of the 256kB of + * flash. + */ + storage_partition: partition@3c000 { + label = "storage"; + reg = <0x0003c000 DT_SIZE_K(16)>; + }; + }; +}; + +&rtc { + clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00000400>, + <&rcc STM32_SRC_LSE RTC_SEL(1)>; + status = "okay"; +}; + +&vref { + status = "okay"; +}; + +&vbat { + status = "okay"; +}; \ No newline at end of file diff --git a/zephyr/boards/st/g2h_lorawan_heat_control/g2h_lorawan_heat_control.dtsi b/zephyr/boards/st/g2h_lorawan_heat_control/g2h_lorawan_heat_control.dtsi new file mode 100644 index 0000000..db32aa2 --- /dev/null +++ b/zephyr/boards/st/g2h_lorawan_heat_control/g2h_lorawan_heat_control.dtsi @@ -0,0 +1,8 @@ +#include +#include + +&pinctrl { + gpio_pc0: gpio_pc0 { + pinmux = ; + }; +}; diff --git a/zephyr/boards/st/g2h_lorawan_heat_control/g2h_lorawan_heat_control.yaml b/zephyr/boards/st/g2h_lorawan_heat_control/g2h_lorawan_heat_control.yaml new file mode 100644 index 0000000..350f6ac --- /dev/null +++ b/zephyr/boards/st/g2h_lorawan_heat_control/g2h_lorawan_heat_control.yaml @@ -0,0 +1,26 @@ +identifier: g2h_lorawan_heat_control +name: G2H LoraWAN Heat Control +type: mcu +arch: arm +toolchain: + - zephyr + - gnuarmemb +ram: 64 +flash: 256 +supported: + - gpio + - i2c + - spi + - arduino_gpio + - arduino_i2c + - arduino_spi + - adc + - dac + - pwm + - counter + - dma + - watchdog + - nvs + - lora + - rtc +vendor: st diff --git a/zephyr/boards/st/g2h_lorawan_heat_control/g2h_lorawan_heat_control_defconfig b/zephyr/boards/st/g2h_lorawan_heat_control/g2h_lorawan_heat_control_defconfig new file mode 100644 index 0000000..8b09bb0 --- /dev/null +++ b/zephyr/boards/st/g2h_lorawan_heat_control/g2h_lorawan_heat_control_defconfig @@ -0,0 +1,15 @@ +# enable uart driver +CONFIG_SERIAL=y + +# enable GPIO +CONFIG_GPIO=y + +# console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y + +# Enable MPU +CONFIG_ARM_MPU=y + +# Enable HW stack protection +CONFIG_HW_STACK_PROTECTION=y diff --git a/zephyr/boards/st/g2h_lorawan_heat_control/st_morpho_connector.dtsi b/zephyr/boards/st/g2h_lorawan_heat_control/st_morpho_connector.dtsi new file mode 100644 index 0000000..c2e2a06 --- /dev/null +++ b/zephyr/boards/st/g2h_lorawan_heat_control/st_morpho_connector.dtsi @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2023 Marcin Niestroj + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include + +/ { + st_morpho_header: st-morpho-header { + compatible = "st-morpho-header"; + #gpio-cells = <2>; + gpio-map-mask = ; + gpio-map-pass-thru = <0x0 GPIO_DT_FLAGS_MASK>; + gpio-map = , + , /* shared with SWD connected to STLINK */ + , /* shared with SWD connected to STLINK */ + , + , + , + , + , + , + , + , + , + , + + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , /* SB7=ON, SB2=OFF, SB6=OFF */ + , + , /* SB9=ON, SB4=OFF, SB10=OFF */ + ; + }; +}; diff --git a/zephyr/boards/st/g2h_lorawan_heat_control/support/openocd.cfg b/zephyr/boards/st/g2h_lorawan_heat_control/support/openocd.cfg new file mode 100644 index 0000000..9d7fe81 --- /dev/null +++ b/zephyr/boards/st/g2h_lorawan_heat_control/support/openocd.cfg @@ -0,0 +1,11 @@ +source [find interface/stlink.cfg] + +transport select hla_swd + +source [find target/stm32wlx.cfg] + +# Debug compatible reset configuration (default) +reset_config srst_only srst_nogate + +# Sleep mode compatible reset configuration (stock firmware compatible) +# reset_config srst_only srst_nogate connect_assert_srst diff --git a/zephyr/dts/bindings/power-switch.yaml b/zephyr/dts/bindings/power-switch.yaml new file mode 100644 index 0000000..438faf1 --- /dev/null +++ b/zephyr/dts/bindings/power-switch.yaml @@ -0,0 +1,10 @@ +description: GPIO pin to switch a power output on or off + +compatible: "power-switch" + +properties: + gpios: + type: phandle-array + required: true + description: | + The GPIO connected to the gate driver for the MOSFET. \ No newline at end of file diff --git a/zephyr/g2h_lorawan_heat_control.overlay b/zephyr/g2h_lorawan_heat_control.overlay new file mode 100644 index 0000000..08e6e90 --- /dev/null +++ b/zephyr/g2h_lorawan_heat_control.overlay @@ -0,0 +1,6 @@ +/ { + load_switch: load_switch { + compatible = "power-switch"; + gpios = <&gpioc 0 GPIO_ACTIVE_HIGH>; + }; +}; \ No newline at end of file diff --git a/zephyr/prj.conf b/zephyr/prj.conf new file mode 100644 index 0000000..ea9563b --- /dev/null +++ b/zephyr/prj.conf @@ -0,0 +1,3 @@ +CONFIG_LORA=y +CONFIG_LORAWAN=y +CONFIG_LORAMAC_REGION_EU868=y \ No newline at end of file