You can set a gpio pin mode to PULLUP, and there’s a function built in to the freertos/arduino stuff for the ESP32 to convert that gpio pin signal to an interrupt. From there you can pass in a function pointer to run upon receiving the interrupt.
The rotary encoder I bought simply applies pulses to one pin when spinning clockwise, and another pin when spinning counter clockwise, so I just attached the interrupts to two separate gpio pins, and sent the updates to the mouse stuff directly in the interrupt handler. I simply moved the mouse N units to the right or left if going clockwise or counterclockwise.
I’m sure it’s not ideal but it worked to play breakout. I’m still a little new to the world of microcontrollers so it’s possible that I did something dumb.
There is also a very simple and straightforward chip that will convert quadrature to pulses. Ls7183n. It's kind of unnecessary if you can write your own interrupt handlers but it's useful if you're just working with discrete electronics
The LSI-Logic encoder interface chips are nice if your encoders are running at thousands of RPM. You also have to jump though a few more hoops than just an online order (I use an LSI device in a machine tool reconditioning product), so it's not particularly hobbyist-friendly. I'd be hard pressed to imagine anyone using them if they didn't absolutely have to.
Huh... I'm a hobbyist and I got them at digikey for about $5/chip. It ships in a couple weeks directly from LSI. My personal goal was to eliminate one microcontroller from my project. I would probably not use one in the future as long as my project had even a basic microcontroller.
I just checked and the LSI7366R (the version I use) is now available through Digi-Key. They have really expanded their Marketplace program. I used to have to buy them directly from LSI: it wasn't a big deal to setup an account with them, but it's nice to know that next time I can just piggyback it onto my Digikey order. Although if the delay is a couple weeks I'd have to plan ahead. They typically get them to me in a couple of days.
The rotary encoder I bought simply applies pulses to one pin when spinning clockwise, and another pin when spinning counter clockwise, so I just attached the interrupts to two separate gpio pins, and sent the updates to the mouse stuff directly in the interrupt handler. I simply moved the mouse N units to the right or left if going clockwise or counterclockwise.
I’m sure it’s not ideal but it worked to play breakout. I’m still a little new to the world of microcontrollers so it’s possible that I did something dumb.