Struct ftdi_embedded_hal::Spi
source · 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>where
Device: MpsseCmdExecutor<Error = E>,
E: Error,
Error<E>: From<E>,
impl<Device, E> Spi<Device>where
Device: MpsseCmdExecutor<Error = E>,
E: Error,
Error<E>: From<E>,
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);