embassy-mcxa

Crates

git

Versions

mcx-a256

Flavors

Spi

Struct Spi 

Source
pub struct Spi<'d, M: IoMode> { /* private fields */ }
Expand description

Spi driver.

Implementations§

Source§

impl<'d, M: IoMode> Spi<'d, M>

Source

pub fn blocking_read(&mut self, data: &mut [u8]) -> Result<(), IoError>

Read data from Spi blocking execution until done.

Source

pub fn blocking_write(&mut self, data: &[u8]) -> Result<(), IoError>

Write data to Spi blocking execution until done.

Source

pub fn blocking_transfer( &mut self, read: &mut [u8], write: &[u8], ) -> Result<(), IoError>

Transfer data to SPI blocking execution until done.

Source

pub fn blocking_transfer_in_place( &mut self, data: &mut [u8], ) -> Result<(), IoError>

Transfer data in place to SPI blocking execution until done.

Source

pub fn blocking_flush(&mut self) -> Result<(), IoError>

Block execution until Spi is done.

Source§

impl<'d> Spi<'d, Blocking>

Source

pub fn new_blocking<T: Instance>( _peri: Peri<'d, T>, sck: Peri<'d, impl SckPin<T> + 'd>, mosi: Peri<'d, impl MosiPin<T> + 'd>, miso: Peri<'d, impl MisoPin<T> + 'd>, config: Config, ) -> Result<Self, SetupError>

Create a SPI driver in blocking mode.

Source

pub fn new_blocking_txonly<T: Instance>( _peri: Peri<'d, T>, sck: Peri<'d, impl SckPin<T> + 'd>, mosi: Peri<'d, impl MosiPin<T> + 'd>, config: Config, ) -> Result<Self, SetupError>

Create a TX-only SPI driver in blocking mode.

Source

pub fn new_blocking_rxonly<T: Instance>( _peri: Peri<'d, T>, sck: Peri<'d, impl SckPin<T> + 'd>, miso: Peri<'d, impl MisoPin<T> + 'd>, config: Config, ) -> Result<Self, SetupError>

Create an RX-only SPI driver in blocking mode.

Source§

impl<'d> Spi<'d, Async>

Source

pub fn new_async<T: Instance>( _peri: Peri<'d, T>, sck: Peri<'d, impl SckPin<T> + 'd>, mosi: Peri<'d, impl MosiPin<T> + 'd>, miso: Peri<'d, impl MisoPin<T> + 'd>, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd, config: Config, ) -> Result<Self, SetupError>

Create a SPI driver in async mode.

Source

pub fn new_async_txonly<T: Instance>( _peri: Peri<'d, T>, sck: Peri<'d, impl SckPin<T> + 'd>, mosi: Peri<'d, impl MosiPin<T> + 'd>, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd, config: Config, ) -> Result<Self, SetupError>

Create a TX-only SPI driver in async mode.

Source

pub fn new_async_rxonly<T: Instance>( _peri: Peri<'d, T>, sck: Peri<'d, impl SckPin<T> + 'd>, miso: Peri<'d, impl MisoPin<T> + 'd>, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd, config: Config, ) -> Result<Self, SetupError>

Create an RX-only SPI driver in async mode.

Source§

impl<'d> Spi<'d, Dma<'d>>

Source

pub fn new_async_with_dma<T: Instance>( _peri: Peri<'d, T>, sck: Peri<'d, impl SckPin<T> + 'd>, mosi: Peri<'d, impl MosiPin<T> + 'd>, miso: Peri<'d, impl MisoPin<T> + 'd>, tx_dma: Peri<'d, impl TxDma<T>>, rx_dma: Peri<'d, impl RxDma<T>>, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd, config: Config, ) -> Result<Self, SetupError>

Create a SPI driver in async mode.

Source§

impl<'d, M: AsyncMode> Spi<'d, M>
where Self: AsyncEngine,

Source

pub fn async_read( &mut self, data: &mut [u8], ) -> impl Future<Output = Result<(), IoError>>

Read data from Spi async execution until done.

Source

pub fn async_write( &mut self, data: &[u8], ) -> impl Future<Output = Result<(), IoError>>

Write data to Spi async execution until done.

Source

pub fn async_transfer( &mut self, read: &mut [u8], write: &[u8], ) -> impl Future<Output = Result<(), IoError>>

Transfer data to SPI async execution until done.

Source

pub fn async_transfer_in_place( &mut self, data: &mut [u8], ) -> impl Future<Output = Result<(), IoError>>

Transfer data in place to SPI async execution until done.

Source

pub async fn async_flush(&mut self) -> Result<(), IoError>

Async flush.

Trait Implementations§

Source§

impl<'d, M: IoMode> ErrorType for Spi<'d, M>

Source§

type Error = IoError

Error type.
Source§

impl<'d, M: IoMode> SetConfig for Spi<'d, M>

Source§

type Config = Config

The configuration type used by this driver.
Source§

type ConfigError = SetupError

The error type that can occur if set_config fails.
Source§

fn set_config(&mut self, config: &Self::Config) -> Result<(), Self::ConfigError>

Set the configuration of the driver.
Source§

impl<'d, M: IoMode> SpiBus for Spi<'d, M>

Source§

fn flush(&mut self) -> Result<(), Self::Error>

Wait until all operations have completed and the bus is idle. Read more
Source§

fn read(&mut self, words: &mut [u8]) -> Result<(), Self::Error>

Read words from the slave. Read more
Source§

fn write(&mut self, words: &[u8]) -> Result<(), Self::Error>

Write words to the slave, ignoring all the incoming words. Read more
Source§

fn transfer(&mut self, read: &mut [u8], write: &[u8]) -> Result<(), Self::Error>

Write and read simultaneously. write is written to the slave on MOSI and words received on MISO are stored in read. Read more
Source§

fn transfer_in_place(&mut self, words: &mut [u8]) -> Result<(), Self::Error>

Write and read simultaneously. The contents of words are written to the slave, and the received words are stored into the same words buffer, overwriting it. Read more
Source§

impl<'d, M: AsyncMode> SpiBus for Spi<'d, M>
where Spi<'d, M>: AsyncEngine,

Source§

async fn flush(&mut self) -> Result<(), Self::Error>

Wait until all operations have completed and the bus is idle. Read more
Source§

async fn write(&mut self, words: &[u8]) -> Result<(), Self::Error>

Write words to the slave, ignoring all the incoming words. Read more
Source§

async fn read(&mut self, words: &mut [u8]) -> Result<(), Self::Error>

Read words from the slave. Read more
Source§

async fn transfer( &mut self, read: &mut [u8], write: &[u8], ) -> Result<(), Self::Error>

Write and read simultaneously. write is written to the slave on MOSI and words received on MISO are stored in read. Read more
Source§

async fn transfer_in_place( &mut self, words: &mut [u8], ) -> Result<(), Self::Error>

Write and read simultaneously. The contents of words are written to the slave, and the received words are stored into the same words buffer, overwriting it. Read more
Source§

impl<'d, M: IoMode> Transfer<u8> for Spi<'d, M>

Source§

type Error = IoError

Error type
Source§

fn transfer<'w>(&mut self, words: &'w mut [u8]) -> Result<&'w [u8], Self::Error>

Sends words to the slave. Returns the words received from the slave
Source§

impl<'d, M: IoMode> Write<u8> for Spi<'d, M>

Source§

type Error = IoError

Error type
Source§

fn write(&mut self, words: &[u8]) -> Result<(), Self::Error>

Sends words to the slave, ignoring all the incoming words

Auto Trait Implementations§

§

impl<'d, M> Freeze for Spi<'d, M>
where M: Freeze,

§

impl<'d, M> !RefUnwindSafe for Spi<'d, M>

§

impl<'d, M> Send for Spi<'d, M>
where M: Send + Sync,

§

impl<'d, M> Sync for Spi<'d, M>
where M: Sync,

§

impl<'d, M> Unpin for Spi<'d, M>
where M: Unpin,

§

impl<'d, M> !UnwindSafe for Spi<'d, M>

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.