diff options
| author | Dario Nieuwenhuis <[email protected]> | 2021-03-29 00:55:05 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2021-03-29 00:58:58 +0200 |
| commit | 5b74e326e5da8214eec9360e67f42ff2ca3905e8 (patch) | |
| tree | 893ea3221e0ca0b6ec1b9685cae40249b12c36ac | |
| parent | b9e709403d8073861ae9f5010ddf2cfa6d90f41e (diff) | |
nrf/qpsi: make config non_exhaustive
| -rw-r--r-- | embassy-nrf-examples/src/bin/qspi.rs | 9 | ||||
| -rw-r--r-- | embassy-nrf/src/qspi.rs | 13 |
2 files changed, 14 insertions, 8 deletions
diff --git a/embassy-nrf-examples/src/bin/qspi.rs b/embassy-nrf-examples/src/bin/qspi.rs index 4e24a13dd..2005b997a 100644 --- a/embassy-nrf-examples/src/bin/qspi.rs +++ b/embassy-nrf-examples/src/bin/qspi.rs | |||
| @@ -36,14 +36,7 @@ async fn run() { | |||
| 36 | let io2 = p.P0_22; | 36 | let io2 = p.P0_22; |
| 37 | let io3 = p.P0_23; | 37 | let io3 = p.P0_23; |
| 38 | 38 | ||
| 39 | let config = qspi::Config { | 39 | let config = qspi::Config::default(); |
| 40 | read_opcode: qspi::ReadOpcode::READ4IO, | ||
| 41 | write_opcode: qspi::WriteOpcode::PP4IO, | ||
| 42 | xip_offset: 0, | ||
| 43 | write_page_size: qspi::WritePageSize::_256BYTES, | ||
| 44 | deep_power_down: None, | ||
| 45 | }; | ||
| 46 | |||
| 47 | let irq = interrupt::take!(QSPI); | 40 | let irq = interrupt::take!(QSPI); |
| 48 | let q = qspi::Qspi::new(p.QSPI, irq, sck, csn, io0, io1, io2, io3, config); | 41 | let q = qspi::Qspi::new(p.QSPI, irq, sck, csn, io0, io1, io2, io3, config); |
| 49 | pin_mut!(q); | 42 | pin_mut!(q); |
diff --git a/embassy-nrf/src/qspi.rs b/embassy-nrf/src/qspi.rs index e05186ab5..033c9e012 100644 --- a/embassy-nrf/src/qspi.rs +++ b/embassy-nrf/src/qspi.rs | |||
| @@ -36,6 +36,7 @@ pub struct DeepPowerDownConfig { | |||
| 36 | pub exit_time: u16, | 36 | pub exit_time: u16, |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | #[non_exhaustive] | ||
| 39 | pub struct Config { | 40 | pub struct Config { |
| 40 | pub xip_offset: u32, | 41 | pub xip_offset: u32, |
| 41 | pub read_opcode: ReadOpcode, | 42 | pub read_opcode: ReadOpcode, |
| @@ -44,6 +45,18 @@ pub struct Config { | |||
| 44 | pub deep_power_down: Option<DeepPowerDownConfig>, | 45 | pub deep_power_down: Option<DeepPowerDownConfig>, |
| 45 | } | 46 | } |
| 46 | 47 | ||
| 48 | impl Default for Config { | ||
| 49 | fn default() -> Self { | ||
| 50 | Self { | ||
| 51 | read_opcode: ReadOpcode::READ4IO, | ||
| 52 | write_opcode: WriteOpcode::PP4IO, | ||
| 53 | xip_offset: 0, | ||
| 54 | write_page_size: WritePageSize::_256BYTES, | ||
| 55 | deep_power_down: None, | ||
| 56 | } | ||
| 57 | } | ||
| 58 | } | ||
| 59 | |||
| 47 | pub struct Qspi<'d, T: Instance> { | 60 | pub struct Qspi<'d, T: Instance> { |
| 48 | peri: T, | 61 | peri: T, |
| 49 | irq: T::Interrupt, | 62 | irq: T::Interrupt, |
