Struct esp32c2_hal::spi::Spi
source · pub struct Spi<T> { /* private fields */ }
Implementations
sourceimpl<T> Spi<T>where
T: Instance,
impl<T> Spi<T>where
T: Instance,
sourcepub fn new<SCK, MOSI, MISO, CS>(
spi: T,
sck: SCK,
mosi: MOSI,
miso: MISO,
cs: CS,
frequency: Rate<u32, 1, 1>,
mode: SpiMode,
peripheral_clock_control: &mut PeripheralClockControl,
clocks: &Clocks
) -> Spi<T>where
SCK: OutputPin,
MOSI: OutputPin,
MISO: InputPin,
CS: OutputPin,
pub fn new<SCK, MOSI, MISO, CS>(
spi: T,
sck: SCK,
mosi: MOSI,
miso: MISO,
cs: CS,
frequency: Rate<u32, 1, 1>,
mode: SpiMode,
peripheral_clock_control: &mut PeripheralClockControl,
clocks: &Clocks
) -> Spi<T>where
SCK: OutputPin,
MOSI: OutputPin,
MISO: InputPin,
CS: OutputPin,
Constructs an SPI instance in 8bit dataframe mode.
sourcepub fn new_no_cs<SCK, MOSI, MISO>(
spi: T,
sck: SCK,
mosi: MOSI,
miso: MISO,
frequency: Rate<u32, 1, 1>,
mode: SpiMode,
peripheral_clock_control: &mut PeripheralClockControl,
clocks: &Clocks
) -> Spi<T>where
SCK: OutputPin,
MOSI: OutputPin,
MISO: InputPin,
pub fn new_no_cs<SCK, MOSI, MISO>(
spi: T,
sck: SCK,
mosi: MOSI,
miso: MISO,
frequency: Rate<u32, 1, 1>,
mode: SpiMode,
peripheral_clock_control: &mut PeripheralClockControl,
clocks: &Clocks
) -> Spi<T>where
SCK: OutputPin,
MOSI: OutputPin,
MISO: InputPin,
Constructs an SPI instance in 8bit dataframe mode without CS pin.
sourcepub fn new_no_cs_no_miso<SCK, MOSI>(
spi: T,
sck: SCK,
mosi: MOSI,
frequency: Rate<u32, 1, 1>,
mode: SpiMode,
peripheral_clock_control: &mut PeripheralClockControl,
clocks: &Clocks
) -> Spi<T>where
SCK: OutputPin,
MOSI: OutputPin,
pub fn new_no_cs_no_miso<SCK, MOSI>(
spi: T,
sck: SCK,
mosi: MOSI,
frequency: Rate<u32, 1, 1>,
mode: SpiMode,
peripheral_clock_control: &mut PeripheralClockControl,
clocks: &Clocks
) -> Spi<T>where
SCK: OutputPin,
MOSI: OutputPin,
Constructs an SPI instance in 8bit dataframe mode without CS and MISO pin.
sourcepub fn new_mosi_only<MOSI>(
spi: T,
mosi: MOSI,
frequency: Rate<u32, 1, 1>,
mode: SpiMode,
peripheral_clock_control: &mut PeripheralClockControl,
clocks: &Clocks
) -> Spi<T>where
MOSI: OutputPin,
pub fn new_mosi_only<MOSI>(
spi: T,
mosi: MOSI,
frequency: Rate<u32, 1, 1>,
mode: SpiMode,
peripheral_clock_control: &mut PeripheralClockControl,
clocks: &Clocks
) -> Spi<T>where
MOSI: OutputPin,
Constructs an SPI instance in 8bit dataframe mode with only MOSI connected. This might be useful for (ab)using SPI to implement other protocols by bitbanging (WS2812B, onewire, generating arbitrary waveforms…)
pub fn change_bus_frequency(
&mut self,
frequency: Rate<u32, 1, 1>,
clocks: &Clocks
)
Trait Implementations
sourceimpl<T> FullDuplex<u8> for Spi<T>where
T: Instance,
impl<T> FullDuplex<u8> for Spi<T>where
T: Instance,
sourceimpl<T, RX, TX, P> WithDmaSpi2<T, RX, TX, P> for Spi<T>where
T: Instance + Spi2Instance,
TX: Tx,
RX: Rx,
P: SpiPeripheral + Spi2Peripheral,
impl<T, RX, TX, P> WithDmaSpi2<T, RX, TX, P> for Spi<T>where
T: Instance + Spi2Instance,
TX: Tx,
RX: Rx,
P: SpiPeripheral + Spi2Peripheral,
Auto Trait Implementations
impl<T> RefUnwindSafe for Spi<T>where
T: RefUnwindSafe,
impl<T> Send for Spi<T>where
T: Send,
impl<T> Sync for Spi<T>where
T: Sync,
impl<T> Unpin for Spi<T>where
T: Unpin,
impl<T> UnwindSafe for Spi<T>where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more