pub struct Qspi<MODE> { /* private fields */ }
Implementations§
Source§impl 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.
Sourcepub fn into_xip(self) -> Qspi<XIP>
pub fn into_xip(self) -> Qspi<XIP>
Latches the peripheral in a read/execute state, so it can be used to read or execute directly from flash.
Note: Hardcodes 8 dummy cycles.
Sourcepub fn free(
self,
) -> (Qspi, Pin<PB10, AlternateH>, Pin<PB11, AlternateH>, Pin<PA08, AlternateH>, Pin<PA09, AlternateH>, Pin<PA10, AlternateH>, Pin<PA11, AlternateH>)
pub fn free( self, ) -> (Qspi, Pin<PB10, AlternateH>, Pin<PB11, AlternateH>, Pin<PA08, AlternateH>, Pin<PA09, AlternateH>, Pin<PA10, AlternateH>, Pin<PA11, AlternateH>)
Return the consumed pins and the Qspi peripheral
Order: (qspi, sck, cs, io0, io1, io2, io3)
Source§impl Qspi<XIP>
Operations available in XIP mode
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.
Source§impl<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