pub fn flash_spi_master(
    clocks: &mut GenericClockController,
    sercom5: pac::SERCOM5,
    pm: &mut pac::PM,
    sck: gpio::Pb23<Input<Floating>>,
    mosi: gpio::Pb22<Input<Floating>>,
    miso: gpio::Pb3<Input<Floating>>,
    cs: gpio::Pa13<Input<Floating>>,
    port: &mut Port,
) -> (
    hal::sercom::SPIMaster5<
        hal::sercom::Sercom5Pad1<hal::gpio::Pb3<hal::gpio::PfD>>,
        hal::sercom::Sercom5Pad2<hal::gpio::Pb22<hal::gpio::PfD>>,
        hal::sercom::Sercom5Pad3<hal::gpio::Pb23<hal::gpio::PfD>>,
    >,
    hal::gpio::Pa13<hal::gpio::Output<hal::gpio::PushPull>>,
) {
    let gclk0 = clocks.gclk0();
    let flash = SPIMaster5::new(
        &clocks.sercom5_core(&gclk0).unwrap(),
        48.mhz(),
        hal::hal::spi::Mode {
            phase: hal::hal::spi::Phase::CaptureOnFirstTransition,
            polarity: hal::hal::spi::Polarity::IdleLow,
        },
        sercom5,
        pm,
        (miso.into_pad(port), mosi.into_pad(port), sck.into_pad(port)),
    );

    let mut cs = cs.into_push_pull_output(port);

    // We’re confident that set_high won’t error here because on-board
    // GPIO pins don’t error.
    cs.set_high().unwrap();

    (flash, cs)
}
/// Convenience for accessing the on-board SPI Flash device.
/// This powers up SERCOM5 and configures it for use as an
/// SPI Master.
Convenience for accessing the on-board SPI Flash device.
This powers up SERCOM5 and configures it for use as an
SPI Master.
Convenience for accessing the on - board SPI Flash device . This powers up SERCOM5 and configures it for use as an SPI Master .
pub fn flash_spi_master(
    clocks: &mut GenericClockController,
    sercom5: pac::SERCOM5,
    pm: &mut pac::PM,
    sck: gpio::Pb23<Input<Floating>>,
    mosi: gpio::Pb22<Input<Floating>>,
    miso: gpio::Pb3<Input<Floating>>,
    cs: gpio::Pa13<Input<Floating>>,
    port: &mut Port,
) -> (
    hal::sercom::SPIMaster5<
        hal::sercom::Sercom5Pad1<hal::gpio::Pb3<hal::gpio::PfD>>,
        hal::sercom::Sercom5Pad2<hal::gpio::Pb22<hal::gpio::PfD>>,
        hal::sercom::Sercom5Pad3<hal::gpio::Pb23<hal::gpio::PfD>>,
    >,
    hal::gpio::Pa13<hal::gpio::Output<hal::gpio::PushPull>>,
) {
    let gclk0 = clocks.gclk0();
    let flash = SPIMaster5::new(
        &clocks.sercom5_core(&gclk0).unwrap(),
        48.mhz(),
        hal::hal::spi::Mode {
            phase: hal::hal::spi::Phase::CaptureOnFirstTransition,
            polarity: hal::hal::spi::Polarity::IdleLow,
        },
        sercom5,
        pm,
        (miso.into_pad(port), mosi.into_pad(port), sck.into_pad(port)),
    );
    let mut cs = cs.into_push_pull_output(port);
    // We’re confident that set_high won’t error here because on-board
    // GPIO pins don’t error.
    cs.set_high().unwrap();
    (flash, cs)
}
pub fn flash_spi_master ( clocks : & mut GenericClockController , sercom5 : pac :: SERCOM5 , pm : & mut pac :: PM , sck : gpio :: Pb23 < Input < Floating > > , mosi : gpio :: Pb22 < Input < Floating > > , miso : gpio :: Pb3 < Input < Floating > > , cs : gpio :: Pa13 < Input < Floating > > , port : & mut Port , ) -> ( hal :: sercom :: SPIMaster5 < hal :: sercom :: Sercom5Pad1 < hal :: gpio :: Pb3 < hal :: gpio :: PfD > > , hal :: sercom :: Sercom5Pad2 < hal :: gpio :: Pb22 < hal :: gpio :: PfD > > , hal :: sercom :: Sercom5Pad3 < hal :: gpio :: Pb23 < hal :: gpio :: PfD > > , > , hal :: gpio :: Pa13 < hal :: gpio :: Output < hal :: gpio :: PushPull > > , ) { let gclk0 = clocks . gclk0 ( ) ; let flash = SPIMaster5 :: new ( & clocks . sercom5_core ( & gclk0 ) . unwrap ( ) , 48 . mhz ( ) , hal :: hal :: spi :: Mode { phase : hal :: hal :: spi :: Phase :: CaptureOnFirstTransition , polarity : hal :: hal :: spi :: Polarity :: IdleLow , } , sercom5 , pm , ( miso . into_pad ( port ) , mosi . into_pad ( port ) , sck . into_pad ( port ) ) , ) ; let mut cs = cs . into_push_pull_output ( port ) ; // We’re confident that set_high won’t error here because on-board // GPIO pins don’t error. cs . set_high ( ) . unwrap ( ) ; ( flash , cs ) }
Convenience for accessing the on-board SPI Flash device.
Convenience for accessing the on - board SPI Flash device .
clocks
&mut GenericClockController
sercom5
pac::SERCOM5
pm
&mut pac::PM
sck
gpio::Pb23<Input<Floating>>
mosi
gpio::Pb22<Input<Floating>>
miso
gpio::Pb3<Input<Floating>>
cs
gpio::Pa13<Input<Floating>>
port
&mut Port
clocks
&mut GenericClockController
sercom5
pac::SERCOM5
pm
&mut pac::PM
sck
gpio::Pb23<Input<Floating>>
mosi
gpio::Pb22<Input<Floating>>
miso
gpio::Pb3<Input<Floating>>
cs
gpio::Pa13<Input<Floating>>
port
&mut Port