--- /dev/null
+//
+// Inspired by MicroDox:
+// http://geekhack.org/index.php?topic=42231.msg1062851#msg1062851
+// https://www.massdrop.com/ext/ergodox/?referer=CTL63V&hash=9ff8ddbb75e03e517aaa39acabc81669
+//
+
+static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /*
+ * Keymap: Default Layer in QWERTY
+ *
+ * ,--------------------------------------------------. ,--------------------------------------------------.
+ * | | | | | | | | | | | | | | | |
+ * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
+ * | Tab | Q | W | E | R | T | | | | Y | U | I | O | P | [ |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | Tab/Shf| A | S | D | F | G |------| |------| H | J | K | L | ; | ' |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | LCtrl/~| Z | X | C | V | B | | | | N | M | , | . | / | ] |
+ * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
+ * | | | Caps | LAlt | LGui | | RGui | | | | |
+ * | | | | Spc | Esc | | | | | | |
+ * `----------------------------------' `----------------------------------'
+ * ,-------------. ,-------------.
+ * | | | | | |
+ * ,------|------|------| |------+------+------.
+ * | | | | | | | |
+ * | BkSp | Del |------| |------| Enter| Space|
+ * | | | Esc | | Ins | | |
+ * | LCtl | LSft | LAlt | | RAlt | RSft | RCtl |
+ * `--------------------' `--------------------'
+ *
+ *
+ *
+ ****************************************************************************************************
+ *
+ * Under XOrg, I use my own mapping from QWERTY to "Workman for Programmers"
+ * See XOrg files in ./addons/ subdirectory.
+ *
+ * I have to do so, because of two things:
+ * 1) my native language is Russian, and XOrg keymap for it is based on QWERTY layout
+ * 2) I want to have non-standart shifted keys, like $ (as normal) and @ (as shifted), or _ and -
+ *
+ * And even if (2) could be solved using FN* keys (but there is limit in firmware for only 32 such
+ * keys), then (1) can't be solved at firmware level at all.
+ *
+ * So, I have to stick with QWERTY as my main layout + my own XOrg keyboard layout for English.
+ * But sometimes I have to input something when XOrg is not active - for example, in Linux console,
+ * or in firmware console (while debugging firmware), or when keyboard is connected to not my computer.
+ *
+ * For such cases I have Layer1 :)
+ * // hint: switch to Layer1 is only at Layer6
+ *
+ ****************************************************************************************************
+ *
+ *
+ *
+ * Keymap: Default Layer in Workman
+ *
+ * ,--------------------------------------------------. ,--------------------------------------------------.
+ * | | | | | | | | | | | | | | | |
+ * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
+ * | Tab | Q | D | R | W | B | | | | J | F | U | P | $ | : |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | Tab/Shf| A | S | H | T | G |------| |------| Y | N | E | O | I | - |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | LCtrl | Z | X | M | C | V | | | | K | L | , | . | / | | |
+ * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
+ * | | | Caps | LAlt | LGui | | RGui | | | | |
+ * | | | | Spc | Esc | | | | | | |
+ * `----------------------------------' `----------------------------------'
+ * ,-------------. ,-------------.
+ * | | | | | |
+ * ,------|------|------| |------+------+------.
+ * | | | | | | | |
+ * | BkSp | Del |------| |------| Enter| Space|
+ * | | | Esc | | Ins | | |
+ * | LCtl | LSft | LAlt | | RAlt | RSft | RCtl |
+ * `--------------------' `--------------------'
+ *
+ * Keymap: Default Layer in Workman / with Shift
+ *
+ * ,--------------------------------------------------. ,--------------------------------------------------.
+ * | | | | | | | | | | | | | | | |
+ * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
+ * | Tab | Q | D | R | W | B | | | | J | F | U | P | @ | % |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | Tab/Shf| A | S | H | T | G |------| |------| Y | N | E | O | I | _ |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | LCtrl | Z | X | M | C | V | | | | K | L | , | . | / | & |
+ * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
+ * | | | Caps | LAlt | LGui | | RGui | | | | |
+ * | | | | Spc | Esc | | | | | | |
+ * `----------------------------------' `----------------------------------'
+ * ,-------------. ,-------------.
+ * | | | | | |
+ * ,------|------|------| |------+------+------.
+ * | | | | | | | |
+ * | BkSp | Del |------| |------| Enter| Space|
+ * | | | Esc | | Ins | | |
+ * | LCtl | LSft | LAlt | | RAlt | RSft | RCtl |
+ * `--------------------' `--------------------'
+ *
+ * | ~ | ; | ! | # | { | } | ' | | ^ | [ | ] | * | ( | ) | = |
+ * | ` | 1 | 2 | 3 | 4 | 5 | " | | \ | 6 | 7 | 8 | 9 | 0 | + |
+ */
+
+ KEYMAP( // Layer0: default, leftled:none
+ // left hand
+ NO, NO, NO, NO, NO, NO, NO,
+ TAB, Q, W, E, R, T, NO,
+ FN11,FN28,FN29,FN30,FN21,G,
+ FN12,FN24,FN25,FN26,FN27,B, NO,
+ NO, NO, CAPS,FN13,FN14,
+ NO, NO,
+ NO,
+ FN5, FN6, FN7,
+ // right hand
+ NO, NO, NO, NO, NO, NO, NO,
+ NO, Y, U, I, O, P, LBRC,
+ H, J, K, L, FN22,FN15,
+ NO, N, M, COMM,DOT, SLSH,FN16,
+ RGUI,FN17,NO, NO, NO,
+ NO, NO,
+ NO,
+ FN8, FN9, FN10
+ ),
+
+ KEYMAP( // Layer1: Workman layout, leftled:all
+ // left hand
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,Q, D, R, W, B, TRNS,
+ TRNS,A, S, H, T, G,
+ TRNS,Z, X, M, C, V, TRNS,
+ TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,TRNS,
+ TRNS,
+ TRNS,TRNS,TRNS,
+ // right hand
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,J, F, U, P, 4, TRNS,
+ Y, N, E, O, I, TRNS,
+ TRNS,K, L, TRNS,TRNS,TRNS,TRNS,
+ TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,TRNS,
+ TRNS,
+ TRNS,TRNS,TRNS
+ ),
+
+ KEYMAP( // Layer2: numpad, leftled:blue
+ // left hand
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,NO, NO, NO, NO, NO, TRNS,
+ TRNS,NO, NO, NO, TRNS,NO,
+ TRNS,NO, NO, NO, TRNS,NO, TRNS,
+ TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,TRNS,
+ TRNS,
+ TRNS,TRNS,TRNS,
+ // right hand
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,NLCK,P7, P8, P9, PMNS,PGUP,
+ PAST,P4, P5, P6, PPLS,PGDN,
+ TRNS,FN17,P1, P2, P3, PSLS,PENT,
+ P0, PDOT,SLSH,NO, NO,
+ TRNS,TRNS,
+ TRNS,
+ TRNS,TRNS,TRNS
+ ),
+
+ KEYMAP( // Layer3: F-keys + PgUp/PgDn on right hand, leftled:green
+ // left hand
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,NO, NO, NO, NO, NO, TRNS,
+ TRNS,NO, TRNS,NO, NO, NO,
+ TRNS,NO, TRNS,NO, NO, NO, TRNS,
+ TRNS,TRNS,TRNS,LALT,LGUI,
+ TRNS,TRNS,
+ TRNS,
+ LCTL,LSFT,LALT,
+ // right hand
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,PSCR,F1, F2, F3, F4, PGUP,
+ SLCK,F5, F6, F7, F8, PGDN,
+ TRNS,PAUS,F9, F10, F11, F12, APP,
+ RGUI,RALT,TRNS,TRNS,TRNS,
+ TRNS,TRNS,
+ TRNS,
+ RALT,RSFT,RCTL
+ ),
+
+ KEYMAP( // Layer4: unconvenient keys on right hand, leftled:red
+ // left hand
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,NO, NO, NO, NO, NO, TRNS,
+ TRNS,TRNS,NO, NO, NO, NO,
+ TRNS,TRNS,NO, NO, NO, NO, TRNS,
+ TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,TRNS,
+ TRNS,
+ TRNS,TRNS,TRNS,
+
+ // in Workman right hand will be:
+ //
+ // ^ { } ( ) +
+ // ' ! $ " ; =
+ // # [ < > ] \
+ //
+
+ // right hand
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,MINS,4, 5, 9, 0, PPLS,
+ BSLS,2, P, FN1, 1, EQL,
+ TRNS,3, 6, FN3, FN4, 7, FN2,
+ TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,TRNS,
+ TRNS,
+ TRNS,TRNS,TRNS
+ ),
+
+ KEYMAP( // Layer5: cursor, leftled:red
+ // left hand
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,NO, NO, NO, NO, NO, TRNS,
+ TRNS,NO, NO, NO, TRNS,NO,
+ TRNS,NO, NO, NO, NO, NO, TRNS,
+ TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,TRNS,
+ TRNS,
+ TRNS,TRNS,TRNS,
+ // right hand
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,PGUP,HOME,END, DEL, INS, PGUP,
+ PGDN,LEFT,UP, DOWN,RGHT,PGDN,
+ TRNS,NO, HOME,END, DEL, INS, TRNS,
+ TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,TRNS,
+ TRNS,
+ TRNS,TRNS,TRNS
+ ),
+
+ KEYMAP( // Layer6: F1-F10, Workman-layer switch, Teensy, layer switches, leftled:red+onboard
+ // left hand
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
+ FN0, F1, F2, F3, F4, F5, TRNS,
+ TRNS,FN18,NO, NO, FN19,NO,
+ TRNS,NO, NO, NO, FN19,NO, TRNS,
+ TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,TRNS,
+ TRNS,
+ TRNS,TRNS,TRNS,
+ // right hand
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,F6, F7, F8, F9, F10, FN0,
+ FN0, NO, NO, NO, TRNS,TRNS,
+ TRNS,NO, NO, NO, NO, NO, TRNS,
+ TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,TRNS,
+ TRNS,
+ TRNS,TRNS,TRNS
+ ),
+
+ //
+ // rarely used
+ //
+
+ KEYMAP( // Layer7: F-keys only, leftled:red
+ // left hand
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,F13, F14, F15, F16, NO, TRNS,
+ TRNS,F17, F18, F19, F20, NO,
+ TRNS,F21, F22, F23, F24, NO, TRNS,
+ TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,TRNS,
+ TRNS,
+ TRNS,TRNS,TRNS,
+ // right hand
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,NO, F1, F2, F3, F4, TRNS,
+ NO, F5, F6, F7, F8, TRNS,
+ TRNS,NO, F9, F10, F11, F12, TRNS,
+ TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,TRNS,
+ TRNS,
+ TRNS,TRNS,TRNS
+ ),
+
+ KEYMAP( // Layer8: mouse and navigation, leftled:blue and green
+ // left hand
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,NO, NO, NO, NO, NO, TRNS,
+ TRNS,NO, NO, TRNS,NO, NO,
+ TRNS,NO, NO, TRNS,NO, NO, TRNS,
+ TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,TRNS,
+ TRNS,
+ TRNS,TRNS,TRNS,
+
+ // right hand
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,BTN2,WH_L,WH_U,WH_D,WH_R,PGUP,
+ BTN1,MS_L,MS_U,MS_D,MS_R,PGDN,
+ TRNS,BTN3,HOME,END, DEL, INS, NO,
+ TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,TRNS,
+ TRNS,
+ TRNS,TRNS,TRNS
+ ),
+
+/*
+ // templates to copy from
+
+ KEYMAP( // LayerN: transparent on edges + hard-defined thumb keys, all others are empty
+ // left hand
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,NO, NO, NO, NO, NO, TRNS,
+ TRNS,NO, NO, NO, NO, NO,
+ TRNS,NO, NO, NO, NO, NO, TRNS,
+ TRNS,TRNS,TRNS,LALT,LGUI,
+ TRNS,TRNS,
+ TRNS,
+ LCTL,LSFT,TRNS,
+ // right hand
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,NO, NO, NO, NO, NO, TRNS,
+ NO, NO, NO, NO, NO, TRNS,
+ TRNS,NO, NO, NO, NO, NO, TRNS,
+ RGUI,RALT,TRNS,TRNS,TRNS,
+ TRNS,TRNS,
+ TRNS,
+ TRNS,RSFT,RCTL
+ ),
+ KEYMAP( // LayerN: fully transparent
+ // left hand
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,TRNS,
+ TRNS,
+ TRNS,TRNS,TRNS,
+ // right hand
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,TRNS,TRNS,TRNS,TRNS,
+ TRNS,TRNS,
+ TRNS,
+ TRNS,TRNS,TRNS
+ ),
+*/
+
+};
+
+/* id for user defined functions */
+enum function_id {
+ TEENSY_KEY,
+};
+
+/*
+ * Fn action definition
+ */
+static const uint16_t PROGMEM fn_actions[] = {
+ ACTION_FUNCTION(TEENSY_KEY), // FN0 - Teensy key
+
+ // Layer4: unconvenient keys on right hand
+ ACTION_MODS_KEY(MOD_LSFT, KC_BSLS), // FN1 = Shifted BackSlash // " in Workman
+ ACTION_MODS_KEY(MOD_LSFT, KC_MINS), // FN2 = Shifted Minus // \ in Workman
+ ACTION_MODS_KEY(MOD_LSFT, KC_COMM), // FN3 = Shifted comma // < in Workman
+ ACTION_MODS_KEY(MOD_LSFT, KC_DOT), // FN4 = Shifted dot // > in Workman
+
+ // Dual-role keys on thumbs
+ ACTION_MODS_TAP_KEY(MOD_LCTL, KC_BSPC), // FN5 = LShift with tap BackSpace
+ ACTION_MODS_TAP_KEY(MOD_LSFT, KC_DEL), // FN6 = LCtrl with tap Delete
+ ACTION_MODS_TAP_KEY(MOD_LALT, KC_ESC), // FN7 = LAlt with tap Escape
+ ACTION_MODS_TAP_KEY(MOD_RALT, KC_INS), // FN8 = RAlt with tap Ins
+ ACTION_MODS_TAP_KEY(MOD_RSFT, KC_ENT), // FN9 = RShift with tap Enter
+ ACTION_MODS_TAP_KEY(MOD_RCTL, KC_SPC), // FN10 = RCtrl with tap Space
+
+ // Dual-role keys on pinkies
+ ACTION_MODS_TAP_KEY(MOD_LSFT, KC_TAB), // FN11 = LShift with tap Tab
+ ACTION_MODS_TAP_KEY(MOD_LCTL, KC_GRV), // FN12 = LCtrl with tap Tilda
+ ACTION_MODS_TAP_KEY(MOD_LALT, KC_SPC), // FN13 = LAlt with tap Space
+ ACTION_MODS_TAP_KEY(MOD_LGUI, KC_ESC), // FN14 = LGui with tap Escape
+ ACTION_MODS_TAP_KEY(MOD_RSFT, KC_QUOT), // FN15 = RShift with tap quotes
+ ACTION_MODS_TAP_KEY(MOD_RCTL, KC_RBRC), // FN16 = RCtrl with tap ]
+
+ // Layers switching
+ ACTION_LAYER_SET(0, ON_BOTH), // FN17 - set Layer0
+ ACTION_LAYER_SET(1, ON_BOTH), // FN18 - set Layer1, to use Workman layout at firmware level
+ ACTION_LAYER_SET(2, ON_BOTH), // FN19 - set Layer2, to use with Numpad keys
+
+ ACTION_LAYER_MOMENTARY(2), // UNUSED: FN20 - momentary Layer2, to use with Numpad keys
+ ACTION_LAYER_TAP_KEY(5, KC_F), // FN21 - momentary Layer5, to use with cursor
+ ACTION_LAYER_TAP_KEY(6, KC_SCLN), // FN22 - tapping ; Layer6, to use with F1-F10, Workman-layer switch, Teensy, layer switches
+ ACTION_LAYER_MOMENTARY(7), // UNUSED: FN23 - momentary Layer7, to use with F* keys (F1-F24)
+
+ ACTION_LAYER_TAP_KEY(4, KC_Z), // FN24 = momentary Layer4 on Z key, to use with unconvenient keys
+ ACTION_LAYER_TAP_KEY(3, KC_X), // FN25 = momentary Layer3 on X key, to use with F* keys
+ ACTION_LAYER_TAP_KEY(8, KC_C), // FN26 = momentary Layer8 on C key, to use with mouse and navigation keys
+ ACTION_LAYER_TAP_KEY(2, KC_V), // FN27 = momentary Layer2 on V key, to use with Numpad keys
+
+ // i'd like to remove this - will try to get used to live without this and convert them to usual keys
+ ACTION_LAYER_TAP_KEY(4, KC_A), // FN28 = momentary Layer4 on A key, to use with unconvenient keys
+ ACTION_LAYER_TAP_KEY(3, KC_S), // FN29 = momentary Layer3 on S key, to use with F* keys
+ ACTION_LAYER_TAP_KEY(8, KC_D), // FN30 = momentary Layer8 on D key, to use with mouse and navigation keys
+ ACTION_LAYER_TAP_KEY(2, KC_F), // UNUSED: FN31 = momentary Layer2 on F key, to use with Numpad keys
+};
+
+void action_function(keyrecord_t *event, uint8_t id, uint8_t opt)
+{
+ print("action_function called\n");
+ print("id = "); phex(id); print("\n");
+ print("opt = "); phex(opt); print("\n");
+ if (id == TEENSY_KEY) {
+ clear_keyboard();
+ print("\n\nJump to bootloader... ");
+ _delay_ms(250);
+ bootloader_jump(); // should not return
+ print("not supported.\n");
+ }
+}
+