15 KiB
The Corne keyboard is a split keyboard with 3x6 column staggered keys and 3 thumb keys.
The keyboard can be programmed using the QMK firmware for the crkbd. With the help of the mugur interface this file can be used as a literate config to generate a keymap and the relevant build files for the QMK firmware…
For reference, comparison and reading the Crkbd Keymap by Manna Harbour and drashna provide good examples of detailed configs, and the QMK tree has further specifics and a wide range of examples.
general principles
This config uses a mulit-layer qwerty layout which has emerged from a combination of writing and programming using emacs (and emacs style keybindings) on macos and linux. The numeric layer has numbers on the home row and shifted symbols on the first row, with commonly used brackets on the third row symmetrically between sides. The emacs layer(s) provide both command and prefix keys. The movement layer provides arrows (as WASD) and jump keys on the left and mouse keys (when enabled) on the right. There is a QMK reset key on each half of the keyboard.
specific mappings
Details of keyboard layout, layers, macros and general confusion can be found in the QMK docs
Layers
- qwerty and modifiers.
- numbers, symbols & brackets.
- movement. arrows & jump on the left, mouse keys on the right
- emacs layers.
- qmk control layer.
Modifiers
- Left thumb (base layer) Emacs layer,
KC_LAPO
, and GUI (held) or space (tap) - Right thumb (base layer) Enter,
KC_RAPC
, and Toggle numeric layer
The KC_LAPO
key is Left Alt when held
and (
when tapped, it can be used as Meta
. The KC_RAPC
key is Right Alt when held and )
when
tapped, it can be used for accents and non-ascii characters with the
international macos input sources.
The emacs
layer is activated with
Left-thumb-outer (L30
) and the hypm
layer can be activated with
Left-thumb-outer, right-thumb-outer (R32
)
and can be used to provide the H-
prefix
bindings defined in .emacs
The hyper
key seen by emacs is mapped to KC_RGUI
rather than the KC_HYPR
modifier combination (see also the “the infamous
Apple Fn key” for compatibility)
QMK Reset
- Left.
L20
&L30
- Right.
R25
&R05
To create a new layer, start with a blank layer.
"blank"
(
--- --- --- --- --- --- --- --- --- --- --- ---
--- --- --- --- --- --- --- --- --- --- --- ---
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- )
Details of the mugur
keycode naming can
be found in the documentation of mugur--symbol
(helpful-callable 'mugur--symbol)
A complete keymap can be defined within mugur-mugur
which will generate the required
files to build the firmware.
require 'mugur)
(
let ((mugur-qmk-path "~/qmk_firmware")
("crkbd")
(mugur-keyboard-name "LAYOUT_split_3x6_3")
(mugur-layout-name "zzkt4")
(mugur-keymap-name 175))
(mugur-tapping-term
(mugur-mugur"base"
'((t y u i o p bspace
tab q w e r ; (LT move ?\')
C a s d f g h j k l ?\
S z x c v b n m ?\, dot ?\? (MO qmik)space) ent rapc (TG numeric))
(MO emacs) lapo (G
"numeric"
(- = bspace
~ ?\! ?\@ ?\# ?\$ ?\% ?\^ ?\& ?\* 0 1 2 3 4 5 6 7 8 9 0 (LT move ent)
S --- ?\< ?\{ ?\[ ?\( ?\) ?\] ?\} ?\> | (MO emacs)
(TG qmik) C-M --- --- S (TG numeric))
"move"
(
--- M-v up --- --- --- --- --- --- --- --- ---
C-a left down right C-e --- --- --- --- --- --- ---
--- M-< C-v M-> --- --- --- --- --- --- --- ---
--- --- --- --- --- --- )
"emacs"
(0) (C-x 2) (C-x 3) (C-x 4 t) --- --- --- --- ---
esc --- --- (C-x "gtd" ent) (C-x b) --- --- "λ" --- ---
--- --- M-% --- --- (M-x "magit" ent) --- --- --- ---
reset --- M-x C-c --- ?\( ?\) (M-x 8) --- (MO hypm))
--- --- (H-i e) (C-x
"hypm"
(
--- --- --- --- --- --- --- --- H-i (H-i o) (H-i l) ---
--- --- --- H-d --- --- --- --- --- --- --- ---
--- --- --- --- --- --- --- H-m (H-m s) --- --- ---
--- --- --- --- --- --- )
"qmik"
(
--- rgb_tog rgb_mod --- --- --- --- --- --- --- --- reset
rgb_sad rgb_vad rgb_hud --- --- --- --- --- --- --- --- ---
rgb_sai rgb_vai rgb_hui --- --- --- --- --- --- --- S ---
--- --- --- --- --- --- ) )))
keymap.c
This will generate a keymap.c
file with
org-babel-tangle
and should be run before
the elisp code block for the keymap described above.
#include QMK_KEYBOARD_H
#include "version.h"
mugur
will write the keymap and only
overwrite the region between these comments.
// START-MUGUR-REGION
// END-MUGUR-REGION
add an fm logo animation…
#ifdef OLED_DRIVER_ENABLE
// 'fm_logo-128x32', 32x128px
static void render_logo(void) {
static const char PROGMEM fm_logo[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x20, 0x70, 0x78, 0x78, 0x78, 0x78, 0x38, 0x30, 0x60, 0xd0, 0xc0, 0x80,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x83, 0xcf, 0xfe, 0xfc, 0xf0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06, 0x0c, 0x0e, 0x1e, 0x1e, 0x3e, 0x7e, 0xfe, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x78, 0x70, 0x70, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00,
0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xc0, 0xc0, 0xc0, 0xe0, 0xfb,
0xff, 0xff, 0x83, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x03, 0x03, 0x07, 0x07, 0x0f, 0x1f, 0x7f, 0xff, 0xff,
0x7f, 0x3f, 0x3f, 0x1f, 0x1f, 0x1e, 0x1e, 0x1c, 0x1c, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x30, 0x30, 0x60, 0x60, 0x60, 0xe0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf8, 0xf8, 0xfe, 0xff, 0xf8,
0xe0, 0xe0, 0xc0, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x0f, 0xff, 0xff, 0xff, 0x1f, 0x0f, 0x07,
0x07, 0x07, 0x03, 0x03, 0x83, 0x83, 0x83, 0x83, 0x83, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x07, 0x0e, 0x1c, 0xf8,
0xfc, 0xfe, 0x6f, 0xe7, 0xf3, 0xf9, 0xf9, 0xf9, 0xf9, 0xf3, 0xe3, 0x07, 0x1e, 0xfc, 0xf0, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x07, 0x0f, 0x1c, 0x38, 0x33, 0x33, 0x77, 0x77, 0x33, 0x33, 0x39, 0x1c, 0x0f, 0x07, 0x01, 0x00
};
(fm_logo, sizeof(fm_logo));
oled_write_raw_P}
// rotate the OLEDs
(oled_rotation_t rotation) {
oled_rotation_t oled_init_userif (isLeftHand) {
return OLED_ROTATION_270;
} else {
return OLED_ROTATION_90;
}
}
void oled_task_user(void) {
();
render_logo(5);
oled_scroll_set_speed();
oled_scroll_left}
#endif
turn on (or off) debug info (check that CONSOLE_ENABLE
is set accordingly in rules.mk
)
void keyboard_post_init_user(void) {
=true;
debug_enable//debug_matrix=true;
=true;
debug_keyboard//debug_mouse=true;
}
rules.mk
this will create a rules.mk
file with
some specifics for the Corne
Keyboard (CRKBD)
BOOTLOADER = atmel-dfu # Elite-C
RGBLIGHT_ENABLE = no
RGB_MATRIX_ENABLE = yes # WS2812 # per-key RGB and underglow
UNICODE_ENABLE = yes
OLED_DRIVER_ENABLE = yes
MOUSEKEY_ENABLE = no # use mouse keys or not
CONSOLE_ENABLE = no # debug info
config.h
This will generate a config.h
file
#define EE_HANDS
taping timing and tap/hold (as seen in the QMK docs)
#define TAPPING_TERM 175
#define COMBO_TERM 300
#define RETRO_TAPPING
Unicode input method (tangle as required)
#define UNICODE_SELECTED_MODES UC_MAC
#define UNICODE_SELECTED_MODES UC_LNX, UC_MAC
for VIA compatibility (if needed)
#define VENDOR_ID 0x4653
#define PRODUCT_ID 0x0001
RGB matrix & lighting effects
#ifdef RGB_MATRIX_ENABLE
#define RGB_MATRIX_KEYPRESSES // reacts to keypresses
#define RGB_DISABLE_WHEN_USB_SUSPENDED true // turn off effects when suspended
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
#define RGB_MATRIX_LED_PROCESS_LIMIT (DRIVER_LED_TOTAL + 4) / 5 // limits the number of LEDs to process in an animation per task run (increases keyboard responsiveness)
#define RGB_MATRIX_LED_FLUSH_LIMIT 16 // limits in milliseconds how frequently an animation will update the LEDs. 16 (16ms) is equivalent to limiting to 60fps (increases keyboard responsiveness)
#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 150 // limits maximum brightness of LEDs to 150 out of 255. Higher may cause the controller to crash.
#define RGB_MATRIX_HUE_STEP 8
#define RGB_MATRIX_SAT_STEP 8
#define RGB_MATRIX_VAL_STEP 8
#define RGB_MATRIX_SPD_STEP 10
Disable the animations you don't want/need. You will need to disable a good number of these because they take up a lot of space. Disable until you can successfully compile your firmware.
#define DISABLE_RGB_MATRIX_ALPHAS_MODS
#define DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN
/* #define DISABLE_RGB_MATRIX_BREATHING */
#define DISABLE_RGB_MATRIX_CYCLE_ALL
#define DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
#define DISABLE_RGB_MATRIX_CYCLE_UP_DOWN
#define DISABLE_RGB_MATRIX_CYCLE_OUT_IN
#define DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL
#define DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
#define DISABLE_RGB_MATRIX_DUAL_BEACON
#define DISABLE_RGB_MATRIX_RAINBOW_BEACON
#define DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS
#define DISABLE_RGB_MATRIX_RAINDROPS
#define DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
/* #define DISABLE_RGB_MATRIX_TYPING_HEATMAP */
#define DISABLE_RGB_MATRIX_DIGITAL_RAIN
#define DISABLE_RGB_MATRIX_SOLID_REACTIVE
#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE
#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE
#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS
#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS
#define DISABLE_RGB_MATRIX_SPLASH
#define DISABLE_RGB_MATRIX_MULTISPLASH
#define DISABLE_RGB_MATRIX_SOLID_SPLASH
#define DISABLE_RGB_MATRIX_SOLID_MULTISPLASH
Default colours & modes
#define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_TYPING_HEATMAP
#define RGB_MATRIX_STARTUP_HUE 128 // HSV_CYAN
#define RGB_MATRIX_STARTUP_SAT 255
#define RGB_MATRIX_STARTUP_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS
// #define RGB_MATRIX_STARTUP_SPD
#endif
build (generate, compile and flash cycle)
first tangle this file
(org-babel-tangle)
then write the keymap as defined above
<<keymap()>>
then compile and/or write to the keyboard
qmk compile -kb crkbd -km zzkt4
qmk flash -km zzkt4 -bl dfu
or flash one side at a time…
qmk flash -km zzkt4 -bl dfu-split-left
qmk flash -km zzkt4 -bl dfu-split-right
illustrative
further
- QMK Configurator (for crkbd)
- Build log - Josef Adamčík
- Build log - Thomas Baart
- Keyboard Layouts (wikipedia)