From 6de70bacd25b7e5ec841345b7734d9131632ba13 Mon Sep 17 00:00:00 2001 From: Christopher Durand Date: Fri, 22 Sep 2023 12:49:16 +0200 Subject: [PATCH] [example] Add Nucleo-G070RB blink example --- .github/workflows/linux.yml | 2 +- examples/nucleo_g070rb/blink/main.cpp | 44 ++++++++++++++++++++++++ examples/nucleo_g070rb/blink/project.xml | 11 ++++++ 3 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 examples/nucleo_g070rb/blink/main.cpp create mode 100644 examples/nucleo_g070rb/blink/project.xml diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 9de02e20ef..c6da2de592 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -153,7 +153,7 @@ jobs: - name: Examples STM32G0 Series if: always() run: | - (cd examples && ../tools/scripts/examples_compile.py nucleo_g071rb) + (cd examples && ../tools/scripts/examples_compile.py nucleo_g070rb nucleo_g071rb) - name: Examples STM32L0 Series if: always() run: | diff --git a/examples/nucleo_g070rb/blink/main.cpp b/examples/nucleo_g070rb/blink/main.cpp new file mode 100644 index 0000000000..a6f817cc72 --- /dev/null +++ b/examples/nucleo_g070rb/blink/main.cpp @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2019, Niklas Hauser + * + * This file is part of the modm project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include +#include + +using namespace Board; + +// ---------------------------------------------------------------------------- +int +main() +{ + Board::initialize(); + LedD13::setOutput(modm::Gpio::Low); + + // Use the logging streams to print some messages. + // Change MODM_LOG_LEVEL above to enable or disable these messages + MODM_LOG_DEBUG << "debug" << modm::endl; + MODM_LOG_INFO << "info" << modm::endl; + MODM_LOG_WARNING << "warning" << modm::endl; + MODM_LOG_ERROR << "error" << modm::endl; + + uint32_t counter{0}; + modm::PeriodicTimer timer{500ms}; + + while (true) + { + if (timer.execute()) + { + LedD13::toggle(); + + MODM_LOG_INFO << "loop: " << counter++ << modm::endl; + } + } + + return 0; +} diff --git a/examples/nucleo_g070rb/blink/project.xml b/examples/nucleo_g070rb/blink/project.xml new file mode 100644 index 0000000000..001c5a5fc0 --- /dev/null +++ b/examples/nucleo_g070rb/blink/project.xml @@ -0,0 +1,11 @@ + + modm:nucleo-g070rb + + + + + modm:platform:gpio + modm:processing:timer + modm:build:scons + +