I've wrote a new driver for Quadrature Encoders, it actually is really simple as there are no interrupt & callbacks: if you enable the update/overflow interrupt and your motor vibrates around that value, you can get many interrupts, and actually I did not find any application which needs QEI callbacks (any suggestions?).
I started from the ICU driver files, the QEI driver simply:
- configures the given timer as QEI
- enables it with qeiEnable()
- returns the current value with qeiGetCount()
The configuration parameters are the one I saw on both STM32 and NXP17xx reference manuals: encoder mode (quadrature or direction+clock), precision (count on edges from only one channel or from both channels) and direction (invert or not the counting direction).
As attachment there are the high & low level drivers, while an updated ChibiOS source tree with everything added is here: https://github.com/openrobots-dev/ChibiOS
A demo which uses the driver (quadrature mode, both edges) with an HEDS-5540 encoder is here: https://github.com/openrobots-dev/R2P_DCM_module
With that configuration, it seems to work