diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/peripheral/dwt.rs | 11 | ||||
-rw-r--r-- | src/peripheral/mod.rs | 4 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/peripheral/dwt.rs b/src/peripheral/dwt.rs index 961f6fd..21af4f1 100644 --- a/src/peripheral/dwt.rs +++ b/src/peripheral/dwt.rs @@ -144,7 +144,18 @@ impl DWT { /// Returns the current clock cycle count #[cfg(not(armv6m))] #[inline] + #[deprecated( + since = "0.7.4", + note = "Use `cycle_count` which follows the C-GETTER convention" + )] pub fn get_cycle_count() -> u32 { + Self::cycle_count() + } + + /// Returns the current clock cycle count + #[cfg(not(armv6m))] + #[inline] + pub fn cycle_count() -> u32 { // NOTE(unsafe) atomic read with no side effects unsafe { (*Self::ptr()).cyccnt.read() } } diff --git a/src/peripheral/mod.rs b/src/peripheral/mod.rs index 961f31d..8f5678d 100644 --- a/src/peripheral/mod.rs +++ b/src/peripheral/mod.rs @@ -23,7 +23,7 @@ //! ``` //! A part of the peripheral API doesn't require access to a peripheral instance. This part of the //! API is provided as static methods on the peripheral types. One example is the -//! [`DWT::get_cycle_count`](struct.DWT.html#method.get_cycle_count) method. +//! [`DWT::cycle_count`](struct.DWT.html#method.cycle_count) method. //! //! ``` no_run //! # use cortex_m::peripheral::{DWT, Peripherals}; @@ -33,7 +33,7 @@ //! } // all the peripheral singletons are destroyed here //! //! // but this method can be called without a DWT instance -//! let cyccnt = DWT::get_cycle_count(); +//! let cyccnt = DWT::cycle_count(); //! ``` //! //! The singleton property can be *unsafely* bypassed using the `ptr` static method which is |