nrf/qpsi: make config non_exhaustive

This commit is contained in:
Dario Nieuwenhuis 2021-03-29 00:55:05 +02:00
parent b9e709403d
commit 5b74e326e5
2 changed files with 14 additions and 8 deletions

View file

@ -36,14 +36,7 @@ async fn run() {
let io2 = p.P0_22;
let io3 = p.P0_23;
let config = qspi::Config {
read_opcode: qspi::ReadOpcode::READ4IO,
write_opcode: qspi::WriteOpcode::PP4IO,
xip_offset: 0,
write_page_size: qspi::WritePageSize::_256BYTES,
deep_power_down: None,
};
let config = qspi::Config::default();
let irq = interrupt::take!(QSPI);
let q = qspi::Qspi::new(p.QSPI, irq, sck, csn, io0, io1, io2, io3, config);
pin_mut!(q);

View file

@ -36,6 +36,7 @@ pub struct DeepPowerDownConfig {
pub exit_time: u16,
}
#[non_exhaustive]
pub struct Config {
pub xip_offset: u32,
pub read_opcode: ReadOpcode,
@ -44,6 +45,18 @@ pub struct Config {
pub deep_power_down: Option<DeepPowerDownConfig>,
}
impl Default for Config {
fn default() -> Self {
Self {
read_opcode: ReadOpcode::READ4IO,
write_opcode: WriteOpcode::PP4IO,
xip_offset: 0,
write_page_size: WritePageSize::_256BYTES,
deep_power_down: None,
}
}
}
pub struct Qspi<'d, T: Instance> {
peri: T,
irq: T::Interrupt,