Warning
I am still working on this. these devices are quite a bit more complicated to interface in C than these, so it will probly take some time. I ended up consolidating these into a single repo at pipd.
Various libs for working with an i2c 4 rotary-encoder thing on a pi.
- linux-4encoder - C lib. Just uses regular linux stuff.
- puredata-pi4encoder - Puredata extension that use linux-4encoder
- Simple python example here that uses blinka/circuitpython
There is reference here for i2c format.
Make sure to add this to your /boot/firmware/config.txt
:
# dtparam=i2c_arm=on,i2c_arm_baudrate=50000
# dtparam=i2c_arm=on,i2c_arm_baudrate=100000
# dtparam=i2c_arm=on,i2c_arm_baudrate=400000
dtparam=i2c_arm=on,i2c_arm_baudrate=1000000
- Have a look here for a pretty complete i2c OLED driver. This idea should work for all 3 (OLED, 4encoder, 8encoder)