Back in January 2021, during the UK's third COVID lockdown, I designed and manufactured my own macropads from scratch, based on the at-the-time brand-new Raspberry Pi Pico.
At the time I wrote the firmware for it in Adafruit's CircuitPython because of its ease of use, especially since it supported USB HID out of the box. The firmware I wrote worked well enough and was super easy update on-the-fly.
Since then, the QMK keyboard firmware group has added support for the RP2040 microprocessor to the firmware, and since the Pi Pico that I was using died out of nowhere, I took it as a good chance to get QMK working with my hardware.
Adding a new keyboard to QMK
Once I'd gotten my fork of QMK up to date and had the QMK Python tool installed, the first thing to do was to work out how to create a new base keyboard.
Thanks to the Python tool, creating the basis of a new keyboard is as simple as running
qmk new-keyboard and following the wizard that asked for the microcontroller type and base layout, among other things.
This created a very basic wireframe keyboard layout that could then be edited - the majority of which was done in the
info.json file. To QMK's credit, even though their documentation for the most part sucks arse, this was fairly easy to do by following the example in the wireframe and using these two documentation pages.
The only hitch was, if the
info.json file fails schema validation, it'll spit out a completely useless error message:
1☒ Not including data from file: keyboards/codemicro/macropad/info.json 2☒ layouts: 'base' is not valid under any of the given schemas 3☒ 'matrix_size' 4Traceback (most recent call last): 5 File "/home/akp/.local/lib/python3.10/site-packages/milc/milc.py", line 528, in __call__ 6 return self.__call__() 7 File "/home/akp/.local/lib/python3.10/site-packages/milc/milc.py", line 533, in __call__ 8 return self._subcommand(self) 9 File "/media/akp/Code/src/codemicro/qmk_firmware/lib/python/qmk/cli/generate/rules_mk.py", line 59, in generate_rules_mk 10 kb_info_json = dotty(info_json(cli.args.keyboard)) 11 File "/media/akp/Code/src/codemicro/qmk_firmware/lib/python/qmk/info.py", line 127, in info_json 12 info_data = _extract_led_config(info_data, str(keyboard)) 13 File "/media/akp/Code/src/codemicro/qmk_firmware/lib/python/qmk/info.py", line 641, in _extract_led_config 14 cols = info_data['matrix_size']['cols'] 15KeyError: 'matrix_size' 16 17 * No bootloader specified. Please set an appropriate bootloader in your rules.mk or info.json. [ERRORS] 18 19platforms/avr/bootloader.mk:142: *** Invalid BOOTLOADER. Stop.
This is nothing to do with the bootloader - this is because, instead of setting the layout name to any name you want, you have to set it to one of the ones listed here. I only found this out with some Googling and some trial and error, not because it was clearly explained in any documentation.
Once this was out of the way, it was just a case of creating a keymap with my custom modifications for some LEDs (which was adapted from the things I covered in this post), running
qmk compile -kb codemicro/macropad -km codemicro and copying the
.uf2 file to my Pico.