Skip to content

Commit db67186

Browse files
Merge #124
124: Add api to set SLEEPONEXIT bit in SCR register r=korken89 a=simonvandel Co-authored-by: Simon Vandel Sillesen <[email protected]>
2 parents b70a217 + f7f2555 commit db67186

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/peripheral/scb.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,24 @@ impl SCB {
596596
}
597597
}
598598

599+
const SCB_SCR_SLEEPONEXIT: u32 = 0x1 << 1;
600+
601+
impl SCB {
602+
/// Set the SLEEPONEXIT bit in the SCR register
603+
pub fn set_sleeponexit(&mut self) {
604+
unsafe {
605+
self.scr.modify(|scr| scr | SCB_SCR_SLEEPONEXIT);
606+
}
607+
}
608+
609+
/// Clear the SLEEPONEXIT bit in the SCR register
610+
pub fn clear_sleeponexit(&mut self) {
611+
unsafe {
612+
self.scr.modify(|scr| scr & !SCB_SCR_SLEEPONEXIT);
613+
}
614+
}
615+
}
616+
599617
const SCB_AIRCR_VECTKEY: u32 = 0x05FA << 16;
600618
const SCB_AIRCR_PRIGROUP_MASK: u32 = 0x5 << 8;
601619
const SCB_AIRCR_SYSRESETREQ: u32 = 1 << 2;

0 commit comments

Comments
 (0)