Skip to content

Add initializers for peripherals based on numbers #60

Merged
chrysn merged 6 commits intomainfrom
init-by-number
Dec 2, 2023
Merged

Add initializers for peripherals based on numbers #60
chrysn merged 6 commits intomainfrom
init-by-number

Conversation

@chrysn
Copy link
Copy Markdown
Member

@chrysn chrysn commented Oct 12, 2023

Since RIOT-OS/rust-riot-sys#17 is in, there are riot-sys functions that allow going from device numbers to device types. (That's typically an identity transformation, but we can't know that generally).

This adds a first bout of initializers to wrappers that are based on such numbers.

As a PR, this builds on #34, because practical applications can likely only pull valid input from a match on BOARD (and we really want that const).

ADC is not in because it'll depend on RIOT-OS/rust-riot-sys#34 to do anything sensible.

@chrysn
Copy link
Copy Markdown
Member Author

chrysn commented Oct 13, 2023

Added a test, along with a commit that illustrates how I think board dependent pins are best handled with the number based initializers. (As long as the boards don't provide a more high-level enumeration of user usable peripherals, that is).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant