diff --git a/src/peripheral/mod.rs b/src/peripheral/mod.rs index 51e2f40b0bc3eeb126a2fbf27e9266ce6c7a3f11..adeeacbc243ec0aff1a7f917a312be601c8a06da 100644 --- a/src/peripheral/mod.rs +++ b/src/peripheral/mod.rs @@ -7,10 +7,14 @@ //! them at any given point in time) and the only way to get an instance of them is through the //! [`Peripherals::take`](struct.Peripherals.html#method.take) method. //! -//! ``` ignore +//! ``` no_run +//! extern crate cortex_m; +//! +//! use cortex_m::peripheral::Peripherals; +//! //! fn main() { -//! let peripherals = Peripherals::take(); -//! peripherals.dwt.enable_cycle_counter(); +//! let mut peripherals = Peripherals::take().unwrap(); +//! peripherals.DWT.enable_cycle_counter(); //! } //! ``` //! @@ -21,15 +25,19 @@ //! API is provided as static methods on the peripheral types. One example is the //! [`DWT::cyccnt`](struct.DWT.html#method.cyccnt) method. //! -//! ``` ignore +//! ``` no_run +//! extern crate cortex_m; +//! +//! use cortex_m::peripheral::{DWT, Peripherals}; +//! //! fn main() { //! { -//! let peripherals = Peripherals::take().unwrap(); +//! let mut peripherals = Peripherals::take().unwrap(); //! peripherals.DWT.enable_cycle_counter(); //! } // all the peripheral singletons are destroyed here //! //! // but this method can be called without a DWT instance -//! let cyccnt = DWT::cyccnt(); +//! let cyccnt = DWT::get_cycle_count(); //! } //! ``` //! @@ -37,10 +45,14 @@ //! available on all the peripheral types. This method is a useful building block for implementing //! higher level and safe abstractions. //! -//! ``` ignore +//! ``` no_run +//! extern crate cortex_m; +//! +//! use cortex_m::peripheral::{DWT, Peripherals}; +//! //! fn main() { //! { -//! let peripherals = Peripherals::take().unwrap(); +//! let mut peripherals = Peripherals::take().unwrap(); //! peripherals.DWT.enable_cycle_counter(); //! } // all the peripheral singletons are destroyed here //! diff --git a/src/peripheral/nvic.rs b/src/peripheral/nvic.rs index 8c55a879b3f374cf873050b66c33e88db513a557..60f9df0fc8d075fb8069809b10c81d7a461c5363 100644 --- a/src/peripheral/nvic.rs +++ b/src/peripheral/nvic.rs @@ -87,8 +87,8 @@ impl NVIC { /// Returns the NVIC priority of `interrupt` /// /// *NOTE* NVIC encodes priority in the highest bits of a byte so values like `1` and `2` map - /// the same priority. Also for NVIC priorities, a lower value (e.g. `16`) has higher priority - /// (urgency) than a larger value (e.g. `32`). + /// to the same priority. Also for NVIC priorities, a lower value (e.g. `16`) has higher + /// priority (urgency) than a larger value (e.g. `32`). pub fn get_priority<I>(interrupt: I) -> u8 where I: Nr,