Close

Investigating QMK on the esp32

A project log for lalboard

A 3D-printed keyboard inspired by the DataHand.

Ben GruverBen Gruver 03/24/2021 at 07:293 Comments

QMK seems to be a popular open source keyboard firmware. I've read through their docs a bit, and I think it should mostly support everything that is needed for the lalboard. Namely split keyboards and a robust key mapping mechanism that should be able to support the various mode keys/modes that the lalboard needs.

The only problem is that it doesn't support esp32. I guess I *could* switch to a compatible board/MCU, but a brief search doesn't show anything readily available that is as featureful, available, and cheap as esp32. And there seems to be at least some demand out there for running qmk on an esp32, so I thought I would poke at it bit.

After much gnashing of teeth (and keys), I managed to get a very very hacky proof of concept that compiles and links. This involves

This is far from an actually functional proof-of-concept, but I think I'm convinced it's at least within the realm of possibility now. I think the next steps will be to more fully implement and integrate the new esp32 functionality in qmk, and ideally figure out some way to link the two builds, to avoid having to build in multiple places and copy stuff around between them.

I doubt something like this would be accepted by the qmk maintainers, since it's essentially using bailing wire and duct tape to smoosh 2 different build systems together. But hopefully it can at least serve as a template for others who want to use qmk on an esp32.

Discussions

dlslide wrote 04/20/2021 at 22:05 point

Hey Ben have you had a look at this project yet? https://github.com/Galzai/MK32

  Are you sure? yes | no

Yang Hu wrote 04/19/2021 at 21:09 point

I'm unfamiliar with esp32, what are the features that you feel are lacking in mcu like STM32F072?

it's natively supported by qmk and is relative cheap. (about $3 in jlcpcb if you use their pcb assembly service: https://jlcpcb.com/parts/componentSearch?isSearch=true&searchTxt=STM32F072CBU6). There're a few open source keyboard designs available using this mcu that should be easy to migrated to your project, like the ferris(https://github.com/pierrechevalier83/ferris/tree/main/0.2)

  Are you sure? yes | no

Ben Gruver wrote 03/26/2021 at 03:23 point

I think I have a build structure that mostly works now. I have an esp-idf project set up, which has my qmk-with-modifications as a git submodule, and using cmake's ExternalProject_add to drive qmk's build, and consuming the static library that it produces -- with the ability to reference code in either direction. e.g. to call qmk's keyboard_task() from the main() function in the esp-idf project, and to call hardware-specific functionality from the new esp32 platform code in my modified version of qmk.

Still lots of stubs that need implementing though :)

  Are you sure? yes | no