pub type PadsFromIds<S, SDA, SCL> = Pads<S, Pad<S, SDA>, Pad<S, SCL>>;
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 type parameter is the Sercom, while the remaining two are PinIds representing the corresponding type parameters of Pads, i.e. SDA & SCL.

use atsamd_hal::pac::Peripherals;
use atsamd_hal::gpio::{PA08, PA09, Pins};
use atsamd_hal::sercom::{Sercom0, i2c};
use atsamd_hal::typelevel::NoneT;

pub type Pads = i2c::PadsFromIds<Sercom0, PA08, PA09>;

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

Implementations

Create a new Pads struct. SDA must always be SERCOM pad 0, and SCL SERCOM pad 1.{