diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index eae5f2e..7bd6da8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,7 +17,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 with: - path: zephyr-firmware-template + path: firmware-template - name: Set up Python uses: actions/setup-python@v5 @@ -27,11 +27,11 @@ jobs: - name: Setup Zephyr project uses: zephyrproject-rtos/action-zephyr-setup@v1 with: - app-path: zephyr-firmware-template + app-path: firmware-template toolchains: arm-zephyr-eabi - name: Build firmware - working-directory: zephyr-firmware-template + working-directory: firmware-template shell: bash run: | if [ "${{ runner.os }}" = "Windows" ]; then @@ -40,7 +40,7 @@ jobs: west twister -T app -v --inline-logs --integration $EXTRA_TWISTER_FLAGS - name: Twister Tests - working-directory: zephyr-firmware-template + working-directory: firmware-template shell: bash run: | if [ "${{ runner.os }}" = "Windows" ]; then diff --git a/README.md b/README.md index 2a4ac7e..5f47158 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -# Zephyr Firmware Template +# Firmware Template - - + + - - + + Documentation @@ -15,7 +15,7 @@
shape_3FWSg8mxSBF3motfyvrGN at 24-08-13 17 33 10 -This repository contains a Zephyr example application. The main purpose of this +This repository contains a Zephyr firmware template. The main purpose of this repository is to serve as a reference on how to structure Zephyr-based applications. Some of the features demonstrated in this example are: @@ -57,12 +57,12 @@ environment. Follow the official ### Initialization The first step is to initialize the workspace folder (``my-workspace``) where -the ``example-application`` and all Zephyr modules will be cloned. Run the following +the ``firmware-template`` and all Zephyr modules will be cloned. Run the following command: ```shell # initialize my-workspace for the panomic-application (main branch) -west init -m git@github.com:Technoculture/panomic-tray-firmware --mr main panomic-workspace +west init -m https://github.com/Technoculture/firmware-template --mr main panomic-workspace # update Zephyr modules cd panomic-workspace west update diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index a59bf06..d5e17d1 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -1,5 +1,5 @@ #------------------------------------------------------------------------------- -# Zephyr Example Application +# Firmware Template # # Copyright (c) 2021 Nordic Semiconductor ASA # SPDX-License-Identifier: Apache-2.0 diff --git a/app/boards/nucleo_f302r8.overlay b/app/boards/nucleo_f302r8.overlay index 279e356..f7efd9c 100644 --- a/app/boards/nucleo_f302r8.overlay +++ b/app/boards/nucleo_f302r8.overlay @@ -5,23 +5,23 @@ /* This devicetree overlay file will be automatically picked by the Zephyr * build system when building the sample for the nucleo_f302r8 board. It shows - * how the example-application can be built on sample boards already provided + * how the firmware-template can be built on sample boards already provided * by Zephyr. */ / { - example_sensor: example-sensor { - compatible = "zephyr,example-sensor"; - input-gpios = <&gpioc 13 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; - }; + example_sensor: example-sensor { + compatible = "zephyr,example-sensor"; + input-gpios = <&gpioc 13 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; + }; - blink_led: blink-led { - compatible = "blink-gpio-led"; - led-gpios = <&gpiob 13 GPIO_ACTIVE_HIGH>; - blink-period-ms = <1000>; - }; + blink_led: blink-led { + compatible = "blink-gpio-led"; + led-gpios = <&gpiob 13 GPIO_ACTIVE_HIGH>; + blink-period-ms = <1000>; + }; }; &gpioc { - status = "okay"; + status = "okay"; }; diff --git a/app/sample.yaml b/app/sample.yaml index 582bb8f..9a7a8c9 100644 --- a/app/sample.yaml +++ b/app/sample.yaml @@ -2,8 +2,8 @@ # the Zephyr testing tool. In this file, multiple combinations can be specified, # so that you can easily test all of them locally or in CI. sample: - description: Example application - name: example-application + description: Firmware template + name: firmware-template common: build_only: true integration_platforms: diff --git a/app/src/main.c b/app/src/main.c index dffdf41..7040226 100644 --- a/app/src/main.c +++ b/app/src/main.c @@ -14,67 +14,76 @@ LOG_MODULE_REGISTER(main, CONFIG_APP_LOG_LEVEL); #define BLINK_PERIOD_MS_STEP 100U -#define BLINK_PERIOD_MS_MAX 1000U +#define BLINK_PERIOD_MS_MAX 1000U int main(void) { - int ret; - unsigned int period_ms = BLINK_PERIOD_MS_MAX; - const struct device *sensor, *blink; - struct sensor_value last_val = { 0 }, val; - - printk("Zephyr Example Application %s\n", APP_VERSION_STRING); - - sensor = DEVICE_DT_GET(DT_NODELABEL(example_sensor)); - if (!device_is_ready(sensor)) { - LOG_ERR("Sensor not ready"); - return 0; - } - - blink = DEVICE_DT_GET(DT_NODELABEL(blink_led)); - if (!device_is_ready(blink)) { - LOG_ERR("Blink LED not ready"); - return 0; - } - - ret = blink_off(blink); - if (ret < 0) { - LOG_ERR("Could not turn off LED (%d)", ret); - return 0; - } - - printk("Use the sensor to change LED blinking period\n"); - - while (1) { - ret = sensor_sample_fetch(sensor); - if (ret < 0) { - LOG_ERR("Could not fetch sample (%d)", ret); - return 0; - } - - ret = sensor_channel_get(sensor, SENSOR_CHAN_PROX, &val); - if (ret < 0) { - LOG_ERR("Could not get sample (%d)", ret); - return 0; - } - - if ((last_val.val1 == 0) && (val.val1 == 1)) { - if (period_ms == 0U) { - period_ms = BLINK_PERIOD_MS_MAX; - } else { - period_ms -= BLINK_PERIOD_MS_STEP; - } - - printk("Proximity detected, setting LED period to %u ms\n", - period_ms); - blink_set_period_ms(blink, period_ms); - } - - last_val = val; - - k_sleep(K_MSEC(100)); - } - - return 0; + int ret; + unsigned int period_ms = BLINK_PERIOD_MS_MAX; + const struct device *sensor, *blink; + struct sensor_value last_val = {0}, val; + + printk("Firmware Template %s\n", APP_VERSION_STRING); + + sensor = DEVICE_DT_GET(DT_NODELABEL(example_sensor)); + if (!device_is_ready(sensor)) + { + LOG_ERR("Sensor not ready"); + return 0; + } + + blink = DEVICE_DT_GET(DT_NODELABEL(blink_led)); + if (!device_is_ready(blink)) + { + LOG_ERR("Blink LED not ready"); + return 0; + } + + ret = blink_off(blink); + if (ret < 0) + { + LOG_ERR("Could not turn off LED (%d)", ret); + return 0; + } + + printk("Use the sensor to change LED blinking period\n"); + + while (1) + { + ret = sensor_sample_fetch(sensor); + if (ret < 0) + { + LOG_ERR("Could not fetch sample (%d)", ret); + return 0; + } + + ret = sensor_channel_get(sensor, SENSOR_CHAN_PROX, &val); + if (ret < 0) + { + LOG_ERR("Could not get sample (%d)", ret); + return 0; + } + + if ((last_val.val1 == 0) && (val.val1 == 1)) + { + if (period_ms == 0U) + { + period_ms = BLINK_PERIOD_MS_MAX; + } + else + { + period_ms -= BLINK_PERIOD_MS_STEP; + } + + printk("Proximity detected, setting LED period to %u ms\n", + period_ms); + blink_set_period_ms(blink, period_ms); + } + + last_val = val; + + k_sleep(K_MSEC(100)); + } + + return 0; } - diff --git a/boards/vendor/custom_plank/README.md b/boards/vendor/custom_plank/README.md index f4b868b..c00b9a0 100644 --- a/boards/vendor/custom_plank/README.md +++ b/boards/vendor/custom_plank/README.md @@ -2,5 +2,5 @@ `custom_plank` board is used to demonstrate how to create custom boards. It is in fact a simplified version of the nRF52840-DK board, so the -`example-application` can be run on that development kit when using +`firmware-template` can be run on that development kit when using `custom_plank`. diff --git a/doc/Doxyfile b/doc/Doxyfile index 2c744db..8efc377 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -42,7 +42,7 @@ DOXYFILE_ENCODING = UTF-8 # title of most generated pages and in a few other places. # The default value is: My Project. -PROJECT_NAME = "Example Application" +PROJECT_NAME = "Firmware Template" # The PROJECT_NUMBER tag can be used to enter a project or revision number. This # could be handy for archiving the generated documentation or if some version @@ -54,7 +54,7 @@ PROJECT_NUMBER = 1.0.0 # for a project that appears at the top of each page and should give viewer a # quick idea about the purpose of the project. Keep the description short. -PROJECT_BRIEF = A Zephyr-based example application +PROJECT_BRIEF = A Zephyr-based firmware template # With the PROJECT_LOGO tag one can specify a logo or an icon that is included # in the documentation. The maximum height of the logo should not exceed 55 diff --git a/doc/_doxygen/main.md b/doc/_doxygen/main.md index 10402ea..597527c 100644 --- a/doc/_doxygen/main.md +++ b/doc/_doxygen/main.md @@ -1,5 +1,5 @@ # Introduction -This is the Doxygen documentation for [example-application]. +This is the Doxygen documentation for [firmware-template]. -[example-application]: https://github.com/zephyrproject-rtos/example-application +[firmware-template]: https://github.com/technoculture/firmware-template diff --git a/doc/conf.py b/doc/conf.py index 0cb5ccc..836bf0e 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -6,7 +6,7 @@ # -- Project information ----------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information -project = 'Example Application' +project = 'Firmware Template' copyright = '2024, The Zephyr Community' author = 'The Zephyr Community' release = '1.0.0' @@ -35,6 +35,6 @@ # WARNING: please, check breathe maintainership status before using this # extension in production! -breathe_projects = {'example-application': '_build_doxygen/xml'} -breathe_default_project = 'example-application' +breathe_projects = {'firmware-template': '_build_doxygen/xml'} +breathe_default_project = 'firmware-template' breathe_default_members = ('members', ) diff --git a/doc/index.rst b/doc/index.rst index 54f0f0b..d9669a4 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -1,7 +1,7 @@ -Welcome to Example Application's documentation! +Welcome to Firmware Template's documentation! =============================================== -This is a simple Sphinx documentation setup for ``example-application``. +This is a simple Sphinx documentation setup for ``firmware-template``. .. toctree:: :maxdepth: 2 diff --git a/scripts/example_west_command.py b/scripts/example_west_command.py index 7f68d7f..ef884cf 100644 --- a/scripts/example_west_command.py +++ b/scripts/example_west_command.py @@ -4,7 +4,7 @@ '''example_west_command.py -Example of a west extension in the example-application repository.''' +Example of a west extension in the firmware-template repository.''' from west.commands import WestCommand # your extension must subclass this from west import log # use this for user output diff --git a/zephyr/module.yml b/zephyr/module.yml index 047032a..bdc0f40 100644 --- a/zephyr/module.yml +++ b/zephyr/module.yml @@ -3,7 +3,7 @@ build: # Path to the Kconfig file that will be sourced into Zephyr Kconfig tree under - # Zephyr > Modules > example-application. Path is relative from root of this + # Zephyr > Modules > firmware-template. Path is relative from root of this # repository. kconfig: Kconfig # Path to the folder that contains the CMakeLists.txt file to be included by