diff options
| author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2022-01-04 12:31:55 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-01-04 12:31:55 +0000 |
| commit | b2a85ee519067d3290e328f9ad047184ff033cd7 (patch) | |
| tree | 70c550e647b2a1754b50b20cd365bcc67939986d | |
| parent | f744b74e90d3bb1a571c10f0749f22132b51d303 (diff) | |
| parent | 89b009b11d7c45533f53a41c6586ba514cf7be58 (diff) | |
Merge #565
565: stm32: RCC cleanups r=Dirbaio a=Dirbaio
Co-authored-by: Dario Nieuwenhuis <[email protected]>
| -rw-r--r-- | embassy-stm32/src/rcc/g0/mod.rs | 34 | ||||
| -rw-r--r-- | embassy-stm32/src/rcc/g4/mod.rs | 42 | ||||
| -rw-r--r-- | embassy-stm32/src/rcc/h7/mod.rs | 10 | ||||
| -rw-r--r-- | embassy-stm32/src/rcc/l0/mod.rs | 34 | ||||
| -rw-r--r-- | embassy-stm32/src/rcc/l1/mod.rs | 34 | ||||
| -rw-r--r-- | embassy-stm32/src/rcc/l4/mod.rs | 34 | ||||
| -rw-r--r-- | embassy-stm32/src/rcc/u5/mod.rs | 22 | ||||
| -rw-r--r-- | embassy-stm32/src/rcc/wb/mod.rs | 34 | ||||
| -rw-r--r-- | embassy-stm32/src/rcc/wl5x/mod.rs | 41 | ||||
| -rw-r--r-- | examples/stm32h7/src/bin/camera.rs | 2 | ||||
| -rw-r--r-- | examples/stm32h7/src/example_common.rs | 1 | ||||
| -rw-r--r-- | examples/stm32l0/src/bin/lorawan.rs | 2 | ||||
| -rw-r--r-- | examples/stm32l4/src/bin/rng.rs | 4 | ||||
| -rw-r--r-- | examples/stm32wl55/src/bin/lorawan.rs | 2 | ||||
| -rw-r--r-- | examples/stm32wl55/src/bin/subghz.rs | 2 |
15 files changed, 42 insertions, 256 deletions
diff --git a/embassy-stm32/src/rcc/g0/mod.rs b/embassy-stm32/src/rcc/g0/mod.rs index 103d9a840..7f7af2fc9 100644 --- a/embassy-stm32/src/rcc/g0/mod.rs +++ b/embassy-stm32/src/rcc/g0/mod.rs | |||
| @@ -102,10 +102,10 @@ impl Into<u8> for AHBPrescaler { | |||
| 102 | 102 | ||
| 103 | /// Clocks configutation | 103 | /// Clocks configutation |
| 104 | pub struct Config { | 104 | pub struct Config { |
| 105 | mux: ClockSrc, | 105 | pub mux: ClockSrc, |
| 106 | ahb_pre: AHBPrescaler, | 106 | pub ahb_pre: AHBPrescaler, |
| 107 | apb_pre: APBPrescaler, | 107 | pub apb_pre: APBPrescaler, |
| 108 | low_power_run: bool, | 108 | pub low_power_run: bool, |
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | impl Default for Config { | 111 | impl Default for Config { |
| @@ -120,32 +120,6 @@ impl Default for Config { | |||
| 120 | } | 120 | } |
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | impl Config { | ||
| 124 | #[inline] | ||
| 125 | pub fn clock_src(mut self, mux: ClockSrc) -> Self { | ||
| 126 | self.mux = mux; | ||
| 127 | self | ||
| 128 | } | ||
| 129 | |||
| 130 | #[inline] | ||
| 131 | pub fn ahb_pre(mut self, pre: AHBPrescaler) -> Self { | ||
| 132 | self.ahb_pre = pre; | ||
| 133 | self | ||
| 134 | } | ||
| 135 | |||
| 136 | #[inline] | ||
| 137 | pub fn apb_pre(mut self, pre: APBPrescaler) -> Self { | ||
| 138 | self.apb_pre = pre; | ||
| 139 | self | ||
| 140 | } | ||
| 141 | |||
| 142 | #[inline] | ||
| 143 | pub fn low_power_run(mut self, on: bool) -> Self { | ||
| 144 | self.low_power_run = on; | ||
| 145 | self | ||
| 146 | } | ||
| 147 | } | ||
| 148 | |||
| 149 | /// RCC peripheral | 123 | /// RCC peripheral |
| 150 | pub struct Rcc<'d> { | 124 | pub struct Rcc<'d> { |
| 151 | _rb: peripherals::RCC, | 125 | _rb: peripherals::RCC, |
diff --git a/embassy-stm32/src/rcc/g4/mod.rs b/embassy-stm32/src/rcc/g4/mod.rs index 8dd37af8e..8a75b2e03 100644 --- a/embassy-stm32/src/rcc/g4/mod.rs +++ b/embassy-stm32/src/rcc/g4/mod.rs | |||
| @@ -74,11 +74,11 @@ impl Into<u8> for AHBPrescaler { | |||
| 74 | 74 | ||
| 75 | /// Clocks configutation | 75 | /// Clocks configutation |
| 76 | pub struct Config { | 76 | pub struct Config { |
| 77 | mux: ClockSrc, | 77 | pub mux: ClockSrc, |
| 78 | ahb_pre: AHBPrescaler, | 78 | pub ahb_pre: AHBPrescaler, |
| 79 | apb1_pre: APBPrescaler, | 79 | pub apb1_pre: APBPrescaler, |
| 80 | apb2_pre: APBPrescaler, | 80 | pub apb2_pre: APBPrescaler, |
| 81 | low_power_run: bool, | 81 | pub low_power_run: bool, |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | impl Default for Config { | 84 | impl Default for Config { |
| @@ -94,38 +94,6 @@ impl Default for Config { | |||
| 94 | } | 94 | } |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | impl Config { | ||
| 98 | #[inline] | ||
| 99 | pub fn clock_src(mut self, mux: ClockSrc) -> Self { | ||
| 100 | self.mux = mux; | ||
| 101 | self | ||
| 102 | } | ||
| 103 | |||
| 104 | #[inline] | ||
| 105 | pub fn ahb_pre(mut self, pre: AHBPrescaler) -> Self { | ||
| 106 | self.ahb_pre = pre; | ||
| 107 | self | ||
| 108 | } | ||
| 109 | |||
| 110 | #[inline] | ||
| 111 | pub fn apb1_pre(mut self, pre: APBPrescaler) -> Self { | ||
| 112 | self.apb1_pre = pre; | ||
| 113 | self | ||
| 114 | } | ||
| 115 | |||
| 116 | #[inline] | ||
| 117 | pub fn apb2_pre(mut self, pre: APBPrescaler) -> Self { | ||
| 118 | self.apb2_pre = pre; | ||
| 119 | self | ||
| 120 | } | ||
| 121 | |||
| 122 | #[inline] | ||
| 123 | pub fn low_power_run(mut self, on: bool) -> Self { | ||
| 124 | self.low_power_run = on; | ||
| 125 | self | ||
| 126 | } | ||
| 127 | } | ||
| 128 | |||
| 129 | /// RCC peripheral | 97 | /// RCC peripheral |
| 130 | pub struct Rcc<'d> { | 98 | pub struct Rcc<'d> { |
| 131 | _rb: peripherals::RCC, | 99 | _rb: peripherals::RCC, |
diff --git a/embassy-stm32/src/rcc/h7/mod.rs b/embassy-stm32/src/rcc/h7/mod.rs index be7f440a1..cd493a80a 100644 --- a/embassy-stm32/src/rcc/h7/mod.rs +++ b/embassy-stm32/src/rcc/h7/mod.rs | |||
| @@ -72,8 +72,6 @@ pub struct Config { | |||
| 72 | pub pll1: PllConfig, | 72 | pub pll1: PllConfig, |
| 73 | pub pll2: PllConfig, | 73 | pub pll2: PllConfig, |
| 74 | pub pll3: PllConfig, | 74 | pub pll3: PllConfig, |
| 75 | pub enable_dma1: bool, | ||
| 76 | pub enable_dma2: bool, | ||
| 77 | } | 75 | } |
| 78 | 76 | ||
| 79 | pub struct Rcc<'d> { | 77 | pub struct Rcc<'d> { |
| @@ -331,14 +329,6 @@ impl<'d> Rcc<'d> { | |||
| 331 | }); | 329 | }); |
| 332 | while !SYSCFG.cccsr().read().ready() {} | 330 | while !SYSCFG.cccsr().read().ready() {} |
| 333 | 331 | ||
| 334 | if self.config.enable_dma1 { | ||
| 335 | RCC.ahb1enr().modify(|w| w.set_dma1en(true)); | ||
| 336 | } | ||
| 337 | |||
| 338 | if self.config.enable_dma2 { | ||
| 339 | RCC.ahb1enr().modify(|w| w.set_dma2en(true)); | ||
| 340 | } | ||
| 341 | |||
| 342 | CoreClocks { | 332 | CoreClocks { |
| 343 | hclk: Hertz(rcc_hclk), | 333 | hclk: Hertz(rcc_hclk), |
| 344 | pclk1: Hertz(rcc_pclk1), | 334 | pclk1: Hertz(rcc_pclk1), |
diff --git a/embassy-stm32/src/rcc/l0/mod.rs b/embassy-stm32/src/rcc/l0/mod.rs index 8af4eca08..fd84f09c5 100644 --- a/embassy-stm32/src/rcc/l0/mod.rs +++ b/embassy-stm32/src/rcc/l0/mod.rs | |||
| @@ -183,10 +183,10 @@ impl Into<Msirange> for MSIRange { | |||
| 183 | 183 | ||
| 184 | /// Clocks configutation | 184 | /// Clocks configutation |
| 185 | pub struct Config { | 185 | pub struct Config { |
| 186 | mux: ClockSrc, | 186 | pub mux: ClockSrc, |
| 187 | ahb_pre: AHBPrescaler, | 187 | pub ahb_pre: AHBPrescaler, |
| 188 | apb1_pre: APBPrescaler, | 188 | pub apb1_pre: APBPrescaler, |
| 189 | apb2_pre: APBPrescaler, | 189 | pub apb2_pre: APBPrescaler, |
| 190 | } | 190 | } |
| 191 | 191 | ||
| 192 | impl Default for Config { | 192 | impl Default for Config { |
| @@ -201,32 +201,6 @@ impl Default for Config { | |||
| 201 | } | 201 | } |
| 202 | } | 202 | } |
| 203 | 203 | ||
| 204 | impl Config { | ||
| 205 | #[inline] | ||
| 206 | pub fn clock_src(mut self, mux: ClockSrc) -> Self { | ||
| 207 | self.mux = mux; | ||
| 208 | self | ||
| 209 | } | ||
| 210 | |||
| 211 | #[inline] | ||
| 212 | pub fn ahb_pre(mut self, pre: AHBPrescaler) -> Self { | ||
| 213 | self.ahb_pre = pre; | ||
| 214 | self | ||
| 215 | } | ||
| 216 | |||
| 217 | #[inline] | ||
| 218 | pub fn apb1_pre(mut self, pre: APBPrescaler) -> Self { | ||
| 219 | self.apb1_pre = pre; | ||
| 220 | self | ||
| 221 | } | ||
| 222 | |||
| 223 | #[inline] | ||
| 224 | pub fn apb2_pre(mut self, pre: APBPrescaler) -> Self { | ||
| 225 | self.apb2_pre = pre; | ||
| 226 | self | ||
| 227 | } | ||
| 228 | } | ||
| 229 | |||
| 230 | /// RCC peripheral | 204 | /// RCC peripheral |
| 231 | pub struct Rcc<'d> { | 205 | pub struct Rcc<'d> { |
| 232 | _rb: peripherals::RCC, | 206 | _rb: peripherals::RCC, |
diff --git a/embassy-stm32/src/rcc/l1/mod.rs b/embassy-stm32/src/rcc/l1/mod.rs index d0b52d2f4..e46bee323 100644 --- a/embassy-stm32/src/rcc/l1/mod.rs +++ b/embassy-stm32/src/rcc/l1/mod.rs | |||
| @@ -118,10 +118,10 @@ impl Into<u8> for MSIRange { | |||
| 118 | 118 | ||
| 119 | /// Clocks configutation | 119 | /// Clocks configutation |
| 120 | pub struct Config { | 120 | pub struct Config { |
| 121 | mux: ClockSrc, | 121 | pub mux: ClockSrc, |
| 122 | ahb_pre: AHBPrescaler, | 122 | pub ahb_pre: AHBPrescaler, |
| 123 | apb1_pre: APBPrescaler, | 123 | pub apb1_pre: APBPrescaler, |
| 124 | apb2_pre: APBPrescaler, | 124 | pub apb2_pre: APBPrescaler, |
| 125 | } | 125 | } |
| 126 | 126 | ||
| 127 | impl Default for Config { | 127 | impl Default for Config { |
| @@ -136,32 +136,6 @@ impl Default for Config { | |||
| 136 | } | 136 | } |
| 137 | } | 137 | } |
| 138 | 138 | ||
| 139 | impl Config { | ||
| 140 | #[inline] | ||
| 141 | pub fn clock_src(mut self, mux: ClockSrc) -> Self { | ||
| 142 | self.mux = mux; | ||
| 143 | self | ||
| 144 | } | ||
| 145 | |||
| 146 | #[inline] | ||
| 147 | pub fn ahb_pre(mut self, pre: AHBPrescaler) -> Self { | ||
| 148 | self.ahb_pre = pre; | ||
| 149 | self | ||
| 150 | } | ||
| 151 | |||
| 152 | #[inline] | ||
| 153 | pub fn apb1_pre(mut self, pre: APBPrescaler) -> Self { | ||
| 154 | self.apb1_pre = pre; | ||
| 155 | self | ||
| 156 | } | ||
| 157 | |||
| 158 | #[inline] | ||
| 159 | pub fn apb2_pre(mut self, pre: APBPrescaler) -> Self { | ||
| 160 | self.apb2_pre = pre; | ||
| 161 | self | ||
| 162 | } | ||
| 163 | } | ||
| 164 | |||
| 165 | /// RCC peripheral | 139 | /// RCC peripheral |
| 166 | pub struct Rcc<'d> { | 140 | pub struct Rcc<'d> { |
| 167 | _rb: peripherals::RCC, | 141 | _rb: peripherals::RCC, |
diff --git a/embassy-stm32/src/rcc/l4/mod.rs b/embassy-stm32/src/rcc/l4/mod.rs index e1eadf856..a0eedf0b6 100644 --- a/embassy-stm32/src/rcc/l4/mod.rs +++ b/embassy-stm32/src/rcc/l4/mod.rs | |||
| @@ -269,10 +269,10 @@ impl Into<u8> for AHBPrescaler { | |||
| 269 | 269 | ||
| 270 | /// Clocks configutation | 270 | /// Clocks configutation |
| 271 | pub struct Config { | 271 | pub struct Config { |
| 272 | mux: ClockSrc, | 272 | pub mux: ClockSrc, |
| 273 | ahb_pre: AHBPrescaler, | 273 | pub ahb_pre: AHBPrescaler, |
| 274 | apb1_pre: APBPrescaler, | 274 | pub apb1_pre: APBPrescaler, |
| 275 | apb2_pre: APBPrescaler, | 275 | pub apb2_pre: APBPrescaler, |
| 276 | } | 276 | } |
| 277 | 277 | ||
| 278 | impl Default for Config { | 278 | impl Default for Config { |
| @@ -287,32 +287,6 @@ impl Default for Config { | |||
| 287 | } | 287 | } |
| 288 | } | 288 | } |
| 289 | 289 | ||
| 290 | impl Config { | ||
| 291 | #[inline] | ||
| 292 | pub fn clock_src(mut self, mux: ClockSrc) -> Self { | ||
| 293 | self.mux = mux; | ||
| 294 | self | ||
| 295 | } | ||
| 296 | |||
| 297 | #[inline] | ||
| 298 | pub fn ahb_pre(mut self, pre: AHBPrescaler) -> Self { | ||
| 299 | self.ahb_pre = pre; | ||
| 300 | self | ||
| 301 | } | ||
| 302 | |||
| 303 | #[inline] | ||
| 304 | pub fn apb1_pre(mut self, pre: APBPrescaler) -> Self { | ||
| 305 | self.apb1_pre = pre; | ||
| 306 | self | ||
| 307 | } | ||
| 308 | |||
| 309 | #[inline] | ||
| 310 | pub fn apb2_pre(mut self, pre: APBPrescaler) -> Self { | ||
| 311 | self.apb2_pre = pre; | ||
| 312 | self | ||
| 313 | } | ||
| 314 | } | ||
| 315 | |||
| 316 | /// RCC peripheral | 290 | /// RCC peripheral |
| 317 | pub struct Rcc<'d> { | 291 | pub struct Rcc<'d> { |
| 318 | _rb: peripherals::RCC, | 292 | _rb: peripherals::RCC, |
diff --git a/embassy-stm32/src/rcc/u5/mod.rs b/embassy-stm32/src/rcc/u5/mod.rs index 6e68b2205..a3df3a02d 100644 --- a/embassy-stm32/src/rcc/u5/mod.rs +++ b/embassy-stm32/src/rcc/u5/mod.rs | |||
| @@ -274,16 +274,16 @@ impl Default for MSIRange { | |||
| 274 | 274 | ||
| 275 | #[derive(Copy, Clone)] | 275 | #[derive(Copy, Clone)] |
| 276 | pub struct Config { | 276 | pub struct Config { |
| 277 | mux: ClockSrc, | 277 | pub mux: ClockSrc, |
| 278 | ahb_pre: AHBPrescaler, | 278 | pub ahb_pre: AHBPrescaler, |
| 279 | apb1_pre: APBPrescaler, | 279 | pub apb1_pre: APBPrescaler, |
| 280 | apb2_pre: APBPrescaler, | 280 | pub apb2_pre: APBPrescaler, |
| 281 | apb3_pre: APBPrescaler, | 281 | pub apb3_pre: APBPrescaler, |
| 282 | } | 282 | } |
| 283 | 283 | ||
| 284 | impl Config { | 284 | impl Default for Config { |
| 285 | pub fn new() -> Self { | 285 | fn default() -> Self { |
| 286 | Config { | 286 | Self { |
| 287 | mux: ClockSrc::MSI(MSIRange::default()), | 287 | mux: ClockSrc::MSI(MSIRange::default()), |
| 288 | ahb_pre: Default::default(), | 288 | ahb_pre: Default::default(), |
| 289 | apb1_pre: Default::default(), | 289 | apb1_pre: Default::default(), |
| @@ -293,12 +293,6 @@ impl Config { | |||
| 293 | } | 293 | } |
| 294 | } | 294 | } |
| 295 | 295 | ||
| 296 | impl Default for Config { | ||
| 297 | fn default() -> Self { | ||
| 298 | Config::new() | ||
| 299 | } | ||
| 300 | } | ||
| 301 | |||
| 302 | /// Extension trait that freezes the `RCC` peripheral with provided clocks configuration | 296 | /// Extension trait that freezes the `RCC` peripheral with provided clocks configuration |
| 303 | pub trait RccExt { | 297 | pub trait RccExt { |
| 304 | fn freeze(self, config: Config, power: &Power) -> Clocks; | 298 | fn freeze(self, config: Config, power: &Power) -> Clocks; |
diff --git a/embassy-stm32/src/rcc/wb/mod.rs b/embassy-stm32/src/rcc/wb/mod.rs index 435357418..73835cacd 100644 --- a/embassy-stm32/src/rcc/wb/mod.rs +++ b/embassy-stm32/src/rcc/wb/mod.rs | |||
| @@ -86,10 +86,10 @@ impl Into<u8> for AHBPrescaler { | |||
| 86 | 86 | ||
| 87 | /// Clocks configutation | 87 | /// Clocks configutation |
| 88 | pub struct Config { | 88 | pub struct Config { |
| 89 | mux: ClockSrc, | 89 | pub mux: ClockSrc, |
| 90 | ahb_pre: AHBPrescaler, | 90 | pub ahb_pre: AHBPrescaler, |
| 91 | apb1_pre: APBPrescaler, | 91 | pub apb1_pre: APBPrescaler, |
| 92 | apb2_pre: APBPrescaler, | 92 | pub apb2_pre: APBPrescaler, |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | impl Default for Config { | 95 | impl Default for Config { |
| @@ -104,32 +104,6 @@ impl Default for Config { | |||
| 104 | } | 104 | } |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | impl Config { | ||
| 108 | #[inline] | ||
| 109 | pub fn clock_src(mut self, mux: ClockSrc) -> Self { | ||
| 110 | self.mux = mux; | ||
| 111 | self | ||
| 112 | } | ||
| 113 | |||
| 114 | #[inline] | ||
| 115 | pub fn ahb_pre(mut self, pre: AHBPrescaler) -> Self { | ||
| 116 | self.ahb_pre = pre; | ||
| 117 | self | ||
| 118 | } | ||
| 119 | |||
| 120 | #[inline] | ||
| 121 | pub fn apb1_pre(mut self, pre: APBPrescaler) -> Self { | ||
| 122 | self.apb1_pre = pre; | ||
| 123 | self | ||
| 124 | } | ||
| 125 | |||
| 126 | #[inline] | ||
| 127 | pub fn apb2_pre(mut self, pre: APBPrescaler) -> Self { | ||
| 128 | self.apb2_pre = pre; | ||
| 129 | self | ||
| 130 | } | ||
| 131 | } | ||
| 132 | |||
| 133 | /// RCC peripheral | 107 | /// RCC peripheral |
| 134 | pub struct Rcc<'d> { | 108 | pub struct Rcc<'d> { |
| 135 | _rb: peripherals::RCC, | 109 | _rb: peripherals::RCC, |
diff --git a/embassy-stm32/src/rcc/wl5x/mod.rs b/embassy-stm32/src/rcc/wl5x/mod.rs index aa49c99c9..edf603ee6 100644 --- a/embassy-stm32/src/rcc/wl5x/mod.rs +++ b/embassy-stm32/src/rcc/wl5x/mod.rs | |||
| @@ -87,10 +87,10 @@ impl Into<u8> for AHBPrescaler { | |||
| 87 | 87 | ||
| 88 | /// Clocks configutation | 88 | /// Clocks configutation |
| 89 | pub struct Config { | 89 | pub struct Config { |
| 90 | mux: ClockSrc, | 90 | pub mux: ClockSrc, |
| 91 | ahb_pre: AHBPrescaler, | 91 | pub ahb_pre: AHBPrescaler, |
| 92 | apb1_pre: APBPrescaler, | 92 | pub apb1_pre: APBPrescaler, |
| 93 | apb2_pre: APBPrescaler, | 93 | pub apb2_pre: APBPrescaler, |
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | impl Default for Config { | 96 | impl Default for Config { |
| @@ -105,32 +105,6 @@ impl Default for Config { | |||
| 105 | } | 105 | } |
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | impl Config { | ||
| 109 | #[inline] | ||
| 110 | pub fn clock_src(mut self, mux: ClockSrc) -> Self { | ||
| 111 | self.mux = mux; | ||
| 112 | self | ||
| 113 | } | ||
| 114 | |||
| 115 | #[inline] | ||
| 116 | pub fn ahb_pre(mut self, pre: AHBPrescaler) -> Self { | ||
| 117 | self.ahb_pre = pre; | ||
| 118 | self | ||
| 119 | } | ||
| 120 | |||
| 121 | #[inline] | ||
| 122 | pub fn apb1_pre(mut self, pre: APBPrescaler) -> Self { | ||
| 123 | self.apb1_pre = pre; | ||
| 124 | self | ||
| 125 | } | ||
| 126 | |||
| 127 | #[inline] | ||
| 128 | pub fn apb2_pre(mut self, pre: APBPrescaler) -> Self { | ||
| 129 | self.apb2_pre = pre; | ||
| 130 | self | ||
| 131 | } | ||
| 132 | } | ||
| 133 | |||
| 134 | /// RCC peripheral | 108 | /// RCC peripheral |
| 135 | pub struct Rcc<'d> { | 109 | pub struct Rcc<'d> { |
| 136 | _rb: peripherals::RCC, | 110 | _rb: peripherals::RCC, |
| @@ -257,13 +231,6 @@ impl RccExt for RCC { | |||
| 257 | 231 | ||
| 258 | pub unsafe fn init(config: Config) { | 232 | pub unsafe fn init(config: Config) { |
| 259 | let r = <peripherals::RCC as embassy::util::Steal>::steal(); | 233 | let r = <peripherals::RCC as embassy::util::Steal>::steal(); |
| 260 | let rcc = pac::RCC; | ||
| 261 | rcc.ahb2enr().write(|w| { | ||
| 262 | w.set_gpioaen(true); | ||
| 263 | w.set_gpioben(true); | ||
| 264 | w.set_gpiocen(true); | ||
| 265 | w.set_gpiohen(true); | ||
| 266 | }); | ||
| 267 | let clocks = r.freeze(config); | 234 | let clocks = r.freeze(config); |
| 268 | set_freqs(clocks); | 235 | set_freqs(clocks); |
| 269 | } | 236 | } |
diff --git a/examples/stm32h7/src/bin/camera.rs b/examples/stm32h7/src/bin/camera.rs index 2fa742b83..d94592071 100644 --- a/examples/stm32h7/src/bin/camera.rs +++ b/examples/stm32h7/src/bin/camera.rs | |||
| @@ -34,8 +34,6 @@ pub fn config() -> Config { | |||
| 34 | config.rcc.sys_ck = Some(400.mhz().into()); | 34 | config.rcc.sys_ck = Some(400.mhz().into()); |
| 35 | config.rcc.hclk = Some(400.mhz().into()); | 35 | config.rcc.hclk = Some(400.mhz().into()); |
| 36 | config.rcc.pll1.q_ck = Some(100.mhz().into()); | 36 | config.rcc.pll1.q_ck = Some(100.mhz().into()); |
| 37 | config.rcc.enable_dma1 = true; | ||
| 38 | config.rcc.enable_dma2 = true; | ||
| 39 | config.rcc.pclk1 = Some(100.mhz().into()); | 37 | config.rcc.pclk1 = Some(100.mhz().into()); |
| 40 | config.rcc.pclk2 = Some(100.mhz().into()); | 38 | config.rcc.pclk2 = Some(100.mhz().into()); |
| 41 | config.rcc.pclk3 = Some(100.mhz().into()); | 39 | config.rcc.pclk3 = Some(100.mhz().into()); |
diff --git a/examples/stm32h7/src/example_common.rs b/examples/stm32h7/src/example_common.rs index 2e26730fa..524bee6d9 100644 --- a/examples/stm32h7/src/example_common.rs +++ b/examples/stm32h7/src/example_common.rs | |||
| @@ -23,6 +23,5 @@ pub fn config() -> Config { | |||
| 23 | let mut config = Config::default(); | 23 | let mut config = Config::default(); |
| 24 | config.rcc.sys_ck = Some(400.mhz().into()); | 24 | config.rcc.sys_ck = Some(400.mhz().into()); |
| 25 | config.rcc.pll1.q_ck = Some(100.mhz().into()); | 25 | config.rcc.pll1.q_ck = Some(100.mhz().into()); |
| 26 | config.rcc.enable_dma1 = true; | ||
| 27 | config | 26 | config |
| 28 | } | 27 | } |
diff --git a/examples/stm32l0/src/bin/lorawan.rs b/examples/stm32l0/src/bin/lorawan.rs index cbae88356..7ce859a8d 100644 --- a/examples/stm32l0/src/bin/lorawan.rs +++ b/examples/stm32l0/src/bin/lorawan.rs | |||
| @@ -25,7 +25,7 @@ use lorawan_encoding::default_crypto::DefaultFactory as Crypto; | |||
| 25 | 25 | ||
| 26 | fn config() -> embassy_stm32::Config { | 26 | fn config() -> embassy_stm32::Config { |
| 27 | let mut config = embassy_stm32::Config::default(); | 27 | let mut config = embassy_stm32::Config::default(); |
| 28 | config.rcc = config.rcc.clock_src(embassy_stm32::rcc::ClockSrc::HSI16); | 28 | config.rcc.mux = embassy_stm32::rcc::ClockSrc::HSI16; |
| 29 | config | 29 | config |
| 30 | } | 30 | } |
| 31 | 31 | ||
diff --git a/examples/stm32l4/src/bin/rng.rs b/examples/stm32l4/src/bin/rng.rs index ee5f579f8..c60b1d8bc 100644 --- a/examples/stm32l4/src/bin/rng.rs +++ b/examples/stm32l4/src/bin/rng.rs | |||
| @@ -14,13 +14,13 @@ use example_common::*; | |||
| 14 | 14 | ||
| 15 | fn config() -> Config { | 15 | fn config() -> Config { |
| 16 | let mut config = Config::default(); | 16 | let mut config = Config::default(); |
| 17 | config.rcc = config.rcc.clock_src(ClockSrc::PLL( | 17 | config.rcc.mux = ClockSrc::PLL( |
| 18 | PLLSource::HSI16, | 18 | PLLSource::HSI16, |
| 19 | PLLClkDiv::Div2, | 19 | PLLClkDiv::Div2, |
| 20 | PLLSrcDiv::Div1, | 20 | PLLSrcDiv::Div1, |
| 21 | PLLMul::Mul8, | 21 | PLLMul::Mul8, |
| 22 | Some(PLLClkDiv::Div2), | 22 | Some(PLLClkDiv::Div2), |
| 23 | )); | 23 | ); |
| 24 | config | 24 | config |
| 25 | } | 25 | } |
| 26 | 26 | ||
diff --git a/examples/stm32wl55/src/bin/lorawan.rs b/examples/stm32wl55/src/bin/lorawan.rs index 155905ae7..7048a5814 100644 --- a/examples/stm32wl55/src/bin/lorawan.rs +++ b/examples/stm32wl55/src/bin/lorawan.rs | |||
| @@ -23,7 +23,7 @@ use lorawan_encoding::default_crypto::DefaultFactory as Crypto; | |||
| 23 | 23 | ||
| 24 | fn config() -> embassy_stm32::Config { | 24 | fn config() -> embassy_stm32::Config { |
| 25 | let mut config = embassy_stm32::Config::default(); | 25 | let mut config = embassy_stm32::Config::default(); |
| 26 | config.rcc = config.rcc.clock_src(embassy_stm32::rcc::ClockSrc::HSI16); | 26 | config.rcc.mux = embassy_stm32::rcc::ClockSrc::HSI16; |
| 27 | config | 27 | config |
| 28 | } | 28 | } |
| 29 | 29 | ||
diff --git a/examples/stm32wl55/src/bin/subghz.rs b/examples/stm32wl55/src/bin/subghz.rs index 89549c766..a73c361c2 100644 --- a/examples/stm32wl55/src/bin/subghz.rs +++ b/examples/stm32wl55/src/bin/subghz.rs | |||
| @@ -66,7 +66,7 @@ const TX_PARAMS: TxParams = TxParams::new() | |||
| 66 | 66 | ||
| 67 | fn config() -> embassy_stm32::Config { | 67 | fn config() -> embassy_stm32::Config { |
| 68 | let mut config = embassy_stm32::Config::default(); | 68 | let mut config = embassy_stm32::Config::default(); |
| 69 | config.rcc = config.rcc.clock_src(embassy_stm32::rcc::ClockSrc::HSE32); | 69 | config.rcc.mux = embassy_stm32::rcc::ClockSrc::HSE32; |
| 70 | config | 70 | config |
| 71 | } | 71 | } |
| 72 | 72 | ||
