Struct esp_idf_svc::hal::spi::SpiDeviceDriver
source · pub struct SpiDeviceDriver<'d, T>where
T: Borrow<SpiDriver<'d>> + 'd,{ /* private fields */ }
Implementations§
source§impl<'d> SpiDeviceDriver<'d, SpiDriver<'d>>
impl<'d> SpiDeviceDriver<'d, SpiDriver<'d>>
pub fn new_single<SPI>(
spi: impl Peripheral<P = SPI> + 'd,
sclk: impl Peripheral<P = impl OutputPin> + 'd,
sdo: impl Peripheral<P = impl OutputPin> + 'd,
sdi: Option<impl Peripheral<P = impl InputPin> + 'd>,
cs: Option<impl Peripheral<P = impl OutputPin> + 'd>,
bus_config: &DriverConfig,
config: &Config,
) -> Result<SpiDeviceDriver<'d, SpiDriver<'d>>, EspError>where
SPI: SpiAnyPins,
source§impl<'d, T> SpiDeviceDriver<'d, T>where
T: Borrow<SpiDriver<'d>> + 'd,
impl<'d, T> SpiDeviceDriver<'d, T>where
T: Borrow<SpiDriver<'d>> + 'd,
pub fn new( driver: T, cs: Option<impl Peripheral<P = impl OutputPin> + 'd>, config: &Config, ) -> Result<SpiDeviceDriver<'d, T>, EspError>
pub fn device(&self) -> *mut spi_device_t
pub fn transaction( &mut self, operations: &mut [Operation<'_, u8>], ) -> Result<(), EspError>
pub fn read(&mut self, read: &mut [u8]) -> Result<(), EspError>
pub fn write(&mut self, write: &[u8]) -> Result<(), EspError>
pub fn transfer_in_place(&mut self, buf: &mut [u8]) -> Result<(), EspError>
pub fn transfer( &mut self, read: &mut [u8], write: &[u8], ) -> Result<(), EspError>
Trait Implementations§
source§impl<'d, T> Drop for SpiDeviceDriver<'d, T>where
T: Borrow<SpiDriver<'d>> + 'd,
impl<'d, T> Drop for SpiDeviceDriver<'d, T>where
T: Borrow<SpiDriver<'d>> + 'd,
source§impl<'d, T> ErrorType for SpiDeviceDriver<'d, T>where
T: Borrow<SpiDriver<'d>> + 'd,
impl<'d, T> ErrorType for SpiDeviceDriver<'d, T>where
T: Borrow<SpiDriver<'d>> + 'd,
source§impl<'d, T> SpiDevice for SpiDeviceDriver<'d, T>where
T: Borrow<SpiDriver<'d>> + 'd,
impl<'d, T> SpiDevice for SpiDeviceDriver<'d, T>where
T: Borrow<SpiDriver<'d>> + 'd,
source§fn read(
&mut self,
buf: &mut [u8],
) -> Result<(), <SpiDeviceDriver<'d, T> as ErrorType>::Error>
fn read( &mut self, buf: &mut [u8], ) -> Result<(), <SpiDeviceDriver<'d, T> as ErrorType>::Error>
Do a read within a transaction. Read more
source§fn write(
&mut self,
buf: &[u8],
) -> Result<(), <SpiDeviceDriver<'d, T> as ErrorType>::Error>
fn write( &mut self, buf: &[u8], ) -> Result<(), <SpiDeviceDriver<'d, T> as ErrorType>::Error>
Do a write within a transaction. Read more
source§fn transaction(
&mut self,
operations: &mut [Operation<'_, u8>],
) -> Result<(), <SpiDeviceDriver<'d, T> as ErrorType>::Error>
fn transaction( &mut self, operations: &mut [Operation<'_, u8>], ) -> Result<(), <SpiDeviceDriver<'d, T> as ErrorType>::Error>
Perform a transaction against the device. Read more
source§fn transfer(
&mut self,
read: &mut [Word],
write: &[Word],
) -> Result<(), Self::Error>
fn transfer( &mut self, read: &mut [Word], write: &[Word], ) -> Result<(), Self::Error>
Do a transfer within a transaction. Read more
source§fn transfer_in_place(&mut self, buf: &mut [Word]) -> Result<(), Self::Error>
fn transfer_in_place(&mut self, buf: &mut [Word]) -> Result<(), Self::Error>
Do an in-place transfer within a transaction. Read more
source§impl<'d, T> Transactional<u8> for SpiDeviceDriver<'d, T>where
T: Borrow<SpiDriver<'d>> + 'd,
impl<'d, T> Transactional<u8> for SpiDeviceDriver<'d, T>where
T: Borrow<SpiDriver<'d>> + 'd,
source§fn exec(
&mut self,
operations: &mut [Operation<'_, u8>],
) -> Result<(), <SpiDeviceDriver<'d, T> as Transactional<u8>>::Error>
fn exec( &mut self, operations: &mut [Operation<'_, u8>], ) -> Result<(), <SpiDeviceDriver<'d, T> as Transactional<u8>>::Error>
Execute the provided transactions
source§impl<'d, T> Transfer<u8> for SpiDeviceDriver<'d, T>where
T: Borrow<SpiDriver<'d>> + 'd,
impl<'d, T> Transfer<u8> for SpiDeviceDriver<'d, T>where
T: Borrow<SpiDriver<'d>> + 'd,
source§impl<'d, T> Write<u8> for SpiDeviceDriver<'d, T>where
T: Borrow<SpiDriver<'d>> + 'd,
impl<'d, T> Write<u8> for SpiDeviceDriver<'d, T>where
T: Borrow<SpiDriver<'d>> + 'd,
source§impl<'d, T> WriteIter<u8> for SpiDeviceDriver<'d, T>where
T: Borrow<SpiDriver<'d>> + 'd,
impl<'d, T> WriteIter<u8> for SpiDeviceDriver<'d, T>where
T: Borrow<SpiDriver<'d>> + 'd,
All data is chunked into max(iter.len(), 64)
source§fn write_iter<WI>(
&mut self,
words: WI,
) -> Result<(), <SpiDeviceDriver<'d, T> as WriteIter<u8>>::Error>where
WI: IntoIterator<Item = u8>,
fn write_iter<WI>(
&mut self,
words: WI,
) -> Result<(), <SpiDeviceDriver<'d, T> as WriteIter<u8>>::Error>where
WI: IntoIterator<Item = u8>,
Sends
words
to the slave, ignoring all the incoming words