Module grand_central_m4::sercom::v2::pad[][src]

Expand description

Define a SERCOM pad type

This module helps configure Pins as SERCOM pads. It provides type-level tools to convert Pins to the correct PinMode and to enforce type-level constraints at compile-time.

Overview

A SERCOM pad is defined by two types, its corresponding Sercom instance and its PadNum, from Pad0 to Pad3. However, a given SERCOM pad can usually be mapped to several possible PinIds.

There are two primary traits defined in this module:

  • The IsPad trait is implemented on Pin types that are properly configured as SERCOM pads, with PinMode AlternateC or AlternateD. It acts as both a type class for SERCOM pads and as a type-level function to recover the corresponding Sercom and PadNum types from the Pin.
  • The GetPad trait maps each PinId to its corresponding, pad-related types. The PadMode alias uses GetPad to recover the corresponding PinMode for a given SERCOM pad, while the Pad alias recovers the configured Pin type.

IOSET

SAMx5x chips do not allow arbitrary combinations of PinId for a given SERCOM. Instead, all PinIds must belong to the same IOSET. This module defines a [type-level enum], IoSet, to enforce this restriction, and the InIoSet type class is responsible for labeling each IsPad type with its corresponding, valid IoSet(s).

Enums

Type-level variant of IoSet representing SERCOM IOSET 1

Type-level variant of IoSet representing SERCOM IOSET 2

Type-level variant of IoSet representing SERCOM IOSET 3

Type-level variant of IoSet representing SERCOM IOSET 4

Type-level variant of IoSet representing SERCOM IOSET 5

Type-level variant of IoSet representing SERCOM IOSET 6

Type-level variant of PadNum representing SERCOM pad 0

Type-level variant of PadNum representing SERCOM pad 1

Type-level variant of PadNum representing SERCOM pad 2

Type-level variant of PadNum representing SERCOM pad 3

Traits

Type-level function mapping OptionalPinIds to their corresponding OptionalPads

Type-level function mapping PinIds to SERCOM-pad-related types

Type class for SERCOM pads in a given IoSet

Type-level enum representing a SERCOM IOSET

Type class for Pins configured as SERCOM pads

Type-level equivalent of Option<Pad>

Type-level equivalent of Option<PadNum>

Type-level enum representing a SERCOM pad number

Type-level equivalent of Some(Pad)

Type Definitions

Type alias to recover a Pin configured as a SERCOM pad in the correct PadMode

Type alias using GetPad to recover the PinMode for a given SERCOM pad