pub fn spi_master(
    clocks: &mut GenericClockController,
    baud: impl Into<Hertz>,
    sercom4: pac::SERCOM4,
    pm: &mut pac::PM,
    sck: impl Into<Sck>,
    mosi: impl Into<Mosi>,
    miso: impl Into<Miso>,
) -> Spi {
    let gclk0 = clocks.gclk0();
    let clock = clocks.sercom4_core(&gclk0).unwrap();
    let freq = clock.freq();
    let pads = spi::Pads::default()
        .data_in(miso.into())
        .data_out(mosi.into())
        .sclk(sck.into());
    spi::Config::new(pm, sercom4, pads, freq)
        .baud(baud)
        .spi_mode(spi::MODE_0)
        .enable()
}
/// Convenience function for setting up the D24/SCK, D23/MOSI, and D22/MISO pins
/// as a SPI Master.
Convenience function for setting up the D24/SCK, D23/MOSI, and D22/MISO pins
as a SPI Master.
Convenience function for setting up the D24 / SCK D23 / MOSI and D22 / MISO pins as a SPI Master .
pub fn spi_master(
    clocks: &mut GenericClockController,
    baud: impl Into<Hertz>,
    sercom4: pac::SERCOM4,
    pm: &mut pac::PM,
    sck: impl Into<Sck>,
    mosi: impl Into<Mosi>,
    miso: impl Into<Miso>,
) -> Spi {
    let gclk0 = clocks.gclk0();
    let clock = clocks.sercom4_core(&gclk0).unwrap();
    let freq = clock.freq();
    let pads = spi::Pads::default()
        .data_in(miso.into())
        .data_out(mosi.into())
        .sclk(sck.into());
    spi::Config::new(pm, sercom4, pads, freq)
        .baud(baud)
        .spi_mode(spi::MODE_0)
        .enable()
}
pub fn spi_master ( clocks : & mut GenericClockController , baud : impl Into < Hertz > , sercom4 : pac :: SERCOM4 , pm : & mut pac :: PM , sck : impl Into < Sck > , mosi : impl Into < Mosi > , miso : impl Into < Miso > , ) -> Spi { let gclk0 = clocks . gclk0 ( ) ; let clock = clocks . sercom4_core ( & gclk0 ) . unwrap ( ) ; let freq = clock . freq ( ) ; let pads = spi :: Pads :: default ( ) . data_in ( miso . into ( ) ) . data_out ( mosi . into ( ) ) . sclk ( sck . into ( ) ) ; spi :: Config :: new ( pm , sercom4 , pads , freq ) . baud ( baud ) . spi_mode ( spi :: MODE_0 ) . enable ( ) }
Convenience function for setting up the D24/SCK, D23/MOSI, and D22/MISO pins
as a SPI Master.
Convenience function for setting up the D24 / SCK D23 / MOSI and D22 / MISO pins as a SPI Master .
clocks
&mut GenericClockController
baud
impl Into<Hertz>
sercom4
pac::SERCOM4
pm
&mut pac::PM
sck
impl Into<Sck>
mosi
impl Into<Mosi>
miso
impl Into<Miso>
clocks
&mut GenericClockController
baud
impl Into<Hertz>
sercom4
pac::SERCOM4
pm
&mut pac::PM
sck
impl Into<Sck>
mosi
impl Into<Mosi>
miso
impl Into<Miso>