esp-hal icon indicating copy to clipboard operation
esp-hal copied to clipboard

Generic Pin Type

Open jrmoulton opened this issue 3 years ago • 5 comments

The Hal currently lacks a generic pin type. Other HAL's such as the nrf-hal use a degrade method to obtain a generic pin. While working on the SpiDevice implementation the lack of a generic pin makes it so that I can't have a method take a type of pin2 and then take a type of pin3 for example. Is there a reason that a generic pin doesn't already exist?

jrmoulton avatar Jul 25 '22 05:07 jrmoulton

There no specific reason other than "nobody did it, yet"

bjoernQ avatar Jul 25 '22 06:07 bjoernQ

Ok. I'll work on implementing it

jrmoulton avatar Jul 25 '22 14:07 jrmoulton

I was thinking about this last week briefly (didn't get around to starting on it) but at the time I wasn't sure how to handle the banked GPIO access. Different GPIO require different registers to be read/written depending on which bank they're on, so we may need to do some runtime checks to accomplish this, unless you can come up with something clever 😁

@jrmoulton I'm happy to collaborate on this if you need any help, just let me know.

jessebraham avatar Jul 25 '22 14:07 jessebraham

Just a heads up, I'm pretty deep into a fairly extensive rework of the GPIO module, and I have a generic pin type in this work. Hoping to PR something next week.

jessebraham avatar Sep 02 '22 20:09 jessebraham

Good to know. I tried several different clever things and none of them worked so this is good to hear

jrmoulton avatar Sep 02 '22 20:09 jrmoulton