Skip to content

Idiomatically passing pins used for both input and output #136

Closed Answered by mciantyre
djmdjm asked this question in Q&A
Discussion options

You must be logged in to vote

One issue is that the erased pads don't know how to become a GPIO input / output. So even though we have those erased pad references, we're still not equipped to tell the GPIO port our intended direction or output state. The GPIO port normally depends on the strong type information to understand how to configure an input / output. That adds type complexity.

The solutions are definitely non-obvious. I'll provide two options that are possible in today's BSP. The commit message describes the options at a higher level. Haven't tested these beyond a type check, but I hope these can get you started.

I'm happy to answer follow-ons here, and discuss other designs that may be simpler for Rust newc…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by djmdjm
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants