tinygo-org / drivers

TinyGo drivers for sensors, displays, wireless adaptors, and other devices that use I2C, SPI, GPIO, ADC, and UART interfaces.
https://tinygo.org
BSD 3-Clause "New" or "Revised" License
584 stars 180 forks source link

Rotary encoder support #648

Closed bgould closed 4 months ago

bgould commented 5 months ago

This is a driver for typical rotary encoders based on:

https://gist.github.com/aykevl/3fc1683ed77bb0a9c07559dfe857304a

Not sure if the package name I've chosen is the best, I'm open to suggestions to change it.

deadprogram commented 5 months ago

Not sure if the package name I've chosen is the best, I'm open to suggestions to change it.

Might as well just name it rotary_encoder to make Go happy.

Thanks for adding this @bgould

soypat commented 5 months ago

I'd suggest naming the package encoders and adding this as a QuadratureViaInterrupt type (or similar name) to identify what kind of encoder it is and what it's working principle is. This would also allow future additions of other encoder types under a single, easy to find package. I'd also name the Config type QuadratureConfig.

deadprogram commented 4 months ago

Thanks for adding this @bgould and to @soypat for all the feedback. Now merging.