Module atsamd_hal::sercom::pad
source · [−]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.
Enums
Traits
Type-level function mapping
OptionalPinIds to their corresponding
OptionalPadsType-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)