Type Definition atsamd_hal::sercom::i2c::PadsFromIds
source · [−]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 two are
PinId
s 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)
}