Struct esp_idf_hal::spi::SpiDeviceDriver
source · pub struct SpiDeviceDriver<'d, T> { /* private fields */ }
Implementations§
source§impl<'d> SpiDeviceDriver<'d, SpiDriver<'d>>
impl<'d> SpiDeviceDriver<'d, SpiDriver<'d>>
pub fn new_single<SPI: SpiAnyPins>(
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 + OutputPin> + 'd>,
dma: Dma,
cs: Option<impl Peripheral<P = impl OutputPin> + 'd>,
config: &Config
) -> Result<Self, EspError>
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<Self, EspError>
pub fn device(&self) -> spi_device_handle_t
pub fn transaction<R, E>(
&mut self,
f: impl FnOnce(&mut SpiBusDriver<'d>) -> Result<R, E>
) -> Result<R, E>where
E: From<EspError>,
pub fn transfer(&mut self, read: &mut [u8], write: &[u8]) -> Result<(), EspError>
pub fn write(&mut self, write: &[u8]) -> Result<(), EspError>
pub fn read(&mut self, read: &mut [u8]) -> Result<(), EspError>
pub fn transfer_in_place(&mut self, buf: &mut [u8]) -> Result<(), EspError>
Trait Implementations§
source§impl<'d, T> Drop for SpiDeviceDriver<'d, T>
impl<'d, T> Drop for SpiDeviceDriver<'d, T>
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,
§type Bus = SpiBusDriver<'d>
type Bus = SpiBusDriver<'d>
SPI Bus type for this device.
source§fn transaction<R>(
&mut self,
f: impl FnOnce(&mut Self::Bus) -> Result<R, <Self::Bus as ErrorType>::Error>
) -> Result<R, Self::Error>
fn transaction<R>(
&mut self,
f: impl FnOnce(&mut Self::Bus) -> Result<R, <Self::Bus as ErrorType>::Error>
) -> Result<R, Self::Error>
Perform a transaction against the device. Read more
source§fn write<Word>(&mut self, buf: &[Word]) -> Result<(), Self::Error>where
Self::Bus: SpiBusWrite<Word>,
Word: Copy,
fn write<Word>(&mut self, buf: &[Word]) -> Result<(), Self::Error>where
Self::Bus: SpiBusWrite<Word>,
Word: Copy,
Do a write within a transaction. Read more
source§fn read<Word>(&mut self, buf: &mut [Word]) -> Result<(), Self::Error>where
Self::Bus: SpiBusRead<Word>,
Word: Copy,
fn read<Word>(&mut self, buf: &mut [Word]) -> Result<(), Self::Error>where
Self::Bus: SpiBusRead<Word>,
Word: Copy,
Do a read 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§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,
impl<'d, T> Send for SpiDeviceDriver<'d, T>where
T: Send,
Auto Trait Implementations§
impl<'d, T> RefUnwindSafe for SpiDeviceDriver<'d, T>where
T: RefUnwindSafe,
impl<'d, T> !Sync for SpiDeviceDriver<'d, T>
impl<'d, T> Unpin for SpiDeviceDriver<'d, T>where
T: Unpin,
impl<'d, T> UnwindSafe for SpiDeviceDriver<'d, T>where
T: UnwindSafe,
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more