Struct esp_idf_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>>

source

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> + 'd>, cs: Option<impl Peripheral<P = impl OutputPin> + 'd>, bus_config: &DriverConfig, config: &Config, ) -> Result<Self, EspError>

source§

impl<'d, T> SpiDeviceDriver<'d, T>
where T: Borrow<SpiDriver<'d>> + 'd,

source

pub fn new( driver: T, cs: Option<impl Peripheral<P = impl OutputPin> + 'd>, config: &Config, ) -> Result<Self, EspError>

source

pub fn device(&self) -> spi_device_handle_t

source

pub fn transaction( &mut self, operations: &mut [Operation<'_, u8>], ) -> Result<(), EspError>

source

pub async fn transaction_async( &mut self, operations: &mut [Operation<'_, u8>], ) -> Result<(), EspError>

source

pub fn read(&mut self, read: &mut [u8]) -> Result<(), EspError>

source

pub async fn read_async(&mut self, read: &mut [u8]) -> Result<(), EspError>

source

pub fn write(&mut self, write: &[u8]) -> Result<(), EspError>

source

pub async fn write_async(&mut self, write: &[u8]) -> Result<(), EspError>

source

pub fn transfer_in_place(&mut self, buf: &mut [u8]) -> Result<(), EspError>

source

pub async fn transfer_in_place_async( &mut self, buf: &mut [u8], ) -> Result<(), EspError>

source

pub fn transfer( &mut self, read: &mut [u8], write: &[u8], ) -> Result<(), EspError>

source

pub async fn transfer_async( &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,

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<'d, T> ErrorType for SpiDeviceDriver<'d, T>
where T: Borrow<SpiDriver<'d>> + 'd,

§

type Error = SpiError

Error type.
source§

impl<'d, T> SpiDevice for SpiDeviceDriver<'d, T>
where T: Borrow<SpiDriver<'d>> + 'd,

source§

async fn read(&mut self, buf: &mut [u8]) -> Result<(), Self::Error>

Do a read within a transaction. Read more
source§

async fn write(&mut self, buf: &[u8]) -> Result<(), Self::Error>

Do a write within a transaction. Read more
source§

async fn transaction( &mut self, operations: &mut [Operation<'_, u8>], ) -> Result<(), Self::Error>

Perform a transaction against the device. Read more
source§

async fn transfer( &mut self, read: &mut [Word], write: &[Word], ) -> Result<(), Self::Error>

Do a transfer within a transaction. Read more
source§

async 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> SpiDevice for SpiDeviceDriver<'d, T>
where T: Borrow<SpiDriver<'d>> + 'd,

source§

fn read(&mut self, buf: &mut [u8]) -> Result<(), Self::Error>

Do a read within a transaction. Read more
source§

fn write(&mut self, buf: &[u8]) -> Result<(), Self::Error>

Do a write within a transaction. Read more
source§

fn transaction( &mut self, operations: &mut [Operation<'_, u8>], ) -> Result<(), Self::Error>

Perform a transaction against the device. Read more
source§

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>

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,

§

type Error = SpiError

Associated error type
source§

fn exec( &mut self, operations: &mut [Operation<'_, u8>], ) -> Result<(), Self::Error>

Execute the provided transactions
source§

impl<'d, T> WriteIter<u8> for SpiDeviceDriver<'d, T>
where T: Borrow<SpiDriver<'d>> + 'd,

All data is chunked into max(iter.len(), 64)

§

type Error = SpiError

Error type
source§

fn write_iter<WI>(&mut self, words: WI) -> Result<(), Self::Error>
where WI: IntoIterator<Item = u8>,

Sends words to the slave, ignoring all the incoming words
source§

impl<'d, T> Transfer<u8> for SpiDeviceDriver<'d, T>
where T: Borrow<SpiDriver<'d>> + 'd,

§

type Error = SpiError

Error type
source§

fn transfer<'w>(&mut self, words: &'w mut [u8]) -> Result<&'w [u8], Self::Error>

Sends words to the slave. Returns the words received from the slave
source§

impl<'d, T> Write<u8> for SpiDeviceDriver<'d, T>
where T: Borrow<SpiDriver<'d>> + 'd,

§

type Error = SpiError

Error type
source§

fn write(&mut self, words: &[u8]) -> Result<(), Self::Error>

Sends words to the slave, ignoring all the incoming words
source§

impl<'d, T> Send for SpiDeviceDriver<'d, T>
where T: Send + Borrow<SpiDriver<'d>> + 'd,

Auto Trait Implementations§

§

impl<'d, T> Freeze for SpiDeviceDriver<'d, T>
where T: Freeze,

§

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 T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.