pub struct SpiDmaBus<'d, Dm>where
Dm: DriverMode,{ /* private fields */ }
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>
impl SpiDmaBus<'_, Async>
Sourcepub async fn read_async(&mut self, words: &mut [u8]) -> Result<(), Error>
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.
Sourcepub async fn write_async(&mut self, words: &[u8]) -> Result<(), Error>
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.
Sourcepub async fn transfer_async(
&mut self,
read: &mut [u8],
write: &[u8],
) -> Result<(), Error>
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.
Sourcepub async fn transfer_in_place_async(
&mut self,
words: &mut [u8],
) -> Result<(), Error>
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>
impl<'d> SpiDmaBus<'d, Blocking>
Sourcepub fn into_async(self) -> SpiDmaBus<'d, Async>
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>
impl<'d> SpiDmaBus<'d, Async>
Sourcepub fn into_blocking(self) -> SpiDmaBus<'d, Blocking>
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,
impl<'d, Dm> SpiDmaBus<'d, Dm>where
Dm: DriverMode,
Source§impl SpiDmaBus<'_, Blocking>
impl SpiDmaBus<'_, Blocking>
Sourcepub fn listen(&mut self, interrupts: impl Into<EnumSet<SpiInterrupt>>)
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.
Sourcepub fn unlisten(&mut self, interrupts: impl Into<EnumSet<SpiInterrupt>>)
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.
Sourcepub fn interrupts(&mut self) -> EnumSet<SpiInterrupt>
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.
Sourcepub fn clear_interrupts(&mut self, interrupts: impl Into<EnumSet<SpiInterrupt>>)
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,
impl<Dm> SpiDmaBus<'_, Dm>where
Dm: DriverMode,
Sourcepub fn apply_config(&mut self, config: &Config) -> Result<(), ConfigError>
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.
Sourcepub fn read(&mut self, words: &mut [u8]) -> Result<(), Error>
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.
Sourcepub fn write(&mut self, words: &[u8]) -> Result<(), Error>
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.
Sourcepub fn transfer(&mut self, read: &mut [u8], write: &[u8]) -> Result<(), Error>
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.
Sourcepub fn transfer_in_place(&mut self, words: &mut [u8]) -> Result<(), Error>
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.
Sourcepub fn half_duplex_read(
&mut self,
data_mode: DataMode,
cmd: Command,
address: Address,
dummy: u8,
buffer: &mut [u8],
) -> Result<(), Error>
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.
Sourcepub fn half_duplex_write(
&mut self,
data_mode: DataMode,
cmd: Command,
address: Address,
dummy: u8,
buffer: &[u8],
) -> Result<(), Error>
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,
impl<'d, Dm> Debug for SpiDmaBus<'d, Dm>where
Dm: DriverMode + Debug,
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.
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§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.
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)
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.
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 ConfigError = ConfigError
type ConfigError = ConfigError
set_config
fails.Source§fn set_config(&mut self, config: &Self::Config) -> Result<(), Self::ConfigError>
fn set_config(&mut self, config: &Self::Config) -> Result<(), Self::ConfigError>
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.
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>
async fn read(&mut self, words: &mut [u8]) -> Result<(), Self::Error>
words
from the slave. Read moreSource§async fn write(&mut self, words: &[u8]) -> Result<(), Self::Error>
async fn write(&mut self, words: &[u8]) -> Result<(), Self::Error>
words
to the slave, ignoring all the incoming words. Read moreSource§async fn transfer(
&mut self,
read: &mut [u8],
write: &[u8],
) -> Result<(), Self::Error>
async fn transfer( &mut self, read: &mut [u8], write: &[u8], ) -> Result<(), Self::Error>
write
is written to the slave on MOSI and
words received on MISO are stored in read
. Read moreSource§async fn transfer_in_place(
&mut self,
words: &mut [u8],
) -> Result<(), Self::Error>
async fn transfer_in_place( &mut self, words: &mut [u8], ) -> Result<(), Self::Error>
words
are
written to the slave, and the received words are stored into the same
words
buffer, overwriting it. Read moreSource§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.
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>
fn read(&mut self, words: &mut [u8]) -> Result<(), Self::Error>
words
from the slave. Read moreSource§fn write(&mut self, words: &[u8]) -> Result<(), Self::Error>
fn write(&mut self, words: &[u8]) -> Result<(), Self::Error>
words
to the slave, ignoring all the incoming words. Read moreSource§fn transfer(&mut self, read: &mut [u8], write: &[u8]) -> Result<(), Self::Error>
fn transfer(&mut self, read: &mut [u8], write: &[u8]) -> Result<(), Self::Error>
write
is written to the slave on MOSI and
words received on MISO are stored in read
. Read moreSource§fn transfer_in_place(&mut self, words: &mut [u8]) -> Result<(), Self::Error>
fn transfer_in_place(&mut self, words: &mut [u8]) -> Result<(), Self::Error>
words
are
written to the slave, and the received words are stored into the same
words
buffer, overwriting it. Read more