refactor(sercom): clean up underlying pad data structures #879
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change lays the groundwork for implementing synchronous and half-duplex UART by cleaning the pad modules. Each commit compiles on its own.
hal/src/sercom/pads.rs
Pads<P0, P1, P2, P3>
container, representing GPIO pins for one Sercom (each Sercom has up to 4 Pads: Pad0, Pad1, Pad2, Pad3 which can only be assigned to one Pad each -> suitable struct for storing underlying pins)roles_type
to combine Pads with protocol roles (Rx, Tx, ...)ValidPads
traitShareSercom
)ShareIoSet
)Pads
+Roles
structuresPadSet
andValidPads
have been reduced toValidPads
SercomX
arguments in pad aliases (e.g.uart::Pads<Sercom0, …>
).into()
to pick the correct alternate functionTODO:
python3 build-all.py
runs for each commitPads
behave like the old ones (no invalid configurations).into()
calls (the old code automatically converted aPin
into the correctPad
, but replicating that behavior requires specifying a Sercom) ADormantPads
struct might hold GPIO pins until it is activated by claiming a Sercom slot (for example in theUart
constructor), coverting them to their alternate functionsThis intermediate refactoring state is shared for review and to help the team become familiar with the changes.