aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32/src
diff options
context:
space:
mode:
authorxoviat <[email protected]>2023-10-12 02:01:27 +0000
committerGitHub <[email protected]>2023-10-12 02:01:27 +0000
commiteb368f77a46682f76dcc4d75f9ba4ce80dfb4193 (patch)
tree28e7e476b0a620142c538c469f88f55c775538d1 /embassy-stm32/src
parentac84631a2aa0243b8e7dccbe8af324f3f5cd19e0 (diff)
parent57ccc1051a2790073f3963a8ab079bc072d0014f (diff)
Merge pull request #2023 from xoviat/rcc-mux
stm32: add rcc mux for h5
Diffstat (limited to 'embassy-stm32/src')
-rw-r--r--embassy-stm32/src/rcc/h.rs51
-rw-r--r--embassy-stm32/src/rcc/mod.rs46
2 files changed, 95 insertions, 2 deletions
diff --git a/embassy-stm32/src/rcc/h.rs b/embassy-stm32/src/rcc/h.rs
index 7236d82ff..d37dd45d4 100644
--- a/embassy-stm32/src/rcc/h.rs
+++ b/embassy-stm32/src/rcc/h.rs
@@ -388,7 +388,7 @@ pub(crate) unsafe fn init(config: Config) {
388 let pll1 = init_pll(0, config.pll1, &pll_input); 388 let pll1 = init_pll(0, config.pll1, &pll_input);
389 let pll2 = init_pll(1, config.pll2, &pll_input); 389 let pll2 = init_pll(1, config.pll2, &pll_input);
390 #[cfg(any(rcc_h5, stm32h7))] 390 #[cfg(any(rcc_h5, stm32h7))]
391 let _pll3 = init_pll(2, config.pll3, &pll_input); 391 let pll3 = init_pll(2, config.pll3, &pll_input);
392 392
393 // Configure sysclk 393 // Configure sysclk
394 let (sys, sw) = match config.sys { 394 let (sys, sw) = match config.sys {
@@ -447,7 +447,7 @@ pub(crate) unsafe fn init(config: Config) {
447 #[cfg(stm32h7)] 447 #[cfg(stm32h7)]
448 let adc = match config.adc_clock_source { 448 let adc = match config.adc_clock_source {
449 AdcClockSource::PLL2_P => pll2.p, 449 AdcClockSource::PLL2_P => pll2.p,
450 AdcClockSource::PLL3_R => _pll3.r, 450 AdcClockSource::PLL3_R => pll3.r,
451 AdcClockSource::PER => _per_ck, 451 AdcClockSource::PER => _per_ck,
452 _ => unreachable!(), 452 _ => unreachable!(),
453 }; 453 };
@@ -545,6 +545,53 @@ pub(crate) unsafe fn init(config: Config) {
545 apb2_tim, 545 apb2_tim,
546 adc, 546 adc,
547 rtc, 547 rtc,
548
549 #[cfg(stm32h5)]
550 mux_rcc_pclk1: Some(apb1),
551 #[cfg(stm32h5)]
552 mux_pll2_q: None,
553 #[cfg(stm32h5)]
554 mux_pll3_q: None,
555 #[cfg(stm32h5)]
556 mux_hsi_ker: None,
557 #[cfg(stm32h5)]
558 mux_csi_ker: None,
559 #[cfg(stm32h5)]
560 mux_lse: None,
561 #[cfg(stm32h5)]
562 mux_pll1_q: pll1.q,
563 #[cfg(stm32h5)]
564 mux_pll2_p: pll2.p,
565 #[cfg(rcc_h5)]
566 mux_pll3_p: pll3.p,
567 #[cfg(stm32h5)]
568 mux_audioclk: None,
569 #[cfg(stm32h5)]
570 mux_per: None,
571
572 #[cfg(rcc_h5)]
573 mux_pll3_r: pll3.r,
574 #[cfg(all(not(rcc_h5), stm32h5))]
575 mux_pll3_r: None,
576 #[cfg(stm32h5)]
577 mux_rcc_pclk3: Some(apb3),
578 #[cfg(stm32h5)]
579 mux_pll3_1: None,
580 #[cfg(stm32h5)]
581 mux_hsi48_ker: None,
582 #[cfg(stm32h5)]
583 mux_lsi_ker: None,
584 #[cfg(stm32h5)]
585 mux_pll2_r: pll2.r,
586 #[cfg(stm32h5)]
587 mux_rcc_pclk2: Some(apb2),
588 #[cfg(stm32h5)]
589 mux_rcc_pclk4: None,
590 #[cfg(stm32h5)]
591 mux_hse: hse,
592
593 #[cfg(stm32h5)]
594 mux_hsi48: None,
548 }); 595 });
549} 596}
550 597
diff --git a/embassy-stm32/src/rcc/mod.rs b/embassy-stm32/src/rcc/mod.rs
index abb53fd10..695d41589 100644
--- a/embassy-stm32/src/rcc/mod.rs
+++ b/embassy-stm32/src/rcc/mod.rs
@@ -134,6 +134,52 @@ pub struct Clocks {
134 pub hrtim: Option<Hertz>, 134 pub hrtim: Option<Hertz>,
135 135
136 pub rtc: Option<Hertz>, 136 pub rtc: Option<Hertz>,
137
138 #[cfg(stm32h5)]
139 pub mux_rcc_pclk1: Option<Hertz>,
140 #[cfg(stm32h5)]
141 pub mux_pll2_q: Option<Hertz>,
142 #[cfg(stm32h5)]
143 pub mux_pll3_q: Option<Hertz>,
144 #[cfg(stm32h5)]
145 pub mux_hsi_ker: Option<Hertz>,
146 #[cfg(stm32h5)]
147 pub mux_csi_ker: Option<Hertz>,
148 #[cfg(stm32h5)]
149 pub mux_lse: Option<Hertz>,
150
151 #[cfg(stm32h5)]
152 pub mux_pll1_q: Option<Hertz>,
153 #[cfg(stm32h5)]
154 pub mux_pll2_p: Option<Hertz>,
155 #[cfg(rcc_h5)]
156 pub mux_pll3_p: Option<Hertz>,
157 #[cfg(stm32h5)]
158 pub mux_audioclk: Option<Hertz>,
159 #[cfg(stm32h5)]
160 pub mux_per: Option<Hertz>,
161
162 #[cfg(stm32h5)]
163 pub mux_pll3_r: Option<Hertz>,
164 #[cfg(stm32h5)]
165 pub mux_rcc_pclk3: Option<Hertz>,
166 #[cfg(stm32h5)]
167 pub mux_pll3_1: Option<Hertz>,
168 #[cfg(stm32h5)]
169 pub mux_hsi48_ker: Option<Hertz>,
170 #[cfg(stm32h5)]
171 pub mux_lsi_ker: Option<Hertz>,
172 #[cfg(stm32h5)]
173 pub mux_pll2_r: Option<Hertz>,
174 #[cfg(stm32h5)]
175 pub mux_rcc_pclk2: Option<Hertz>,
176 #[cfg(stm32h5)]
177 pub mux_rcc_pclk4: Option<Hertz>,
178 #[cfg(stm32h5)]
179 pub mux_hse: Option<Hertz>,
180
181 #[cfg(stm32h5)]
182 pub mux_hsi48: Option<Hertz>,
137} 183}
138 184
139#[cfg(feature = "low-power")] 185#[cfg(feature = "low-power")]