pub struct Spi<Device: MpsseCmdExecutor> { /* private fields */ }
Expand description
FTDI SPI bus.
In embedded-hal version 1 this represents an exclusive SPI bus.
This is created by calling FtHal::spi
.
Implementations§
Source§impl<Device, E> Spi<Device>
impl<Device, E> Spi<Device>
Sourcepub fn set_clock_polarity<P: Into<Polarity>>(&mut self, cpol: P)
pub fn set_clock_polarity<P: Into<Polarity>>(&mut self, cpol: P)
Set the SPI clock polarity.
FTD2XX devices only supports SPI mode 0 and 2, clock phase is fixed.
§Example
use eh1::spi::Polarity;
use ftdi_embedded_hal as hal;
let device = libftd2xx::Ft2232h::with_description("Dual RS232-HS A")?;
let hal = hal::FtHal::init_freq(device, 3_000_000)?;
let mut spi = hal.spi()?;
spi.set_clock_polarity(Polarity::IdleLow);
Trait Implementations§
Source§impl<Device, E> FullDuplex for Spi<Device>
impl<Device, E> FullDuplex for Spi<Device>
Source§impl<Device, E> SpiBus for Spi<Device>
impl<Device, E> SpiBus for Spi<Device>
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<(), Error<E>>
fn write(&mut self, words: &[u8]) -> Result<(), Error<E>>
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§impl<Device, E> FullDuplex<u8> for Spi<Device>
impl<Device, E> FullDuplex<u8> for Spi<Device>
Auto Trait Implementations§
impl<Device> Freeze for Spi<Device>
impl<Device> RefUnwindSafe for Spi<Device>
impl<Device> Send for Spi<Device>where
Device: Send,
impl<Device> Sync for Spi<Device>where
Device: Send,
impl<Device> Unpin for Spi<Device>
impl<Device> UnwindSafe for Spi<Device>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more