Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initializers for peripherals based on numbers #60

Merged
merged 6 commits into from
Dec 2, 2023
Merged

Conversation

chrysn
Copy link
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
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).

@chrysn chrysn enabled auto-merge December 2, 2023 23:49
@chrysn chrysn merged commit 15341d0 into main Dec 2, 2023
51 checks passed
@chrysn chrysn deleted the init-by-number branch December 3, 2023 00:59
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