Skip to content

Commit 5a19c39

Browse files
committed
address review comments
1 parent 80328e9 commit 5a19c39

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

src/peripheral/mod.rs

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@
77
//! them at any given point in time) and the only way to get an instance of them is through the
88
//! [`Peripherals::take`](struct.Peripherals.html#method.take) method.
99
//!
10-
//! ``` ignore
10+
//! ``` no_run
11+
//! extern crate cortex_m;
12+
//!
13+
//! use cortex_m::peripheral::Peripherals;
14+
//!
1115
//! fn main() {
12-
//! let peripherals = Peripherals::take();
13-
//! peripherals.dwt.enable_cycle_counter();
16+
//! let mut peripherals = Peripherals::take().unwrap();
17+
//! peripherals.DWT.enable_cycle_counter();
1418
//! }
1519
//! ```
1620
//!
@@ -21,26 +25,34 @@
2125
//! API is provided as static methods on the peripheral types. One example is the
2226
//! [`DWT::cyccnt`](struct.DWT.html#method.cyccnt) method.
2327
//!
24-
//! ``` ignore
28+
//! ``` no_run
29+
//! extern crate cortex_m;
30+
//!
31+
//! use cortex_m::peripheral::{DWT, Peripherals};
32+
//!
2533
//! fn main() {
2634
//! {
27-
//! let peripherals = Peripherals::take().unwrap();
35+
//! let mut peripherals = Peripherals::take().unwrap();
2836
//! peripherals.DWT.enable_cycle_counter();
2937
//! } // all the peripheral singletons are destroyed here
3038
//!
3139
//! // but this method can be called without a DWT instance
32-
//! let cyccnt = DWT::cyccnt();
40+
//! let cyccnt = DWT::get_cycle_count();
3341
//! }
3442
//! ```
3543
//!
3644
//! The singleton property can be *unsafely* bypassed using the `ptr` static method which is
3745
//! available on all the peripheral types. This method is a useful building block for implementing
3846
//! higher level and safe abstractions.
3947
//!
40-
//! ``` ignore
48+
//! ``` no_run
49+
//! extern crate cortex_m;
50+
//!
51+
//! use cortex_m::peripheral::{DWT, Peripherals};
52+
//!
4153
//! fn main() {
4254
//! {
43-
//! let peripherals = Peripherals::take().unwrap();
55+
//! let mut peripherals = Peripherals::take().unwrap();
4456
//! peripherals.DWT.enable_cycle_counter();
4557
//! } // all the peripheral singletons are destroyed here
4658
//!

src/peripheral/nvic.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ impl NVIC {
8787
/// Returns the NVIC priority of `interrupt`
8888
///
8989
/// *NOTE* NVIC encodes priority in the highest bits of a byte so values like `1` and `2` map
90-
/// the same priority. Also for NVIC priorities, a lower value (e.g. `16`) has higher priority
91-
/// (urgency) than a larger value (e.g. `32`).
90+
/// to the same priority. Also for NVIC priorities, a lower value (e.g. `16`) has higher
91+
/// priority (urgency) than a larger value (e.g. `32`).
9292
pub fn get_priority<I>(interrupt: I) -> u8
9393
where
9494
I: Nr,

0 commit comments

Comments
 (0)