stm32f3: fix nonexistent cfg tests

The rcc code was taken from stm32-rs which uses 'x' features, but
embassy uses features with full chip names.

Add these 'x' wildcards as cfgs and use them in rcc.
They will be useful for USB too.
This commit is contained in:
Greg V 2022-02-02 22:51:47 +03:00
parent d76cd5ceaf
commit 8bb41a3281
2 changed files with 6 additions and 2 deletions

View File

@ -125,6 +125,10 @@ fn main() {
println!("cargo:rustc-cfg={}", &chip_name[..chip_name.len() - 2]); println!("cargo:rustc-cfg={}", &chip_name[..chip_name.len() - 2]);
} }
if chip_name.starts_with("stm32f3") {
println!("cargo:rustc-cfg={}x{}", &chip_name[..9], &chip_name[10..11]);
}
// ======== // ========
// Handle time-driver-XXXX features. // Handle time-driver-XXXX features.

View File

@ -217,8 +217,8 @@ fn calc_pll(config: &Config, Hertz(sysclk): Hertz) -> (Hertz, PllConfig) {
cfg_if::cfg_if! { cfg_if::cfg_if! {
// For some chips PREDIV is always two, and cannot be changed // For some chips PREDIV is always two, and cannot be changed
if #[cfg(any( if #[cfg(any(
feature="stm32f302xd", feature="stm32f302xe", feature="stm32f303xd", stm32f302xd, stm32f302xe, stm32f303xd,
feature="stm32f303xe", feature="stm32f398xe" stm32f303xe, stm32f398xe
))] { ))] {
let (multiplier, divisor) = get_mul_div(sysclk, HSI); let (multiplier, divisor) = get_mul_div(sysclk, HSI);
( (