diff options
-rw-r--r-- | src/peripheral/scb.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/peripheral/scb.rs b/src/peripheral/scb.rs index 58e083b..2ad0770 100644 --- a/src/peripheral/scb.rs +++ b/src/peripheral/scb.rs @@ -580,3 +580,21 @@ impl SCB { ::asm::isb(); } } + +const SCB_SCR_SLEEPDEEP: u32 = 0x1 << 2; + +impl SCB { + /// Set the SLEEPDEEP bit in the SCR register + pub fn set_sleepdeep(&mut self) { + unsafe { + self.scr.modify(|scr| scr | SCB_SCR_SLEEPDEEP); + } + } + + /// Clear the SLEEPDEEP bit in the SCR register + pub fn clear_sleepdeep(&mut self) { + unsafe { + self.scr.modify(|scr| scr & !SCB_SCR_SLEEPDEEP); + } + } +} |