[−][src]Struct esp32_hal::spi::SPI
SPI abstraction
Implementations
impl<CS: OutputPin> SPI<SPI1, Gpio6<Output<PushPull>>, Gpio7<Output<PushPull>>, Gpio8<Input<Floating>>, CS>
[src]
pub fn new(
instance: SPI1,
pins: Pins<Gpio6<Output<PushPull>>, Gpio7<Output<PushPull>>, Gpio8<Input<Floating>>, CS>,
config: Config,
clock_control: ClockControlConfig
) -> Result<Self, Error>
[src]
instance: SPI1,
pins: Pins<Gpio6<Output<PushPull>>, Gpio7<Output<PushPull>>, Gpio8<Input<Floating>>, CS>,
config: Config,
clock_control: ClockControlConfig
) -> Result<Self, Error>
Create new instance of SPI controller for SPI1
SPI1 can only use fixed pin for SCLK, SDO and SDI as they are shared with SPI0.
impl<SCLK: OutputPin, SDO: OutputPin, SDI: InputPin + OutputPin, CS: OutputPin> SPI<SPI2, SCLK, SDO, SDI, CS>
[src]
pub fn new(
instance: SPI2,
pins: Pins<SCLK, SDO, SDI, CS>,
config: Config,
clock_control: ClockControlConfig
) -> Result<Self, Error>
[src]
instance: SPI2,
pins: Pins<SCLK, SDO, SDI, CS>,
config: Config,
clock_control: ClockControlConfig
) -> Result<Self, Error>
Create new instance of SPI controller for SPI2
impl<SCLK: OutputPin, SDO: OutputPin, SDI: InputPin + OutputPin, CS: OutputPin> SPI<SPI3, SCLK, SDO, SDI, CS>
[src]
pub fn new(
instance: SPI3,
pins: Pins<SCLK, SDO, SDI, CS>,
config: Config,
clock_control: ClockControlConfig
) -> Result<Self, Error>
[src]
instance: SPI3,
pins: Pins<SCLK, SDO, SDI, CS>,
config: Config,
clock_control: ClockControlConfig
) -> Result<Self, Error>
Create new instance of SPI controller for SPI3
impl<INSTANCE: Instance, SCLK: OutputPin, SDO: OutputPin, SDI: InputPin + OutputPin, CS: OutputPin> SPI<INSTANCE, SCLK, SDO, SDI, CS>
[src]
pub fn change_baudrate<T: Into<Hertz> + Copy>(
&mut self,
baudrate: T
) -> Result<&mut Self, Error>
[src]
&mut self,
baudrate: T
) -> Result<&mut Self, Error>
Change the SPI baudrate
pub fn baudrate(&self) -> Hertz
[src]
Returns the current baudrate
pub fn change_bit_order(&mut self, data_mode: BitOrder) -> &mut Self
[src]
Change the bit order
pub fn change_data_mode(&mut self, data_mode: Mode) -> &mut Self
[src]
Change the data mode
pub fn release(self) -> INSTANCE
[src]
Release and return the raw interface to the underlying SPI peripheral
Trait Implementations
impl<T: U8orU16orU32, INSTANCE: Instance, SCLK: OutputPin, SDO: OutputPin, SDI: InputPin + OutputPin, CS: OutputPin> FullDuplex<T> for SPI<INSTANCE, SCLK, SDO, SDI, CS>
[src]
Full-duplex implementation for writing/reading via SPI
Note: these functions do not lock the frequency of the APB bus, so transactions may be at lower frequency if APB bus is not locked in caller.
type Error = Error
An enumeration of SPI errors
fn read(&mut self) -> Result<T, Error>
[src]
fn send(&mut self, value: T) -> Result<(), Error>
[src]
impl<INSTANCE: Instance, SCLK: OutputPin, SDO: OutputPin, SDI: InputPin + OutputPin, CS: OutputPin> Transfer<u16> for SPI<INSTANCE, SCLK, SDO, SDI, CS>
[src]
type Error = Error
Error type
fn transfer<'w>(
&mut self,
words: &'w mut [u16]
) -> Result<&'w [u16], Self::Error>
[src]
&mut self,
words: &'w mut [u16]
) -> Result<&'w [u16], Self::Error>
impl<INSTANCE: Instance, SCLK: OutputPin, SDO: OutputPin, SDI: InputPin + OutputPin, CS: OutputPin> Transfer<u32> for SPI<INSTANCE, SCLK, SDO, SDI, CS>
[src]
type Error = Error
Error type
fn transfer<'w>(
&mut self,
words: &'w mut [u32]
) -> Result<&'w [u32], Self::Error>
[src]
&mut self,
words: &'w mut [u32]
) -> Result<&'w [u32], Self::Error>
impl<INSTANCE: Instance, SCLK: OutputPin, SDO: OutputPin, SDI: InputPin + OutputPin, CS: OutputPin> Transfer<u8> for SPI<INSTANCE, SCLK, SDO, SDI, CS>
[src]
type Error = Error
Error type
fn transfer<'w>(&mut self, words: &'w mut [u8]) -> Result<&'w [u8], Self::Error>
[src]
impl<INSTANCE: Instance, SCLK: OutputPin, SDO: OutputPin, SDI: InputPin + OutputPin, CS: OutputPin> Write<u16> for SPI<INSTANCE, SCLK, SDO, SDI, CS>
[src]
impl<INSTANCE: Instance, SCLK: OutputPin, SDO: OutputPin, SDI: InputPin + OutputPin, CS: OutputPin> Write<u32> for SPI<INSTANCE, SCLK, SDO, SDI, CS>
[src]
impl<INSTANCE: Instance, SCLK: OutputPin, SDO: OutputPin, SDI: InputPin + OutputPin, CS: OutputPin> Write<u8> for SPI<INSTANCE, SCLK, SDO, SDI, CS>
[src]
impl<INSTANCE: Instance, SCLK: OutputPin, SDO: OutputPin, SDI: InputPin + OutputPin, CS: OutputPin> WriteIter<u16> for SPI<INSTANCE, SCLK, SDO, SDI, CS>
[src]
type Error = Error
Error type
fn write_iter<WI>(&mut self, words: WI) -> Result<(), Self::Error> where
WI: IntoIterator<Item = u16>,
[src]
WI: IntoIterator<Item = u16>,
impl<INSTANCE: Instance, SCLK: OutputPin, SDO: OutputPin, SDI: InputPin + OutputPin, CS: OutputPin> WriteIter<u32> for SPI<INSTANCE, SCLK, SDO, SDI, CS>
[src]
type Error = Error
Error type
fn write_iter<WI>(&mut self, words: WI) -> Result<(), Self::Error> where
WI: IntoIterator<Item = u32>,
[src]
WI: IntoIterator<Item = u32>,
impl<INSTANCE: Instance, SCLK: OutputPin, SDO: OutputPin, SDI: InputPin + OutputPin, CS: OutputPin> WriteIter<u8> for SPI<INSTANCE, SCLK, SDO, SDI, CS>
[src]
type Error = Error
Error type
fn write_iter<WI>(&mut self, words: WI) -> Result<(), Self::Error> where
WI: IntoIterator<Item = u8>,
[src]
WI: IntoIterator<Item = u8>,
Auto Trait Implementations
impl<INSTANCE, SCLK, SDO, SDI, CS> Send for SPI<INSTANCE, SCLK, SDO, SDI, CS> where
CS: Send,
INSTANCE: Send,
SCLK: Send,
SDI: Send,
SDO: Send,
CS: Send,
INSTANCE: Send,
SCLK: Send,
SDI: Send,
SDO: Send,
impl<INSTANCE, SCLK, SDO, SDI, CS> Sync for SPI<INSTANCE, SCLK, SDO, SDI, CS> where
CS: Sync,
INSTANCE: Sync,
SCLK: Sync,
SDI: Sync,
SDO: Sync,
CS: Sync,
INSTANCE: Sync,
SCLK: Sync,
SDI: Sync,
SDO: Sync,
impl<INSTANCE, SCLK, SDO, SDI, CS> Unpin for SPI<INSTANCE, SCLK, SDO, SDI, CS> where
CS: Unpin,
INSTANCE: Unpin,
SCLK: Unpin,
SDI: Unpin,
SDO: Unpin,
CS: Unpin,
INSTANCE: Unpin,
SCLK: Unpin,
SDI: Unpin,
SDO: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<W, S> Transfer<W> for S where
S: Default<W>,
W: Clone,
[src]
S: Default<W>,
W: Clone,
type Error = <S as FullDuplex<W>>::Error
Error type
fn transfer(
&mut self,
words: &'w mut [W]
) -> Result<&'w [W], <S as FullDuplex<W>>::Error>
[src]
&mut self,
words: &'w mut [W]
) -> Result<&'w [W], <S as FullDuplex<W>>::Error>
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<W, S> Write<W> for S where
S: Default<W>,
W: Clone,
[src]
S: Default<W>,
W: Clone,
type Error = <S as FullDuplex<W>>::Error
Error type
fn write(&mut self, words: &[W]) -> Result<(), <S as FullDuplex<W>>::Error>
[src]
impl<W, S> WriteIter<W> for S where
S: Default<W>,
W: Clone,
[src]
S: Default<W>,
W: Clone,
type Error = <S as FullDuplex<W>>::Error
Error type
fn write_iter<WI>(
&mut self,
words: WI
) -> Result<(), <S as FullDuplex<W>>::Error> where
WI: IntoIterator<Item = W>,
[src]
&mut self,
words: WI
) -> Result<(), <S as FullDuplex<W>>::Error> where
WI: IntoIterator<Item = W>,