commit 7a82e544142ab1d529bfb13095a5095560ca6bdf Author: pjanik-hub Date: Thu Feb 19 19:07:05 2026 -0700 testing diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..567609b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build/ diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..1089c13 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.20.0) + +set(BOARD nucleo_g474re) +find_package(Zephyr REQUIRED) +project(app) + +target_sources(app PRIVATE src/main.c) diff --git a/Kconfig b/Kconfig new file mode 100644 index 0000000..3e836c5 --- /dev/null +++ b/Kconfig @@ -0,0 +1,14 @@ +# SPDX-License-Identifier: Apache-2.0 + +mainmenu "First App" + +# Your application configuration options go here + +# Sources Kconfig.zephyr in the Zephyr root directory. +# +# Note: All 'source' statements work relative to the Zephyr root directory (due +# to the $srctree environment variable being set to $ZEPHYR_BASE). If you want +# to 'source' relative to the current Kconfig file instead, use 'rsource' (or a +# path relative to the Zephyr root). + +source "Kconfig.zephyr" \ No newline at end of file diff --git a/boards/nucleo_g474re.overlay b/boards/nucleo_g474re.overlay new file mode 100644 index 0000000..299b4df --- /dev/null +++ b/boards/nucleo_g474re.overlay @@ -0,0 +1,23 @@ +/ { + aliases { + /* alias used by DT_ALIAS(led0) in app code */ + led0 = &ld2; + }; + + /* simple gpio-leds node */ + leds { + compatible = "gpio-leds"; + ld2: led_0 { + gpios = <&gpioa 5 GPIO_ACTIVE_HIGH>; /* LD2 -> PA5 */ + label = "LD2"; + }; + }; +}; + +&gpioa { + status = "okay"; +}; + +&gpioc { + status = "okay"; +}; \ No newline at end of file diff --git a/prj.conf b/prj.conf new file mode 100644 index 0000000..0211a80 --- /dev/null +++ b/prj.conf @@ -0,0 +1,7 @@ +# enable gpio driver +CONFIG_GPIO=y +CONFIG_SERIAL=y +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y +CONFIG_PRINTK=y +CONFIG_UART_INTERRUPT_DRIVEN=y \ No newline at end of file diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..ae94e3b --- /dev/null +++ b/src/main.c @@ -0,0 +1,37 @@ +#include +#include +#include +#include + +#define SLEEP_MS 2000 + +#define LED_NODE DT_ALIAS(led0) +#if !DT_NODE_HAS_STATUS(LED_NODE, okay) +#error "led0 not enabled in devicetree" +#endif + +static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED_NODE, gpios); + +int main(void) +{ + printk("app started\n"); + + if (!gpio_is_ready_dt(&led)) + { + printk("LED GPIO not ready\n"); + return 0; + } + + int ret = gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE); + if (ret < 0) + { + printk("LED GPIO configure failed: %d\n", ret); + return 0; + } + + char incoming; + int i = 0; + while (1) + { + } +} \ No newline at end of file