microsoft / RP2040MacropadHidSample

MIT License
30 stars 8 forks source link

Adding more rotary encoders #3

Open RacoonDOEggs opened 7 months ago

RacoonDOEggs commented 7 months ago

Hello, I would like to make another HID device based on the RP2040 MacroPad that uses multiple rotary encoders to control various system and app sound levels. If I want to replace the push buttons with encoders, what are all of the files I need to modify to make sure I don't forget anything? In addition, is the encoder behaviour determined in the MacroPad software or in windows?

rsolorzanomsft commented 5 months ago

The answer to this depends, are you adding a rotary encoder to the adafruit macropad talked about in this project, or are you talking about using this project as a basis for your own RP2040 project which uses two rotary encoders?

If you're talking about the latter, then I'd recommend looking at encoder.c, macropad.c, and util.h. util.h can be updated to match your RP2040 pin configuration, and you can comment out all the non-encoder related code in macropad.c. Then, in encoder.h, you can add the appropriate pin configuration/ IRQ to handle the extra encoder in initEncoder().

If you're talking about the former, then there may be something you can set up with the STEMMA QT port which uses I2C (never tried that myself). Since this project doesn't use I2C, I recommend reading the pico SDK docs.