Struct rtt_target::UpChannel [−][src]
pub struct UpChannel(_);
RTT up (target to host) channel
Supports writing binary data directly, or writing strings via core::fmt
macros such as
write
as well as the ufmt crate’s uwrite
macros (use the u
method).
Note that the formatted writing implementations diverge slightly from the trait definitions in that if the channel is in non-blocking mode, writing will not block.
Implementations
impl UpChannel
[src]
impl UpChannel
[src]pub fn write(&mut self, buf: &[u8]) -> usize
[src]
Writes buf
to the channel and returns the number of bytes written. Behavior when the
buffer is full is subject to the channel blocking mode.
pub fn u(&mut self) -> uWriter<'_>
[src]
Creates a writer for formatted writing with ufmt.
The correct way to use this method is to call it once for each write operation. This is so that non blocking modes will work correctly.
let mut output = channels.up.0; uwriteln!(output.u(), "Hello, ufmt!");
pub fn mode(&self) -> ChannelMode
[src]
Gets the current blocking mode of the channel. The default is NoBlockSkip
.
pub fn set_mode(&mut self, mode: ChannelMode)
[src]
Sets the blocking mode of the channel
pub fn into_terminal(self) -> TerminalChannel
[src]
Converts the channel into a virtual terminal that can be used for writing into multiple virtual terminals.
pub unsafe fn conjure(number: usize) -> Option<UpChannel>
[src]
Magically creates a channel out of thin air. Return None
if the channel number is too
high, or if the channel has not been initialized.
Calling this function will cause a linking error if rtt_init
has not been called.
Safety
It’s undefined behavior for something else to access the channel through anything else besides the returned object during or after calling this function. Essentially this function is only safe to use in panic handlers and the like that permanently disable interrupts.