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

source

pub fn new<F, T>( clock: &Sercom2CoreClock, freq: F, mode: Mode, sercom: SERCOM2, pm: &mut PM, padout: T ) -> SPIMaster2<MISO, MOSI, SCK>where F: Into<Hertz>, T: Into<Padout<SERCOM2, MISO, MOSI, SCK>>, Padout<SERCOM2, 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: &Sercom2CoreClock)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<SERCOM2, MISO, MOSI, SCK>, SERCOM2)

👎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 SPIMaster2<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) -> Hertzwhere 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) -> u8where 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 SPIMaster2<MISO, MOSI, SCK>

§

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 SPIMaster2<MISO, MOSI, SCK>

source§

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

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

impl<MISO, MOSI, SCK> UnwindSafe for SPIMaster2<MISO, MOSI, SCK>where MISO: UnwindSafe, MOSI: UnwindSafe, SCK: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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<T> for T

§

type Output = T

Should always be Self
source§

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

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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> Write<W> for Swhere S: Default<W>, W: Clone,

§

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