aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32/src
diff options
context:
space:
mode:
Diffstat (limited to 'embassy-stm32/src')
-rw-r--r--embassy-stm32/src/qspi/mod.rs52
1 files changed, 28 insertions, 24 deletions
diff --git a/embassy-stm32/src/qspi/mod.rs b/embassy-stm32/src/qspi/mod.rs
index c0cd216f0..0644069a6 100644
--- a/embassy-stm32/src/qspi/mod.rs
+++ b/embassy-stm32/src/qspi/mod.rs
@@ -48,6 +48,7 @@ impl Default for TransferConfig {
48 48
49/// QSPI driver configuration. 49/// QSPI driver configuration.
50#[derive(Clone, Copy)] 50#[derive(Clone, Copy)]
51#[non_exhaustive]
51pub struct Config { 52pub struct Config {
52 /// Flash memory size representend as 2^[0-32], as reasonable minimum 1KiB(9) was chosen. 53 /// Flash memory size representend as 2^[0-32], as reasonable minimum 1KiB(9) was chosen.
53 /// If you need other value the whose predefined use `Other` variant. 54 /// If you need other value the whose predefined use `Other` variant.
@@ -62,6 +63,8 @@ pub struct Config {
62 pub cs_high_time: ChipSelectHighTime, 63 pub cs_high_time: ChipSelectHighTime,
63 /// Shift sampling point of input data (none, or half-cycle) 64 /// Shift sampling point of input data (none, or half-cycle)
64 pub sample_shifting: SampleShifting, 65 pub sample_shifting: SampleShifting,
66 /// GPIO Speed
67 pub gpio_speed: Speed,
65} 68}
66 69
67impl Default for Config { 70impl Default for Config {
@@ -73,6 +76,7 @@ impl Default for Config {
73 fifo_threshold: FIFOThresholdLevel::_17Bytes, 76 fifo_threshold: FIFOThresholdLevel::_17Bytes,
74 cs_high_time: ChipSelectHighTime::_5Cycle, 77 cs_high_time: ChipSelectHighTime::_5Cycle,
75 sample_shifting: SampleShifting::None, 78 sample_shifting: SampleShifting::None,
79 gpio_speed: Speed::VeryHigh,
76 } 80 }
77 } 81 }
78} 82}
@@ -286,14 +290,14 @@ impl<'d, T: Instance> Qspi<'d, T, Blocking> {
286 ) -> Self { 290 ) -> Self {
287 Self::new_inner( 291 Self::new_inner(
288 peri, 292 peri,
289 new_pin!(d0, AfType::output(OutputType::PushPull, Speed::VeryHigh)), 293 new_pin!(d0, AfType::output(OutputType::PushPull, config.gpio_speed)),
290 new_pin!(d1, AfType::output(OutputType::PushPull, Speed::VeryHigh)), 294 new_pin!(d1, AfType::output(OutputType::PushPull, config.gpio_speed)),
291 new_pin!(d2, AfType::output(OutputType::PushPull, Speed::VeryHigh)), 295 new_pin!(d2, AfType::output(OutputType::PushPull, config.gpio_speed)),
292 new_pin!(d3, AfType::output(OutputType::PushPull, Speed::VeryHigh)), 296 new_pin!(d3, AfType::output(OutputType::PushPull, config.gpio_speed)),
293 new_pin!(sck, AfType::output(OutputType::PushPull, Speed::VeryHigh)), 297 new_pin!(sck, AfType::output(OutputType::PushPull, config.gpio_speed)),
294 new_pin!( 298 new_pin!(
295 nss, 299 nss,
296 AfType::output_pull(OutputType::PushPull, Speed::VeryHigh, Pull::Up) 300 AfType::output_pull(OutputType::PushPull, config.gpio_speed, Pull::Up)
297 ), 301 ),
298 None, 302 None,
299 config, 303 config,
@@ -314,14 +318,14 @@ impl<'d, T: Instance> Qspi<'d, T, Blocking> {
314 ) -> Self { 318 ) -> Self {
315 Self::new_inner( 319 Self::new_inner(
316 peri, 320 peri,
317 new_pin!(d0, AfType::output(OutputType::PushPull, Speed::VeryHigh)), 321 new_pin!(d0, AfType::output(OutputType::PushPull, config.gpio_speed)),
318 new_pin!(d1, AfType::output(OutputType::PushPull, Speed::VeryHigh)), 322 new_pin!(d1, AfType::output(OutputType::PushPull, config.gpio_speed)),
319 new_pin!(d2, AfType::output(OutputType::PushPull, Speed::VeryHigh)), 323 new_pin!(d2, AfType::output(OutputType::PushPull, config.gpio_speed)),
320 new_pin!(d3, AfType::output(OutputType::PushPull, Speed::VeryHigh)), 324 new_pin!(d3, AfType::output(OutputType::PushPull, config.gpio_speed)),
321 new_pin!(sck, AfType::output(OutputType::PushPull, Speed::VeryHigh)), 325 new_pin!(sck, AfType::output(OutputType::PushPull, config.gpio_speed)),
322 new_pin!( 326 new_pin!(
323 nss, 327 nss,
324 AfType::output_pull(OutputType::PushPull, Speed::VeryHigh, Pull::Up) 328 AfType::output_pull(OutputType::PushPull, config.gpio_speed, Pull::Up)
325 ), 329 ),
326 None, 330 None,
327 config, 331 config,
@@ -345,14 +349,14 @@ impl<'d, T: Instance> Qspi<'d, T, Async> {
345 ) -> Self { 349 ) -> Self {
346 Self::new_inner( 350 Self::new_inner(
347 peri, 351 peri,
348 new_pin!(d0, AfType::output(OutputType::PushPull, Speed::VeryHigh)), 352 new_pin!(d0, AfType::output(OutputType::PushPull, config.gpio_speed)),
349 new_pin!(d1, AfType::output(OutputType::PushPull, Speed::VeryHigh)), 353 new_pin!(d1, AfType::output(OutputType::PushPull, config.gpio_speed)),
350 new_pin!(d2, AfType::output(OutputType::PushPull, Speed::VeryHigh)), 354 new_pin!(d2, AfType::output(OutputType::PushPull, config.gpio_speed)),
351 new_pin!(d3, AfType::output(OutputType::PushPull, Speed::VeryHigh)), 355 new_pin!(d3, AfType::output(OutputType::PushPull, config.gpio_speed)),
352 new_pin!(sck, AfType::output(OutputType::PushPull, Speed::VeryHigh)), 356 new_pin!(sck, AfType::output(OutputType::PushPull, config.gpio_speed)),
353 new_pin!( 357 new_pin!(
354 nss, 358 nss,
355 AfType::output_pull(OutputType::PushPull, Speed::VeryHigh, Pull::Up) 359 AfType::output_pull(OutputType::PushPull, config.gpio_speed, Pull::Up)
356 ), 360 ),
357 new_dma!(dma), 361 new_dma!(dma),
358 config, 362 config,
@@ -374,14 +378,14 @@ impl<'d, T: Instance> Qspi<'d, T, Async> {
374 ) -> Self { 378 ) -> Self {
375 Self::new_inner( 379 Self::new_inner(
376 peri, 380 peri,
377 new_pin!(d0, AfType::output(OutputType::PushPull, Speed::VeryHigh)), 381 new_pin!(d0, AfType::output(OutputType::PushPull, config.gpio_speed)),
378 new_pin!(d1, AfType::output(OutputType::PushPull, Speed::VeryHigh)), 382 new_pin!(d1, AfType::output(OutputType::PushPull, config.gpio_speed)),
379 new_pin!(d2, AfType::output(OutputType::PushPull, Speed::VeryHigh)), 383 new_pin!(d2, AfType::output(OutputType::PushPull, config.gpio_speed)),
380 new_pin!(d3, AfType::output(OutputType::PushPull, Speed::VeryHigh)), 384 new_pin!(d3, AfType::output(OutputType::PushPull, config.gpio_speed)),
381 new_pin!(sck, AfType::output(OutputType::PushPull, Speed::VeryHigh)), 385 new_pin!(sck, AfType::output(OutputType::PushPull, config.gpio_speed)),
382 new_pin!( 386 new_pin!(
383 nss, 387 nss,
384 AfType::output_pull(OutputType::PushPull, Speed::VeryHigh, Pull::Up) 388 AfType::output_pull(OutputType::PushPull, config.gpio_speed, Pull::Up)
385 ), 389 ),
386 new_dma!(dma), 390 new_dma!(dma),
387 config, 391 config,