Skip to main content

SPIMaster5

Struct SPIMaster5 

Source
pub struct SPIMaster5<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> SPIMaster5<MISO, MOSI, SCK>

Source

pub fn new<F, T>( clock: &Sercom5CoreClock, freq: F, mode: Mode, sercom: SERCOM5, mclk: &mut MCLK, padout: T, ) -> SPIMaster5<MISO, MOSI, SCK>
where F: Into<Hertz>, T: Into<Padout<SERCOM5, MISO, MOSI, SCK>>, Padout<SERCOM5, 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 pinout specifies which pins are bound to the MISO, MOSI, SCK functions.

Source

pub fn set_baud<F>(&mut self, freq: F, clock: &Sercom5CoreClock)
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<SERCOM5, MISO, MOSI, SCK>, SERCOM5)

๐Ÿ‘Ž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 SPIMaster5<MISO, MOSI, SCK>

Sourceยง

fn spi(&self) -> &SPIM

๐Ÿ‘Ž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) -> &SPIM

๐Ÿ‘Ž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> Default<u8> for SPIMaster5<MISO, MOSI, SCK>

Sourceยง

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

Sourceยง

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

Available on crate feature unproven only.
Sourceยง

impl<MISO, MOSI, SCK> FullDuplex<u8> for SPIMaster5<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

Auto Trait Implementationsยง

ยง

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

ยง

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

ยง

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

ยง

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

ยง

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

ยง

impl<MISO, MOSI, SCK> UnsafeUnpin for SPIMaster5<MISO, MOSI, SCK>
where MISO: UnsafeUnpin, MOSI: UnsafeUnpin, SCK: UnsafeUnpin,

ยง

impl<MISO, MOSI, SCK> UnwindSafe for SPIMaster5<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> Az for T

Sourceยง

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
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<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Sourceยง

fn cast_from(src: Src) -> Dst

Casts the value.
Sourceยง

impl<T> CheckedAs for T

Sourceยง

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Sourceยง

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Sourceยง

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
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> OverflowingAs for T

Sourceยง

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Sourceยง

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Sourceยง

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
Sourceยง

impl<T> Same for T

Sourceยง

type Output = T

Should always be Self
Sourceยง

impl<T> SaturatingAs for T

Sourceยง

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Sourceยง

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Sourceยง

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
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<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<T> UnwrappedAs for T

Sourceยง

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Sourceยง

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Sourceยง

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
Sourceยง

impl<T> WrappingAs for T

Sourceยง

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Sourceยง

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Sourceยง

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.
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
Sourceยง

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

Sourceยง

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

Error type
Sourceยง

fn write_iter<WI>( &mut self, words: WI, ) -> Result<(), <S as FullDuplex<W>>::Error>
where WI: IntoIterator<Item = W>,

Sends words to the slave, ignoring all the incoming words