diff options
| -rw-r--r-- | embassy-stm32/Cargo.toml | 4 | ||||
| -rw-r--r-- | embassy-stm32/build.rs | 14 | ||||
| -rw-r--r-- | embassy-stm32/src/rcc/h.rs | 62 | ||||
| -rw-r--r-- | embassy-stm32/src/rcc/mod.rs | 50 |
4 files changed, 58 insertions, 72 deletions
diff --git a/embassy-stm32/Cargo.toml b/embassy-stm32/Cargo.toml index dbf5a69d3..b18cafb8b 100644 --- a/embassy-stm32/Cargo.toml +++ b/embassy-stm32/Cargo.toml | |||
| @@ -58,7 +58,7 @@ rand_core = "0.6.3" | |||
| 58 | sdio-host = "0.5.0" | 58 | sdio-host = "0.5.0" |
| 59 | embedded-sdmmc = { git = "https://github.com/embassy-rs/embedded-sdmmc-rs", rev = "a4f293d3a6f72158385f79c98634cb8a14d0d2fc", optional = true } | 59 | embedded-sdmmc = { git = "https://github.com/embassy-rs/embedded-sdmmc-rs", rev = "a4f293d3a6f72158385f79c98634cb8a14d0d2fc", optional = true } |
| 60 | critical-section = "1.1" | 60 | critical-section = "1.1" |
| 61 | stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-e4a769aa67aa82603448377daa579d67a789983a" } | 61 | stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-e6e51db6cdd7d533e52ca7a3237f7816a0486cd4" } |
| 62 | vcell = "0.1.3" | 62 | vcell = "0.1.3" |
| 63 | bxcan = "0.7.0" | 63 | bxcan = "0.7.0" |
| 64 | nb = "1.0.0" | 64 | nb = "1.0.0" |
| @@ -76,7 +76,7 @@ critical-section = { version = "1.1", features = ["std"] } | |||
| 76 | [build-dependencies] | 76 | [build-dependencies] |
| 77 | proc-macro2 = "1.0.36" | 77 | proc-macro2 = "1.0.36" |
| 78 | quote = "1.0.15" | 78 | quote = "1.0.15" |
| 79 | stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-e4a769aa67aa82603448377daa579d67a789983a", default-features = false, features = ["metadata"]} | 79 | stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-e6e51db6cdd7d533e52ca7a3237f7816a0486cd4", default-features = false, features = ["metadata"]} |
| 80 | 80 | ||
| 81 | 81 | ||
| 82 | [features] | 82 | [features] |
diff --git a/embassy-stm32/build.rs b/embassy-stm32/build.rs index 7ba3a6bd7..3e1c76f36 100644 --- a/embassy-stm32/build.rs +++ b/embassy-stm32/build.rs | |||
| @@ -520,10 +520,16 @@ fn main() { | |||
| 520 | let variant_name = format_ident!("{}", v.name); | 520 | let variant_name = format_ident!("{}", v.name); |
| 521 | 521 | ||
| 522 | // temporary hack to restrict the scope of the implementation until clock names can be stabilized | 522 | // temporary hack to restrict the scope of the implementation until clock names can be stabilized |
| 523 | let clock_name = format_ident!("mux_{}", v.name.to_ascii_lowercase()); | 523 | let clock_name = format_ident!("{}", v.name.to_ascii_lowercase()); |
| 524 | 524 | ||
| 525 | quote! { | 525 | if v.name.starts_with("AHB") || v.name.starts_with("APB") { |
| 526 | #enum_name::#variant_name => unsafe { crate::rcc::get_freqs().#clock_name.unwrap() }, | 526 | quote! { |
| 527 | #enum_name::#variant_name => unsafe { crate::rcc::get_freqs().#clock_name }, | ||
| 528 | } | ||
| 529 | } else { | ||
| 530 | quote! { | ||
| 531 | #enum_name::#variant_name => unsafe { crate::rcc::get_freqs().#clock_name.unwrap() }, | ||
| 532 | } | ||
| 527 | } | 533 | } |
| 528 | }) | 534 | }) |
| 529 | .collect(); | 535 | .collect(); |
diff --git a/embassy-stm32/src/rcc/h.rs b/embassy-stm32/src/rcc/h.rs index 379d31794..a24f4d4e4 100644 --- a/embassy-stm32/src/rcc/h.rs +++ b/embassy-stm32/src/rcc/h.rs | |||
| @@ -541,61 +541,55 @@ pub(crate) unsafe fn init(config: Config) { | |||
| 541 | apb3, | 541 | apb3, |
| 542 | #[cfg(stm32h7)] | 542 | #[cfg(stm32h7)] |
| 543 | apb4, | 543 | apb4, |
| 544 | #[cfg(stm32h5)] | ||
| 545 | apb4: Hertz(1), | ||
| 544 | apb1_tim, | 546 | apb1_tim, |
| 545 | apb2_tim, | 547 | apb2_tim, |
| 546 | adc, | 548 | adc, |
| 547 | rtc, | 549 | rtc, |
| 548 | 550 | ||
| 549 | #[cfg(stm32h5)] | 551 | #[cfg(stm32h5)] |
| 550 | mux_apb1: Some(apb1), | 552 | hsi: None, |
| 551 | #[cfg(stm32h5)] | ||
| 552 | mux_apb2: Some(apb2), | ||
| 553 | #[cfg(stm32h5)] | 553 | #[cfg(stm32h5)] |
| 554 | mux_apb3: Some(apb3), | 554 | hsi48: None, |
| 555 | #[cfg(stm32h5)] | 555 | #[cfg(stm32h5)] |
| 556 | mux_apb4: None, | 556 | lsi: None, |
| 557 | |||
| 558 | #[cfg(stm32h5)] | 557 | #[cfg(stm32h5)] |
| 559 | mux_rcc_hclk4: None, | 558 | csi: None, |
| 560 | 559 | ||
| 561 | #[cfg(stm32h5)] | 560 | #[cfg(stm32h5)] |
| 562 | mux_pll2_q: None, | 561 | lse: None, |
| 563 | #[cfg(stm32h5)] | ||
| 564 | mux_pll3_q: None, | ||
| 565 | #[cfg(stm32h5)] | 562 | #[cfg(stm32h5)] |
| 566 | mux_hsi: None, | 563 | hse: None, |
| 564 | |||
| 567 | #[cfg(stm32h5)] | 565 | #[cfg(stm32h5)] |
| 568 | mux_csi: None, | 566 | pll1_q: pll1.q, |
| 569 | #[cfg(stm32h5)] | 567 | #[cfg(stm32h5)] |
| 570 | mux_lse: None, | 568 | pll2_q: pll2.q, |
| 571 | #[cfg(stm32h5)] | 569 | #[cfg(stm32h5)] |
| 572 | mux_pll1_q: pll1.q, | 570 | pll2_p: pll2.p, |
| 573 | #[cfg(stm32h5)] | 571 | #[cfg(stm32h5)] |
| 574 | mux_pll2_p: pll2.p, | 572 | pll2_r: pll2.r, |
| 575 | #[cfg(rcc_h5)] | 573 | #[cfg(rcc_h5)] |
| 576 | mux_pll3_p: pll3.p, | 574 | pll3_p: pll3.p, |
| 577 | #[cfg(stm32h5)] | ||
| 578 | mux_audioclk: None, | ||
| 579 | #[cfg(stm32h5)] | ||
| 580 | mux_per: None, | ||
| 581 | |||
| 582 | #[cfg(rcc_h5)] | 575 | #[cfg(rcc_h5)] |
| 583 | mux_pll3_r: pll3.r, | 576 | pll3_q: pll3.q, |
| 584 | #[cfg(all(not(rcc_h5), stm32h5))] | 577 | #[cfg(rcc_h5)] |
| 585 | mux_pll3_r: None, | 578 | pll3_r: pll3.r, |
| 586 | #[cfg(stm32h5)] | ||
| 587 | mux_pll3_1: None, | ||
| 588 | #[cfg(stm32h5)] | ||
| 589 | mux_hsi48_ker: None, | ||
| 590 | #[cfg(stm32h5)] | ||
| 591 | mux_lsi: None, | ||
| 592 | #[cfg(stm32h5)] | ||
| 593 | mux_pll2_r: pll2.r, | ||
| 594 | #[cfg(stm32h5)] | 579 | #[cfg(stm32h5)] |
| 595 | mux_hse: hse, | 580 | pll3_1: None, |
| 581 | |||
| 582 | #[cfg(rcc_h50)] | ||
| 583 | pll3_p: None, | ||
| 584 | #[cfg(rcc_h50)] | ||
| 585 | pll3_q: None, | ||
| 586 | #[cfg(rcc_h50)] | ||
| 587 | pll3_r: None, | ||
| 596 | 588 | ||
| 597 | #[cfg(stm32h5)] | 589 | #[cfg(stm32h5)] |
| 598 | mux_hsi48: None, | 590 | audioclk: None, |
| 591 | #[cfg(stm32h5)] | ||
| 592 | per: None, | ||
| 599 | }); | 593 | }); |
| 600 | } | 594 | } |
| 601 | 595 | ||
diff --git a/embassy-stm32/src/rcc/mod.rs b/embassy-stm32/src/rcc/mod.rs index f7210e186..0904ddbd8 100644 --- a/embassy-stm32/src/rcc/mod.rs +++ b/embassy-stm32/src/rcc/mod.rs | |||
| @@ -56,7 +56,7 @@ pub struct Clocks { | |||
| 56 | pub apb2_tim: Hertz, | 56 | pub apb2_tim: Hertz, |
| 57 | #[cfg(any(rcc_wl5, rcc_wle, rcc_h5, rcc_h50, rcc_h7, rcc_h7rm0433, rcc_h7ab, rcc_u5))] | 57 | #[cfg(any(rcc_wl5, rcc_wle, rcc_h5, rcc_h50, rcc_h7, rcc_h7rm0433, rcc_h7ab, rcc_u5))] |
| 58 | pub apb3: Hertz, | 58 | pub apb3: Hertz, |
| 59 | #[cfg(any(rcc_h7, rcc_h7rm0433, rcc_h7ab))] | 59 | #[cfg(any(rcc_h7, rcc_h7rm0433, rcc_h7ab, stm32h5))] |
| 60 | pub apb4: Hertz, | 60 | pub apb4: Hertz, |
| 61 | #[cfg(any(rcc_wba))] | 61 | #[cfg(any(rcc_wba))] |
| 62 | pub apb7: Hertz, | 62 | pub apb7: Hertz, |
| @@ -136,54 +136,40 @@ pub struct Clocks { | |||
| 136 | pub rtc: Option<Hertz>, | 136 | pub rtc: Option<Hertz>, |
| 137 | 137 | ||
| 138 | #[cfg(stm32h5)] | 138 | #[cfg(stm32h5)] |
| 139 | pub mux_apb1: Option<Hertz>, | 139 | pub hsi: Option<Hertz>, |
| 140 | #[cfg(stm32h5)] | 140 | #[cfg(stm32h5)] |
| 141 | pub mux_apb2: Option<Hertz>, | 141 | pub hsi48: Option<Hertz>, |
| 142 | #[cfg(stm32h5)] | 142 | #[cfg(stm32h5)] |
| 143 | pub mux_apb3: Option<Hertz>, | 143 | pub lsi: Option<Hertz>, |
| 144 | #[cfg(stm32h5)] | 144 | #[cfg(stm32h5)] |
| 145 | pub mux_apb4: Option<Hertz>, | 145 | pub csi: Option<Hertz>, |
| 146 | 146 | ||
| 147 | #[cfg(stm32h5)] | 147 | #[cfg(stm32h5)] |
| 148 | pub mux_rcc_hclk4: Option<Hertz>, | 148 | pub lse: Option<Hertz>, |
| 149 | |||
| 150 | #[cfg(stm32h5)] | ||
| 151 | pub mux_pll2_q: Option<Hertz>, | ||
| 152 | #[cfg(stm32h5)] | ||
| 153 | pub mux_pll3_q: Option<Hertz>, | ||
| 154 | #[cfg(stm32h5)] | ||
| 155 | pub mux_hsi: Option<Hertz>, | ||
| 156 | #[cfg(stm32h5)] | ||
| 157 | pub mux_csi: Option<Hertz>, | ||
| 158 | #[cfg(stm32h5)] | 149 | #[cfg(stm32h5)] |
| 159 | pub mux_lse: Option<Hertz>, | 150 | pub hse: Option<Hertz>, |
| 160 | 151 | ||
| 161 | #[cfg(stm32h5)] | 152 | #[cfg(stm32h5)] |
| 162 | pub mux_pll1_q: Option<Hertz>, | 153 | pub pll1_q: Option<Hertz>, |
| 163 | #[cfg(stm32h5)] | 154 | #[cfg(stm32h5)] |
| 164 | pub mux_pll2_p: Option<Hertz>, | 155 | pub pll2_q: Option<Hertz>, |
| 165 | #[cfg(rcc_h5)] | ||
| 166 | pub mux_pll3_p: Option<Hertz>, | ||
| 167 | #[cfg(stm32h5)] | 156 | #[cfg(stm32h5)] |
| 168 | pub mux_audioclk: Option<Hertz>, | 157 | pub pll2_p: Option<Hertz>, |
| 169 | #[cfg(stm32h5)] | 158 | #[cfg(stm32h5)] |
| 170 | pub mux_per: Option<Hertz>, | 159 | pub pll2_r: Option<Hertz>, |
| 171 | |||
| 172 | #[cfg(stm32h5)] | ||
| 173 | pub mux_pll3_r: Option<Hertz>, | ||
| 174 | #[cfg(stm32h5)] | 160 | #[cfg(stm32h5)] |
| 175 | pub mux_pll3_1: Option<Hertz>, | 161 | pub pll3_p: Option<Hertz>, |
| 176 | #[cfg(stm32h5)] | 162 | #[cfg(stm32h5)] |
| 177 | pub mux_hsi48_ker: Option<Hertz>, | 163 | pub pll3_q: Option<Hertz>, |
| 178 | #[cfg(stm32h5)] | 164 | #[cfg(stm32h5)] |
| 179 | pub mux_lsi: Option<Hertz>, | 165 | pub pll3_r: Option<Hertz>, |
| 180 | #[cfg(stm32h5)] | 166 | #[cfg(stm32h5)] |
| 181 | pub mux_pll2_r: Option<Hertz>, | 167 | pub pll3_1: Option<Hertz>, |
| 182 | #[cfg(stm32h5)] | ||
| 183 | pub mux_hse: Option<Hertz>, | ||
| 184 | 168 | ||
| 185 | #[cfg(stm32h5)] | 169 | #[cfg(stm32h5)] |
| 186 | pub mux_hsi48: Option<Hertz>, | 170 | pub audioclk: Option<Hertz>, |
| 171 | #[cfg(stm32h5)] | ||
| 172 | pub per: Option<Hertz>, | ||
| 187 | } | 173 | } |
| 188 | 174 | ||
| 189 | #[cfg(feature = "low-power")] | 175 | #[cfg(feature = "low-power")] |
