Struct SPIMaster4

Source
pub struct SPIMaster4<MISO, MOSI, SCK> { /* private fields */ }
๐Ÿ‘ŽDeprecated since 0.13.0: The sercom::v1::spi module is deprecated, and will be removed in a subsequent release. Please use the sercom::v2::spi module instead.
Expand description

SPIMasterX represents the corresponding SERCOMX instance configured to act in the role of an SPI Master. Objects of this type implement the HAL FullDuplex and blocking SPI traits.

This type is generic over any valid pad mapping where there is a defined โ€œdata in pin out data out pin outโ€ implementation.

Implementationsยง

Sourceยง

impl<MISO, MOSI, SCK> SPIMaster4<MISO, MOSI, SCK>

Source

pub fn new<F, T>( clock: &Sercom4CoreClock, freq: F, mode: Mode, sercom: SERCOM4, pm: &mut PM, padout: T, ) -> SPIMaster4<MISO, MOSI, SCK>
where F: Into<Hertz>, T: Into<Padout<SERCOM4, MISO, MOSI, SCK>>, Padout<SERCOM4, MISO, MOSI, SCK>: DipoDopo,

๐Ÿ‘ŽDeprecated since 0.13.0: The sercom::v1::spi module is deprecated, and will be removed in a subsequent release. Please use the sercom::v2::spi module instead.

Power on and configure SERCOMX to work as an SPI Master operating with the specified frequency and SPI Mode. The padout specifies which pins are bound to the MISO, MOSI, SCK functions.

You can use a tuple of three SercomXPadY instances for which there exists a From implementation for SPIMasterXPadout.

Source

pub fn set_baud<F>(&mut self, freq: F, clock: &Sercom4CoreClock)
where F: Into<Hertz>,

๐Ÿ‘ŽDeprecated since 0.13.0: The sercom::v1::spi module is deprecated, and will be removed in a subsequent release. Please use the sercom::v2::spi module instead.

Set the baud rate

Source

pub fn free(self) -> (Padout<SERCOM4, MISO, MOSI, SCK>, SERCOM4)

๐Ÿ‘ŽDeprecated since 0.13.0: The sercom::v1::spi module is deprecated, and will be removed in a subsequent release. Please use the sercom::v2::spi module instead.

Tear down the SPI instance and yield the constituent pins and SERCOM instance. No explicit de-initialization is performed.

Trait Implementationsยง

Sourceยง

impl<MISO, MOSI, SCK> CommonSpi for SPIMaster4<MISO, MOSI, SCK>

Sourceยง

fn spi(&self) -> &SPI

๐Ÿ‘ŽDeprecated since 0.13.0: The spi_common module is deprecated, and will be removed in a subsequent release. Please use the sercom::v2::spi::AnySpi trait instead.

Helper for accessing the spi member of the sercom instance

Sourceยง

fn spi_mut(&mut self) -> &SPI

๐Ÿ‘ŽDeprecated since 0.13.0: The spi_common module is deprecated, and will be removed in a subsequent release. Please use the sercom::v2::spi::AnySpi trait instead.

Helper for accessing the spi member of the sercom instance

Sourceยง

fn disable(&mut self)

๐Ÿ‘ŽDeprecated since 0.13.0: The spi_common module is deprecated, and will be removed in a subsequent release. Please use the sercom::v2::spi::AnySpi trait instead.
Disable the SPI
Sourceยง

fn enable(&mut self)

๐Ÿ‘ŽDeprecated since 0.13.0: The spi_common module is deprecated, and will be removed in a subsequent release. Please use the sercom::v2::spi::AnySpi trait instead.
Enable the SPI
Sourceยง

fn set_mode(&mut self, mode: Mode)

๐Ÿ‘ŽDeprecated since 0.13.0: The spi_common module is deprecated, and will be removed in a subsequent release. Please use the sercom::v2::spi::AnySpi trait instead.
Set the polarity (CPOL) and phase (CPHA) of the SPI
Sourceยง

fn freq<F>(&self, src_clock_freq: Hertz) -> Hertz
where F: Into<Hertz>,

๐Ÿ‘ŽDeprecated since 0.13.0: The spi_common module is deprecated, and will be removed in a subsequent release. Please use the sercom::v2::spi::AnySpi trait instead.
Method for calculating the output frequency given our baud settings. Read more
Sourceยง

fn calculate_baud<F>(freq: F, src_clock_freq: Hertz) -> u8
where F: Into<Hertz>,

๐Ÿ‘ŽDeprecated since 0.13.0: The spi_common module is deprecated, and will be removed in a subsequent release. Please use the sercom::v2::spi::AnySpi trait instead.
Helper for calculating our baudrate register Read more
Sourceยง

impl<MISO, MOSI, SCK> FullDuplex<u8> for SPIMaster4<MISO, MOSI, SCK>

Sourceยง

type Error = Error

An enumeration of SPI errors
Sourceยง

fn read(&mut self) -> Result<u8, Error<Error>>

Reads the word stored in the shift register Read more
Sourceยง

fn send(&mut self, byte: u8) -> Result<(), Error<Error>>

Sends a word to the slave
Sourceยง

impl<MISO, MOSI, SCK> Default<u8> for SPIMaster4<MISO, MOSI, SCK>

Sourceยง

impl<MISO, MOSI, SCK> Default<u8> for SPIMaster4<MISO, MOSI, SCK>

Auto Trait Implementationsยง

ยง

impl<MISO, MOSI, SCK> Freeze for SPIMaster4<MISO, MOSI, SCK>
where MISO: Freeze, MOSI: Freeze, SCK: Freeze,

ยง

impl<MISO, MOSI, SCK> RefUnwindSafe for SPIMaster4<MISO, MOSI, SCK>
where MISO: RefUnwindSafe, MOSI: RefUnwindSafe, SCK: RefUnwindSafe,

ยง

impl<MISO, MOSI, SCK> Send for SPIMaster4<MISO, MOSI, SCK>
where MISO: Send, MOSI: Send, SCK: Send,

ยง

impl<MISO, MOSI, SCK> !Sync for SPIMaster4<MISO, MOSI, SCK>

ยง

impl<MISO, MOSI, SCK> Unpin for SPIMaster4<MISO, MOSI, SCK>
where MISO: Unpin, MOSI: Unpin, SCK: Unpin,

ยง

impl<MISO, MOSI, SCK> UnwindSafe for SPIMaster4<MISO, MOSI, SCK>
where MISO: UnwindSafe, MOSI: UnwindSafe, SCK: 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> Same for T

Sourceยง

type Output = T

Should always be Self
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.
Sourceยง

impl<W, S> Transfer<W> for S
where S: Default<W>, W: Clone,

Sourceยง

type Error = <S as FullDuplex<W>>::Error

Error type
Sourceยง

fn transfer<'w>( &mut self, words: &'w mut [W], ) -> Result<&'w [W], <S as FullDuplex<W>>::Error>

Sends words to the slave. Returns the words received from the slave
Sourceยง

impl<W, S> Write<W> for S
where S: Default<W>, W: Clone,

Sourceยง

type Error = <S as FullDuplex<W>>::Error

Error type
Sourceยง

fn write(&mut self, words: &[W]) -> Result<(), <S as FullDuplex<W>>::Error>

Sends words to the slave, ignoring all the incoming words