Skip to content

Commit

Permalink
Add a free() method for non-cortex-m build targets that panics, to al…
Browse files Browse the repository at this point in the history
…low checking code that uses it on native platform.
  • Loading branch information
adamgreig committed Feb 24, 2022
1 parent c39dfb3 commit f3a4818
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/interrupt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,14 @@ where

r
}

// Make a `free()` function available to allow checking dependencies without specifying a target,
// but that will panic at runtime if executed.
#[doc(hidden)]
#[cfg(not(cortex_m))]
pub fn free<F, R>(_: F) -> R
where
F: FnOnce(&CriticalSection) -> R,
{
panic!("cortex_m::interrupt::free() is only functional on cortex-m platforms");
}
1 change: 0 additions & 1 deletion src/peripheral/tpiu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ impl TPIU {
/// [`trace_output_protocol`](Self::set_trace_output_protocol).
#[inline]
pub fn trace_output_protocol(&self) -> Option<TraceProtocol> {
use core::convert::TryInto;
self.sppr.read().txmode().try_into().ok()
}

Expand Down

0 comments on commit f3a4818

Please sign in to comment.