diff --git a/keyboards/converter/usb_usb/keymaps/chriskopher/combo.c b/keyboards/converter/usb_usb/keymaps/chriskopher/combo.c new file mode 100644 index 000000000..c0a354eb5 --- /dev/null +++ b/keyboards/converter/usb_usb/keymaps/chriskopher/combo.c @@ -0,0 +1,54 @@ +/* Copyright 2020 Christopher Ko + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "shared_enum.h" + +#include "quantum.h" + +enum combo_event { + SD_LAYER_COMBO, + KL_MEH_COMBO, +}; + +const uint16_t PROGMEM sd_combo[] = {KC_S, KC_D, COMBO_END}; // Combo: S + D for SuperDuper mode +const uint16_t PROGMEM kl_combo[] = {KC_K, KC_L, COMBO_END}; // Combo: K + L for Meh modifier + +// Register the combo action +combo_t key_combos[COMBO_COUNT] = { + [SD_LAYER_COMBO] = COMBO_ACTION(sd_combo), + [KL_MEH_COMBO] = COMBO_ACTION(kl_combo), +}; + +// Called after a combo event is triggered +void process_combo_event(uint8_t combo_index, bool pressed) { + switch (combo_index) { + case SD_LAYER_COMBO: + if (pressed) { + layer_on(_SUPERDUPER); + } else { + layer_off(_SUPERDUPER); + } + break; + + case KL_MEH_COMBO: + if (pressed) { + register_mods(MOD_MEH); + } else { + unregister_mods(MOD_MEH); + } + break; + } +} diff --git a/keyboards/converter/usb_usb/keymaps/chriskopher/config.h b/keyboards/converter/usb_usb/keymaps/chriskopher/config.h new file mode 100644 index 000000000..7714f713b --- /dev/null +++ b/keyboards/converter/usb_usb/keymaps/chriskopher/config.h @@ -0,0 +1,25 @@ +/* Copyright 2020 Christopher Ko + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#define TAPPING_TERM 200 // Delay for tap modifiers until it is considered a hold + +#define IGNORE_MOD_TAP_INTERRUPT // Enable ignore mod tap interrupt: https://docs.qmk.fm/#/tap_hold?id=ignore-mod-tap-interrupt +#define IGNORE_MOD_TAP_INTERRUPT_PER_KEY // Allows configuration of ignore mod tap interrupt per key in keymap.c + +#define COMBO_COUNT 2 // Number of defined combos +#define COMBO_TERM 20 // Delay for combo keys to be chained together diff --git a/keyboards/converter/usb_usb/keymaps/chriskopher/keymap.c b/keyboards/converter/usb_usb/keymaps/chriskopher/keymap.c new file mode 100644 index 000000000..c472f78b7 --- /dev/null +++ b/keyboards/converter/usb_usb/keymaps/chriskopher/keymap.c @@ -0,0 +1,186 @@ +/* Copyright 2020 Christopher Ko + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "shared_enum.h" + +#include QMK_KEYBOARD_H + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Modified Qwerty for chriskopher: base default layer + * ,---. ,---------------. ,---------------. ,---------------. ,-----------. + * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| + * `---' `---------------' `---------------' `---------------' `-----------' + * ,-----------------------------------------------------------. ,-----------. ,---------------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \ | |Ins|Hom|PgU| |NmL| /| *| -| + * |-----------------------------------------------------------| |-----------| |---------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| Bsp| |Del|End|PgD| | 7| 8| 9| | + * |-----------------------------------------------------------| `-----------' |-----------| | + * |Ctl/Esc| A| S| D| F| G| H| J| K| L|;/:| ' | Return| | 4| 5| 6| +| + * |-----------------------------------------------------------| ,---. |---------------| + * |Shift/( |Dev/Z| X| C| V| B| N| M| ,| .| /| Shift/)| | ↑ | | 1| 2| 3| | + * |-----------------------------------------------------------| ,-----------. |-----------| | + * |Meh/CapsL|Gui|Alt| Space |Alt|Adjust/Gui|App| Ctl| | ← | ↓ | → | | 0| .|Ent| + * `-----------------------------------------------------------' `-----------' `---------------' + */ + [_CKO] = LAYOUT_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SLCK, KC_PAUS, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_INS, KC_HOME, KC_PGUP, KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, + LCTL_T(KC_ESC), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, TD(SCLN_CLN), KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, + TD(ESPC_L), LT(_DEV,KC_Z), KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, TD(ESPC_R), KC_UP, KC_P1, KC_P2, KC_P3, + MEH_T(KC_CAPS), KC_LGUI, KC_LALT, KC_SPC, KC_RALT, LT(_ADJUST,KC_RGUI), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT + ), + + /* Regular Qwerty: default layer + * ,---. ,---------------. ,---------------. ,---------------. ,-----------. + * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| + * `---' `---------------' `---------------' `---------------' `-----------' + * ,-----------------------------------------------------------. ,-----------. ,---------------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| Bsp| |Ins|Hom|PgU| |NmL| /| *| -| + * |-----------------------------------------------------------| |-----------| |---------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ | |Del|End|PgD| | 7| 8| 9| | + * |-----------------------------------------------------------| `-----------' |-----------| | + * |CapsL | A| S| D| F| G| H| J| K| L| ;| '| Return| | 4| 5| 6| +| + * |-----------------------------------------------------------| ,---. |---------------| + * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | | ↑ | | 1| 2| 3| | + * |-----------------------------------------------------------| ,-----------. |-----------| | + * |Ctl|Gui|Alt| Space |Alt|Adjust/Gui|App|Ctl| | ← | ↓ | → | | 0| .|Ent| + * `-----------------------------------------------------------' `-----------' `---------------' + */ + [_QWERTY] = LAYOUT_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SLCK, KC_PAUS, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, LT(_ADJUST,KC_RGUI), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT + ), + + /* SuperDuper + * ,---. ,---------------. ,---------------. ,---------------. ,-----------. + * | | | | | | | | | | | | | | | | | | | | | + * `---' `---------------' `---------------' `---------------' `-----------' + * ,-----------------------------------------------------------. ,-----------. ,---------------. + * | | | | | | | | | | | | | | | | | | | | | | | | + * |-----------------------------------------------------------| |-----------| |---------------| + * | | | | | | | |1T |T← |T→ |9T | | | | | | | | | | | | | + * |-----------------------------------------------------------| `-----------' |-----------| | + * | |Alt|[SuperDuper]|Bksp|Ctl| ← | ↓ | ↑ | → |Del| | | | | | | | + * |-----------------------------------------------------------| ,---. |---------------| + * | | | | | | | | | | |ToggleSD| | | | | | | | | + * |-----------------------------------------------------------| ,-----------. |-----------| | + * | | | | Shift | | | | | | | | | | | | | + * `-----------------------------------------------------------' `-----------' `---------------' + */ + [_SUPERDUPER] = LAYOUT_ansi( + ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, + ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, + ______, ______, ______, ______, ______, ______, ______, C(KC_1), C(S(KC_TAB)), C(KC_TAB), C(KC_9), ______, ______, ______, ______, ______, ______, ______, ______, ______, + ______, KC_LALT, ______, ______, KC_BSPC, KC_LCTL, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_DEL, ______, ______, ______, ______, ______, ______, + ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, TG(_SUPERDUPER), ______, ______, ______, ______, ______, + ______, ______, ______, KC_LSFT, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______ + ), + + /* Dev + * ,---. ,---------------. ,---------------. ,---------------. ,-----------. + * | | | | | | | | | | | | | | | | | | | | | + * `---' `---------------' `---------------' `---------------' `-----------' + * ,-----------------------------------------------------------. ,-----------. ,---------------. + * | | | | | | | | | | | | | | | | | | | | | | | | + * |-----------------------------------------------------------| |-----------| |---------------| + * | | | | | | | | - | + | ( | ) | | | | | | | | | | | | | + * |-----------------------------------------------------------| `-----------' |-----------| | + * | | | | | | | _ | [ | ] | { | } | | | | | | | | + * |-----------------------------------------------------------| ,---. |---------------| + * | | | | | | | = | | | < | > | ? | | | | | | | | | + * |-----------------------------------------------------------| ,-----------. |-----------| | + * | | | | | | | | | | | | | | | | | + * `-----------------------------------------------------------' `-----------' `---------------' + */ + [_DEV] = LAYOUT_ansi( + ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, + ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, + ______, ______, ______, ______, ______, ______, ______, KC_MINS, S(KC_EQL), S(KC_9), S(KC_0), ______, ______, ______, ______, ______, ______, ______, ______, ______, + ______, ______, ______, ______, ______, ______, S(KC_MINS), KC_LBRC, KC_RBRC, S(KC_LBRC), S(KC_RBRC), ______, ______, ______, ______, ______, ______, + ______, ______, ______, ______, ______, ______, KC_EQL, S(KC_BSLASH), S(KC_COMM), S(KC_DOT), S(KC_SLSH), ______, ______, ______, ______, ______, + ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______ + ), + + /* Adjust + * ,---. ,---------------. ,---------------. ,---------------. ,-----------. + * | | | | | | | | | | | | | | | | | | | | | + * `---' `---------------' `---------------' `---------------' `-----------' + * ,-----------------------------------------------------------. ,--------------. ,---------------. + * | | | | | | | | | | | | | | | |Play|Next|VolU| | | | | | + * |-----------------------------------------------------------| |--------------| |---------------| + * | |QWERTY| | | | | | | | | | | | | |Stop|Prev|VolD| | | | | | + * |-----------------------------------------------------------| `--------------' |-----------| | + * | | | | | | | | | | | | | | | | | | | + * |-----------------------------------------------------------| ,---. |---------------| + * | | | |CKO| | | |Play|Mute|VolD|VolU| SD| | | | | | | | | + * |-----------------------------------------------------------| ,-----------. |-----------| | + * | | | | | | | | | | | | | | | | | + * `-----------------------------------------------------------' `-----------' `---------------' + */ + [_ADJUST] = LAYOUT_ansi( + ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, + ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, KC_MPLY, KC_MNXT, KC_VOLU, ______, ______, ______, ______, + ______, DF(_QWERTY), ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, KC_MSTP, KC_MPRV, KC_VOLD, ______, ______, ______, + ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, + ______, ______, ______, DF(_CKO), ______, ______, KC_MPLY, KC_MUTE, KC_VOLD, KC_VOLU, TG(_SUPERDUPER), ______, ______, ______, ______, ______, + ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______ + ) + +/* Empty layout for future reference + * ,---. ,---------------. ,---------------. ,---------------. ,-----------. + * | | | | | | | | | | | | | | | | | | | | | + * `---' `---------------' `---------------' `---------------' `-----------' + * ,-----------------------------------------------------------. ,-----------. ,---------------. + * | | | | | | | | | | | | | | | | | | | | | | | | + * |-----------------------------------------------------------| |-----------| |---------------| + * | | | | | | | | | | | | | | | | | | | | | | | | + * |-----------------------------------------------------------| `-----------' |-----------| | + * | | | | | | | | | | | | | | | | | | | + * |-----------------------------------------------------------| ,---. |---------------| + * | | | | | | | | | | | | | | | | | | | | + * |-----------------------------------------------------------| ,-----------. |-----------| | + * | | | | | | | | | | | | | | | | | + * `-----------------------------------------------------------' `-----------' `---------------' + */ + /* + * [_EMPTY] = LAYOUT_ansi( + * ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, + * ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, + * ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, + * ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, + * ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, + * ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______ + * ), + */ +}; +// clang-format on + +// Configure ignore mod tap interrupt per key +bool get_ignore_mod_tap_interrupt(uint16_t keycode) { + switch (keycode) { + // I don't like how mod tap interrupt feels with these keys specifically when I'm typing + case LCTL_T(KC_ESC): + return false; + default: + return true; + } +} diff --git a/keyboards/converter/usb_usb/keymaps/chriskopher/readme.md b/keyboards/converter/usb_usb/keymaps/chriskopher/readme.md new file mode 100644 index 000000000..59f70716a --- /dev/null +++ b/keyboards/converter/usb_usb/keymaps/chriskopher/readme.md @@ -0,0 +1,193 @@ +# chriskopher's QMK Config +Currently designed for the use of an ANSI tenkeyless keyboard on Windows 10. Although many of the ideas can be applied agnostically across operating systems. + +## Hardware +- [Hasu USB to USB Controller Converter](https://www.1upkeyboards.com/shop/controllers/usb-to-usb-converter/) + - Limitations include: + - 6KRO + - Media/System control keys and Fn key are not recognized by the converter + - Max firmware size of 28K and a lot of it is taken up by the USB keyboard support, so not all QMK features can be enabled + - No mouse or other pointing device support +- A regular ANSI QWERTY USB Type B keyboard + +## Layer Overview +### Base Layers +#### 0. [My personal modified QWERTY layout](#chriskopher-qwerty-layout) +This is the default base layer that is used for most of my typing and where the intermediate layers are stacked onto. It is loaded by default on keyboard power up. +- Apply this base layer with [Adjust](#adjust-layer) + c, or by powering on the keyboard +- Swapped CapsLock and LCtrl for ergonomics with often performed LCtrl keyboard shortcuts +- Swapped \\ and Backspace to minimize hand movement, inspired by the [HHKB](https://happyhackingkb.com/) layout +- Overloaded modifier keys, inspired by Steve Losh's [A Modern Space Cadet](https://stevelosh.com/blog/2012/10/a-modern-space-cadet/) + - Tap LShift for (, hold for LShift + - Tap RShift for ), hold for RShift + - Tap LCtrl for Esc, hold for LCtrl (remember that LCtrl is swapped with CapsLock) +- Tap Dances that allow different functionality based on the number of key presses within the `TAPPING_TERM` of 200 ms + - Extended space cadet shifting: + - Two taps of LShift sends {, and three taps send [ + - Two taps of RShift sends }, and three taps send ] + - One tap of ; will send ;, two taps of ; will send : +- Combos that allow for different functionality based on custom chorded key presses within the `COMBO_TERM` of 20 ms + - Press and hold s and d to momentarily activate the [(S)uper(D)uper](#superduper-layer) layer + - Press and hold k and l to momentarily activate Meh modifier key + - Meh key (Ctrl + Shift + Alt) is useful for binding unique hotkeys on the OS that won't collide with or override other existing hotkeys + - Tap CapsLock for CapsLock, hold CapsLock to momentarily activate Meh modifier key while held (remember that LCtrl is swapped with CapsLock) +- Tap/Hold actions for layer switching + - Similar to the overloaded modifier keys + - Tap z for z, hold z to momentarily activate [Dev](#dev-layer) layer while held + - Tap RGui for RGui, hold RGui to momentarily activate [Adjust](#adjust-layer) layer while held + +``` +,---. ,---------------. ,---------------. ,---------------. ,-----------. +|Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| +`---' `---------------' `---------------' `---------------' `-----------' +,-----------------------------------------------------------. ,-----------. ,---------------. +| `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \ | |Ins|Hom|PgU| |NmL| /| *| -| +|-----------------------------------------------------------| |-----------| |---------------| +|Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| Bsp| |Del|End|PgD| | 7| 8| 9| | +|-----------------------------------------------------------| `-----------' |-----------| | +|Ctl/Esc| A| S| D| F| G| H| J| K| L|;/:| ' | Return| | 4| 5| 6| +| +|-----------------------------------------------------------| ,---. |---------------| +|Shift/( |Dev/Z| X| C| V| B| N| M| ,| .| /| Shift/)| | ↑ | | 1| 2| 3| | +|-----------------------------------------------------------| ,-----------. |-----------| | +|Meh/CapsL|Gui|Alt| Space |Alt|Adjust/Gui|App| Ctl| | ← | ↓ | → | | 0| .|Ent| +`-----------------------------------------------------------' `-----------' `---------------' +``` + +Note: can't use Hyper key (Ctrl + Shift + Alt + Gui) instead of Meh reliably on Windows 10 because pressing Hyper opens Microsoft Office, Hyper + t opens Microsoft Teams, Hyper + d opens Microsoft OneDrive, Hyper + y Yammer, etc. And I couldn't find a clean way to disable this without needing to modify the host computer. + +#### 1. [A regular QWERTY layout](#regular-qwerty-layout) +This layer is for when other people need to type on my keyboard. +- Apply this base layer with [Adjust](#adjust-layer) + q +- The only modification is the addition of the tap/hold action for switching back to the [Adjust](#adjust-layer) layer while held + - Tap RGui for RGui, hold RGui to momentarily activate [Adjust](#adjust-layer) layer while held + +``` +,---. ,---------------. ,---------------. ,---------------. ,-----------. +|Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| +`---' `---------------' `---------------' `---------------' `-----------' +,-----------------------------------------------------------. ,-----------. ,---------------. +| `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| Bsp| |Ins|Hom|PgU| |NmL| /| *| -| +|-----------------------------------------------------------| |-----------| |---------------| +|Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ | |Del|End|PgD| | 7| 8| 9| | +|-----------------------------------------------------------| `-----------' |-----------| | +|CapsL | A| S| D| F| G| H| J| K| L| ;| '| Return| | 4| 5| 6| +| +|-----------------------------------------------------------| ,---. |---------------| +|Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | | ↑ | | 1| 2| 3| | +|-----------------------------------------------------------| ,-----------. |-----------| | +|Ctl|Gui|Alt| Space |Alt|Adjust/Gui|App|Ctl| | ← | ↓ | → | | 0| .|Ent| +`-----------------------------------------------------------' `-----------' `---------------' +``` + +### Intermediate Layers +#### 2. [(S)uper(D)uper Mode](#superduper-layer) +Inspired by [narze](https://github.com/qmk/qmk_firmware/tree/master/keyboards/planck/keymaps/narze) via [jasonrudolph](https://github.com/jasonrudolph/keyboard#super-duper-mode). It's designed to help with navigation while keeping you on the home row, or very close to it. + +- To activate this layer, press s + d simultaneously and hold from the base layer + - Alternatively, hold / to activate the layer. This method is slower because the layer toggle uses a `TAPPING_TERM` of 200 ms but s + d uses a `COMBO_TERM` of only 20 ms (can be changed within `config.h`). +- Use h / j / k / l + for / / / , respectively +- Use a for Alt +- Use f for Backspace +- Use g for Ctrl +- Use Space for Shift +- Use ; for Delete +- Use i / o to move to the previous/next tab +- Use u / p to go to the first/last tab (in most apps) +- Use / to toggle [(S)uper(D)uper](#superduper-layer) layer + +``` +,---. ,---------------. ,---------------. ,---------------. ,-----------. +| | | | | | | | | | | | | | | | | | | | | +`---' `---------------' `---------------' `---------------' `-----------' +,-----------------------------------------------------------. ,-----------. ,---------------. +| | | | | | | | | | | | | | | | | | | | | | | | +|-----------------------------------------------------------| |-----------| |---------------| +| | | | | | | |1T |T← |T→ |9T | | | | | | | | | | | | | +|-----------------------------------------------------------| `-----------' |-----------| | +| |Alt|[SuperDuper]|Bksp|Ctl| ← | ↓ | ↑ | → |Del| | | | | | | | +|-----------------------------------------------------------| ,---. |---------------| +| | | | | | | | | | |ToggleSD| | | | | | | | | +|-----------------------------------------------------------| ,-----------. |-----------| | +| | | | Shift | | | | | | | | | | | | | +`-----------------------------------------------------------' `-----------' `---------------' +``` + +#### 3. [Dev](#dev-layer) +This layer is for easy access to symbols commonly used during development. +- To activate this layer, press and hold z from the base layer +- Use u / i / o / p + for - / + / ( / ), respectively +- Use h / j / k / l / ; + for _ / [ / ] / { / }, respectively +- Use n / m / , / . / / + for = / | / < / > / ?, respectively + +``` +,---. ,---------------. ,---------------. ,---------------. ,-----------. +| | | | | | | | | | | | | | | | | | | | | +`---' `---------------' `---------------' `---------------' `-----------' +,-----------------------------------------------------------. ,-----------. ,---------------. +| | | | | | | | | | | | | | | | | | | | | | | | +|-----------------------------------------------------------| |-----------| |---------------| +| | | | | | | | - | + | ( | ) | | | | | | | | | | | | | +|-----------------------------------------------------------| `-----------' |-----------| | +| | | | | | | _ | [ | ] | { | } | | | | | | | | +|-----------------------------------------------------------| ,---. |---------------| +| | | | | | | = | | | < | > | ? | | | | | | | | | +|-----------------------------------------------------------| ,-----------. |-----------| | +| | | | | | | | | | | | | | | | | +`-----------------------------------------------------------' `-----------' `---------------' +``` + +### Top Layer +#### 4. [Adjust](#adjust-layer) +This layer is applied at the top so that it will override all other layers and as a result it will always be possible to change which base layer is applied as a default. It is also used for media controls. +- To activate this layer, press and hold RGui from the base layer +- Switch to [chriskopher modified QWERTY layout](#chriskopher-qwerty-layout) with c +- Switch to [regular QWERTY layout](#regular-qwerty-layout) with q +- Use n / m / , / . / / + for Play/Pause / Mute / Volume Down / Volume Up / Toggle [(S)uper(D)uper](#superduper-layer) layer, respectively +- Use Insert / Home / Page Up + for Play/Pause / Next Track / Volume Up, respectively +- Use Delete / End / Page Down +for Stop / Previous Track / Volume Down, respectively + +``` +,---. ,---------------. ,---------------. ,---------------. ,-----------. +| | | | | | | | | | | | | | | | | | | | | +`---' `---------------' `---------------' `---------------' `-----------' +,-----------------------------------------------------------. ,--------------. ,---------------. +| | | | | | | | | | | | | | | |Play|Next|VolU| | | | | | +|-----------------------------------------------------------| |--------------| |---------------| +| |QWERTY| | | | | | | | | | | | | |Stop|Prev|VolD| | | | | | +|-----------------------------------------------------------| `--------------' |-----------| | +| | | | | | | | | | | | | | | | | | | +|-----------------------------------------------------------| ,---. |---------------| +| | | |CKO| | | |Play|Mute|VolD|VolU| SD| | | | | | | | | +|-----------------------------------------------------------| ,-----------. |-----------| | +| | | | | | | | | | | | | | | | | +`-----------------------------------------------------------' `-----------' `---------------' +``` + +## Build Instructions +To compile and flash the config onto the USB to USB converter: +```sh +cd /path/to/qmk_firmware +qmk config user.keyboard=converter/usb_usb/hasu +qmk config user.keymap=chriskopher +qmk compile +qmk flash +``` + +Alternatively: +```sh +cd /path/to/qmk_firmware +qmk compile -kb converter/usb_usb/hasu -km chriskopher +qmk flash -kb converter/usb_usb/hasu -km chriskopher +``` + +To modify the config: +```sh +cd /path/to/qmk_firmware/keyboards/converter/usb_usb/keymaps/chriskopher +``` +and edit `keymap.c`, `config.h`, and `rules.mk`. diff --git a/keyboards/converter/usb_usb/keymaps/chriskopher/rules.mk b/keyboards/converter/usb_usb/keymaps/chriskopher/rules.mk new file mode 100644 index 000000000..d80022853 --- /dev/null +++ b/keyboards/converter/usb_usb/keymaps/chriskopher/rules.mk @@ -0,0 +1,24 @@ +# Copyright 2020 Christopher Ko +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +COMMAND_ENABLE = no # Not being used, and can cause conflicts with space cadet shifting +SPACE_CADET_ENABLE = no # Not using special built in space cadet keys, using custom tap dance instead +EXTRAKEY_ENABLE = yes # Used for audio control and system control keys +COMBO_ENABLE = yes # Used to allow chording of keys to trigger an action +TAP_DANCE_ENABLE = yes # Used to allow multiple taps of a key to perform different actions + +LINK_TIME_OPTIMIZATION_ENABLE = yes # Reduces the compiled firmware size + +SRC += combo.c tap_dance.c diff --git a/keyboards/converter/usb_usb/keymaps/chriskopher/shared_enum.h b/keyboards/converter/usb_usb/keymaps/chriskopher/shared_enum.h new file mode 100644 index 000000000..f83bfa3c4 --- /dev/null +++ b/keyboards/converter/usb_usb/keymaps/chriskopher/shared_enum.h @@ -0,0 +1,36 @@ +/* Copyright 2020 Christopher Ko + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +enum keyboard_layer { + // Base layers + _CKO, + _QWERTY, + // Intermediate layers + _SUPERDUPER, + _DEV, + // Adjust layer at the end + _ADJUST +}; + +enum tap_dance_key_event { + // Extended space cadet shift tap dance + ESPC_L, + ESPC_R, + // Semicolon-Colon tap dance + SCLN_CLN +}; diff --git a/keyboards/converter/usb_usb/keymaps/chriskopher/tap_dance.c b/keyboards/converter/usb_usb/keymaps/chriskopher/tap_dance.c new file mode 100644 index 000000000..8600d8399 --- /dev/null +++ b/keyboards/converter/usb_usb/keymaps/chriskopher/tap_dance.c @@ -0,0 +1,164 @@ +/* Copyright 2020 Christopher Ko + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "shared_enum.h" + +#include "quantum.h" + +enum tap_dance_state { + SINGLE_HOLD = 1, + SINGLE_TAP, + DOUBLE_TAP, + TRIPLE_TAP, +}; + +// Record current state of a tap dance +static int espc_l_tap_state = 0; +static int espc_r_tap_state = 0; +static int scln_cln_tap_state = 0; + +// Watch the state of the tap dance +int cur_dance(qk_tap_dance_state_t *state) { + if (state->pressed) { + return SINGLE_HOLD; + } + if (state->count == 1) { + return SINGLE_TAP; + } + if (state->count == 2) { + return DOUBLE_TAP; + } + if (state->count == 3) { + return TRIPLE_TAP; + } + + return -1; +} + +// Extended Space Cadet Shift - Left ================================== +void espc_l_finished(qk_tap_dance_state_t *state, void *user_data) { + espc_l_tap_state = cur_dance(state); + switch (espc_l_tap_state) { + case SINGLE_TAP: // ( + register_code16(LSFT(KC_9)); + break; + case DOUBLE_TAP: // { + unregister_code16(LSFT(KC_9)); + register_code16(LSFT(KC_LBRC)); + break; + case TRIPLE_TAP: // [ + unregister_code16(LSFT(KC_LBRC)); + register_code16(KC_LBRC); + break; + case SINGLE_HOLD: // LShift + register_code16(KC_LSFT); + break; + } +} + +void espc_l_reset(qk_tap_dance_state_t *state, void *user_data) { + switch (espc_l_tap_state) { + case SINGLE_TAP: // ( + unregister_code16(LSFT(KC_9)); + break; + case DOUBLE_TAP: // { + unregister_code16(LSFT(KC_LBRC)); + break; + case TRIPLE_TAP: // [ + unregister_code16(KC_LBRC); + break; + case SINGLE_HOLD: // LShift + unregister_code16(KC_LSFT); + break; + } + espc_l_tap_state = 0; +} +// ====================================================================// + +// Extended Space Cadet Shift - Right ================================== +void espc_r_finished(qk_tap_dance_state_t *state, void *user_data) { + espc_r_tap_state = cur_dance(state); + switch (espc_r_tap_state) { + case SINGLE_TAP: // ) + register_code16(LSFT(KC_0)); + break; + case DOUBLE_TAP: // } + unregister_code16(LSFT(KC_0)); + register_code16(LSFT(KC_RBRC)); + break; + case TRIPLE_TAP: // ] + unregister_code16(LSFT(KC_RBRC)); + register_code16(KC_RBRC); + break; + case SINGLE_HOLD: // RShift + register_code16(KC_RSFT); + break; + } +} + +void espc_r_reset(qk_tap_dance_state_t *state, void *user_data) { + switch (espc_r_tap_state) { + case SINGLE_TAP: // ) + unregister_code16(LSFT(KC_0)); + break; + case DOUBLE_TAP: // } + unregister_code16(LSFT(KC_RBRC)); + break; + case TRIPLE_TAP: // ] + unregister_code16(KC_RBRC); + break; + case SINGLE_HOLD: // RShift + unregister_code16(KC_RSFT); + break; + } + espc_r_tap_state = 0; +} +// ====================================================================// + +// Semicolon - Colon ================================================== +void scln_cln_finished(qk_tap_dance_state_t *state, void *user_data) { + scln_cln_tap_state = cur_dance(state); + switch (scln_cln_tap_state) { + case SINGLE_TAP: // ; + register_code16(KC_SCLN); + break; + default: // : + register_code16(LSFT(KC_SCLN)); + break; + } +} + +void scln_cln_reset(qk_tap_dance_state_t *state, void *user_data) { + switch (scln_cln_tap_state) { + case SINGLE_TAP: // ; + unregister_code16(KC_SCLN); + break; + default: // : + unregister_code16(LSFT(KC_SCLN)); + break; + } +} +// ====================================================================// + +// Associate tap dance with defined functionality +qk_tap_dance_action_t tap_dance_actions[] = { + // Extended space cadet shift left: Hold - Shift, One - (, Two - {, Three - [ + [ESPC_L] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, espc_l_finished, espc_l_reset), + // Extended space cadet shift right: Hold - Shift, One - ), Two - }, Three - ] + [ESPC_R] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, espc_r_finished, espc_r_reset), + // Semicolon - Colon: One - ;, Two - : + [SCLN_CLN] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, scln_cln_finished, scln_cln_reset), +};