In this project, I wrote custom firmware for a macropad using the QMK framework in C. The project includes 4 main macro layers with more traditional macros such as opening vscode, writing a doxygen comment skeleton and automatically prepping a git commit ready for a message. These layers also have CPU, RAM and battery data streamed from the computer There are also two special utility layers for testing internet speed and a media player which get their data from the computer via a daemon python script. The media layer includes pause/play and song skipping as well as showing the currently playing song via the spotify API. The internet layer runs its test when requested in the background via threads so is non-blocking. I also included a dedicated arrow key layer because my macropad is a set of arrow keys which can be jumped to from any layer via a combo key. RGB indicating the current layer is also synced with my keyboard for a cool lighting effect.
Thanks to Leon Anavi for the open source hardware!
Below are images of each layer.
User Features:
Technical Features:
Data required from the computer is received by raw HID over USB. I used an enum to tag the first byte of each request and such requests are enqueued to a request queue on the macropad during matrix scanning (where keypresses are checked in the firmware). The queue is serviced at regular intervals (but interrupted for fast rgb syncign) and is also capped to avoid memory leaks.
This video demonstrates the layers which involve data streamed from the computer over raw HID. The black bar on the oled screen only shows on video, not in reality.
This video demonstrates the RGB syncing between the macropad and keyboard via the python daemon and my interrupt system.
This video demonstrates the python daemon's servicing of the requeust queue and interrupts can clearly be seen taking priority for RGB syncing. Tag bytes can also be seen, e.g. a tag byte of 1 means a CPU/RAM/Battery request.