The Corne keyboard is a split keyboard with 3x6 column staggered keys and 3 thumb keys.
[[file:img/crkbd-phosphorous.jpg]]
The keyboard can be programmed using the [[https://qmk.fm/][QMK]] firmware for the [[https://github.com/foostan/crkbd][crkbd]]. With the help of the [[https://github.com/mihaiolteanu/mugur][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 [[https://github.com/manna-harbour/qmk_firmware/blob/crkbd/keyboards/crkbd/keymaps/manna-harbour/readme.org][Crkbd Keymap by Manna Harbour]] and [[https://github.com/qmk/qmk_firmware/tree/master/users/drashna][drashna]] provide good examples of detailed configs, and the [[https://github.com/qmk/qmk_firmware/tree/master/keyboards/crkbd/keymaps][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 [[https://docs.qmk.fm/#/][QMK docs]]
*Layers*
- qwerty and modifiers.
- numbers, symbols & brackets.
- movement. arrows & jump on the left, mouse keys on the right
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 “[[https://github.com/qmk/qmk_firmware/issues/2179][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.
#+BEGIN_SRC emacs-lisp :tangle no :results silent :eval no
("blank"
--- --- --- --- --- --- --- --- --- --- --- ---
--- --- --- --- --- --- --- --- --- --- --- ---
--- --- --- --- --- --- --- --- --- --- --- ---
--- --- --- --- --- --- )
#+END_SRC
Details of the =mugur= keycode naming can be found in the documentation of =mugur--symbol=
#+BEGIN_SRC emacs-lisp :tangle no :results silent
(helpful-callable 'mugur--symbol)
#+END_SRC
A complete keymap can be defined within =mugur-mugur= which will generate the required files to build the firmware.
#+name: keymap
#+BEGIN_SRC emacs-lisp :tangle no :results silent :eval query
turn on (or off) debug info (check that =CONSOLE_ENABLE= is set accordingly in =rules.mk= )
#+BEGIN_SRC c :tangle keymap.c
void keyboard_post_init_user(void) {
debug_enable=true;
//debug_matrix=true;
debug_keyboard=true;
//debug_mouse=true;
}
#+END_SRC
** rules.mk
this will create a =rules.mk= file with some specifics for the [[https://github.com/qmk/qmk_firmware/blob/c66df1664497546f32662409778731143e45a552/keyboards/crkbd/readme.md][Corne Keyboard (CRKBD)]]
#+BEGIN_SRC makefile :tangle rules.mk
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
#+END_SRC
** config.h
This will generate a =config.h= file
#+BEGIN_SRC c++ :tangle config.h
#define EE_HANDS
#+END_SRC
taping timing and tap/hold (as seen in the [[https://beta.docs.qmk.fm/using-qmk/software-features/tap_hold][QMK docs]])
#+BEGIN_SRC c++ :tangle config.h
#define TAPPING_TERM 175
#define COMBO_TERM 300
#define RETRO_TAPPING
#+END_SRC
Unicode input method (tangle as required)
#+BEGIN_SRC c :tangle config.h
#define UNICODE_SELECTED_MODES UC_MAC
#+END_SRC
#+BEGIN_SRC c :tangle no
#define UNICODE_SELECTED_MODES UC_LNX, UC_MAC
#+END_SRC
for VIA compatibility (if needed)
#+BEGIN_SRC c :tangle config.h
#define VENDOR_ID 0x4653
#define PRODUCT_ID 0x0001
#+END_SRC
RGB matrix & lighting effects
#+BEGIN_SRC c :tangle config.h
#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
#+END_SRC
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.