Move RTT init to constructor
This commit is contained in:
parent
837268a712
commit
2e4bc42cd5
|
@ -236,6 +236,9 @@ impl NonBlockingOutput {
|
||||||
/// Create a non-blocking output stream
|
/// Create a non-blocking output stream
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
|
unsafe {
|
||||||
|
_SEGGER_RTT.init();
|
||||||
|
}
|
||||||
Self { blocked: false }
|
Self { blocked: false }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -244,7 +247,6 @@ impl fmt::Write for NonBlockingOutput {
|
||||||
fn write_str(&mut self, s: &str) -> fmt::Result {
|
fn write_str(&mut self, s: &str) -> fmt::Result {
|
||||||
if !self.blocked {
|
if !self.blocked {
|
||||||
unsafe {
|
unsafe {
|
||||||
_SEGGER_RTT.init();
|
|
||||||
if !_SEGGER_RTT.up.write(s.as_bytes(), false) {
|
if !_SEGGER_RTT.up.write(s.as_bytes(), false) {
|
||||||
self.blocked = true;
|
self.blocked = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue