diff options
author | 2021-12-16 09:28:54 -0800 | |
---|---|---|
committer | 2021-12-19 12:13:47 -0800 | |
commit | 1b5b39e5d9de9e8e715aeec71f8b0476b9aa9c8f (patch) | |
tree | 622299d9cc5d99bf06ce849e8ea3d8767245454e | |
parent | a0ffab5ca628a98f691568aa43cbf437a3b7f925 (diff) | |
download | cortex-m-1b5b39e5d9de9e8e715aeec71f8b0476b9aa9c8f.tar.gz cortex-m-1b5b39e5d9de9e8e715aeec71f8b0476b9aa9c8f.tar.zst cortex-m-1b5b39e5d9de9e8e715aeec71f8b0476b9aa9c8f.zip |
change has_cycle_counter to a recommended end user call
-rw-r--r-- | src/peripheral/dwt.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/peripheral/dwt.rs b/src/peripheral/dwt.rs index 9751d7a..e4845c7 100644 --- a/src/peripheral/dwt.rs +++ b/src/peripheral/dwt.rs @@ -389,9 +389,10 @@ pub struct CycleCountSettings { pub enum ComparatorFunction { /// Compare accessed memory addresses. Address(ComparatorAddressSettings), - /// Compare cycle count & target value. + /// Compare cycle count & target value. /// - /// **NOTE**: only supported by comparator 0. See C1.8.1. + /// **NOTE**: only supported by comparator 0 and if the HW supports the cycle counter. + /// Check `dwt.has_cycle_counter` for support. See C1.8.1 for more details. CycleCount(CycleCountSettings), } @@ -408,7 +409,7 @@ pub enum DwtError { impl Comparator { /// Configure the function of the comparator #[allow(clippy::missing_inline_in_public_items)] - pub fn configure(&self, dwt: &DWT, settings: ComparatorFunction) -> Result<(), DwtError> { + pub fn configure(&self, settings: ComparatorFunction) -> Result<(), DwtError> { match settings { ComparatorFunction::Address(settings) => { // FUNCTION, EMITRANGE @@ -461,10 +462,6 @@ impl Comparator { } } ComparatorFunction::CycleCount(settings) => { - if !dwt.has_cycle_counter() { - return Err(DwtError::NoCycleCount); - } - let function = match &settings.emit { EmitOption::PCData => 0b0001, EmitOption::WatchpointDebugEvent => 0b0100, |