aboutsummaryrefslogtreecommitdiff
path: root/src/peripheral/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/peripheral/mod.rs')
-rw-r--r--src/peripheral/mod.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/peripheral/mod.rs b/src/peripheral/mod.rs
index d462bdb..bd658a4 100644
--- a/src/peripheral/mod.rs
+++ b/src/peripheral/mod.rs
@@ -9,7 +9,7 @@
#![allow(private_no_mangle_statics)]
use core::marker::PhantomData;
-use core::ops::Deref;
+use core::ops::{Deref, DerefMut};
use interrupt;
@@ -262,8 +262,8 @@ pub struct ITM {
impl ITM {
/// Returns a pointer to the register block
- pub fn ptr() -> *const itm::RegisterBlock {
- 0xE000_0000 as *const _
+ pub fn ptr() -> *mut itm::RegisterBlock {
+ 0xE000_0000 as *mut _
}
}
@@ -275,6 +275,12 @@ impl Deref for ITM {
}
}
+impl DerefMut for ITM {
+ fn deref_mut(&mut self) -> &mut Self::Target {
+ unsafe { &mut *Self::ptr() }
+ }
+}
+
/// Memory Protection Unit
pub struct MPU {
_marker: PhantomData<*const ()>,