Struct esp32c3_hal::spi::Spi
source · pub struct Spi<'d, T> { /* private fields */ }
Implementations§
source§impl<'d, T> Spi<'d, T>where
T: Instance,
impl<'d, T> Spi<'d, T>where
T: Instance,
sourcepub fn new<SCK, MOSI, MISO, CS>(
spi: impl Peripheral<P = T> + 'd,
sck: impl Peripheral<P = SCK> + 'd,
mosi: impl Peripheral<P = MOSI> + 'd,
miso: impl Peripheral<P = MISO> + 'd,
cs: impl Peripheral<P = CS> + 'd,
frequency: Rate<u32, 1, 1>,
mode: SpiMode,
peripheral_clock_control: &mut PeripheralClockControl,
clocks: &Clocks<'_>
) -> Spi<'d, T>where
SCK: OutputPin,
MOSI: OutputPin,
MISO: InputPin,
CS: OutputPin,
pub fn new<SCK, MOSI, MISO, CS>(
spi: impl Peripheral<P = T> + 'd,
sck: impl Peripheral<P = SCK> + 'd,
mosi: impl Peripheral<P = MOSI> + 'd,
miso: impl Peripheral<P = MISO> + 'd,
cs: impl Peripheral<P = CS> + 'd,
frequency: Rate<u32, 1, 1>,
mode: SpiMode,
peripheral_clock_control: &mut PeripheralClockControl,
clocks: &Clocks<'_>
) -> Spi<'d, 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: impl Peripheral<P = T> + 'd,
sck: impl Peripheral<P = SCK> + 'd,
mosi: impl Peripheral<P = MOSI> + 'd,
miso: impl Peripheral<P = MISO> + 'd,
frequency: Rate<u32, 1, 1>,
mode: SpiMode,
peripheral_clock_control: &mut PeripheralClockControl,
clocks: &Clocks<'_>
) -> Spi<'d, T>where
SCK: OutputPin,
MOSI: OutputPin,
MISO: InputPin,
pub fn new_no_cs<SCK, MOSI, MISO>(
spi: impl Peripheral<P = T> + 'd,
sck: impl Peripheral<P = SCK> + 'd,
mosi: impl Peripheral<P = MOSI> + 'd,
miso: impl Peripheral<P = MISO> + 'd,
frequency: Rate<u32, 1, 1>,
mode: SpiMode,
peripheral_clock_control: &mut PeripheralClockControl,
clocks: &Clocks<'_>
) -> Spi<'d, 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: impl Peripheral<P = T> + 'd,
sck: impl Peripheral<P = SCK> + 'd,
mosi: impl Peripheral<P = MOSI> + 'd,
frequency: Rate<u32, 1, 1>,
mode: SpiMode,
peripheral_clock_control: &mut PeripheralClockControl,
clocks: &Clocks<'_>
) -> Spi<'d, T>where
SCK: OutputPin,
MOSI: OutputPin,
pub fn new_no_cs_no_miso<SCK, MOSI>(
spi: impl Peripheral<P = T> + 'd,
sck: impl Peripheral<P = SCK> + 'd,
mosi: impl Peripheral<P = MOSI> + 'd,
frequency: Rate<u32, 1, 1>,
mode: SpiMode,
peripheral_clock_control: &mut PeripheralClockControl,
clocks: &Clocks<'_>
) -> Spi<'d, 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: impl Peripheral<P = T> + 'd,
mosi: impl Peripheral<P = MOSI> + 'd,
frequency: Rate<u32, 1, 1>,
mode: SpiMode,
peripheral_clock_control: &mut PeripheralClockControl,
clocks: &Clocks<'_>
) -> Spi<'d, T>where
MOSI: OutputPin,
pub fn new_mosi_only<MOSI>(
spi: impl Peripheral<P = T> + 'd,
mosi: impl Peripheral<P = MOSI> + 'd,
frequency: Rate<u32, 1, 1>,
mode: SpiMode,
peripheral_clock_control: &mut PeripheralClockControl,
clocks: &Clocks<'_>
) -> Spi<'d, 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…)