Support as_ptr on a register for DMA and such
@@ -32,6 +32,21 @@ pub struct Reg<U, REG> {
unsafe impl<U: Send, REG> Send for Reg<U, REG> {}
+impl<U, REG> Reg<U, REG>
+where
+ U: Copy,
+{
+ /// Gets a memory address of a register.
+ ///
+ /// ```ignore
+ /// let reg_ptr = periph.reg.as_ptr();
+ /// ```
+ #[inline(always)]
+ pub fn as_ptr(&self) -> *mut U {
+ self.register.as_ptr()
+ }
+}
+
impl<U, REG> Reg<U, REG>
where
Self: Readable,
