Module drone::reg
[−]
[src]
Memory-mapped registers.
Mapping
Most of registers should be already mapped by platform crates. These crates
should map registers with reg!
macro as follows:
use drone::reg; use drone::reg::prelude::*; reg! { //! SysTick control and status register. 0xE000_E010 // memory address 0x20 // bit size Ctrl // register's name RReg WReg // list of marker traits to implement }
Binding
It is strongly encouraged to bind registers with a single bind!
block at
the very beginning of the application entry point.
use drone::reg; use drone::reg::prelude::*; use core::mem::size_of_val; reg::bind! { stk_ctrl: stk::Ctrl<Lr>, } // Use the bindings inside the current scope. assert_eq!(size_of_val(&stk_ctrl), 0);
Re-exports
pub use drone_macros::bind_imp; |
pub use drone_macros::reg_imp; |
Modules
prelude |
Memory-mapped registers prelude. |
Structs
Ar |
Zero-sized marker type for thread-safe register bindings. "Ar" stands
for "Atomic register". Does implement |
Lr |
Zero-sized marker type for thread-unsafe register bindings. "Lr" stands
for "Local Register". Does not implement |
Traits
RReg |
Register that can read its value. |
Reg |
Memory-mapped register binding. Types which implement this trait should be zero-sized. This is a zero-cost abstraction for safely working with memory-mapped registers. |
RegFlavor |
Marker trait for various register flavors. |
RegRaw |
Raw register value type. |
RegValue |
Wrapper for a corresponding register's value. |
RwLocalReg |
Register that can read and write its value in a single-threaded context. |
WReg |
Register that can write its value. |