Type Definition grand_central_m4::sercom::v2::spi::PadsFromIds[][src]

pub type PadsFromIds<S, I, DI = NoneT, DO = NoneT, CK = NoneT, SS = NoneT> = Pads<S, I, <DI as GetOptionalPad<S>>::Pad, <DO as GetOptionalPad<S>>::Pad, <CK as GetOptionalPad<S>>::Pad, <SS as GetOptionalPad<S>>::Pad>;
Expand description

Define a set of Pads using PinIds instead of Pins

In some cases, it is more convenient to specify a set of Pads using PinIds rather than Pins. This alias makes it easier to do so.

The first two type parameters are the Sercom and IoSet, while the remaining four are effectively OptionalPinIds representing the corresponding type parameters of Pads, i.e. DI, DO, CK & SS. Each of the remaining type parameters defaults to NoneT.

use atsamd_hal::pac::Peripherals;
use atsamd_hal::gpio::v2::{PA08, PA09, Pins};
use atsamd_hal::sercom::v2::{Sercom0, spi};
use atsamd_hal::sercom::v2::pad::IoSet1;
use atsamd_hal::typelevel::NoneT;

pub type Pads = spi::PadsFromIds<Sercom0, IoSet1, PA08, NoneT, PA09>;

pub fn create_pads() -> Pads {
    let peripherals = Peripherals::take().unwrap();
    let pins = Pins::new(peripherals.PORT);
    spi::Pads::default().sclk(pins.pa09).data_in(pins.pa08)
}