diff --git a/examples/README.md b/examples/README.md index 55c614ede5..402d37e572 100644 --- a/examples/README.md +++ b/examples/README.md @@ -94,7 +94,7 @@ make gdb ## Interesting Examples -We have a lot of examples, 176 to be +We have a lot of examples, 177 to be exact, but here are some of our favorite examples for our supported development boards: diff --git a/examples/nucleo_f103rb/itm/main.cpp b/examples/nucleo_f103rb/itm/main.cpp new file mode 100644 index 0000000000..e0519371fa --- /dev/null +++ b/examples/nucleo_f103rb/itm/main.cpp @@ -0,0 +1,52 @@ +/* + * 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; + +modm::IODeviceWrapper itm_device; +modm::IOStream stream(itm_device); + +int +main() +{ + Board::initialize(); + LedD13::setOutput(); + + // Done by OpenOCD: scons itm fcpu=64000000 + // Itm::initialize(); + // Itm::connect(); + + stream << "Hello from the SWO." << modm::endl; + stream << "debug" << modm::endl; + stream << "info" << modm::endl; + stream << "warning" << modm::endl; + stream << "error" << modm::endl; + + + while (1) + { + static modm::PeriodicTimer tmr{500}; + if (tmr.execute()) + { + tmr.restart(Button::read() ? 100 : 500); + LedD13::toggle(); + + static uint32_t counter{0}; + stream << "loop: " << counter++ << modm::endl; + } + Itm::update(); + } + + return 0; +} diff --git a/examples/nucleo_f103rb/itm/project.xml b/examples/nucleo_f103rb/itm/project.xml new file mode 100644 index 0000000000..b34b7319e2 --- /dev/null +++ b/examples/nucleo_f103rb/itm/project.xml @@ -0,0 +1,11 @@ + + modm:nucleo-f103rb + + + + + + modm:build:scons + modm:platform:itm + +