|
| 1 | +/* |
| 2 | + * Copyright (c) 2016-2017, Niklas Hauser |
| 3 | + * |
| 4 | + * This file is part of the modm project. |
| 5 | + * |
| 6 | + * This Source Code Form is subject to the terms of the Mozilla Public |
| 7 | + * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 8 | + * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 9 | + */ |
| 10 | +// ---------------------------------------------------------------------------- |
| 11 | + |
| 12 | +#include <modm/board.hpp> |
| 13 | +#include <modm/processing.hpp> |
| 14 | + |
| 15 | +using namespace Board; |
| 16 | + |
| 17 | +int |
| 18 | +main() |
| 19 | +{ |
| 20 | + Board::initialize(); |
| 21 | + Leds::setOutput(); |
| 22 | + |
| 23 | + // Use the logging streams to print some messages. |
| 24 | + // Change MODM_LOG_LEVEL above to enable or disable these messages |
| 25 | + MODM_LOG_DEBUG << "debug" << modm::endl; |
| 26 | + MODM_LOG_INFO << "info" << modm::endl; |
| 27 | + MODM_LOG_WARNING << "warning" << modm::endl; |
| 28 | + MODM_LOG_ERROR << "error" << modm::endl; |
| 29 | + |
| 30 | + for (const auto [traits, start, end, size] : modm::platform::HeapTable()) |
| 31 | + { |
| 32 | + MODM_LOG_INFO.printf("Memory section %#x @[0x%p,0x%p](%u)\n", |
| 33 | + traits.value, start, end, size); |
| 34 | + } |
| 35 | + |
| 36 | + uint32_t counter(0); |
| 37 | + modm::ShortTimeout tmr; |
| 38 | + |
| 39 | + while (true) |
| 40 | + { |
| 41 | + Leds::write(1 << (counter % (Leds::width+1) )); |
| 42 | + // modm::delay(Button::read() ? 100ms : 500ms); |
| 43 | + tmr.restart(Button::read() ? 100ms : 500ms); |
| 44 | + while(not tmr.execute()) ; |
| 45 | + |
| 46 | + MODM_LOG_INFO << "loop: " << counter++ << modm::endl; |
| 47 | + } |
| 48 | + |
| 49 | + return 0; |
| 50 | +} |
0 commit comments