Struct Spi

Source
pub struct Spi<'d, Dm: DriverMode> { /* private fields */ }
Available on crate feature unstable only.
Expand description

SPI peripheral driver.

See the module-level documentation for more details.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Implementations§

Source§

impl<'d> Spi<'d, Blocking>

Source

pub fn with_dma<CH>( self, channel: impl Peripheral<P = CH> + 'd, rx_descriptors: &'static mut [DmaDescriptor], tx_descriptors: &'static mut [DmaDescriptor], ) -> SpiDma<'d, Blocking>
where CH: DmaChannelFor<AnySpi>,

Configures the SPI peripheral with the provided DMA channel and descriptors.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source§

impl<'d> Spi<'d, Blocking>

Source

pub fn new( spi: impl Peripheral<P = impl Instance> + 'd, mode: Mode, ) -> Spi<'d, Blocking>

Constructs an SPI instance in 8bit dataframe mode.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source

pub fn with_sck( self, sclk: impl Peripheral<P = impl PeripheralInput> + 'd, ) -> Self

Assign the SCK (Serial Clock) pin for the SPI instance.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source

pub fn with_mosi( self, mosi: impl Peripheral<P = impl PeripheralInput> + 'd, ) -> Self

Assign the MOSI (Master Out Slave In) pin for the SPI instance.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source

pub fn with_miso( self, miso: impl Peripheral<P = impl PeripheralOutput> + 'd, ) -> Self

Assign the MISO (Master In Slave Out) pin for the SPI instance.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source

pub fn with_cs(self, cs: impl Peripheral<P = impl PeripheralInput> + 'd) -> Self

Assign the CS (Chip Select) pin for the SPI instance.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Auto Trait Implementations§

§

impl<'d, Dm> Freeze for Spi<'d, Dm>

§

impl<'d, Dm> RefUnwindSafe for Spi<'d, Dm>
where Dm: RefUnwindSafe,

§

impl<'d, Dm> Send for Spi<'d, Dm>
where Dm: Send,

§

impl<'d, Dm> Sync for Spi<'d, Dm>
where Dm: Sync,

§

impl<'d, Dm> Unpin for Spi<'d, Dm>
where Dm: Unpin,

§

impl<'d, Dm> !UnwindSafe for Spi<'d, Dm>

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where 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>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where 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>

Performs the conversion.