diff options
author | 2018-01-11 19:07:58 +0100 | |
---|---|---|
committer | 2018-01-11 19:07:58 +0100 | |
commit | 5a19c39edc5a06f56c1ba61537d2fb61bf2ac818 (patch) | |
tree | 2514ec4c32c236b34dee475e2ebb631b8fb0673d /src/peripheral/mod.rs | |
parent | 80328e98f361bd7ea07e3376691130790dae71a3 (diff) | |
download | cortex-m-5a19c39edc5a06f56c1ba61537d2fb61bf2ac818.tar.gz cortex-m-5a19c39edc5a06f56c1ba61537d2fb61bf2ac818.tar.zst cortex-m-5a19c39edc5a06f56c1ba61537d2fb61bf2ac818.zip |
address review comments
Diffstat (limited to 'src/peripheral/mod.rs')
-rw-r--r-- | src/peripheral/mod.rs | 28 |
1 files changed, 20 insertions, 8 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 //! |