From 81f36ab74dca703c46e1d94e6d5b63365449e9d7 Mon Sep 17 00:00:00 2001 From: "Manassarn \"Noom\" Manoonchai" Date: Thu, 17 Oct 2019 00:48:37 +0700 Subject: [PATCH] [Keymap] Add narze keymap for usb-usb converter (#6881) * Revert raise/backspace mod tap to just backspace * Initialize usb_usb/narze * Modify keys * Add readme * Support Right shift to ) * Add Dev layer * Use Dev layer on holding z key * Add Dev layer for Ergodox * Update keyboards/converter/usb_usb/keymaps/narze/README.md Fix the command & close the code block as suggested Co-Authored-By: Drashna Jaelre * Reduce rules --- .../converter/usb_usb/keymaps/narze/README.md | 10 ++ .../converter/usb_usb/keymaps/narze/config.h | 48 +++++ .../converter/usb_usb/keymaps/narze/keymap.c | 167 ++++++++++++++++++ .../converter/usb_usb/keymaps/narze/rules.mk | 3 + 4 files changed, 228 insertions(+) create mode 100644 keyboards/converter/usb_usb/keymaps/narze/README.md create mode 100644 keyboards/converter/usb_usb/keymaps/narze/config.h create mode 100644 keyboards/converter/usb_usb/keymaps/narze/keymap.c create mode 100644 keyboards/converter/usb_usb/keymaps/narze/rules.mk diff --git a/keyboards/converter/usb_usb/keymaps/narze/README.md b/keyboards/converter/usb_usb/keymaps/narze/README.md new file mode 100644 index 0000000000..a089568d2c --- /dev/null +++ b/keyboards/converter/usb_usb/keymaps/narze/README.md @@ -0,0 +1,10 @@ +# narze's layout for usb-usb converter + +## Key features +- Qwerty + [Colemak](https://colemak.com) layouts, and you can type Qwerty on software-level Colemak as well. Very useful for gaming or when your friend wanna type something but don't use Colemak. +- [(S)uper (D)uper Mode](https://github.com/jasonrudolph/keyboard#super-duper-mode) inspired by [jasonrudolph](https://github.com/jasonrudolph), with [some extensions](https://gist.github.com/narze/861e2167784842d38771) such as backspace & forward delete. + +## Build instructions +- `cd /path/to/qmk_firmware` +- Ensure latest libraries are loaded `make git-submodule` +- Build & flash : `make converter/usb_usb:narze:flash` diff --git a/keyboards/converter/usb_usb/keymaps/narze/config.h b/keyboards/converter/usb_usb/keymaps/narze/config.h new file mode 100644 index 0000000000..cbdb7d94e3 --- /dev/null +++ b/keyboards/converter/usb_usb/keymaps/narze/config.h @@ -0,0 +1,48 @@ +#pragma once + +/* + * MIDI options + */ + +/* Prevent use of disabled MIDI features in the keymap */ +//#define MIDI_ENABLE_STRICT 1 + +/* enable basic MIDI features: + - MIDI notes can be sent when in Music mode is on +*/ +#define MIDI_BASIC + +/* enable advanced MIDI features: + - MIDI notes can be added to the keymap + - Octave shift and transpose + - Virtual sustain, portamento, and modulation wheel + - etc. +*/ +//#define MIDI_ADVANCED + +/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ +//#define MIDI_TONE_KEYCODE_OCTAVES 2 + +#undef TAPPING_TERM +#define TAPPING_TERM 100 + +#define COMBO_TERM 20 +#define COMBO_COUNT 1 + +#define IGNORE_MOD_TAP_INTERRUPT +#define PERMISSIVE_HOLD + +#define SUPER_DUPER_SOUND S__NOTE(_B1) + +#define MOUSEKEY_DELAY 100 + +#define USB_POLLING_INTERVAL_MS 1 + +#ifdef AUDIO_ENABLE + #define STARTUP_SONG SONG(PLANCK_SOUND) + + #define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \ + SONG(COLEMAK_SOUND), \ + SONG(DVORAK_SOUND) \ + } +#endif diff --git a/keyboards/converter/usb_usb/keymaps/narze/keymap.c b/keyboards/converter/usb_usb/keymaps/narze/keymap.c new file mode 100644 index 0000000000..b5938fa359 --- /dev/null +++ b/keyboards/converter/usb_usb/keymaps/narze/keymap.c @@ -0,0 +1,167 @@ +#include QMK_KEYBOARD_H +#include "narze.h" +#include "keymap_colemak.h" + +enum usb_usb_layers { + _QWERTY, + _COLEMAK, + _QWOC, + _SUPERDUPER, +}; + +enum usb_usb_keycodes { + QWERTY = SAFE_RANGE, + COLEMAK, + QWOC, + SUPERDUPER, + SDTOGG, // Toggle SuperDuper + GUI_UNDS, + LSFT_LPRN, + RSFT_RPRN, +}; + +#define HPR_ESC ALL_T(KC_ESC) +#define SFT_ENT SFT_T(KC_ENT) +#define BRWS_L S(LGUI(KC_LBRC)) +#define BRWS_R S(LGUI(KC_RBRC)) + +enum process_combo_event { + CB_SUPERDUPER, +}; + +const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = { + /* 0: plain Qwerty without layer switching + * ,---------------. ,---------------. ,---------------. + * |F13|F14|F15|F16| |F17|F18|F19|F20| |F21|F22|F23|F24| + * ,---. |---------------| |---------------| |---------------| ,-----------. ,---------------. ,-------. + * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |VDn|VUp|Mut|Pwr| | Help | + * `---' `---------------' `---------------' `---------------' `-----------' `---------------' `-------' + * ,-----------------------------------------------------------. ,-----------. ,---------------. ,-------. + * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|JPY|Bsp| |Ins|Hom|PgU| |NmL| /| *| -| |Stp|Agn| + * |-----------------------------------------------------------| |-----------| |---------------| |-------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ | |Del|End|PgD| | 7| 8| 9| +| |Mnu|Und| + * |-----------------------------------------------------------| `-----------' |---------------| |-------| + * |CapsL | A| S| D| F| G| H| J| K| L| ;| :| #|Retn| | 4| 5| 6|KP,| |Sel|Cpy| + * |-----------------------------------------------------------| ,---. |---------------| |-------| + * |Shft| <| Z| X| C| V| B| N| M| ,| ,| /| RO|Shift | |Up | | 1| 2| 3|KP=| |Exe|Pst| + * |-----------------------------------------------------------| ,-----------. |---------------| |-------| + * |Ctl|Gui|Alt|MHEN|HNJ| Space |H/E|HENK|KANA|Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0 | .|Ent| |Fnd|Cut| + * `-----------------------------------------------------------' `-----------' `---------------' `-------' + */ + [_QWERTY] = LAYOUT_all( + KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, + 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_VOLD, KC_VOLU, KC_MUTE, KC_PWR, KC_HELP, + 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_JYEN, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, KC_STOP, KC_AGIN, + 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_PPLS, KC_MENU, KC_UNDO, + HPR_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PCMM, KC_SLCT, KC_COPY, + LSFT_LPRN,KC_NUBS,KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RO, RSFT_RPRN, KC_UP, KC_P1, KC_P2, KC_P3, KC_PEQL, KC_EXEC, KC_PSTE, + KC_LCTL, KC_LALT, GUI_UNDS,KC_MHEN, KC_HANJ, KC_SPC, KC_HAEN, KC_HENK, KC_KANA, KC_BSPC, KC_RALT, KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT, KC_FIND, KC_CUT + ), + [_COLEMAK] = LAYOUT_all( + KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, + 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_VOLD, KC_VOLU, KC_MUTE, KC_PWR, KC_HELP, + 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_JYEN, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, KC_STOP, KC_AGIN, + 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_PPLS, KC_MENU, KC_UNDO, + HPR_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PCMM, KC_SLCT, KC_COPY, + LSFT_LPRN,KC_NUBS,KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RO, RSFT_RPRN, KC_UP, KC_P1, KC_P2, KC_P3, KC_PEQL, KC_EXEC, KC_PSTE, + KC_LCTL, KC_LALT, GUI_UNDS,KC_MHEN, KC_HANJ, KC_SPC, KC_HAEN, KC_HENK, KC_KANA, KC_BSPC, KC_RALT, KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT, KC_FIND, KC_CUT + ), + [_QWOC] = LAYOUT_all( + KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, + 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_VOLD, KC_VOLU, KC_MUTE, KC_PWR, KC_HELP, + 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_JYEN, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, KC_STOP, KC_AGIN, + 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_PPLS, KC_MENU, KC_UNDO, + HPR_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PCMM, KC_SLCT, KC_COPY, + LSFT_LPRN,KC_NUBS,KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RO, RSFT_RPRN, KC_UP, KC_P1, KC_P2, KC_P3, KC_PEQL, KC_EXEC, KC_PSTE, + KC_LCTL, KC_LALT, GUI_UNDS,KC_MHEN, KC_HANJ, KC_SPC, KC_HAEN, KC_HENK, KC_KANA, KC_BSPC, KC_RALT, KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT, KC_FIND, KC_CUT + ), + [_SUPERDUPER] = LAYOUT_all( + ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, + RESET, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,______,______, ______,______,______,______, ______, + ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,______,______, ______,______,______,______, ______,______, + ______, ______, ______, ______, ______, ______, ______, ______, BRWS_L, BRWS_R, ______, ______, ______, ______, ______,______,______, ______,______,______,______, ______,______, + KC_SPC, KC_LALT, _______, _______, KC_BSPC,KC_LGUI,KC_LEFT, KC_DOWN, KC_UP,KC_RGHT, KC_DEL, ______, ______, ______, ______,______,______,______, ______,______, + ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,______,______,______, ______,______, + ______, ______, ______, ______, ______, KC_LSFT, ______, ______, ______, ______, ______, ______, ______, ______,______,______, ______, ______,______, ______,______ + ), +}; + +void matrix_init_user(void) { + +} + +void matrix_scan_user(void) { + +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + set_single_persistent_default_layer(_QWERTY); + + set_superduper_key_combo_layer(_QWERTY); + } + return false; + + case COLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_COLEMAK); + + set_superduper_key_combo_layer(_COLEMAK); + } + return false; + + case QWOC: + if (record->event.pressed) { + set_single_persistent_default_layer(_QWOC); + + set_superduper_key_combo_layer(_QWOC); + } + return false; + + case SDTOGG: + if (record->event.pressed) { + toggle_superduper_mode(); + } + return false; + + // Macros + + // 1. Hold for LGUI, tap for Underscore + case GUI_UNDS: + perform_space_cadet(record, KC_LGUI, KC_LSFT, KC_MINS); + return false; + + // 2. Hold for LSHIFT, tap for Parens open + case LSFT_LPRN: + perform_space_cadet(record, KC_LSFT, KC_LSFT, KC_9); + return false; + + // 3. Hold for RSHIFT, tap for Parens close + case RSFT_RPRN: + perform_space_cadet(record, KC_RSFT, KC_RSFT, KC_0); + return false; + + default: + return true; + } + return true; +} + +void matrix_setup(void) { + set_superduper_key_combos(); +} + +void process_combo_event(uint8_t combo_index, bool pressed) { + if (pressed) { + switch(combo_index) { + case CB_SUPERDUPER: + layer_on(_SUPERDUPER); + break; + } + } else { + layer_off(_SUPERDUPER); + unregister_mods(MOD_BIT(KC_LGUI) | MOD_BIT(KC_LCTL) | MOD_BIT(KC_LALT)); // Sometimes mods are held, unregister them + } +} diff --git a/keyboards/converter/usb_usb/keymaps/narze/rules.mk b/keyboards/converter/usb_usb/keymaps/narze/rules.mk new file mode 100644 index 0000000000..657773e84e --- /dev/null +++ b/keyboards/converter/usb_usb/keymaps/narze/rules.mk @@ -0,0 +1,3 @@ +EXTRAKEY_ENABLE = no +NKRO_ENABLE = yes +COMBO_ENABLE = yes