Skip to content

Commit 897984a

Browse files
committed
rcc config
1 parent 67bdf68 commit 897984a

File tree

3 files changed

+307
-158
lines changed

3 files changed

+307
-158
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1717

1818
### Added
1919

20+
- `rcc::Config` with prescalers for direct setting of clocks without calculating
2021
- `From<Bps>` for `serial::Config`
2122
- `From<Into<Hertz>>` for `i2c::Mode`
2223
- `exti_rtic` example

examples/adc_temperature.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,17 @@ fn main() -> ! {
2323
.pclk1(28.mhz())
2424
.adcclk(14.mhz())
2525
.freeze(&mut flash.acr);
26+
/*
27+
// Alternative configuration using dividers and multipliers directly
28+
let clocks = rcc.cfgr.freeze_with_config(rcc::Config {
29+
hse: Some(8_000_000),
30+
pllmul: Some(7),
31+
hpre: rcc::HPre::DIV1,
32+
ppre1: rcc::PPre::DIV2,
33+
ppre2: rcc::PPre::DIV1,
34+
usbpre: rcc::UsbPre::DIV1_5,
35+
adcpre: rcc::AdcPre::DIV2,
36+
}, &mut flash.acr);*/
2637
hprintln!("sysclk freq: {}", clocks.sysclk().0).unwrap();
2738
hprintln!("adc freq: {}", clocks.adcclk().0).unwrap();
2839

0 commit comments

Comments
 (0)