Skip to content

Commit 0588013

Browse files
authored
Merge pull request #85 from thalesfragoso/hclk-fix
Fixes hclk miscalculation
2 parents a9be75f + 0dbd6f0 commit 0588013

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
2424

2525
### Changed
2626

27+
- Fix hclk miscalculation
28+
2729
## [v0.3.0] - 2019-04-27
2830

2931
### Added

src/rcc.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,11 @@ impl CFGR {
204204
})
205205
.unwrap_or(0b0111);
206206

207-
let hclk = sysclk / (1 << (hpre_bits - 0b0111));
207+
let hclk = if hpre_bits >= 0b1100 {
208+
sysclk / (1 << (hpre_bits - 0b0110))
209+
} else {
210+
sysclk / (1 << (hpre_bits - 0b0111))
211+
};
208212

209213
assert!(hclk <= 72_000_000);
210214

0 commit comments

Comments
 (0)