Skip to content

Commit

Permalink
add an option to allow overclocking
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-robin authored and burrbull committed Oct 5, 2024
1 parent fea4bb0 commit efc9438
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Add dac
- Fix flash error flag clearing
- Clarify README for windows users
- Add an option to allow overclocking [#494]

### Added

- Allow to set HSE bypass bit in `RCC` clock configuration register to use an external clock input on the `OSC_IN` pin
- support `embedded-hal-1.0`

[#494]: https://github.com/stm32-rs/stm32f1xx-hal/pull/494

## [v0.10.0] - 2022-12-12

Expand Down
8 changes: 7 additions & 1 deletion src/rcc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ pub struct Config {
#[cfg(any(feature = "stm32f103", feature = "connectivity"))]
pub usbpre: UsbPre,
pub adcpre: AdcPre,
pub allow_overclock: bool,
}

impl Default for Config {
Expand All @@ -521,6 +522,7 @@ impl Default for Config {
#[cfg(any(feature = "stm32f103", feature = "connectivity"))]
usbpre: UsbPre::Div15,
adcpre: AdcPre::Div2,
allow_overclock: false,
}
}
}
Expand Down Expand Up @@ -681,6 +683,7 @@ impl Config {
#[cfg(any(feature = "stm32f103", feature = "connectivity"))]
usbpre,
adcpre: apre_bits,
allow_overclock: false,
}
}

Expand Down Expand Up @@ -724,11 +727,13 @@ impl Config {
);

assert!(
sysclk <= 72_000_000
self.allow_overclock ||
(sysclk <= 72_000_000
&& hclk <= 72_000_000
&& pclk1 <= 36_000_000
&& pclk2 <= 72_000_000
&& adcclk <= 14_000_000
)
);

Clocks {
Expand Down Expand Up @@ -763,6 +768,7 @@ fn rcc_config_usb() {
#[cfg(any(feature = "stm32f103", feature = "connectivity"))]
usbpre: UsbPre::Div1,
adcpre: AdcPre::Div8,
allow_overclock: false,
};
assert_eq!(config, config_expected);

Expand Down

0 comments on commit efc9438

Please sign in to comment.