Skip to content

Commit cf262c9

Browse files
bors[bot]hannobraun
andcommitted
Merge #89
89: Add methods to control SLEEPDEEP bit r=japaric a=hannobraun Close #68 Co-authored-by: Hanno Braun <[email protected]>
2 parents f63d0c0 + 14c5e90 commit cf262c9

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)