Skip to content

Commit 6b01313

Browse files
bors[bot]newAM
andauthored
Merge #348
348: Fix slightly misleading examples. r=adamgreig a=newAM This is a bit of a nitpick; the examples provided for the peripherals use the cycle counter as an example, but it is not properly enabled, which is slightly misleading. The examples only do `peripherals.DWT.enable_cycle_counter`, but this write may be ignored because tracing needs to be enabled first. Co-authored-by: Alex Martens <[email protected]>
2 parents 9e9ab9a + 9ddc44c commit 6b01313

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Diff for: src/peripheral/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//! ``` no_run
1111
//! # use cortex_m::peripheral::Peripherals;
1212
//! let mut peripherals = Peripherals::take().unwrap();
13-
//! peripherals.DWT.enable_cycle_counter();
13+
//! peripherals.DCB.enable_trace();
1414
//! ```
1515
//!
1616
//! This method can only be successfully called *once* -- this is why the method returns an
@@ -29,6 +29,7 @@
2929
//! # use cortex_m::peripheral::{DWT, Peripherals};
3030
//! {
3131
//! let mut peripherals = Peripherals::take().unwrap();
32+
//! peripherals.DCB.enable_trace();
3233
//! peripherals.DWT.enable_cycle_counter();
3334
//! } // all the peripheral singletons are destroyed here
3435
//!
@@ -44,6 +45,7 @@
4445
//! # use cortex_m::peripheral::{DWT, Peripherals};
4546
//! {
4647
//! let mut peripherals = Peripherals::take().unwrap();
48+
//! peripherals.DCB.enable_trace();
4749
//! peripherals.DWT.enable_cycle_counter();
4850
//! } // all the peripheral singletons are destroyed here
4951
//!

0 commit comments

Comments
 (0)