Module serpente::sercom::v2::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 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.

Enums

  • 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 Definitions