pub struct AsyncSpi { /* private fields */ }Expand description
Async SPI bus master.
Implementations§
Source§impl AsyncSpi
impl AsyncSpi
Sourcepub const unsafe fn from_handle(handle: ove_spi_t) -> Self
pub const unsafe fn from_handle(handle: ove_spi_t) -> Self
Wrap an existing ove_spi_t handle for async use.
§Safety
handle must be a valid SPI handle. The caller must not use the
same handle through a sync crate::spi::Spi wrapper while async
transfers are in flight.
Sourcepub async fn transfer<'a>(
&'a self,
cs: Option<&'a ove_spi_cs>,
tx: &'a [u8],
rx: &'a mut [u8],
) -> Result<()>
pub async fn transfer<'a>( &'a self, cs: Option<&'a ove_spi_cs>, tx: &'a [u8], rx: &'a mut [u8], ) -> Result<()>
Submit an async full-duplex transfer.
tx and rx lengths must match the actual transfer size. The
future is 'a-bound to the buffers so they can’t be dropped
while in flight.
Trait Implementations§
Source§impl SpiBus for AsyncSpi
impl SpiBus for AsyncSpi
Source§async fn read(&mut self, words: &mut [u8]) -> Result<(), Self::Error>
async fn read(&mut self, words: &mut [u8]) -> Result<(), Self::Error>
Read
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>
Write
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 and read simultaneously.
write is written to the slave on MOSI and
words received on MISO are stored in read. Read moreimpl Send for AsyncSpi
impl Sync for AsyncSpi
Auto Trait Implementations§
impl !Freeze for AsyncSpi
impl !RefUnwindSafe for AsyncSpi
impl Unpin for AsyncSpi
impl UnsafeUnpin for AsyncSpi
impl UnwindSafe for AsyncSpi
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more