Idle: Switch to NOP instead of WFI

Add example how to get old WFI behaviour
This commit is contained in:
Henrik Tjäder 2021-12-14 21:52:57 +01:00
parent 3741d431be
commit 8c8f7f12c3
6 changed files with 77 additions and 13 deletions

View file

@ -85,7 +85,7 @@ pub fn codegen(
vec![],
None,
quote!(loop {
rtic::export::wfi()
rtic::export::nop()
}),
)
}

View file

@ -122,12 +122,5 @@ pub fn codegen(app: &App, analysis: &Analysis, extra: &Extra) -> Vec<TokenStream
));
}
}
// If there's no user `#[idle]` then optimize returning from interrupt handlers
if app.idle.is_none() {
// Set SLEEPONEXIT bit to enter sleep mode when returning from ISR
stmts.push(quote!(core.SCB.scr.modify(|r| r | 1 << 1);));
}
stmts
}