Skip to content

Commit 14c5e90

Browse files
committed
Add methods to control SLEEPDEEP bit
Close #68
1 parent f63d0c0 commit 14c5e90

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
@@ -580,3 +580,21 @@ impl SCB {
580580
::asm::isb();
581581
}
582582
}
583+
584+
const SCB_SCR_SLEEPDEEP: u32 = 0x1 << 2;
585+
586+
impl SCB {
587+
/// Set the SLEEPDEEP bit in the SCR register
588+
pub fn set_sleepdeep(&mut self) {
589+
unsafe {
590+
self.scr.modify(|scr| scr | SCB_SCR_SLEEPDEEP);
591+
}
592+
}
593+
594+
/// Clear the SLEEPDEEP bit in the SCR register
595+
pub fn clear_sleepdeep(&mut self) {
596+
unsafe {
597+
self.scr.modify(|scr| scr & !SCB_SCR_SLEEPDEEP);
598+
}
599+
}
600+
}

0 commit comments

Comments
 (0)