esp-rs / esp32-hal

A hardware abstraction layer for the esp32 written in Rust.
Apache License 2.0
192 stars 28 forks source link

Improve GPIO interface #33

Closed fmckeogh closed 4 years ago

fmckeogh commented 4 years ago

The current interface is good, but it would make implementing peripherals that can work on many different pins easier if we moved to an interface similar to that of the nrf-rs HALs. Instead of each interface needing macros to first define all GpioXX types that may be used during construction, but also for retrieving XX as an integer from the GpioXX type. The Pin pattern has worked well, and there open PR that reduces the size of the structure.

https://github.com/nrf-rs/nrf-hal/blob/master/nrf-hal-common/src/gpio.rs

https://github.com/nrf-rs/nrf-hal/pull/155

I can start work on a PR after I finish I2C if it sounds OK?

MabezDev commented 4 years ago

I believe #6 was trying to do this, though it seems its now closed. I think there were some unresolved issues, and it didn't fully impl all the methods. I like the idea, think it would definitely be an improvement!

fmckeogh commented 4 years ago

Addressed and tracked by #35, closing