---
title: Making My Macropad QMK-Enabled
publishedDate: 2023-01-19
tags:
    - projects
    - keyboards
---

![The macropad itself](thedeviceitself-crop.jpg)

Back in January 2021, during the UK's third COVID lockdown, I designed and manufactured [my own macropads](https://github.com/codemicro/macropad) 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](https://circuitpython.org/) 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](https://qmk.fm) 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](https://docs.qmk.fm/#/platformdev_rp2040) [pages](https://docs.qmk.fm/#/reference_info_json).

The only hitch was, if the `info.json` file fails schema validation, it'll spit out a completely useless error message:

```
☒ Not including data from file: keyboards/codemicro/macropad/info.json
☒       layouts: 'base' is not valid under any of the given schemas
☒ 'matrix_size'
Traceback (most recent call last):
  File "/home/akp/.local/lib/python3.10/site-packages/milc/milc.py", line 528, in __call__
    return self.__call__()
  File "/home/akp/.local/lib/python3.10/site-packages/milc/milc.py", line 533, in __call__
    return self._subcommand(self)
  File "/media/akp/Code/src/codemicro/qmk_firmware/lib/python/qmk/cli/generate/rules_mk.py", line 59, in generate_rules_mk
    kb_info_json = dotty(info_json(cli.args.keyboard))
  File "/media/akp/Code/src/codemicro/qmk_firmware/lib/python/qmk/info.py", line 127, in info_json
    info_data = _extract_led_config(info_data, str(keyboard))
  File "/media/akp/Code/src/codemicro/qmk_firmware/lib/python/qmk/info.py", line 641, in _extract_led_config
    cols = info_data['matrix_size']['cols']
KeyError: 'matrix_size'

 * No bootloader specified. Please set an appropriate bootloader in your rules.mk or info.json.        [ERRORS]

platforms/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](https://github.com/qmk/qmk_firmware/pull/16520/files#diff-2232705531984de977661fb9c8df9f7dfb38c15995559820f9404627bbcf9e91). 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](/blog/adding-indicator-leds)), running `qmk compile -kb codemicro/macropad -km codemicro` and copying the `.uf2` file to my Pico.