aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarun <[email protected]>2024-04-03 16:42:16 -0400
committerKarun <[email protected]>2024-04-03 16:42:16 -0400
commit330a3b04882a072406b9c3b4ef35d4c91c994e01 (patch)
treef8c4216b09cd35b7fd4dfabe6ac91c4e778ac403
parent4ea7dfce176cf588fe0bc37efbca44e229bd6e0e (diff)
Fix passing of dual quad param to inner constructor
-rw-r--r--embassy-stm32/src/ospi/mod.rs30
1 files changed, 10 insertions, 20 deletions
diff --git a/embassy-stm32/src/ospi/mod.rs b/embassy-stm32/src/ospi/mod.rs
index 4a89cd810..398c3298f 100644
--- a/embassy-stm32/src/ospi/mod.rs
+++ b/embassy-stm32/src/ospi/mod.rs
@@ -194,10 +194,6 @@ impl<'d, T: Instance, Dma> Ospi<'d, T, Dma> {
194 d1.set_as_af_pull(d1.af_num(), AFType::Input, Pull::None); 194 d1.set_as_af_pull(d1.af_num(), AFType::Input, Pull::None);
195 d1.set_speed(crate::gpio::Speed::VeryHigh); 195 d1.set_speed(crate::gpio::Speed::VeryHigh);
196 196
197 T::REGS.cr().modify(|w| {
198 w.set_dmm(false);
199 });
200
201 Self::new_inner( 197 Self::new_inner(
202 peri, 198 peri,
203 Some(d0.map_into()), 199 Some(d0.map_into()),
@@ -214,6 +210,7 @@ impl<'d, T: Instance, Dma> Ospi<'d, T, Dma> {
214 dma, 210 dma,
215 config, 211 config,
216 OspiWidth::SING, 212 OspiWidth::SING,
213 false,
217 ) 214 )
218 } 215 }
219 216
@@ -238,10 +235,6 @@ impl<'d, T: Instance, Dma> Ospi<'d, T, Dma> {
238 d1.set_as_af_pull(d1.af_num(), AFType::OutputPushPull, Pull::None); 235 d1.set_as_af_pull(d1.af_num(), AFType::OutputPushPull, Pull::None);
239 d1.set_speed(crate::gpio::Speed::VeryHigh); 236 d1.set_speed(crate::gpio::Speed::VeryHigh);
240 237
241 T::REGS.cr().modify(|w| {
242 w.set_dmm(false);
243 });
244
245 Self::new_inner( 238 Self::new_inner(
246 peri, 239 peri,
247 Some(d0.map_into()), 240 Some(d0.map_into()),
@@ -258,6 +251,7 @@ impl<'d, T: Instance, Dma> Ospi<'d, T, Dma> {
258 dma, 251 dma,
259 config, 252 config,
260 OspiWidth::DUAL, 253 OspiWidth::DUAL,
254 false,
261 ) 255 )
262 } 256 }
263 257
@@ -288,10 +282,6 @@ impl<'d, T: Instance, Dma> Ospi<'d, T, Dma> {
288 d3.set_as_af_pull(d3.af_num(), AFType::OutputPushPull, Pull::None); 282 d3.set_as_af_pull(d3.af_num(), AFType::OutputPushPull, Pull::None);
289 d3.set_speed(crate::gpio::Speed::VeryHigh); 283 d3.set_speed(crate::gpio::Speed::VeryHigh);
290 284
291 T::REGS.cr().modify(|w| {
292 w.set_dmm(false);
293 });
294
295 Self::new_inner( 285 Self::new_inner(
296 peri, 286 peri,
297 Some(d0.map_into()), 287 Some(d0.map_into()),
@@ -308,6 +298,7 @@ impl<'d, T: Instance, Dma> Ospi<'d, T, Dma> {
308 dma, 298 dma,
309 config, 299 config,
310 OspiWidth::QUAD, 300 OspiWidth::QUAD,
301 false,
311 ) 302 )
312 } 303 }
313 304
@@ -350,10 +341,6 @@ impl<'d, T: Instance, Dma> Ospi<'d, T, Dma> {
350 d7.set_as_af_pull(d7.af_num(), AFType::OutputPushPull, Pull::None); 341 d7.set_as_af_pull(d7.af_num(), AFType::OutputPushPull, Pull::None);
351 d7.set_speed(crate::gpio::Speed::VeryHigh); 342 d7.set_speed(crate::gpio::Speed::VeryHigh);
352 343
353 T::REGS.cr().modify(|w| {
354 w.set_dmm(true);
355 });
356
357 Self::new_inner( 344 Self::new_inner(
358 peri, 345 peri,
359 Some(d0.map_into()), 346 Some(d0.map_into()),
@@ -370,6 +357,7 @@ impl<'d, T: Instance, Dma> Ospi<'d, T, Dma> {
370 dma, 357 dma,
371 config, 358 config,
372 OspiWidth::QUAD, 359 OspiWidth::QUAD,
360 true,
373 ) 361 )
374 } 362 }
375 363
@@ -412,10 +400,6 @@ impl<'d, T: Instance, Dma> Ospi<'d, T, Dma> {
412 d7.set_as_af_pull(d7.af_num(), AFType::OutputPushPull, Pull::None); 400 d7.set_as_af_pull(d7.af_num(), AFType::OutputPushPull, Pull::None);
413 d7.set_speed(crate::gpio::Speed::VeryHigh); 401 d7.set_speed(crate::gpio::Speed::VeryHigh);
414 402
415 T::REGS.cr().modify(|w| {
416 w.set_dmm(false);
417 });
418
419 Self::new_inner( 403 Self::new_inner(
420 peri, 404 peri,
421 Some(d0.map_into()), 405 Some(d0.map_into()),
@@ -432,6 +416,7 @@ impl<'d, T: Instance, Dma> Ospi<'d, T, Dma> {
432 dma, 416 dma,
433 config, 417 config,
434 OspiWidth::OCTO, 418 OspiWidth::OCTO,
419 false,
435 ) 420 )
436 } 421 }
437 422
@@ -451,6 +436,7 @@ impl<'d, T: Instance, Dma> Ospi<'d, T, Dma> {
451 dma: impl Peripheral<P = Dma> + 'd, 436 dma: impl Peripheral<P = Dma> + 'd,
452 config: Config, 437 config: Config,
453 width: OspiWidth, 438 width: OspiWidth,
439 dual_quad: bool,
454 ) -> Self { 440 ) -> Self {
455 into_ref!(peri, dma); 441 into_ref!(peri, dma);
456 442
@@ -495,6 +481,10 @@ impl<'d, T: Instance, Dma> Ospi<'d, T, Dma> {
495 w.set_prescaler(config.clock_prescaler); 481 w.set_prescaler(config.clock_prescaler);
496 }); 482 });
497 483
484 T::REGS.cr().modify(|w| {
485 w.set_dmm(dual_quad);
486 });
487
498 T::REGS.tcr().modify(|w| { 488 T::REGS.tcr().modify(|w| {
499 w.set_sshift(match config.sample_shifting { 489 w.set_sshift(match config.sample_shifting {
500 true => vals::SampleShift::HALFCYCLE, 490 true => vals::SampleShift::HALFCYCLE,