pub fn spi_master(
    clocks: &mut GenericClockController,
    baud: impl Into<Hertz>,
    sercom2: pac::SERCOM2,
    mclk: &mut pac::MCLK,
    sclk: impl Into<Sclk>,
    mosi: impl Into<Mosi>,
    miso: impl Into<Miso>,
) -> Spi {
    let gclk0 = clocks.gclk0();
    let clock = clocks.sercom2_core(&gclk0).unwrap();
    let freq = clock.freq();
    let (miso, mosi, sclk) = (miso.into(), mosi.into(), sclk.into());
    let pads = spi::Pads::default().data_in(miso).data_out(mosi).sclk(sclk);
    spi::Config::new(mclk, sercom2, pads, freq)
        .baud(baud)
        .spi_mode(spi::MODE_0)
        .enable()
}
/// Convenience for setting up the 2x3 header block for SPI.
/// This powers up SERCOM2 and configures it for use as an
/// SPI Master in SPI Mode 0.
Convenience for setting up the 2x3 header block for SPI.
This powers up SERCOM2 and configures it for use as an
SPI Master in SPI Mode 0.
Convenience for setting up the 2x3 header block for SPI . This powers up SERCOM2 and configures it for use as an SPI Master in SPI Mode 0 .
pub fn spi_master(
    clocks: &mut GenericClockController,
    baud: impl Into<Hertz>,
    sercom2: pac::SERCOM2,
    mclk: &mut pac::MCLK,
    sclk: impl Into<Sclk>,
    mosi: impl Into<Mosi>,
    miso: impl Into<Miso>,
) -> Spi {
    let gclk0 = clocks.gclk0();
    let clock = clocks.sercom2_core(&gclk0).unwrap();
    let freq = clock.freq();
    let (miso, mosi, sclk) = (miso.into(), mosi.into(), sclk.into());
    let pads = spi::Pads::default().data_in(miso).data_out(mosi).sclk(sclk);
    spi::Config::new(mclk, sercom2, pads, freq)
        .baud(baud)
        .spi_mode(spi::MODE_0)
        .enable()
}
pub fn spi_master ( clocks : & mut GenericClockController , baud : impl Into < Hertz > , sercom2 : pac :: SERCOM2 , mclk : & mut pac :: MCLK , sclk : impl Into < Sclk > , mosi : impl Into < Mosi > , miso : impl Into < Miso > , ) -> Spi { let gclk0 = clocks . gclk0 ( ) ; let clock = clocks . sercom2_core ( & gclk0 ) . unwrap ( ) ; let freq = clock . freq ( ) ; let ( miso , mosi , sclk ) = ( miso . into ( ) , mosi . into ( ) , sclk . into ( ) ) ; let pads = spi :: Pads :: default ( ) . data_in ( miso ) . data_out ( mosi ) . sclk ( sclk ) ; spi :: Config :: new ( mclk , sercom2 , pads , freq ) . baud ( baud ) . spi_mode ( spi :: MODE_0 ) . enable ( ) }
Convenience for setting up the 2x3 header block for SPI.
Convenience for setting up the 2x3 header block for SPI .
clocks
&mut GenericClockController
baud
impl Into<Hertz>
sercom2
pac::SERCOM2
mclk
&mut pac::MCLK
sclk
impl Into<Sclk>
mosi
impl Into<Mosi>
miso
impl Into<Miso>
clocks
&mut GenericClockController
baud
impl Into<Hertz>
sercom2
pac::SERCOM2
mclk
&mut pac::MCLK
sclk
impl Into<Sclk>
mosi
impl Into<Mosi>
miso
impl Into<Miso>