mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-25 21:19:35 +01:00
lock impl behind cfg
This commit is contained in:
parent
33174ac65b
commit
688b199c44
1 changed files with 21 additions and 1 deletions
|
@ -36,11 +36,32 @@ pub fn impl_mutex(
|
|||
};
|
||||
|
||||
let device = &extra.device;
|
||||
|
||||
quote!(
|
||||
#(#cfgs)*
|
||||
impl<'a> rtic::Mutex for #path<'a> {
|
||||
type T = #ty;
|
||||
|
||||
#[cfg(not(armv7m))]
|
||||
#[inline(always)]
|
||||
fn lock<RTIC_INTERNAL_R>(&mut self, f: impl FnOnce(&mut #ty) -> RTIC_INTERNAL_R) -> RTIC_INTERNAL_R {
|
||||
/// Priority ceiling
|
||||
const CEILING: u8 = #ceiling;
|
||||
|
||||
|
||||
unsafe {
|
||||
rtic::export::lock(
|
||||
#ptr,
|
||||
#priority,
|
||||
CEILING,
|
||||
#device::NVIC_PRIO_BITS,
|
||||
&MASKS,
|
||||
f,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(armv7m)]
|
||||
#[inline(always)]
|
||||
fn lock<RTIC_INTERNAL_R>(&mut self, f: impl FnOnce(&mut #ty) -> RTIC_INTERNAL_R) -> RTIC_INTERNAL_R {
|
||||
/// Priority ceiling
|
||||
|
@ -52,7 +73,6 @@ pub fn impl_mutex(
|
|||
#priority,
|
||||
CEILING,
|
||||
#device::NVIC_PRIO_BITS,
|
||||
&MASKS,
|
||||
f,
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue