Skip to content

Commit

Permalink
Merge pull request #130 from ut-ras/modm-rtt
Browse files Browse the repository at this point in the history
Use modm RTT implementation for logging
  • Loading branch information
calebchalmers authored May 27, 2024
2 parents 3c8a7d5 + 509d28b commit 0936610
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 4,154 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
ut-robomaster/build/
ut-robomaster/Pipfile.lock
project.xml.log
rtt.log

.vscode/.cortex-debug.peripherals.state.json
.vscode/.cortex-debug.registers.state.json
Expand Down
12 changes: 6 additions & 6 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@
},
"rttConfig": {
"enabled": true,
"address": "auto",
"address": "0x20000000",
"searchSize": 131072,
"searchId": "modm.rtt.modm",
"decoders": [
{
"port": 0,
"type": "console"
"type": "console",
"logfile": "${workspaceRoot}/ut-robomaster/rtt.log"
}
]
],
},
"postResetCommands": [
"monitor rtt start"
],
},
]
}
28 changes: 13 additions & 15 deletions ut-robomaster/src/communication/rtt.hpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
#include <stdio.h>
#include "modm/io.hpp"
#include "modm/platform/rtt/rtt.hpp"

#include "rtt/SEGGER_RTT.h"

int printf_rtt(const char* fmt, ...)
namespace communication
{
int r;
char data[64];
va_list params;

va_start(params, fmt);
r = vsnprintf(data, 64, fmt, params);
va_end(params);

SEGGER_RTT_Write(0, data, r);
return r;
}
class RttStream : public modm::IOStream
{
public:
RttStream() : IOStream(device) {}

private:
modm::platform::Rtt rtt{0};
modm::IODeviceObjectWrapper<modm::platform::Rtt, modm::IOBuffer::DiscardIfFull> device{rtt};
};
} // namespace communication
36 changes: 0 additions & 36 deletions ut-robomaster/src/communication/rtt/LICENSE.md

This file was deleted.

Loading

0 comments on commit 0936610

Please sign in to comment.