From 3103adf8ba5f07544440d136083d5c61c153e70e Mon Sep 17 00:00:00 2001 From: Jan Teske Date: Sat, 18 Jul 2020 15:55:15 +0200 Subject: [PATCH] Use correct PACs for stm32f318 and stm32f378 According to the "Supported Devices" table in the stm32f3 crate's README (https://crates.io/crates/stm32f3) we were using the wrong PAC module (`stm32f3x8`) for both smt32f318 and stm32f378. Because of that we also supported some peripherals for these devices that are not actually available for them. This commit adds the correct PAC modules for the two devices in question and fixes up the HAL code to use the correct peripherals. --- CHANGELOG.md | 3 ++ Cargo.toml | 4 +- src/gpio.rs | 115 ++++++++++++++++++++------------------------------- src/i2c.rs | 2 - src/lib.rs | 12 ++---- src/rcc.rs | 3 +- src/spi.rs | 6 +-- src/timer.rs | 26 ++++-------- 8 files changed, 64 insertions(+), 107 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5df1a158a..fd586036c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,9 @@ let clocks = rcc - Split up `stm32f302` into sub-targets `stm32f302xb`,`stm32f302xc`,`stm32f302xd`,`stm32f302xe` - Bump `stm32f3` dependency to `0.11.0` ([#97](https://github.com/stm32-rs/stm32f3xx-hal/pull/97)) - The `stm32f3` reexport is now renamed from `stm32` to `pac` ([#101](https://github.com/stm32-rs/stm32f3xx-hal/pull/101)) +- The correct `stm32f3` modules are now used for the `stm32f318` and `stm32f738` + targets. As a result, some previously (wrongly) supported peripherals have + been removed from these targets. ## [v0.4.3] - 2020-04-11 diff --git a/Cargo.toml b/Cargo.toml index 3bc731c60..76c0eeddf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -57,7 +57,7 @@ direct-call-deprecated = [] rt = ["stm32f3/rt"] # Any Changes here should be mirrored in README.md and src/lib.rs stm32f301 = ["stm32f3/stm32f301", "device-selected"] -stm32f318 = ["stm32f3/stm32f3x8", "device-selected"] +stm32f318 = ["stm32f3/stm32f301", "device-selected"] stm32f302 = ["stm32f3/stm32f302", "direct-call-deprecated"] stm32f302xb = ["stm32f302", "device-selected"] stm32f302xc = ["stm32f302", "device-selected"] @@ -71,7 +71,7 @@ stm32f303xe = ["stm32f303", "stm32-usbd/ram_access_2x16", "device-selected"] stm32f303x6 = ["stm32f303", "device-selected"] stm32f303x8 = ["stm32f303", "device-selected"] stm32f373 = ["stm32f3/stm32f373", "device-selected"] -stm32f378 = ["stm32f3/stm32f3x8", "device-selected"] +stm32f378 = ["stm32f3/stm32f373", "device-selected"] stm32f334 = ["stm32f3/stm32f3x4", "device-selected"] stm32f328 = ["stm32f3/stm32f3x8", "device-selected"] stm32f358 = ["stm32f3/stm32f3x8", "device-selected"] diff --git a/src/gpio.rs b/src/gpio.rs index 4516645ae..d740c46bd 100644 --- a/src/gpio.rs +++ b/src/gpio.rs @@ -907,7 +907,6 @@ gpio!([ "stm32f334", "stm32f328", "stm32f358", - "stm32f378", "stm32f398", ], devices_except: [], @@ -922,17 +921,15 @@ gpio!([ AF3: (into_af3, af3,), AF15: (into_af15, af15,), ], [ - AF2: (into_af2, af2, ["stm32f302", "stm32f303", "stm32f334", "stm32f328", "stm32f358", "stm32f378", "stm32f398",],), + AF2: (into_af2, af2, ["stm32f302", "stm32f303", "stm32f334", "stm32f328", "stm32f358", "stm32f398",],), AF4: (into_af4, af4, ["stm32f303xb", "stm32f303xc", "stm32f303xd", "stm32f303xe", "stm32f358", "stm32f398",],), - AF5: (into_af5, af5, ["stm32f378",],), AF6: (into_af6, af6, ["stm32f301", "stm32f318", "stm32f302", "stm32f303", "stm32f334", "stm32f328", "stm32f358", "stm32f398",],), - AF10: (into_af10, af10, ["stm32f378",],), ]), PB1: (pb1, 1, Input, moder1, AFRL, afrl1, bs1, br1, odr1, idr1, pupdr1, ot1, [ AF3: (into_af3, af3,), AF15: (into_af15, af15,), ], [ - AF2: (into_af2, af2, ["stm32f302", "stm32f303", "stm32f334", "stm32f328", "stm32f358", "stm32f378", "stm32f398",],), + AF2: (into_af2, af2, ["stm32f302", "stm32f303", "stm32f334", "stm32f328", "stm32f358", "stm32f398",],), AF4: (into_af4, af4, ["stm32f303xb", "stm32f303xc", "stm32f303xd", "stm32f303xe", "stm32f358", "stm32f398",],), AF6: (into_af6, af6, ["stm32f301", "stm32f318", "stm32f302", "stm32f303", "stm32f334", "stm32f328", "stm32f358", "stm32f398",],), AF8: (into_af8, af8, ["stm32f301", "stm32f318", "stm32f302", "stm32f303", "stm32f334", "stm32f328", "stm32f358", "stm32f398",],), @@ -950,12 +947,11 @@ gpio!([ AF7: (into_af7, af7,), AF15: (into_af15, af15,), ], [ - AF2: (into_af2, af2, ["stm32f302", "stm32f303xb", "stm32f303xc", "stm32f303xd", "stm32f303xe", "stm32f358", "stm32f378", "stm32f398",],), + AF2: (into_af2, af2, ["stm32f302", "stm32f303xb", "stm32f303xc", "stm32f303xd", "stm32f303xe", "stm32f358",],), AF4: (into_af4, af4, ["stm32f303xb", "stm32f303xc", "stm32f303xd", "stm32f303xe", "stm32f358", "stm32f398",],), - AF5: (into_af5, af5, ["stm32f302", "stm32f303", "stm32f334", "stm32f328", "stm32f358", "stm32f378", "stm32f398",],), - AF6: (into_af6, af6, ["stm32f301", "stm32f318", "stm32f302", "stm32f303xb", "stm32f303xc", "stm32f303xd", "stm32f303xe", "stm32f358", "stm32f378", "stm32f398",],), - AF9: (into_af9, af9, ["stm32f378",],), - AF10: (into_af10, af10, ["stm32f302", "stm32f303", "stm32f334", "stm32f328", "stm32f358", "stm32f378", "stm32f398",],), + AF5: (into_af5, af5, ["stm32f302", "stm32f303", "stm32f334", "stm32f328", "stm32f358", "stm32f398",],), + AF6: (into_af6, af6, ["stm32f301", "stm32f318", "stm32f302", "stm32f303xb", "stm32f303xc", "stm32f303xd", "stm32f303xe", "stm32f358", "stm32f398",],), + AF10: (into_af10, af10, ["stm32f302", "stm32f303", "stm32f334", "stm32f328", "stm32f358", "stm32f398",],), AF12: (into_af12, af12, ["stm32f334",],), AF13: (into_af13, af13, ["stm32f334",],), ]), @@ -967,11 +963,10 @@ gpio!([ AF10: (into_af10, af10,), AF15: (into_af15, af15,), ], [ - AF2: (into_af2, af2, ["stm32f302", "stm32f303", "stm32f334", "stm32f328", "stm32f358", "stm32f378", "stm32f398",],), + AF2: (into_af2, af2, ["stm32f302", "stm32f303", "stm32f334", "stm32f328", "stm32f358", "stm32f398",],), AF4: (into_af4, af4, ["stm32f303xb", "stm32f303xc", "stm32f303xd", "stm32f303xe", "stm32f358", "stm32f398",],), - AF5: (into_af5, af5, ["stm32f302", "stm32f303", "stm32f334", "stm32f328", "stm32f358", "stm32f378", "stm32f398",],), - AF6: (into_af6, af6, ["stm32f301", "stm32f318", "stm32f302", "stm32f303xb", "stm32f303xc", "stm32f303xd", "stm32f303xe", "stm32f358", "stm32f378", "stm32f398",],), - AF9: (into_af9, af9, ["stm32f378",],), + AF5: (into_af5, af5, ["stm32f302", "stm32f303", "stm32f334", "stm32f328", "stm32f358", "stm32f398",],), + AF6: (into_af6, af6, ["stm32f301", "stm32f318", "stm32f302", "stm32f303xb", "stm32f303xc", "stm32f303xd", "stm32f303xe", "stm32f358", "stm32f398",],), AF13: (into_af13, af13, ["stm32f334",],), ]), PB5: (pb5, 5, Input, moder5, AFRL, afrl5, bs5, br5, odr5, idr5, pupdr5, ot5, [ @@ -981,12 +976,11 @@ gpio!([ AF10: (into_af10, af10,), AF15: (into_af15, af15,), ], [ - AF2: (into_af2, af2, ["stm32f302", "stm32f303", "stm32f334", "stm32f328", "stm32f358", "stm32f378", "stm32f398",],), + AF2: (into_af2, af2, ["stm32f302", "stm32f303", "stm32f334", "stm32f328", "stm32f358", "stm32f398",],), AF3: (into_af3, af3, ["stm32f303xb", "stm32f303xc", "stm32f303xd", "stm32f303xe", "stm32f358", "stm32f398",],), - AF5: (into_af5, af5, ["stm32f302", "stm32f303", "stm32f334", "stm32f328", "stm32f358", "stm32f378", "stm32f398",],), - AF6: (into_af6, af6, ["stm32f301", "stm32f318", "stm32f302", "stm32f303xb", "stm32f303xc", "stm32f303xd", "stm32f303xe", "stm32f358", "stm32f378", "stm32f398",],), + AF5: (into_af5, af5, ["stm32f302", "stm32f303", "stm32f334", "stm32f328", "stm32f358", "stm32f398",],), + AF6: (into_af6, af6, ["stm32f301", "stm32f318", "stm32f302", "stm32f303xb", "stm32f303xc", "stm32f303xd", "stm32f303xe", "stm32f358", "stm32f398",],), AF8: (into_af8, af8, ["stm32f301", "stm32f303xd", "stm32f303xe", "stm32f318", "stm32f398",],), - AF11: (into_af11, af11, ["stm32f378",],), AF13: (into_af13, af13, ["stm32f334",],), ]), PB6: (pb6, 6, Input, moder6, AFRL, afrl6, bs6, br6, odr6, idr6, pupdr6, ot6, [ @@ -996,12 +990,10 @@ gpio!([ AF7: (into_af7, af7,), AF15: (into_af15, af15,), ], [ - AF2: (into_af2, af2, ["stm32f302", "stm32f303xb", "stm32f303xc", "stm32f303xd", "stm32f303xe", "stm32f358", "stm32f378", "stm32f398",],), + AF2: (into_af2, af2, ["stm32f302", "stm32f303xb", "stm32f303xc", "stm32f303xd", "stm32f303xe", "stm32f358", "stm32f398",],), AF5: (into_af5, af5, ["stm32f303xb", "stm32f303xc", "stm32f303xd", "stm32f303xe", "stm32f358", "stm32f398",],), AF6: (into_af6, af6, ["stm32f303xb", "stm32f303xc", "stm32f303xd", "stm32f303xe", "stm32f358", "stm32f398",],), - AF9: (into_af9, af9, ["stm32f378",],), - AF10: (into_af10, af10, ["stm32f303xb", "stm32f303xc", "stm32f303xd", "stm32f303xe", "stm32f358", "stm32f378", "stm32f398",],), - AF11: (into_af11, af11, ["stm32f378",],), + AF10: (into_af10, af10, ["stm32f303xb", "stm32f303xc", "stm32f303xd", "stm32f303xe", "stm32f358", "stm32f398",],), AF12: (into_af12, af12, ["stm32f334",],), AF13: (into_af13, af13, ["stm32f334",],), ]), @@ -1012,11 +1004,9 @@ gpio!([ AF7: (into_af7, af7,), AF15: (into_af15, af15,), ], [ - AF2: (into_af2, af2, ["stm32f302", "stm32f303xb", "stm32f303xc", "stm32f303xd", "stm32f303xe", "stm32f358", "stm32f378", "stm32f398",],), + AF2: (into_af2, af2, ["stm32f302", "stm32f303xb", "stm32f303xc", "stm32f303xd", "stm32f303xe", "stm32f358", "stm32f398",],), AF5: (into_af5, af5, ["stm32f303xb", "stm32f303xc", "stm32f303xd", "stm32f303xe", "stm32f358", "stm32f398",],), - AF9: (into_af9, af9, ["stm32f378",],), - AF10: (into_af10, af10, ["stm32f302", "stm32f303", "stm32f334", "stm32f328", "stm32f358", "stm32f378", "stm32f398",],), - AF11: (into_af11, af11, ["stm32f378",],), + AF10: (into_af10, af10, ["stm32f302", "stm32f303", "stm32f334", "stm32f328", "stm32f358", "stm32f398",],), AF12: (into_af12, af12, ["stm32f303xd", "stm32f303xe", "stm32f398",],), AF13: (into_af13, af13, ["stm32f334",],), ]), @@ -1026,14 +1016,11 @@ gpio!([ AF4: (into_af4, af4,), AF15: (into_af15, af15,), ], [ - AF2: (into_af2, af2, ["stm32f302", "stm32f303xb", "stm32f303xc", "stm32f303xd", "stm32f303xe", "stm32f358", "stm32f378", "stm32f398",],), - AF5: (into_af5, af5, ["stm32f378",],), - AF6: (into_af6, af6, ["stm32f378",],), - AF7: (into_af7, af7, ["stm32f301", "stm32f303xd", "stm32f303xe", "stm32f318", "stm32f334", "stm32f328", "stm32f378", "stm32f398",],), - AF8: (into_af8, af8, ["stm32f302", "stm32f303xb", "stm32f303xc", "stm32f303xd", "stm32f303xe", "stm32f358", "stm32f378", "stm32f398",],), - AF9: (into_af9, af9, ["stm32f302", "stm32f303", "stm32f334", "stm32f328", "stm32f358", "stm32f378", "stm32f398",],), + AF2: (into_af2, af2, ["stm32f302", "stm32f303xb", "stm32f303xc", "stm32f303xd", "stm32f303xe", "stm32f358", "stm32f398",],), + AF7: (into_af7, af7, ["stm32f301", "stm32f303xd", "stm32f303xe", "stm32f318", "stm32f334", "stm32f328", "stm32f398",],), + AF8: (into_af8, af8, ["stm32f302", "stm32f303xb", "stm32f303xc", "stm32f303xd", "stm32f303xe", "stm32f358", "stm32f398",],), + AF9: (into_af9, af9, ["stm32f302", "stm32f303", "stm32f334", "stm32f328", "stm32f358", "stm32f398",],), AF10: (into_af10, af10, ["stm32f303xb", "stm32f303xc", "stm32f303xd", "stm32f303xe", "stm32f358", "stm32f398",],), - AF11: (into_af11, af11, ["stm32f378",],), AF12: (into_af12, af12, ["stm32f301", "stm32f318", "stm32f302", "stm32f303", "stm32f334", "stm32f328", "stm32f358", "stm32f398",],), AF13: (into_af13, af13, ["stm32f334",],), ]), @@ -1044,12 +1031,10 @@ gpio!([ AF8: (into_af8, af8,), AF15: (into_af15, af15,), ], [ - AF2: (into_af2, af2, ["stm32f302", "stm32f303xb", "stm32f303xc", "stm32f303xd", "stm32f303xe", "stm32f358", "stm32f378", "stm32f398",],), - AF5: (into_af5, af5, ["stm32f378",],), - AF7: (into_af7, af7, ["stm32f301", "stm32f303xd", "stm32f303xe", "stm32f318", "stm32f334", "stm32f328", "stm32f378", "stm32f398",],), - AF9: (into_af9, af9, ["stm32f302", "stm32f303", "stm32f334", "stm32f328", "stm32f358", "stm32f378", "stm32f398",],), + AF2: (into_af2, af2, ["stm32f302", "stm32f303xb", "stm32f303xc", "stm32f303xd", "stm32f303xe", "stm32f358", "stm32f398",],), + AF7: (into_af7, af7, ["stm32f301", "stm32f303xd", "stm32f303xe", "stm32f318", "stm32f334", "stm32f328", "stm32f398",],), + AF9: (into_af9, af9, ["stm32f302", "stm32f303", "stm32f334", "stm32f328", "stm32f358", "stm32f398",],), AF10: (into_af10, af10, ["stm32f303xb", "stm32f303xc", "stm32f303xd", "stm32f303xe", "stm32f358", "stm32f398",],), - AF11: (into_af11, af11, ["stm32f378",],), AF13: (into_af13, af13, ["stm32f334",],), ]), PB10: (pb10, 10, Input, moder10, AFRH, afrh10, bs10, br10, odr10, idr10, pupdr10, ot10, [ @@ -1058,8 +1043,6 @@ gpio!([ AF7: (into_af7, af7,), AF15: (into_af15, af15,), ], [ - AF5: (into_af5, af5, ["stm32f378",],), - AF6: (into_af6, af6, ["stm32f378",],), AF13: (into_af13, af13, ["stm32f334",],), ]), PB11: (pb11, 11, Input, moder11, AFRH, afrh11, bs11, br11, odr11, idr11, pupdr11, ot11, [], [ @@ -1092,9 +1075,8 @@ gpio!([ AF7: (into_af7, af7,), AF15: (into_af15, af15,), ], [ - AF5: (into_af5, af5, ["stm32f301", "stm32f318", "stm32f302", "stm32f303xb", "stm32f303xc", "stm32f303xd", "stm32f303xe", "stm32f358", "stm32f378", "stm32f398",],), + AF5: (into_af5, af5, ["stm32f301", "stm32f318", "stm32f302", "stm32f303xb", "stm32f303xc", "stm32f303xd", "stm32f303xe", "stm32f358", "stm32f398",],), AF6: (into_af6, af6, ["stm32f301", "stm32f318", "stm32f302", "stm32f303", "stm32f334", "stm32f328", "stm32f358", "stm32f398",],), - AF9: (into_af9, af9, ["stm32f378",],), AF13: (into_af13, af13, ["stm32f334",],), ]), PB15: (pb15, 15, Input, moder15, AFRH, afrh15, bs15, br15, odr15, idr15, pupdr15, ot15, [ @@ -1102,11 +1084,9 @@ gpio!([ AF2: (into_af2, af2,), AF15: (into_af15, af15,), ], [ - AF0: (into_af0, af0, ["stm32f301", "stm32f318", "stm32f302", "stm32f303xb", "stm32f303xc", "stm32f303xd", "stm32f303xe", "stm32f358", "stm32f378", "stm32f398",],), - AF3: (into_af3, af3, ["stm32f378",],), + AF0: (into_af0, af0, ["stm32f301", "stm32f318", "stm32f302", "stm32f303xb", "stm32f303xc", "stm32f303xd", "stm32f303xe", "stm32f358", "stm32f398",],), AF4: (into_af4, af4, ["stm32f301", "stm32f318", "stm32f302", "stm32f303", "stm32f334", "stm32f328", "stm32f358", "stm32f398",],), - AF5: (into_af5, af5, ["stm32f301", "stm32f318", "stm32f302", "stm32f303xb", "stm32f303xc", "stm32f303xd", "stm32f303xe", "stm32f358", "stm32f378", "stm32f398",],), - AF9: (into_af9, af9, ["stm32f378",],), + AF5: (into_af5, af5, ["stm32f301", "stm32f318", "stm32f302", "stm32f303xb", "stm32f303xc", "stm32f303xd", "stm32f303xe", "stm32f358", "stm32f398",],), AF13: (into_af13, af13, ["stm32f334",],), ]), ], @@ -1114,6 +1094,7 @@ gpio!([ { devices: [ "stm32f373", + "stm32f378", ], devices_except: [], GPIO: GPIOB, @@ -1367,14 +1348,14 @@ gpio!([ AF7: (into_af7, af7, ["stm32f301", "stm32f373", "stm32f378", "stm32f334", "stm32f358", "stm32f398",],), ]), PC13: (pc13, 13, Input, moder13, AFRH, afrh13, bs13, br13, odr13, idr13, pupdr13, ot13, [], [ - AF1: (into_af1, af1, ["stm32f378", "stm32f398",],), + AF1: (into_af1, af1, ["stm32f398",],), AF4: (into_af4, af4, ["stm32f301", "stm32f318", "stm32f334", "stm32f328", "stm32f358", "stm32f398",],), ]), PC14: (pc14, 14, Input, moder14, AFRH, afrh14, bs14, br14, odr14, idr14, pupdr14, ot14, [], [ - AF1: (into_af1, af1, ["stm32f378", "stm32f398",],), + AF1: (into_af1, af1, ["stm32f398",],), ]), PC15: (pc15, 15, Input, moder15, AFRH, afrh15, bs15, br15, odr15, idr15, pupdr15, ot15, [], [ - AF1: (into_af1, af1, ["stm32f378", "stm32f398",],), + AF1: (into_af1, af1, ["stm32f398",],), ]), ], }, @@ -1575,7 +1556,6 @@ gpio!([ "stm32f303xc", "stm32f303xd", "stm32f303xe", - "stm32f318", "stm32f373", "stm32f378", "stm32f328", @@ -1839,7 +1819,6 @@ gpio!([ }, { devices: [ - "stm32f318", "stm32f328", "stm32f358", "stm32f373", @@ -1968,6 +1947,7 @@ gpio!([ { devices: [ "stm32f301", + "stm32f318", ], devices_except: [], GPIO: GPIOF, @@ -2151,6 +2131,7 @@ gpio!([ { devices: [ "stm32f373", + "stm32f378", ], devices_except: [], GPIO: GPIOF, @@ -2193,10 +2174,8 @@ gpio!([ }, { devices: [ - "stm32f318", "stm32f328", "stm32f358", - "stm32f378", "stm32f398", ], devices_except: [], @@ -2209,19 +2188,18 @@ gpio!([ pins: [ PF0: (pf0, 0, Input, moder0, AFRL, afrl0, bs0, br0, odr0, idr0, pupdr0, ot0, [], [ AF1: (into_af1, af1, ["stm32f398",],), - AF4: (into_af4, af4, ["stm32f318", "stm32f358", "stm32f378", "stm32f398",],), - AF5: (into_af5, af5, ["stm32f318", "stm32f398",],), - AF6: (into_af6, af6, ["stm32f318", "stm32f328", "stm32f358", "stm32f398",],), + AF4: (into_af4, af4, ["stm32f358", "stm32f398",],), + AF5: (into_af5, af5, ["stm32f398",],), + AF6: (into_af6, af6, ["stm32f328", "stm32f358", "stm32f398",],), ]), PF1: (pf1, 1, Input, moder1, AFRL, afrl1, bs1, br1, odr1, idr1, pupdr1, ot1, [], [ AF1: (into_af1, af1, ["stm32f398",],), - AF4: (into_af4, af4, ["stm32f318", "stm32f358", "stm32f378", "stm32f398",],), - AF5: (into_af5, af5, ["stm32f318", "stm32f398",],), + AF4: (into_af4, af4, ["stm32f358", "stm32f398",],), + AF5: (into_af5, af5, ["stm32f398",],), ]), PF2: (pf2, 2, Input, moder2, AFRL, afrl2, bs2, br2, odr2, idr2, pupdr2, ot2, [], [ - AF1: (into_af1, af1, ["stm32f358", "stm32f378", "stm32f398",],), + AF1: (into_af1, af1, ["stm32f358", "stm32f398",],), AF2: (into_af2, af2, ["stm32f398",],), - AF4: (into_af4, af4, ["stm32f378",],), AF12: (into_af12, af12, ["stm32f398",],), ]), PF3: (pf3, 3, Input, moder3, AFRL, afrl3, bs3, br3, odr3, idr3, pupdr3, ot3, [], [ @@ -2230,7 +2208,7 @@ gpio!([ AF12: (into_af12, af12, ["stm32f398",],), ]), PF4: (pf4, 4, Input, moder4, AFRL, afrl4, bs4, br4, odr4, idr4, pupdr4, ot4, [], [ - AF1: (into_af1, af1, ["stm32f358", "stm32f378", "stm32f398",],), + AF1: (into_af1, af1, ["stm32f358", "stm32f398",],), AF2: (into_af2, af2, ["stm32f358", "stm32f398",],), AF3: (into_af3, af3, ["stm32f398",],), AF12: (into_af12, af12, ["stm32f398",],), @@ -2241,18 +2219,15 @@ gpio!([ AF12: (into_af12, af12, ["stm32f398",],), ]), PF6: (pf6, 6, Input, moder6, AFRL, afrl6, bs6, br6, odr6, idr6, pupdr6, ot6, [], [ - AF1: (into_af1, af1, ["stm32f358", "stm32f378", "stm32f398",],), - AF2: (into_af2, af2, ["stm32f358", "stm32f378", "stm32f398",],), - AF4: (into_af4, af4, ["stm32f358", "stm32f378", "stm32f398",],), - AF5: (into_af5, af5, ["stm32f378",],), - AF7: (into_af7, af7, ["stm32f358", "stm32f378", "stm32f398",],), + AF1: (into_af1, af1, ["stm32f358", "stm32f398",],), + AF2: (into_af2, af2, ["stm32f358", "stm32f398",],), + AF4: (into_af4, af4, ["stm32f358", "stm32f398",],), + AF7: (into_af7, af7, ["stm32f358", "stm32f398",],), AF12: (into_af12, af12, ["stm32f398",],), ]), PF7: (pf7, 7, Input, moder7, AFRL, afrl7, bs7, br7, odr7, idr7, pupdr7, ot7, [], [ - AF1: (into_af1, af1, ["stm32f378", "stm32f398",],), + AF1: (into_af1, af1, ["stm32f398",],), AF2: (into_af2, af2, ["stm32f398",],), - AF4: (into_af4, af4, ["stm32f378",],), - AF7: (into_af7, af7, ["stm32f378",],), AF12: (into_af12, af12, ["stm32f398",],), ]), PF8: (pf8, 8, Input, moder8, AFRH, afrh8, bs8, br8, odr8, idr8, pupdr8, ot8, [], [ @@ -2268,7 +2243,7 @@ gpio!([ AF12: (into_af12, af12, ["stm32f398",],), ]), PF10: (pf10, 10, Input, moder10, AFRH, afrh10, bs10, br10, odr10, idr10, pupdr10, ot10, [], [ - AF1: (into_af1, af1, ["stm32f358", "stm32f378", "stm32f398",],), + AF1: (into_af1, af1, ["stm32f358", "stm32f398",],), AF2: (into_af2, af2, ["stm32f398",],), AF3: (into_af3, af3, ["stm32f358", "stm32f398",],), AF5: (into_af5, af5, ["stm32f358", "stm32f398",],), diff --git a/src/i2c.rs b/src/i2c.rs index 9764e3195..a2bc249ae 100644 --- a/src/i2c.rs +++ b/src/i2c.rs @@ -12,7 +12,6 @@ use crate::gpio::gpiob::{PB6, PB7, PB8, PB9}; feature = "stm32f303xc", feature = "stm32f303xd", feature = "stm32f303xe", - feature = "stm32f318", feature = "stm32f328", feature = "stm32f358", feature = "stm32f398", @@ -61,7 +60,6 @@ unsafe impl SclPin for PF1 {} feature = "stm32f303xc", feature = "stm32f303xd", feature = "stm32f303xe", - feature = "stm32f318", feature = "stm32f328", feature = "stm32f358", feature = "stm32f398", diff --git a/src/lib.rs b/src/lib.rs index d6f7cdf55..0c3a2df41 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -82,7 +82,7 @@ pub use embedded_hal as hal; pub use nb; pub use nb::block; -#[cfg(feature = "stm32f301")] +#[cfg(any(feature = "stm32f301", feature = "stm32f318"))] pub use stm32f3::stm32f301 as pac; #[cfg(feature = "stm32f302")] @@ -91,19 +91,13 @@ pub use stm32f3::stm32f302 as pac; #[cfg(feature = "stm32f303")] pub use stm32f3::stm32f303 as pac; -#[cfg(feature = "stm32f373")] +#[cfg(any(feature = "stm32f373", feature = "stm32f378"))] pub use stm32f3::stm32f373 as pac; #[cfg(feature = "stm32f334")] pub use stm32f3::stm32f3x4 as pac; -#[cfg(any( - feature = "stm32f318", - feature = "stm32f328", - feature = "stm32f358", - feature = "stm32f378", - feature = "stm32f398" -))] +#[cfg(any(feature = "stm32f328", feature = "stm32f358", feature = "stm32f398"))] pub use stm32f3::stm32f3x8 as pac; #[cfg(feature = "device-selected")] diff --git a/src/rcc.rs b/src/rcc.rs index 1fb34cf11..3e5c40282 100644 --- a/src/rcc.rs +++ b/src/rcc.rs @@ -97,7 +97,7 @@ impl APB2 { const HSI: u32 = 8_000_000; // Hz // some microcontrollers do not have USB -#[cfg(any(feature = "stm32f301", feature = "stm32f334",))] +#[cfg(any(feature = "stm32f301", feature = "stm32f318", feature = "stm32f334",))] mod usb_clocking { use crate::rcc::PllConfig; @@ -116,7 +116,6 @@ mod usb_clocking { } #[cfg(any( - feature = "stm32f318", feature = "stm32f302", feature = "stm32f303", feature = "stm32f373", diff --git a/src/spi.rs b/src/spi.rs index 18d5ba252..e148130bf 100644 --- a/src/spi.rs +++ b/src/spi.rs @@ -15,7 +15,6 @@ use crate::gpio::gpioa::{PA5, PA6, PA7}; feature = "stm32f328", feature = "stm32f334", feature = "stm32f358", - feature = "stm32f378", feature = "stm32f398" ))] use crate::gpio::gpiob::PB13; @@ -38,7 +37,6 @@ use crate::rcc::APB1; #[cfg(any( feature = "stm32f302", feature = "stm32f303", - feature = "stm32f318", feature = "stm32f328", feature = "stm32f334", feature = "stm32f358", @@ -83,7 +81,6 @@ unsafe impl SckPin for PA5 {} feature = "stm32f328", feature = "stm32f334", feature = "stm32f358", - feature = "stm32f378", feature = "stm32f398" ))] unsafe impl SckPin for PB13 {} @@ -255,7 +252,7 @@ hal! { SPI1: (spi1, APB2, spi1en, spi1rst, pclk2), } -#[cfg(feature = "stm32f301")] +#[cfg(any(feature = "stm32f301", feature = "stm32f318"))] hal! { SPI2: (spi2, APB1, spi2en, spi2rst, pclk1), SPI3: (spi3, APB1, spi3en, spi3rst, pclk1), @@ -264,7 +261,6 @@ hal! { #[cfg(any( feature = "stm32f302", feature = "stm32f303", - feature = "stm32f318", feature = "stm32f328", feature = "stm32f358", feature = "stm32f373", diff --git a/src/timer.rs b/src/timer.rs index eb7d9c067..1b5b04b72 100644 --- a/src/timer.rs +++ b/src/timer.rs @@ -2,28 +2,25 @@ use crate::hal::timer::{CountDown, Periodic}; #[cfg(any( + feature = "stm32f301", feature = "stm32f302", feature = "stm32f303", feature = "stm32f334", feature = "stm32f318", feature = "stm32f328", feature = "stm32f358", - feature = "stm32f378", feature = "stm32f398", ))] use crate::pac::TIM1; #[cfg(any( feature = "stm32f303", - feature = "stm32f318", feature = "stm32f328", feature = "stm32f358", - feature = "stm32f378", feature = "stm32f398" ))] use crate::pac::TIM20; #[cfg(any( feature = "stm32f303", - feature = "stm32f318", feature = "stm32f328", feature = "stm32f358", feature = "stm32f373", @@ -33,19 +30,16 @@ use crate::pac::TIM20; use crate::pac::TIM4; #[cfg(any( feature = "stm32f303", - feature = "stm32f318", feature = "stm32f328", feature = "stm32f358", - feature = "stm32f378", feature = "stm32f398", ))] use crate::pac::TIM8; -#[cfg(feature = "stm32f373")] +#[cfg(any(feature = "stm32f373", feature = "stm32f378"))] use crate::pac::{TIM12, TIM13, TIM14, TIM18, TIM19, TIM5}; use crate::pac::{TIM15, TIM16, TIM17, TIM2, TIM6}; #[cfg(any( feature = "stm32f303", - feature = "stm32f318", feature = "stm32f328", feature = "stm32f334", feature = "stm32f358", @@ -189,8 +183,12 @@ macro_rules! hal { } } -#[cfg(feature = "stm32f301")] +#[cfg(any(feature = "stm32f301", feature = "stm32f318"))] hal! { + { + TIM1: (tim1, tim1en, tim1rst), + APB2: (apb2, pclk2), + }, { TIM2: (tim2, tim2en, tim2rst), APB1: (apb1, pclk1), @@ -325,7 +323,7 @@ hal! { }, } -#[cfg(feature = "stm32f373")] +#[cfg(any(feature = "stm32f373", feature = "stm32f378"))] hal! { { TIM2: (tim2, tim2en, tim2rst), @@ -385,13 +383,7 @@ hal! { }, } -#[cfg(any( - feature = "stm32f318", - feature = "stm32f328", - feature = "stm32f358", - feature = "stm32f378", - feature = "stm32f398" -))] +#[cfg(any(feature = "stm32f328", feature = "stm32f358", feature = "stm32f398"))] hal! { { TIM1: (tim1, tim1en, tim1rst),