As Framework 16 has QMK keyboard, of course I was tempted to mess with it. But here lies the problem - to update the keyboard, one has to get into the boot mode. And to get into the boot mode, one has to simultaneously press both Alt
keys while plugging the keyboard in (or 2
and 6
key for the Numpad). That gets old really quickly. So, for my first modification, I decided to make this a bit easier.
Dedicating a key for the boot functionality was out of question. I wanted to have a full keyboard experience and not to sacrifice any keys. And that goes double for the Numpad as there isn't too many keys there to start with. So, I needed a key to serve its normal function during the day and to turn into the bootloading villain during the night. One way to signal such intent would be a long press.
But which key is unlikely to be long pressed on my keyboard you might ask. While there are couple of candidates, there is only one villain among them - CapsLock
. Rarely used intentionally, and even when used, never held for long. Oh, and look at that, we have a parallel key on the Numpad - NumLock
.
With keys decided upon, it was time to modify the firmware. Fortunately, we don't need to start from scratch as Framework already did the hard part of the job. Unfortunately, there is so many branches and the most obvious one (framework16-keyboards
) is not matching the production hardware. The last tag, v0.2.9 as I'm writing this, seems to match the hardware I have so I started from that.
So, how do we change it? Well, it's easy as adding a few lines to the process_record_user
function in keymap.c
. Something like this:
...
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+ static uint16_t bootloader_key_timer = 0;
+ static bool bootloader_other_key_recorded = false; // track if any key other than CapsLock has been pressed
+ if (keycode != KC_CAPS) { bootloader_other_key_recorded = true; }
+
switch (keycode) {
+ case KC_CAPS: // enter bootloader if CapsLock is held for 5 seconds
+ if (record->event.pressed) {
+ bootloader_key_timer = timer_read();
+ bootloader_other_key_recorded = false; // start tracking other keys
+ } else {
+ if (!bootloader_other_key_recorded) { // only go to bootloader if no other key has been pressed
+ if (timer_elapsed(bootloader_key_timer) >= 5000) {
+ bootloader_jump();
+ }
+ }
+ bootloader_key_timer = 0; // reset timer counter on release so it can be used for tracking if CapsLock is pressed
+ }
+ break;
+
case FN_LOCK:
...
This code will start timer as soon as CapsLock
is pressed and then just track if any other key has been pressed while CapsLock
is still down. If yes, it will just behave as it normally would (i.e. no bootload function). However, if there was no other keypresses and key has been held down for 5 seconds, upon releasing the CapsLock
, you will go into the bootloader mode without having to disassemble your input modules.
Not strictly necessary modification but it makes QMK development so much easier.
PS: Or you can download code from my repo containing a few additional changes (e.g. NumLock changing background level for the Numpad).