Struct SpiDmaBus

Source
pub struct SpiDmaBus<'d, Dm>
where Dm: DriverMode,
{ /* private fields */ }
Available on crate feature unstable only.
Expand description

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time. A DMA-capable SPI bus.

This structure is responsible for managing SPI transfers using DMA buffers.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Implementations§

Source§

impl SpiDmaBus<'_, Async>

Source

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

Fill the given buffer with data from the bus.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source

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

Transmit the given buffer to the bus.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source

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

Transfer by writing out a buffer and reading the response from the bus into another buffer.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source

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

Transfer by writing out a buffer and reading the response from the bus into the same buffer.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source§

impl<'d> SpiDmaBus<'d, Blocking>

Source

pub fn into_async(self) -> SpiDmaBus<'d, Async>

Converts the SPI instance into async mode.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source§

impl<'d> SpiDmaBus<'d, Async>

Source

pub fn into_blocking(self) -> SpiDmaBus<'d, Blocking>

Converts the SPI instance into async mode.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source§

impl<'d, Dm> SpiDmaBus<'d, Dm>
where Dm: DriverMode,

Source

pub fn new(spi_dma: SpiDma<'d, Dm>, rx_buf: DmaRxBuf, tx_buf: DmaTxBuf) -> Self

Creates a new SpiDmaBus with the specified SPI instance and DMA buffers.

Source

pub fn split(self) -> (SpiDma<'d, Dm>, DmaRxBuf, DmaTxBuf)

Splits SpiDmaBus back into SpiDma, DmaRxBuf and DmaTxBuf.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source§

impl SpiDmaBus<'_, Blocking>

Source

pub fn listen(&mut self, interrupts: impl Into<EnumSet<SpiInterrupt>>)

Listen for the given interrupts

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source

pub fn unlisten(&mut self, interrupts: impl Into<EnumSet<SpiInterrupt>>)

Unlisten the given interrupts

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source

pub fn interrupts(&mut self) -> EnumSet<SpiInterrupt>

Gets asserted interrupts

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source

pub fn clear_interrupts(&mut self, interrupts: impl Into<EnumSet<SpiInterrupt>>)

Resets asserted interrupts

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source§

impl<Dm> SpiDmaBus<'_, Dm>
where Dm: DriverMode,

Source

pub fn apply_config(&mut self, config: &Config) -> Result<(), ConfigError>

Change the bus configuration.

§Errors

If frequency passed in config exceeds 80MHz or is below 70kHz, ConfigError::UnsupportedFrequency error will be returned.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source

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

Reads data from the SPI bus using DMA.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source

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

Writes data to the SPI bus using DMA.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source

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

Transfers data to and from the SPI bus simultaneously using DMA.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source

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

Transfers data in place on the SPI bus using DMA.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source

pub fn half_duplex_read( &mut self, data_mode: DataMode, cmd: Command, address: Address, dummy: u8, buffer: &mut [u8], ) -> Result<(), Error>

Half-duplex read.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source

pub fn half_duplex_write( &mut self, data_mode: DataMode, cmd: Command, address: Address, dummy: u8, buffer: &[u8], ) -> Result<(), Error>

Half-duplex write.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Trait Implementations§

Source§

impl<'d, Dm> Debug for SpiDmaBus<'d, Dm>
where Dm: DriverMode + Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<Dm> ErrorType for SpiDmaBus<'_, Dm>
where Dm: DriverMode,

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source§

type Error = Error

Error type.
Source§

impl<'d, Dm> Format for SpiDmaBus<'d, Dm>

Source§

fn format(&self, f: Formatter<'_>)

Writes the defmt representation of self to fmt.
Source§

impl InterruptConfigurable for SpiDmaBus<'_, Blocking>

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source§

fn set_interrupt_handler(&mut self, handler: InterruptHandler)

Sets the interrupt handler

Interrupts are not enabled at the peripheral level here.

Source§

impl<Dm> SetConfig for SpiDmaBus<'_, Dm>
where Dm: DriverMode,

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source§

type Config = Config

The configuration type used by this driver.
Source§

type ConfigError = ConfigError

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 SpiBus for SpiDmaBus<'_, Async>

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source§

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

Read words from the slave. 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 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§

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

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

impl<Dm> SpiBus for SpiDmaBus<'_, Dm>
where Dm: DriverMode,

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

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§

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

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

Auto Trait Implementations§

§

impl<'d, Dm> Freeze for SpiDmaBus<'d, Dm>

§

impl<'d, Dm> RefUnwindSafe for SpiDmaBus<'d, Dm>
where Dm: RefUnwindSafe,

§

impl<'d, Dm> Send for SpiDmaBus<'d, Dm>
where Dm: Send,

§

impl<'d, Dm> !Sync for SpiDmaBus<'d, Dm>

§

impl<'d, Dm> Unpin for SpiDmaBus<'d, Dm>
where Dm: Unpin,

§

impl<'d, Dm> !UnwindSafe for SpiDmaBus<'d, Dm>

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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.
§

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

Performs the conversion.