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

Leverage typelevel implementation in i2c, pwm (and a little bit in uart). #560

Closed
wants to merge 1 commit into from

Conversation

ithinuel
Copy link
Member

@ithinuel ithinuel commented Mar 4, 2023

This notably makes the documentation more readable.

@ithinuel ithinuel force-pushed the experiment-with-typelevel branch 2 times, most recently from 985bae5 to f1bfced Compare March 4, 2023 08:57
TX::Id: ValidTxPin<UART>,
RX::Id: ValidRxPin<UART>,
CTS::Id: ValidCtsPin<UART>,
RTS::Id: ValidRtsPin<UART>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm currently only reading this on my phone so it's quite likely that I'm missing the big picture, literally. But I wonder: does this still, somehow, guarantee that the combination of pins comprises a valid set of pins for the UART peripheral, as the name of the struct implies?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(it probably does, because the restriction on the Id types implies that the TX/RX/... types are also valid for the UART, right?)

Copy link
Member Author

@ithinuel ithinuel Mar 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. At least that is how I understand it.

I tried to build a Pins with an invalid set of pins (Cts instead of Rx and mixed UART) and they appropriately failed saying the ValidUartPinout bound wasn't satisfied.

Edit: It was missing the validation of the function for the tuple styled pinouts.

@ithinuel ithinuel force-pushed the experiment-with-typelevel branch 3 times, most recently from ae59170 to f75bdf6 Compare March 4, 2023 13:12
…rt).

This notably makes the documentation more readable.
@ithinuel ithinuel force-pushed the experiment-with-typelevel branch from f75bdf6 to 2aa932b Compare March 5, 2023 10:53
@jannic
Copy link
Member

jannic commented Mar 9, 2023

BTW, this is a breaking change as it removes some traits.

@ithinuel ithinuel marked this pull request as draft March 10, 2023 10:20
@ithinuel
Copy link
Member Author

Converting to draft as I'm progressing on GPIO overhaul and more breaking changes.

@ithinuel
Copy link
Member Author

Closing in favor of #585

@ithinuel ithinuel closed this Apr 22, 2023
@ithinuel ithinuel deleted the experiment-with-typelevel branch April 23, 2023 00:12
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.

2 participants