-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[examples] Add RTT with OpenOCD example
- Loading branch information
Showing
4 changed files
with
99 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright (c) 2021, 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 <modm/board.hpp> | ||
#include <modm/processing.hpp> | ||
|
||
using namespace Board; | ||
|
||
Rtt rtt(1); | ||
modm::IODeviceObjectWrapper< Rtt, modm::IOBuffer::DiscardIfFull > device(rtt); | ||
modm::IOStream stream(device); | ||
|
||
// ---------------------------------------------------------------------------- | ||
int | ||
main() | ||
{ | ||
Board::initialize(); | ||
|
||
uint32_t counter(0); | ||
modm::PeriodicTimer tmr(100ms); | ||
|
||
char data; | ||
while (true) | ||
{ | ||
stream.get(data); | ||
switch(data) | ||
{ | ||
case '1'...'9': | ||
tmr.restart(std::chrono::milliseconds((data - '0') * 100)); | ||
break; | ||
} | ||
if (tmr.execute()) | ||
{ | ||
LedBlue::toggle(); | ||
|
||
stream << "loop: " << counter++ << modm::endl; | ||
} | ||
} | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<library> | ||
<extends>modm:disco-f469ni</extends> | ||
<options> | ||
<option name="modm:build:build.path">../../../build/stm32f469_discovery/rtt</option> | ||
<option name="modm:platform:rtt:buffer.rx">16</option> | ||
</options> | ||
<modules> | ||
<module>modm:platform:rtt</module> | ||
<module>modm:processing:timer</module> | ||
<module>modm:build:scons</module> | ||
</modules> | ||
</library> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters