Friday, April 14, 2023

Crkbd keymap from configurator json and using kb2040 microcontroller

 


I wanted to document this for anyone else who's not super familiar with qmk and wants to get a setup working with the kb2040.   Here are the steps I followed:

Design a layout on QMK Configurator

https://config.qmk.fm/#/crkbd/rev1/LAYOUT_split_3x6_3

Export the json, e.g. to ~/Downloads/my_custom_keymap.json

Setup QMK on your computer

sudo apt install python3-pip

pip3 install qmk

qmk setup

And setup the keymap

We copy the default keymap directory and replace keymap.c with one based on our json.

cd ~/qmk_firmware/keyboards/crkbd/keymaps

cp default foo

cd foo

mv keymap.c keymap.c.defaultl

qmk json2c ~/Downloads/my_custom_keymap.json > keymap.c

Then build the firmware and flash it!

The secret sauce here was "CONVERT_TO=kb2040" - I didn't have to modify anything else, it just did what was needed to make this compatible with the kb2040 microcontrollers.

qmk flash -kb crkbd -km foo -e CONVERT_TO=kb2040

Press the boot button on the mcu, plug it into usb, and it should flash.  You can run it again for the second half of the kb, or just drag the .df2 over to it.