From 5a19c39edc5a06f56c1ba61537d2fb61bf2ac818 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio <jorge@japaric.io> Date: Thu, 11 Jan 2018 19:07:58 +0100 Subject: [PATCH] address review comments --- src/peripheral/mod.rs | 28 ++++++++++++++++++++-------- src/peripheral/nvic.rs | 4 ++-- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/peripheral/mod.rs b/src/peripheral/mod.rs index 51e2f40..adeeacb 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 8c55a87..60f9df0 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, -- GitLab