Skip to content

Commit 1b5b39e

Browse files
committed
change has_cycle_counter to a recommended end user call
1 parent a0ffab5 commit 1b5b39e

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/peripheral/dwt.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -389,9 +389,10 @@ pub struct CycleCountSettings {
389389
pub enum ComparatorFunction {
390390
/// Compare accessed memory addresses.
391391
Address(ComparatorAddressSettings),
392-
/// Compare cycle count & target value.
392+
/// Compare cycle count & target value.
393393
///
394-
/// **NOTE**: only supported by comparator 0. See C1.8.1.
394+
/// **NOTE**: only supported by comparator 0 and if the HW supports the cycle counter.
395+
/// Check `dwt.has_cycle_counter` for support. See C1.8.1 for more details.
395396
CycleCount(CycleCountSettings),
396397
}
397398

@@ -408,7 +409,7 @@ pub enum DwtError {
408409
impl Comparator {
409410
/// Configure the function of the comparator
410411
#[allow(clippy::missing_inline_in_public_items)]
411-
pub fn configure(&self, dwt: &DWT, settings: ComparatorFunction) -> Result<(), DwtError> {
412+
pub fn configure(&self, settings: ComparatorFunction) -> Result<(), DwtError> {
412413
match settings {
413414
ComparatorFunction::Address(settings) => {
414415
// FUNCTION, EMITRANGE
@@ -461,10 +462,6 @@ impl Comparator {
461462
}
462463
}
463464
ComparatorFunction::CycleCount(settings) => {
464-
if !dwt.has_cycle_counter() {
465-
return Err(DwtError::NoCycleCount);
466-
}
467-
468465
let function = match &settings.emit {
469466
EmitOption::PCData => 0b0001,
470467
EmitOption::WatchpointDebugEvent => 0b0100,

0 commit comments

Comments
 (0)