pub struct SpiBusDriver<'d, T>where
T: BorrowMut<SpiDriver<'d>>,{ /* private fields */ }
Implementations§
Source§impl<'d, T> SpiBusDriver<'d, T>where
T: BorrowMut<SpiDriver<'d>>,
impl<'d, T> SpiBusDriver<'d, T>where
T: BorrowMut<SpiDriver<'d>>,
pub fn new(driver: T, config: &Config) -> Result<Self, EspError>
pub fn read(&mut self, words: &mut [u8]) -> Result<(), EspError>
pub async fn read_async(&mut self, words: &mut [u8]) -> Result<(), EspError>
pub fn write(&mut self, words: &[u8]) -> Result<(), EspError>
pub async fn write_async(&mut self, words: &[u8]) -> Result<(), EspError>
pub fn transfer( &mut self, read: &mut [u8], write: &[u8], ) -> Result<(), EspError>
pub async fn transfer_async( &mut self, read: &mut [u8], write: &[u8], ) -> Result<(), EspError>
pub fn transfer_in_place(&mut self, words: &mut [u8]) -> Result<(), EspError>
pub async fn transfer_in_place_async( &mut self, words: &mut [u8], ) -> Result<(), EspError>
pub fn flush(&mut self) -> Result<(), EspError>
Sourcepub fn operation(&mut self, operation: Operation<'_>) -> Result<(), EspError>
pub fn operation(&mut self, operation: Operation<'_>) -> Result<(), EspError>
Run the provided Operation
on the bus.
Only Operations that result in a transfer are supported. For example,
passing an Operation::DelayNs
will return an error.
Sourcepub async fn operation_async(
&mut self,
operation: Operation<'_>,
) -> Result<(), EspError>
pub async fn operation_async( &mut self, operation: Operation<'_>, ) -> Result<(), EspError>
Run the provided Operation
on the bus.
Only Operations that result in a transfer are supported. For example,
passing an Operation::DelayNs
will return an error.
Trait Implementations§
Source§impl<'d, T> Drop for SpiBusDriver<'d, T>where
T: BorrowMut<SpiDriver<'d>>,
impl<'d, T> Drop for SpiBusDriver<'d, T>where
T: BorrowMut<SpiDriver<'d>>,
Source§impl<'d, T> ErrorType for SpiBusDriver<'d, T>where
T: BorrowMut<SpiDriver<'d>>,
impl<'d, T> ErrorType for SpiBusDriver<'d, T>where
T: BorrowMut<SpiDriver<'d>>,
Source§impl<'d, T> SpiBus for SpiBusDriver<'d, T>where
T: BorrowMut<SpiDriver<'d>>,
impl<'d, T> SpiBus for SpiBusDriver<'d, T>where
T: BorrowMut<SpiDriver<'d>>,
Source§fn read(&mut self, words: &mut [u8]) -> Result<(), Self::Error>
fn read(&mut self, words: &mut [u8]) -> Result<(), Self::Error>
Read
words
from the slave. Read moreSource§fn write(&mut self, words: &[u8]) -> Result<(), Self::Error>
fn write(&mut self, words: &[u8]) -> Result<(), Self::Error>
Write
words
to the slave, ignoring all the incoming words. Read moreSource§fn flush(&mut self) -> Result<(), Self::Error>
fn flush(&mut self) -> Result<(), Self::Error>
Wait until all operations have completed and the bus is idle. Read more
Source§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 and read simultaneously.
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>
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 moreSource§impl<'d, T> SpiBus for SpiBusDriver<'d, T>where
T: BorrowMut<SpiDriver<'d>>,
impl<'d, T> SpiBus for SpiBusDriver<'d, T>where
T: BorrowMut<SpiDriver<'d>>,
Source§async fn read(&mut self, buf: &mut [u8]) -> Result<(), Self::Error>
async fn read(&mut self, buf: &mut [u8]) -> Result<(), Self::Error>
Read
words
from the slave. Read moreSource§async fn write(&mut self, buf: &[u8]) -> Result<(), Self::Error>
async fn write(&mut self, buf: &[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 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>
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