UART over RTT¶
lbuild module: modm:platform:rtt
The RTT channels are exposed as a UART interface which you can use like so:
// Access data via static methods
using Rtt = modm::platform::Rtt<0>;
// Create a software loopback
if (uint8_t data; Rtt::read(data)) { Rtt::write(data); }
// Wrap into an IOStream
modm::IODeviceWrapper<Rtt, modm::IOBuffer::BlockIfFull> rtt_device;
modm::IOStream stream(rtt_device);
// Writing data
stream << "Hello World" << modm::endl;
// Reading data from an IOStream
if (char data; stream.get(data), data != modm::IOStream::eof)
{ /* process new data */ }
To configure the number and size of RTT channels, see the modm:rtt
module.
This module is only available for rp, sam, stm32.
Dependencies¶
Limited availability: Check with 'lbuild discover' if this module is available for your target!