diff options
| author | xoviat <[email protected]> | 2023-07-30 10:18:54 -0500 |
|---|---|---|
| committer | xoviat <[email protected]> | 2023-07-30 10:18:54 -0500 |
| commit | a8a491212bc0b4de0c3d5e64b3891ebf3087eb44 (patch) | |
| tree | 9dceb8bc3257d3573ec2e03462e9654960e33e92 | |
| parent | 2f18770e276d985c16ba865636bdc641cb2cf74a (diff) | |
stm32/rcc: cleanup merge
| -rw-r--r-- | embassy-stm32/src/rcc/common.rs | 2 | ||||
| -rw-r--r-- | embassy-stm32/src/rcc/g0.rs | 2 | ||||
| -rw-r--r-- | embassy-stm32/src/rcc/g4.rs | 11 | ||||
| -rw-r--r-- | embassy-stm32/src/rcc/wb.rs | 5 | ||||
| -rw-r--r-- | embassy-stm32/src/rcc/wl.rs | 2 |
5 files changed, 14 insertions, 8 deletions
diff --git a/embassy-stm32/src/rcc/common.rs b/embassy-stm32/src/rcc/common.rs index 7debb143d..62736a43a 100644 --- a/embassy-stm32/src/rcc/common.rs +++ b/embassy-stm32/src/rcc/common.rs | |||
| @@ -142,7 +142,7 @@ impl Div<APBPrescaler> for Hertz { | |||
| 142 | } | 142 | } |
| 143 | } | 143 | } |
| 144 | 144 | ||
| 145 | #[cfg(not(any(rcc_f1, rcc_g4, rcc_h7, rcc_wb, rcc_wl5, rcc_wle)))] | 145 | #[cfg(not(any(rcc_f1, rcc_f100, rcc_f1cl, rcc_g4, rcc_h7, rcc_h7ab, rcc_wb, rcc_wl5, rcc_wle)))] |
| 146 | impl From<APBPrescaler> for rcc::vals::Ppre { | 146 | impl From<APBPrescaler> for rcc::vals::Ppre { |
| 147 | fn from(val: APBPrescaler) -> rcc::vals::Ppre { | 147 | fn from(val: APBPrescaler) -> rcc::vals::Ppre { |
| 148 | use rcc::vals::Ppre; | 148 | use rcc::vals::Ppre; |
diff --git a/embassy-stm32/src/rcc/g0.rs b/embassy-stm32/src/rcc/g0.rs index 1aaf983ad..bf2d5199e 100644 --- a/embassy-stm32/src/rcc/g0.rs +++ b/embassy-stm32/src/rcc/g0.rs | |||
| @@ -380,7 +380,7 @@ pub(crate) unsafe fn init(config: Config) { | |||
| 380 | APBPrescaler::NotDivided => (ahb_freq.0, ahb_freq.0), | 380 | APBPrescaler::NotDivided => (ahb_freq.0, ahb_freq.0), |
| 381 | pre => { | 381 | pre => { |
| 382 | let pre: Ppre = pre.into(); | 382 | let pre: Ppre = pre.into(); |
| 383 | let pre: u8 = 1 << (pre.0 - 3); | 383 | let pre: u8 = 1 << (pre.to_bits() - 3); |
| 384 | let freq = ahb_freq.0 / pre as u32; | 384 | let freq = ahb_freq.0 / pre as u32; |
| 385 | (freq, freq * 2) | 385 | (freq, freq * 2) |
| 386 | } | 386 | } |
diff --git a/embassy-stm32/src/rcc/g4.rs b/embassy-stm32/src/rcc/g4.rs index 5489b7187..dff04023e 100644 --- a/embassy-stm32/src/rcc/g4.rs +++ b/embassy-stm32/src/rcc/g4.rs | |||
| @@ -22,8 +22,15 @@ pub enum ClockSrc { | |||
| 22 | PLL, | 22 | PLL, |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | impl Into<u8> for APBPrescaler { | 25 | /// PLL clock input source |
| 26 | fn into(self) -> u8 { | 26 | #[derive(Clone, Copy, Debug)] |
| 27 | pub enum PllSrc { | ||
| 28 | HSI16, | ||
| 29 | HSE(Hertz), | ||
| 30 | } | ||
| 31 | |||
| 32 | impl Into<Pllsrc> for PllSrc { | ||
| 33 | fn into(self) -> Pllsrc { | ||
| 27 | match self { | 34 | match self { |
| 28 | PllSrc::HSE(..) => Pllsrc::HSE, | 35 | PllSrc::HSE(..) => Pllsrc::HSE, |
| 29 | PllSrc::HSI16 => Pllsrc::HSI16, | 36 | PllSrc::HSI16 => Pllsrc::HSI16, |
diff --git a/embassy-stm32/src/rcc/wb.rs b/embassy-stm32/src/rcc/wb.rs index b8ef01a9e..21aacec58 100644 --- a/embassy-stm32/src/rcc/wb.rs +++ b/embassy-stm32/src/rcc/wb.rs | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | pub use super::common::{AHBPrescaler, APBPrescaler}; | 1 | pub use super::common::{AHBPrescaler, APBPrescaler}; |
| 2 | use crate::pac::RCC; | 2 | use crate::rcc::Clocks; |
| 3 | use crate::rcc::{set_freqs, Clocks, Clocks}; | 3 | use crate::time::{khz, mhz, Hertz}; |
| 4 | use crate::time::{khz, mhz, Hertz, Hertz}; | ||
| 5 | 4 | ||
| 6 | /// Most of clock setup is copied from stm32l0xx-hal, and adopted to the generated PAC, | 5 | /// Most of clock setup is copied from stm32l0xx-hal, and adopted to the generated PAC, |
| 7 | /// and with the addition of the init function to configure a system clock. | 6 | /// and with the addition of the init function to configure a system clock. |
diff --git a/embassy-stm32/src/rcc/wl.rs b/embassy-stm32/src/rcc/wl.rs index eca1f6134..ea6e8dde6 100644 --- a/embassy-stm32/src/rcc/wl.rs +++ b/embassy-stm32/src/rcc/wl.rs | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | pub use super::common::{AHBPrescaler, APBPrescaler, VoltageScale}; | 1 | pub use super::common::{AHBPrescaler, APBPrescaler, VoltageScale}; |
| 2 | use crate::pac::pwr::vals::Dbp; | 2 | use crate::pac::pwr::vals::Dbp; |
| 3 | use crate::pac::{FLASH, FLASH, PWR, RCC, RCC}; | 3 | use crate::pac::{FLASH, PWR, RCC}; |
| 4 | use crate::rcc::{set_freqs, Clocks}; | 4 | use crate::rcc::{set_freqs, Clocks}; |
| 5 | use crate::time::Hertz; | 5 | use crate::time::Hertz; |
| 6 | 6 | ||
