[][src]Module trinket_m0::sercom::v2::pads

Version 2 of the SERCOM pads module

This module implements the Pad type, which represents a Pin configured to act as a SERCOM pad. A Pad is parameterized by three types. The first two types identify the pad by its Sercom and PadNum. However, each SERCOM pad can usually be mapped to several possible GPIO pins. The third type must implement the Map trait, which identifies a corresponding PinId and PinMode. The PinMode is usually AlternateC or AlternateD.

To create a Pad, use the From/Into traits. Upon creation, the Pad takes ownership of the Pin. The conversion from Pin to Pad is potentially many-valued, so it usually must be constrained. On the other hand, the conversion from Pad to Pin is always unique, because the Pad always knows which Pin it contains.

let pad: Pad<Sercom0, Pad0, IoSet1> = pins.pa08.into();
let pin: Pin<_, _> = pad.into();

Because of differences in the way pins are mapped to SERCOM pads, the Map trait is implemented on different types, depending on the chip series. See the Map documentation for more details.

As a result, the actual implementations of Map are not found in this module. They are included in the pad_map module.

Structs

Pad

Represents a SERCOM Pad configured to use a particular pin

Enums

Pad0

Represents the corresponding SERCOM pad number

Pad1

Represents the corresponding SERCOM pad number

Pad2

Represents the corresponding SERCOM pad number

Pad3

Represents the corresponding SERCOM pad number

Sercom0

Represents the corresponding SERCOM instance

Sercom1

Represents the corresponding SERCOM instance

Sercom2

Represents the corresponding SERCOM instance

Sercom3

Represents the corresponding SERCOM instance

Traits

AnyPad

Meta-type representing any Pad

Map

Type-level function mapping Pads to Pins

OptionalPad

Meta-type representing an optional Pad.

PadNum

Type-level enum representing a SERCOM pad number

Sercom

Type-level enum representing a Serial Communication Interface (SERCOM)

SomePad

Meta-type representing a valid Pad.

Type Definitions

ConcretePad

Type alias to convert from an implementation of AnyPad to the corresponding concrete Pad

SERCOM

Type alias to extract the correct PAC SERCOM type from the Sercom instance