Skip to content

Commit 52b895f

Browse files
committed
Add DWT.set_cycle_count
1 parent bb41983 commit 52b895f

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

Diff for: CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1313
- Exception overhead counter
1414
- LSU counter
1515
- Folded-instruction counter
16+
- Added `DWT.set_cycle_count` (#347).
1617

1718
### Deprecated
1819

Diff for: src/peripheral/dwt.rs

+7
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,13 @@ impl DWT {
160160
unsafe { (*Self::ptr()).cyccnt.read() }
161161
}
162162

163+
/// Set the cycle count
164+
#[cfg(not(armv6m))]
165+
#[inline]
166+
pub fn set_cycle_count(&mut self, count: u32) {
167+
unsafe { self.cyccnt.write(count) }
168+
}
169+
163170
/// Removes the software lock on the DWT
164171
///
165172
/// Some devices, like the STM32F7, software lock the DWT after a power cycle.

0 commit comments

Comments
 (0)