Spi

Struct Spi 

Source
pub struct Spi<SPI, SCKPIN, MISOPIN, MOSIPIN, WIDTH> { /* private fields */ }
Expand description

SPI abstraction

Implementations§

Source§

impl<SCKPIN, MISOPIN, MOSIPIN> Spi<SPI1, SCKPIN, MISOPIN, MOSIPIN, EightBit>

Source

pub fn spi1<F>( spi: SPI1, pins: (SCKPIN, MISOPIN, MOSIPIN), mode: Mode, speed: F, rcc: &mut Rcc, ) -> Self
where SCKPIN: SckPin<SPI1>, MISOPIN: MisoPin<SPI1>, MOSIPIN: MosiPin<SPI1>, F: Into<Hertz>,

Creates a new spi instance

Source§

impl<SCKPIN, MISOPIN, MOSIPIN> Spi<SPI2, SCKPIN, MISOPIN, MOSIPIN, EightBit>

Source

pub fn spi2<F>( spi: SPI2, pins: (SCKPIN, MISOPIN, MOSIPIN), mode: Mode, speed: F, rcc: &mut Rcc, ) -> Self
where SCKPIN: SckPin<SPI2>, MISOPIN: MisoPin<SPI2>, MOSIPIN: MosiPin<SPI2>, F: Into<Hertz>,

Creates a new spi instance

Source§

impl<SPI, SCKPIN, MISOPIN, MOSIPIN, WIDTH> Spi<SPI, SCKPIN, MISOPIN, MOSIPIN, WIDTH>
where SPI: Deref<Target = RegisterBlock>,

Source

pub fn into_8bit_width(self) -> Spi<SPI, SCKPIN, MISOPIN, MOSIPIN, EightBit>

Source

pub fn into_16bit_width(self) -> Spi<SPI, SCKPIN, MISOPIN, MOSIPIN, SixteenBit>

Source

pub fn release(self) -> (SPI, (SCKPIN, MISOPIN, MOSIPIN))

Trait Implementations§

Source§

impl<SPI, SCKPIN, MISOPIN, MOSIPIN> Transfer<u16> for Spi<SPI, SCKPIN, MISOPIN, MOSIPIN, SixteenBit>
where SPI: Deref<Target = RegisterBlock>,

Source§

type Error = Error

Error type
Source§

fn transfer<'w>( &mut self, words: &'w mut [u16], ) -> Result<&'w [u16], Self::Error>

Sends words to the slave. Returns the words received from the slave
Source§

impl<SPI, SCKPIN, MISOPIN, MOSIPIN> Transfer<u8> for Spi<SPI, SCKPIN, MISOPIN, MOSIPIN, EightBit>
where SPI: Deref<Target = RegisterBlock>,

Source§

type Error = Error

Error type
Source§

fn transfer<'w>(&mut self, words: &'w mut [u8]) -> Result<&'w [u8], Self::Error>

Sends words to the slave. Returns the words received from the slave
Source§

impl<SPI, SCKPIN, MISOPIN, MOSIPIN> Write<u16> for Spi<SPI, SCKPIN, MISOPIN, MOSIPIN, SixteenBit>
where SPI: Deref<Target = RegisterBlock>,

Source§

type Error = Error

Error type
Source§

fn write(&mut self, words: &[u16]) -> Result<(), Self::Error>

Sends words to the slave, ignoring all the incoming words
Source§

impl<SPI, SCKPIN, MISOPIN, MOSIPIN> Write<u8> for Spi<SPI, SCKPIN, MISOPIN, MOSIPIN, EightBit>
where SPI: Deref<Target = RegisterBlock>,

Source§

type Error = Error

Error type
Source§

fn write(&mut self, words: &[u8]) -> Result<(), Self::Error>

Sends words to the slave, ignoring all the incoming words

Auto Trait Implementations§

§

impl<SPI, SCKPIN, MISOPIN, MOSIPIN, WIDTH> Freeze for Spi<SPI, SCKPIN, MISOPIN, MOSIPIN, WIDTH>
where SPI: Freeze, SCKPIN: Freeze, MISOPIN: Freeze, MOSIPIN: Freeze,

§

impl<SPI, SCKPIN, MISOPIN, MOSIPIN, WIDTH> RefUnwindSafe for Spi<SPI, SCKPIN, MISOPIN, MOSIPIN, WIDTH>
where SPI: RefUnwindSafe, SCKPIN: RefUnwindSafe, MISOPIN: RefUnwindSafe, MOSIPIN: RefUnwindSafe, WIDTH: RefUnwindSafe,

§

impl<SPI, SCKPIN, MISOPIN, MOSIPIN, WIDTH> Send for Spi<SPI, SCKPIN, MISOPIN, MOSIPIN, WIDTH>
where SPI: Send, SCKPIN: Send, MISOPIN: Send, MOSIPIN: Send, WIDTH: Send,

§

impl<SPI, SCKPIN, MISOPIN, MOSIPIN, WIDTH> Sync for Spi<SPI, SCKPIN, MISOPIN, MOSIPIN, WIDTH>
where SPI: Sync, SCKPIN: Sync, MISOPIN: Sync, MOSIPIN: Sync, WIDTH: Sync,

§

impl<SPI, SCKPIN, MISOPIN, MOSIPIN, WIDTH> Unpin for Spi<SPI, SCKPIN, MISOPIN, MOSIPIN, WIDTH>
where SPI: Unpin, SCKPIN: Unpin, MISOPIN: Unpin, MOSIPIN: Unpin, WIDTH: Unpin,

§

impl<SPI, SCKPIN, MISOPIN, MOSIPIN, WIDTH> UnwindSafe for Spi<SPI, SCKPIN, MISOPIN, MOSIPIN, WIDTH>
where SPI: UnwindSafe, SCKPIN: UnwindSafe, MISOPIN: UnwindSafe, MOSIPIN: UnwindSafe, WIDTH: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.