samd21_mini::prelude

Trait _atsamd_hal_spi_common_CommonSpi

source
pub trait _atsamd_hal_spi_common_CommonSpi {
    // Required methods
    fn spi(&self) -> &SPI;
    fn spi_mut(&mut self) -> &SPI;

    // Provided methods
    fn disable(&mut self) { ... }
    fn enable(&mut self) { ... }
    fn set_mode(&mut self, mode: Mode) { ... }
    fn freq<F>(&self, src_clock_freq: Hertz) -> Hertz
       where F: Into<Hertz> { ... }
    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.
Expand description

Consolidated common logic for dealing with ATSAMD SPI peripherals.

Required Methodsยง

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

Provided Methodsยง

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.

for synchronous SERCOM peripherals, the calculation for the final frequency is f_baud = f_ref / (2 * (BAUD + 1)).

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

for synchronous SERCOM peripherals, the calculation for this register is BAUD = f_ref / (2 * f_baud) - 1.

Dyn Compatibilityยง

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementorsยง

sourceยง

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

sourceยง

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

sourceยง

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

sourceยง

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

sourceยง

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

sourceยง

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