Skip to content

Commit f61593f

Browse files
authored
Merge branch 'main' into main
2 parents 9c0d908 + 6128141 commit f61593f

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ Initial release
713713

714714
### [defmt-rtt-next]
715715

716-
* No changes
716+
* [#968] Add `in_blocking_mode` public method
717717

718718
### [defmt-rtt-v1.0.0] (2025-04-01)
719719

@@ -949,6 +949,7 @@ Initial release
949949
---
950950

951951
[#966]: https://github.com/knurling-rs/defmt/pull/966
952+
[#968]: https://github.com/knurling-rs/defmt/pull/968
952953
[#965]: https://github.com/knurling-rs/defmt/pull/965
953954
[#960]: https://github.com/knurling-rs/defmt/pull/960
954955
[#959]: https://github.com/knurling-rs/defmt/pull/959

firmware/defmt-rtt/src/lib.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,17 @@ static _SEGGER_RTT: Header = Header {
9393
},
9494
};
9595

96+
/// Report whether the SEGGER RTT up channel is in blocking mode.
97+
///
98+
/// Returns true if the mode bitfield within the flags value has been set to
99+
/// `SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL`.
100+
///
101+
/// Currently we start-up in non-blocking mode, so if it's been set to blocking
102+
/// mode then the connected client (e.g. probe-rs) must have done it.
103+
pub fn in_blocking_mode() -> bool {
104+
(_SEGGER_RTT.up_channel.flags.load(Ordering::Relaxed) & MODE_MASK) == MODE_BLOCK_IF_FULL
105+
}
106+
96107
/// Our shared buffer
97108
#[cfg_attr(target_os = "macos", link_section = ".uninit,defmt-rtt.BUFFER")]
98109
#[cfg_attr(not(target_os = "macos"), link_section = ".uninit.defmt-rtt.BUFFER")]

0 commit comments

Comments
 (0)