pub type PadsFromIds<S, RX = NoneT, TX = NoneT, RTS = NoneT, CTS = NoneT> = Pads<S, <RX as GetOptionalPad<S>>::Pad, <TX as GetOptionalPad<S>>::Pad, <RTS as GetOptionalPad<S>>::Pad, <CTS 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. RX
, TX
, RTS
& CTS
. 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, uart};
use atsamd_hal::typelevel::NoneT;
pub type Pads = uart::PadsFromIds<Sercom0, PA08, PA09>;
pub fn create_pads() -> Pads {
let peripherals = Peripherals::take().unwrap();
let pins = Pins::new(peripherals.PORT);
uart::Pads::default().rx(pins.pa09).tx(pins.pa08)
}