Struct itsybitsy_m4::Qspi

source ·
pub struct Qspi<MODE> { /* private fields */ }

Implementations§

source§

impl Qspi<OneShot>

source

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.

source

pub fn run_command(&self, command: Command) -> Result<(), Error>

Run a generic command that neither takes nor receives data

source

pub fn read_command( &self, command: Command, response: &mut [u8] ) -> Result<(), Error>

Run one of the read commands

source

pub fn write_command(&self, command: Command, data: &[u8]) -> Result<(), Error>

Run one of the write commands

source

pub fn erase_command(&self, command: Command, address: u32) -> Result<(), Error>

Run one of the erase commands

source

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

source

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.

source

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.

source§

impl Qspi<XIP>

Operations available in XIP mode

source

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>

source

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

Auto Trait Implementations§

§

impl<MODE> Freeze for Qspi<MODE>

§

impl<MODE> RefUnwindSafe for Qspi<MODE>
where MODE: RefUnwindSafe,

§

impl<MODE> Send for Qspi<MODE>
where MODE: Send,

§

impl<MODE> !Sync for Qspi<MODE>

§

impl<MODE> Unpin for Qspi<MODE>
where MODE: Unpin,

§

impl<MODE> UnwindSafe for Qspi<MODE>
where MODE: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.