mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-23 20:22:51 +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;
|
let device = &extra.device;
|
||||||
|
|
||||||
quote!(
|
quote!(
|
||||||
#(#cfgs)*
|
#(#cfgs)*
|
||||||
impl<'a> rtic::Mutex for #path<'a> {
|
impl<'a> rtic::Mutex for #path<'a> {
|
||||||
type T = #ty;
|
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)]
|
#[inline(always)]
|
||||||
fn lock<RTIC_INTERNAL_R>(&mut self, f: impl FnOnce(&mut #ty) -> RTIC_INTERNAL_R) -> RTIC_INTERNAL_R {
|
fn lock<RTIC_INTERNAL_R>(&mut self, f: impl FnOnce(&mut #ty) -> RTIC_INTERNAL_R) -> RTIC_INTERNAL_R {
|
||||||
/// Priority ceiling
|
/// Priority ceiling
|
||||||
|
@ -52,7 +73,6 @@ pub fn impl_mutex(
|
||||||
#priority,
|
#priority,
|
||||||
CEILING,
|
CEILING,
|
||||||
#device::NVIC_PRIO_BITS,
|
#device::NVIC_PRIO_BITS,
|
||||||
&MASKS,
|
|
||||||
f,
|
f,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue