esp_idf_hal::spi

Type Alias SpiSingleDeviceDriver

Source
pub type SpiSingleDeviceDriver<'d> = SpiDeviceDriver<'d, SpiDriver<'d>>;

Aliased Type§

struct SpiSingleDeviceDriver<'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<'_>], ) -> Result<(), EspError>

Source

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

Source

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

Source

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

Source

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,

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,

Source§

type Error = SpiError

Error type.
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,

Source§

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)

Source§

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,

Source§

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,

Source§

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,