aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar bors[bot] <bors[bot]@users.noreply.github.com> 2018-05-17 09:17:27 +0000
committerGravatar bors[bot] <bors[bot]@users.noreply.github.com> 2018-05-17 09:17:27 +0000
commitcf262c922fce7c5b0cff3b5d4acfd4008d194fa6 (patch)
treebccda86409c1906013627709853abb9ca2069fa0
parentf63d0c0114e50538cd65a18c2f2e1b1d6dcd5e8f (diff)
parent14c5e9049f8b0a95d98517fe2f121777175f2286 (diff)
downloadcortex-m-cf262c922fce7c5b0cff3b5d4acfd4008d194fa6.tar.gz
cortex-m-cf262c922fce7c5b0cff3b5d4acfd4008d194fa6.tar.zst
cortex-m-cf262c922fce7c5b0cff3b5d4acfd4008d194fa6.zip
Merge #89
89: Add methods to control SLEEPDEEP bit r=japaric a=hannobraun Close #68 Co-authored-by: Hanno Braun <hanno@braun-robotics.com>
-rw-r--r--src/peripheral/scb.rs18
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);
+ }
+ }
+}