-
Notifications
You must be signed in to change notification settings - Fork 259
Edit A Keymap
Editing a keymap is core to what the keyboardio is about, and probably one of the first things to try. For this example, let's imagine you want to map ESCAPE to the PROG key in the default keymap, as the QWERTY G-ds intended.
- Open the Arduino IDE. In the “File” menu, click on the “Examples” submenu. Scroll down to ‘Model01-Firmware’.
There is a lot going on in this file. By all means, read through the code and the comments and get familiar with it if you like. Or you can just breeze past it for now and skip down to the keymaps:
- Scroll down to this line:
enum { QWERTY, FUNCTION, NUMPAD }; // layers
That's where the keymaps section begins. It tells you that there are three layers:
- QWERTY is the default, or zero layer
- FUNCTION is layer 1
- NUMPAD is layer 2
The QWERTY keymap itself is a little further down, and looks like this:
[QWERTY] = KEYMAP_STACKED
(___, Key_1, Key_2, Key_3, Key_4, Key_5, Key_LEDEffectNext,
Key_Backtick, Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Tab,
Key_PageUp, Key_A, Key_S, Key_D, Key_F, Key_G,
Key_PageDown, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Escape,
Key_LeftControl, Key_Backspace, Key_LeftGui, Key_LeftShift,
ShiftToLayer(FUNCTION),
M(MACRO_ANY), Key_6, Key_7, Key_8, Key_9, Key_0, Key_KeypadNumLock,
Key_Enter, Key_Y, Key_U, Key_I, Key_O, Key_P, Key_Equals,
Key_H, Key_J, Key_K, Key_L, Key_Semicolon, Key_Quote,
Key_RightAlt, Key_N, Key_M, Key_Comma, Key_Period, Key_Slash, Key_Minus,
Key_RightShift, Key_LeftAlt, Key_Spacebar, Key_RightControl,
ShiftToLayer(FUNCTION)),
It's a map of your keyboard's layout. The top block that starts with "(___," and ends with "ShiftToLayer(FUNCTION)," is the left half of the keyboardio. that first "___," represets the PROG key. It is a transparent key in the keymap, free to be mapped to anything you like.
At the end of the fourth row is "Key_Escape," which corresponds to the ESC key on your keyboard. That means "Key_Escape," is the keycode for the ESC key.
- Replace "___," with "Key_Escape," in the first row, so your keymap now looks like this:
[QWERTY] = KEYMAP_STACKED
(Key_Escape, Key_1, Key_2, Key_3, Key_4, Key_5, Key_LEDEffectNext,
Key_Backtick, Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Tab,
Key_PageUp, Key_A, Key_S, Key_D, Key_F, Key_G,
Key_PageDown, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Escape,
Key_LeftControl, Key_Backspace, Key_LeftGui, Key_LeftShift,
ShiftToLayer(FUNCTION),
M(MACRO_ANY), Key_6, Key_7, Key_8, Key_9, Key_0, Key_KeypadNumLock,
Key_Enter, Key_Y, Key_U, Key_I, Key_O, Key_P, Key_Equals,
Key_H, Key_J, Key_K, Key_L, Key_Semicolon, Key_Quote,
Key_RightAlt, Key_N, Key_M, Key_Comma, Key_Period, Key_Slash, Key_Minus,
Key_RightShift, Key_LeftAlt, Key_Spacebar, Key_RightControl,
ShiftToLayer(FUNCTION)),
-
Save the file.
-
While holding down the prog key, click on the right arrow in the sketch window menu bar to compile compile and install.
The Keyboardio LED's will flash across the board as the firmware is installed, and then the "LED" key will glow blue.
Now when you press the PROG key it will send an ESCAPE to your computer.
Troubleshooting
Advanced Topics
Development and customization
Keyboardio Model 01 docs
- Keyboardio Model 01 Introduction
- Flashing a new bootloader
- Default Model 01 QWERTY Layout
- Common Alternate Layouts
- Hardware Test Mode
Community