mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-30 15:34:33 +01:00
rtic::export::Peripherals created by into instead of transmute
This commit is contained in:
parent
bfb498e722
commit
e297ceb1ad
1 changed files with 8 additions and 6 deletions
|
@ -38,15 +38,17 @@ pub fn codegen(
|
|||
}
|
||||
}
|
||||
|
||||
stmts.push(quote!(
|
||||
// NOTE(transmute) to avoid debug_assertion in multi-core mode
|
||||
let mut core: rtic::export::Peripherals = core::mem::transmute(());
|
||||
));
|
||||
|
||||
if app.args.cores == 1 {
|
||||
stmts.push(quote!(
|
||||
// To set the variable in cortex_m so the peripherals cannot be taken multiple times
|
||||
let _ = cortex_m::Peripherals::steal();
|
||||
let peripherals = cortex_m::Peripherals::steal();
|
||||
let mut core: rtic::export::Peripherals = peripherals.into();
|
||||
));
|
||||
} else {
|
||||
stmts.push(quote!(
|
||||
// NOTE(transmute) to avoid debug_assertion in multi-core mode
|
||||
// (This code will go away when we drop multi-core mode)
|
||||
let mut core: rtic::export::Peripherals = core::mem::transmute(());
|
||||
));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue