Struct atsamd_hal::qspi::Qspi
source · [−]pub struct Qspi<MODE> { /* private fields */ }
Implementations
sourceimpl Qspi<OneShot>
impl Qspi<OneShot>
sourcepub fn new(
mclk: &mut MCLK,
qspi: QSPI,
_sck: impl AnyPin<Id = PB10>,
_cs: impl AnyPin<Id = PB11>,
_io0: impl AnyPin<Id = PA08>,
_io1: impl AnyPin<Id = PA09>,
_io2: impl AnyPin<Id = PA10>,
_io3: impl AnyPin<Id = PA11>
) -> Qspi<OneShot>
pub fn new(
mclk: &mut MCLK,
qspi: QSPI,
_sck: impl AnyPin<Id = PB10>,
_cs: impl AnyPin<Id = PB11>,
_io0: impl AnyPin<Id = PA08>,
_io1: impl AnyPin<Id = PA09>,
_io2: impl AnyPin<Id = PA10>,
_io3: impl AnyPin<Id = PA11>
) -> Qspi<OneShot>
Enable the clocks for the qspi peripheral in single data rate mode assuming 120mhz system clock, for 4mhz spi mode 0 operation.
sourcepub fn run_command(&self, command: Command) -> Result<(), Error>
pub fn run_command(&self, command: Command) -> Result<(), Error>
Run a generic command that neither takes nor receives data
sourcepub fn read_command(
&self,
command: Command,
response: &mut [u8]
) -> Result<(), Error>
pub fn read_command(
&self,
command: Command,
response: &mut [u8]
) -> Result<(), Error>
Run one of the read commands
sourcepub fn write_command(&self, command: Command, data: &[u8]) -> Result<(), Error>
pub fn write_command(&self, command: Command, data: &[u8]) -> Result<(), Error>
Run one of the write commands
sourcepub fn erase_command(&self, command: Command, address: u32) -> Result<(), Error>
pub fn erase_command(&self, command: Command, address: u32) -> Result<(), Error>
Run one of the erase commands
sourcepub fn read_memory(&mut self, addr: u32, buf: &mut [u8])
pub fn read_memory(&mut self, addr: u32, buf: &mut [u8])
Quad Fast Read a sequential block of memory to buf Note: Hardcodes 8 dummy cycles
sourcepub fn write_memory(&mut self, addr: u32, buf: &[u8])
pub fn write_memory(&mut self, addr: u32, buf: &[u8])
Page Program a sequential block of memory to addr.
Note more than page size bytes are sent to the device, some bytes will be discarded. Check your device for specific handling.
sourceimpl Qspi<XIP>
impl Qspi<XIP>
Operations available in XIP mode
sourcepub fn into_oneshot(self) -> Qspi<OneShot>
pub fn into_oneshot(self) -> Qspi<OneShot>
Latches the peripheral in a read/execute state, so it can be used to read or execute directly from flash.
sourceimpl<MODE> Qspi<MODE>
impl<MODE> Qspi<MODE>
sourcepub fn set_clk_divider(&mut self, value: u8)
pub fn set_clk_divider(&mut self, value: u8)
Set the clock divider, relative to the main clock
This fn safely subtracts 1 from your input value as the underlying fn is SCK Baud = MCKL / (value + 1)
ex if MCLK is 120mhz value 0 is reduced to 0 results in 120mhz clock value 1 is reduced to 0 results in 120mhz clock value 2 is reduced to 1 results in 60mhz clock