Skip to content

Commit 2c8220c

Browse files
authored
Merge pull request #67 from Sh3Rm4n/issue-57
Rework PLL calculation and utilize oscillator clock divison
2 parents a73d1c2 + 1d9d025 commit 2c8220c

File tree

5 files changed

+313
-90
lines changed

5 files changed

+313
-90
lines changed

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,32 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
99

10+
### Fixed
11+
12+
- `PLL` was calculated wrong for devices, which do not divide `HSI` ([#67](https://github.com/stm32-rs/stm32f3xx-hal/pull/67))
13+
1014
### Changed
1115

1216
- **Breaking** The feature gate requires you to select a subvaraint if possible. ([#67](https://github.com/stm32-rs/stm32f3xx-hal/pull/67))
17+
- **Breaking** Split up `stm32f302` into sub-targets `stm32f302xb`,`stm32f302xc`,`stm32f302xd`,`stm32f302xe`
18+
- The system clock calculation is more fine grained now. ([#67](https://github.com/stm32-rs/stm32f3xx-hal/pull/67))
19+
Now the system clock can be some value, like 14 MHz, which can not a
20+
be represented as a multiple of the oscillator clock:
21+
```rust
22+
let clocks = rcc
23+
.cfgr
24+
.use_hse(8.mhz())
25+
.sysclk(14.mhz())
26+
27+
// or
28+
let clocks = rcc
29+
.cfgr
30+
.use_hse(32.mhz())
31+
.sysclk(72.mhz())
32+
```
33+
This is possible through utilizing the divider, which can devide the
34+
external oscillator clock on most devices. Some devices have even the
35+
possibility to divide the internal oscillator clock.
1336

1437
## [v0.4.3] - 2020-04-11
1538

Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,11 @@ stm32f301xc = ["stm32f301", "device-selected"]
5858
stm32f301xd = ["stm32f301", "device-selected"]
5959
stm32f301xe = ["stm32f301", "device-selected"]
6060
stm32f318 = ["stm32f3/stm32f3x8", "device-selected"]
61-
stm32f302 = ["stm32f3/stm32f302", "device-selected"]
61+
stm32f302 = ["stm32f3/stm32f302", "direct-call-deprecated"]
62+
stm32f302xb = ["stm32f302", "device-selected"]
63+
stm32f302xc = ["stm32f302", "device-selected"]
64+
stm32f302xd = ["stm32f302", "device-selected"]
65+
stm32f302xe = ["stm32f302", "device-selected"]
6266
stm32f303 = ["stm32f3/stm32f303", "direct-call-deprecated"]
6367
stm32f303xb = ["stm32f303", "stm32-usbd/ram_access_1x16", "device-selected"]
6468
stm32f303xc = ["stm32f303", "stm32-usbd/ram_access_1x16", "device-selected"]

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ Note: `x` denotes any character in [a-z]
5555
* stm32f301xd
5656
* stm32f301xe
5757
* stm32f318
58-
* stm32f302
58+
* stm32f302xb
59+
* stm32f302xc
60+
* stm32f302xd
61+
* stm32f302xe
5962
* stm32f303xb
6063
* stm32f303xc
6164
* stm32f303xd

src/lib.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
* stm32f301xd
1212
* stm32f301xe
1313
* stm32f318
14-
* stm32f302
14+
* stm32f302xb
15+
* stm32f302xc
16+
* stm32f302xd
17+
* stm32f302xe
1518
* stm32f303xb
1619
* stm32f303xc
1720
* stm32f303xd
@@ -45,7 +48,10 @@ compile_error!(
4548
* stm32f301xd
4649
* stm32f301xe
4750
* stm32f318
48-
* stm32f302
51+
* stm32f302xb
52+
* stm32f302xc
53+
* stm32f302xd
54+
* stm32f302xe
4955
* stm32f303xb
5056
* stm32f303xc
5157
* stm32f303xd
@@ -71,8 +77,8 @@ compile_error!(
7177
"The feature you selected is deprecated, because it was split up into sub-devices.
7278
7379
Example: The STM32F3Discovery board has a STM32F303VCT6 chip.
74-
You used to use `--features stm32f303` but now functionalities for the sub-device were added.
75-
Replace it with `--features stm32f303xc` to make your code build again.
80+
You probably used to use `--features stm32f303` but now functionalities for the sub-device were added.
81+
In this case replace it with `--features stm32f303xc` to make your code build again.
7682
7783
Please select one of the chip features stated above."
7884
);

0 commit comments

Comments
 (0)