From 6eb89ae906db7f226570e1839b88dcdd3a8fa962 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20Hormaz=C3=A1bal?= Date: Sat, 9 Dec 2017 06:06:27 +0100 Subject: [PATCH] New Planck Layout (#2123) * added own keymap for planck * Update Readme.md * Update Readme.md * Update Readme.md * Update Readme.md * Update Readme.md --- .../planck/keymaps/dr_notsokind/Readme.md | 66 ++++ .../planck/keymaps/dr_notsokind/config.h | 29 ++ .../planck/keymaps/dr_notsokind/keymap.c | 307 ++++++++++++++++++ .../planck/keymaps/dr_notsokind/rules.mk | 25 ++ 4 files changed, 427 insertions(+) create mode 100644 keyboards/planck/keymaps/dr_notsokind/Readme.md create mode 100644 keyboards/planck/keymaps/dr_notsokind/config.h create mode 100644 keyboards/planck/keymaps/dr_notsokind/keymap.c create mode 100644 keyboards/planck/keymaps/dr_notsokind/rules.mk diff --git a/keyboards/planck/keymaps/dr_notsokind/Readme.md b/keyboards/planck/keymaps/dr_notsokind/Readme.md new file mode 100644 index 000000000..2caf4965d --- /dev/null +++ b/keyboards/planck/keymaps/dr_notsokind/Readme.md @@ -0,0 +1,66 @@ +# Dr NotSoKind's layout + +Feel free to ask questions or send suggestions to [me on Twitter](https://twitter.com/pnikosis) + +I love some features from the default layout, although there are things that definitively I can't get used to. The *circuit* layout gave me some good ideas, so I combined both, plus some own ideas to fit better my needs. BTW, I don't use Dvorak or other layouts than QWERTY and I'm too old and grumpy for learning something new (I'm lying a bit here, I learn new stuff every day), so I removed the ther typing layouts + +## Things I love about the default layout +1. I love the consistency between the raise and lower layers, like one is the shifted version of the other. +2. I like the F keys distributed in two rows, from F1 to F6 and F7 to F12, which makes them easier to find and access. + +## Things I don't like from the default layout +1. Arrow keys distributed VIM like. I use VIM frequently, but there I navigate using HJKL. Moving to the arrows intituively I tend to expect three arrows on the bottom (left, down, right) and one up in the middle (up). +2. Tab and Esc. I switched them. +3. Alt and Super. Switched them too. + +## Needs, changes and goals +1. Arrow keys and distributed "traditionally". +2. Media keys easily accessible. +3. A button for Sleep/Power. +4. As close as possible to a US QWERTY layout. +5. A Numpad, for when I want to feel like an accountant. +6. Be able to record Dynamic Macros. + +Layers: + +### Main Layout / QWERTY + +Has four modes: The default, Lower, Raise and Media. + +![Main](https://i.imgur.com/x4wSt76.png) + +http://www.keyboard-layout-editor.com/#/gists/4cfb26f84bbb4fabe5e6c7cc22c85e24 + +Media gives access to most media keys, and some keyboard actions such as Print Screen, Insert, Calculator or Power/Sleep/Wake. Also in the Media layer, you can record two different macros and reproduce them. + +Record the Macro with `Media` + `;` (or `Media` + `'` for the Macro 2), you will hear a beep (if the audio is enabled). Do your stuff, finish recording with `Media` + `Enter`. For reproducing the Macro, press `Media` + `,` (or `Media` + `.` for the second Macro). + +Additionally, Lower + Raise gives access to the layer switching, plus keyboard modes (such as music mode), reset, SysReq and Lock Mode, which disables the double shift tap for CapsLock (taken from the *circuit* layout). Also provides another distribution for the F keys. + +### Lower + Raise (adjust) + +![Adjust](https://i.imgur.com/ADNLR6n.png) + +http://www.keyboard-layout-editor.com/#/gists/12462bfba17d16bb40b54ed914209d92 + +### Numpad + +Pressing Esc exits the numpad layer (also you can go to the QWERTY layer through the adjust layer) + +![Numpad](https://i.imgur.com/iTyhjNZ.png) + +http://www.keyboard-layout-editor.com/#/gists/5ab730ab278d2050c5250498806e8edc + +-------------------------------------- +Notes taken from the circuit layout: + +### Special keys: +* `RSHFT` and `ENTER` are combined. Tap once for `ENTER` and hold for `RSHFT`. `ENTER` will be registered on release if released within 200 ms, else `RSHFT` is registered starting at 201 ms until release. +* If for some reason, this interferes with the normal usage of the `ENTER` key in any way, (some problem that may never happen), I have added a regular non-modified `ENTER` key on the same key in the [LOWER] and [RAISE] layers. +* `LSHFT` and `CAPS` are also combined. The key works like a normal `LSHFT` unless double-tapped, in which case it counts as `CAPS`. This functionality unfortunately delays all key presses by at most 200 ms, but I have added ways to disable this both temporarily or permanently, described below. +* A failsafe `CAPS` key is on the same key in the [LOWER] and [RAISE] layers. +* There are `UNDO`, `CUT`, `COPY`, and `PASTE` keys. This was intended to be a universal way to use these commands since in macOS cut is `⌘ + C` but in Windows it is `⌃ + C`. Unfortunately these special keys only work in Windows. ¯\\\_(ツ)\_/¯ + +##Game lock: +**TL;DR** the game lock toggle disables the double-tap `CAPS`, and disables `GUI` keys (WINDOWS key). + diff --git a/keyboards/planck/keymaps/dr_notsokind/config.h b/keyboards/planck/keymaps/dr_notsokind/config.h new file mode 100644 index 000000000..4c6158199 --- /dev/null +++ b/keyboards/planck/keymaps/dr_notsokind/config.h @@ -0,0 +1,29 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +/* + * 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 + +#endif \ No newline at end of file diff --git a/keyboards/planck/keymaps/dr_notsokind/keymap.c b/keyboards/planck/keymaps/dr_notsokind/keymap.c new file mode 100644 index 000000000..e95c02eda --- /dev/null +++ b/keyboards/planck/keymaps/dr_notsokind/keymap.c @@ -0,0 +1,307 @@ +// Layout picture at http://www.keyboard-layout-editor.com/#/gists/125febfad6960add078e6f14256539b6 + +#include "planck.h" +#include "action_layer.h" +#ifdef AUDIO_ENABLE +#include "audio.h" +#endif +#include "eeconfig.h" + +extern keymap_config_t keymap_config; + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. +#define _QWERTY 0 +#define _NUMPAD 1 +#define _LOCKED 2 +#define _RAISE 3 +#define _LOWER 4 +#define _FUNCTN 5 +#define _MEDIA 6 + +enum planck_keycodes { + QWERTY = SAFE_RANGE, + NUMPAD, + RAISE, + LOWER, + MEDIA, + DYNAMIC_MACRO_RANGE +}; + +#include "dynamic_macro.h" + +// Key code names +#define SFT_ENT FUNC(0) // Tap for enter, hold for right shift +#define LOCK FUNC(1) +#define KC_PSTE KC_PASTE +#define _______ KC_TRNS +#define XXXXXXX KC_NO + +#ifdef TAP_DANCE_ENABLE +#define SFT_CAP TD(0) // Left shift, double tap for caps +#endif +#ifndef TAP_DANCE_ENABLE +#define SFT_CAP KC_LSFT // Regular left shift +#endif + +// Tap Dance Definitions +#ifdef TAP_DANCE_ENABLE +qk_tap_dance_action_t tap_dance_actions[] = { + [0] = ACTION_TAP_DANCE_DOUBLE(KC_LSFT, KC_CAPS) +}; +#endif + +// Function definitions +const uint16_t PROGMEM fn_actions[] = { + [0] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_ENT), + [1] = ACTION_LAYER_TOGGLE(_LOCKED) +}; + +// Layout definitions +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* QWERTY + * ,-----------------------------------------------------------------------------------. + * | Esc | Q | W | E | R | T | Y | U | I | O | P | BKSP | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Tab | A | S | D | F | G | H | J | K | L | ; | ' | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |*Shift| Z | X | C | V | B | N | M | , | . | Up |SftEnt| + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Ctrl | GUI | Alt | Mute | Lower| Space | Raise| / | Left | Down | Right| + * `-----------------------------------------------------------------------------------' + */ +[_QWERTY] = { + {KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, + {KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, + {SFT_CAP, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_UP, SFT_ENT}, + {KC_LCTL, KC_LGUI, KC_LALT, MEDIA, LOWER, KC_SPC, KC_SPC, RAISE, KC_SLSH, KC_LEFT, KC_DOWN, KC_RGHT} +}, + +/* NUMPAD + * ,-----------------------------------------------------------------------------------. + * |QWERTY| NULL | NULL | NULL | NULL | NULL | NULL | / | 7 | 8 | 9 | - | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | NULL | NULL | NULL | NULL | NULL | NULL | * | 4 | 5 | 6 | + | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | |NumLck| NULL | NULL | NULL | NULL | NULL |BckSp | 1 | 2 | 3 | Ent | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | | | | | | | 0 | . | , | = | + * `-----------------------------------------------------------------------------------' + */ +[_NUMPAD] = { + {QWERTY, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_PSLS, KC_P7, KC_P8, KC_P9, KC_PMNS}, + {_______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_PAST, KC_P4, KC_P5, KC_P6, KC_PPLS}, + {_______, KC_NLCK, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_BSPC, KC_P1, KC_P2, KC_P3, KC_PENT}, + {_______, _______, _______, _______, _______, _______, _______, _______, KC_P0, KC_PDOT, KC_PCMM, KC_PEQL} +}, + +/* LOCK + * ,-----------------------------------------------------------------------------------. + * | | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Shift| | | | | | | | | | | Enter| + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | NULL | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[_LOCKED] = { + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, + {KC_LSFT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_ENT}, + {_______, XXXXXXX, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} +}, + +/* RAISE + + * ,-----------------------------------------------------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | BKSP | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | CAPS | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / | NULL | PgUp | Enter| + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | | | Vol+ | | NULL | | | Home | PgDn | End | + * `-----------------------------------------------------------------------------------' + */ +[_RAISE] = { + {KC_GRV , KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, + {KC_DEL , KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, + {KC_CAPS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, XXXXXXX, KC_PGUP, KC_ENT }, + {_______, _______, _______, KC_VOLU, _______, XXXXXXX, XXXXXXX, _______, _______, KC_HOME, KC_PGDN, KC_END } +}, + +/* LOWER + * ,-----------------------------------------------------------------------------------. + * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Del | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Del | F13 | F14 | F15 | F16 | F17 | F18 | _ | + | { | } | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | CAPS | F19 | F20 | F21 | F22 | F23 | F24 |ISO ~ |ISO | | NULL | PgUp | Enter| + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | | | Vol- | | NULL | | | Home | PgDn | End | + * `-----------------------------------------------------------------------------------' + */ +[_LOWER] = { + {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL }, + {KC_DEL, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE}, + {KC_CAPS, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, S(KC_NUHS), S(KC_NUBS), XXXXXXX, KC_PGUP, KC_ENT }, + {_______, _______, _______, KC_VOLD, _______, XXXXXXX, XXXXXXX, _______, _______, KC_HOME, KC_PGDN, KC_END } +}, + +/* MEDIA AND COMMANDS + * ,-----------------------------------------------------------------------------------. + * |Sleep | NULL |WbHome| NULL | NULL | NULL |Again | NULL |Insert| NULL |PrntSc|Power | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Wake | NULL |WbSrch| NULL | Find | NULL | NULL | NULL | Calc | NULL |RecMc1|RecMc2| + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | NULL | Undo | Cut | Copy | Paste| NULL | NULL | NULL |Macro1|Macro2| Prev | NULL | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | NULL | NULL | NULL | | Vol- | Mute | Vol+ | NULL | Stop | Next | Play | + * `-----------------------------------------------------------------------------------' + */ +[_MEDIA] = { + {KC_SLEP, XXXXXXX, KC_WHOM, XXXXXXX, XXXXXXX, XXXXXXX, KC_AGAIN, XXXXXXX, KC_INS, XXXXXXX, KC_PSCR, KC_PWR}, + {KC_WAKE, XXXXXXX, KC_WSCH, XXXXXXX, KC_FIND, XXXXXXX, XXXXXXX, XXXXXXX, KC_CALC, XXXXXXX, DYN_REC_START1, DYN_REC_START2 }, + {XXXXXXX, KC_UNDO, KC_CUT, KC_COPY, KC_PSTE, XXXXXXX, XXXXXXX, XXXXXXX, DYN_MACRO_PLAY1, DYN_MACRO_PLAY2, KC_MPRV, DYN_REC_STOP }, + {XXXXXXX, XXXXXXX, XXXXXXX, _______, KC_VOLD, KC_MUTE, KC_MUTE, KC_VOLU, XXXXXXX, KC_MSTP, KC_MNXT, KC_MPLY } +}, + +/* FUNCTIONS + * ,-----------------------------------------------------------------------------------. + * | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | F13 | F14 | F15 | F16 | F17 | F18 | F19 | F20 | F21 | F22 | F23 | F24 | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | NULL | NULL | NULL |AudOff|MusOff|QWERTY|NUMPAD|Mus On|Aud On| NULL |Voice+|SysReq| + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Reset| NULL | Lock | NULL | | NULL | | NULL |AGNorm|Voice-|AGSwap| + * `-----------------------------------------------------------------------------------' + */ +[_FUNCTN] = { + {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_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24 }, + {XXXXXXX, XXXXXXX, XXXXXXX, AU_OFF, MU_OFF, QWERTY, NUMPAD, MU_ON, AU_ON, XXXXXXX, MUV_IN, KC_SYSREQ}, + {RESET, XXXXXXX, LOCK, XXXXXXX, _______, XXXXXXX, XXXXXXX, _______, XXXXXXX, AG_NORM, MUV_DE, AG_SWAP} +} + +}; + +#ifdef AUDIO_ENABLE +float tone_startup[][2] = SONG(STARTUP_SOUND); +float tone_qwerty[][2] = SONG(QWERTY_SOUND); +float tone_numpad[][2] = SONG(NUM_LOCK_ON_SOUND); +float tone_dyn_macro_rec[][2] = SONG(TERMINAL_SOUND); +float tone_dyn_macro_stop[][2] = SONG(COIN_SOUND); +float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); +float tone_goodbye[][2] = SONG(GOODBYE_SOUND); +#endif + + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + uint16_t macro_kc = (keycode == NUMPAD ? DYN_REC_STOP : keycode); + if (!process_record_dynamic_macro(macro_kc, record)) { + return false; + } + switch (keycode) { + case DYN_REC_START1: + case DYN_REC_START2: +#ifdef AUDIO_ENABLE + PLAY_SONG(tone_dyn_macro_rec); +#endif + break; + case DYN_REC_STOP: +#ifdef AUDIO_ENABLE + PLAY_SONG(tone_dyn_macro_stop); +#endif + break; + case QWERTY: + if (record->event.pressed) { + if (IS_LAYER_ON(_NUMPAD)) { +#ifdef AUDIO_ENABLE + PLAY_SONG(tone_qwerty); +#endif + layer_off(_NUMPAD); + } + } + return false; + break; + case NUMPAD: + if (record->event.pressed) { + if (!IS_LAYER_ON(_NUMPAD)) { +#ifdef AUDIO_ENABLE + PLAY_SONG(tone_numpad); +#endif + layer_on(_NUMPAD); + } + } + return false; + break; + case RAISE: + if (record->event.pressed) { + layer_on(_RAISE); + update_tri_layer(_RAISE, _LOWER, _FUNCTN); + } else { + layer_off(_RAISE); + update_tri_layer(_RAISE, _LOWER, _FUNCTN); + } + return false; + break; + case LOWER: + if (record->event.pressed) { + layer_on(_LOWER); + update_tri_layer(_RAISE, _LOWER, _FUNCTN); + } else { + layer_off(_LOWER); + update_tri_layer(_RAISE, _LOWER, _FUNCTN); + } + return false; + break; + case MEDIA: + if (record->event.pressed) { + layer_on(_MEDIA); + } else { + layer_off(_MEDIA); + } + return false; + break; + } + return true; +} + +void matrix_init_user(void) { +#ifdef AUDIO_ENABLE + startup_user(); +#endif +} + +#ifdef AUDIO_ENABLE + +void startup_user() +{ + _delay_ms(20); // gets rid of tick + PLAY_SONG(tone_startup); +} + +void shutdown_user() +{ + PLAY_SONG(tone_goodbye); + _delay_ms(150); + stop_all_notes(); +} + +void music_on_user(void) +{ + music_scale_user(); +} + +void music_scale_user(void) +{ + PLAY_SONG(music_scale); +} + +#endif diff --git a/keyboards/planck/keymaps/dr_notsokind/rules.mk b/keyboards/planck/keymaps/dr_notsokind/rules.mk new file mode 100644 index 000000000..7f691ebe4 --- /dev/null +++ b/keyboards/planck/keymaps/dr_notsokind/rules.mk @@ -0,0 +1,25 @@ + +# Build Options +# change to "no" to disable the options, or define them in the makefile.mk in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = no # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = yes # Commands for debug and configuration +NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = yes # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +TAP_DANCE_ENABLE = yes # Enables the double-tap functionality of keys + +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif