Method 2: Compiling a .hex from source
This method is a bit more involved, especially on Windows. We recommend compiling from
source in the following cases:
1. You want to create new firmware retaining Unicode input or other functionality supported
by TMK but not by the Keyboard Firmware Builder site
2. You are familiar with C and/or Makefiles, including the necessary dev tools
3. You are curious what the source code used to create Mathkeeb’s firmware looks like
Before modifying any Mathkeeb keymap files you will need to set up a development
environment. Linked below is the documentation website for TMK, the open-source firmware
builder tool on which Mathkeeb and many other custom keyboards are based.
https://github.com/tmk/tmk_keyboard/blob/master/tmk_core/doc/build.md
Click this link and follow Step 1: Install Tools. After doing this, you should have the necessary
“toolchain” to compile a .hex for Mathkeeb. Note that the Mathkeeb does use the PJRC Teensy, and
you will need the Teensy Loader to flash any new .hex files onto Mathkeeb (this is covered in the
“Reprogramming” section above).
You do not need to bother with Step 2, as all of the source files for Mathkeeb are provided as a .zip
on the advanced users page of our website. All you need to do is download and extract this .zip to a
location of your choice.
NOTE:
You should avoid working in a directory that has spaces in the file path (e.g. “Program Files”)
as this can cause problems. Stick to a path like C:\Users\Apogee\... instead.
For most changes that you might want to make to Mathkeeb’s layout, you will need to open
and edit one of the keymap.c files. Which one you choose will depend on your operating system: the
keymap.c located in the ‘windows’ folder has macros for Alt codes, whereas the one in the ‘linux’
folder has macros for Unicode input.
First, open the keymap.c file in your text editor of choice. You should see something similar to the
figure below. What you are looking at is each layer of Mathkeeb, expressed as a matrix of keycodes.
You will notice that the default firmware only uses the first 8 layers, although TMK supports a
maximum of 32 layers.
7