Expand description
Type-level tools to configure SERCOM pads
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
IsPadtrait is implemented onPintypes that are properly configured as SERCOM pads, withPinModeAlternateCorAlternateD. It acts as both a type class for SERCOM pads and as a type-level function to recover the correspondingSercomandPadNumtypes from thePin. - The
GetPadtrait maps eachPinIdto its corresponding, pad-related types. ThePadModealias usesGetPadto recover the correspondingPinModefor a given SERCOM pad, while thePadalias recovers the configuredPintype.
§IOSET (SAMD51/SAME5x only)
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§
- IoSet1
- Type-level variant of
IoSetrepresenting SERCOM IOSET 1 - IoSet2
- Type-level variant of
IoSetrepresenting SERCOM IOSET 2 - IoSet3
- Type-level variant of
IoSetrepresenting SERCOM IOSET 3 - IoSet4
- Type-level variant of
IoSetrepresenting SERCOM IOSET 4 - IoSet5
- Type-level variant of
IoSetrepresenting SERCOM IOSET 5 - IoSet6
- Type-level variant of
IoSetrepresenting SERCOM IOSET 6 - Pad0
- Type-level variant of
PadNumrepresenting SERCOM pad 0 - Pad1
- Type-level variant of
PadNumrepresenting SERCOM pad 1 - Pad2
- Type-level variant of
PadNumrepresenting SERCOM pad 2 - Pad3
- Type-level variant of
PadNumrepresenting SERCOM pad 3 - Undoc
IoSet1 - Type-level variant of
IoSetrepresenting an undocumented SERCOM IOSET - Undoc
IoSet2 - Type-level variant of
IoSetrepresenting an undocumented SERCOM IOSET
Traits§
- Common
IoSets - Type class for accessing the intersection of IoSets of OptionalPads Currently implemented for tuples of 2 and 4 elements
- GetOptional
Pad - Type-level function mapping
OptionalPinIds to their correspondingOptionalPads - GetPad
- Type-level function mapping
PinIds to SERCOM-pad-related types - InIoSet
- Type class for SERCOM pads in a given
IoSet - IoSet
- Type-level enum representing a SERCOM IOSET
- IoSets
- Type class for corresponding IoSet indices for OptionalPads, NoneT serves as a wildcard
- IsI2c
Pad - Type class for
Pins which can be used as I2C pads - IsPad
- Type class for
Pins configured as SERCOM pads - Optional
Pad - Type-level equivalent of
Option<Pad> - Optional
PadNum - Type-level equivalent of
Option<PadNum> - PadNum
- Type-level enum representing a SERCOM pad number
- Share
IoSet - Shortcut trait for Pad tuples that share at least one IoSet
- SomePad
- Type-level equivalent of
Some(Pad)