pub trait 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) -> 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.

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) -> 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

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

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>