pub trait SwoAccess {
// Required methods
fn enable_swo(&mut self, config: &SwoConfig) -> Result<(), ArmError>;
fn disable_swo(&mut self) -> Result<(), ArmError>;
fn read_swo_timeout(
&mut self,
timeout: Duration,
) -> Result<Vec<u8>, ArmError>;
// Provided methods
fn read_swo(&mut self) -> Result<Vec<u8>, ArmError> { ... }
fn swo_poll_interval_hint(&mut self, config: &SwoConfig) -> Option<Duration> { ... }
fn swo_buffer_size(&mut self) -> Option<usize> { ... }
}
Expand description
An interface to operate SWO to be implemented on drivers that support SWO.
Required Methods§
Sourcefn enable_swo(&mut self, config: &SwoConfig) -> Result<(), ArmError>
fn enable_swo(&mut self, config: &SwoConfig) -> Result<(), ArmError>
Configure a SwoAccess interface for reading SWO data.
Sourcefn disable_swo(&mut self) -> Result<(), ArmError>
fn disable_swo(&mut self) -> Result<(), ArmError>
Disable SWO reading on this SwoAccess interface.
Provided Methods§
Sourcefn read_swo(&mut self) -> Result<Vec<u8>, ArmError>
fn read_swo(&mut self) -> Result<Vec<u8>, ArmError>
Read any available SWO data without waiting.
Returns a Vec<u8>
of received SWO bytes since the last read_swo()
call.
If no data was available, returns an empty Vec.
Sourcefn swo_poll_interval_hint(&mut self, config: &SwoConfig) -> Option<Duration>
fn swo_poll_interval_hint(&mut self, config: &SwoConfig) -> Option<Duration>
Request an estimated best time to wait between polls of read_swo
.
A probe can implement this if it can work out a sensible time to wait between polls, for example using the probe’s internal buffer size and SWO baud rate, or a 0s duration if reads can block for new data.
The default implementation computes an estimated interval based on the buffer size, mode, and baud rate.
Sourcefn swo_buffer_size(&mut self) -> Option<usize>
fn swo_buffer_size(&mut self) -> Option<usize>
Request the probe SWO buffer size, if known.