diff options
author | 2021-08-14 08:15:45 -0700 | |
---|---|---|
committer | 2021-08-14 08:15:45 -0700 | |
commit | 52ff95e1a8ea4e63f6dc7dd7029977481eabe501 (patch) | |
tree | d8bd6721eb76468ded4286bb79c8b83bb2a80040 /src | |
parent | 33a6b16b84b6fbe2cd9a82934d9e2837a7237b65 (diff) | |
download | cortex-m-52ff95e1a8ea4e63f6dc7dd7029977481eabe501.tar.gz cortex-m-52ff95e1a8ea4e63f6dc7dd7029977481eabe501.tar.zst cortex-m-52ff95e1a8ea4e63f6dc7dd7029977481eabe501.zip |
Deprecate get_cycle_count in favor of cycle_count
This follows the rust C-GETTER API guidelines.
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 |