Type Definition serpente::sercom::v2::spi::PadsFromIds [−][src]
pub type PadsFromIds<S, DI = NoneT, DO = NoneT, CK = NoneT, SS = NoneT> = Pads<S, <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 PinId
s instead of Pin
s
In some cases, it is more convenient to specify a set of Pads
using
PinId
s rather than Pin
s. This alias makes it easier to do so.
The first type parameter is the Sercom
, while the remaining four are
effectively OptionalPinId
s 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::typelevel::NoneT;
pub type Pads = spi::PadsFromIds<Sercom0, 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)
}