diff options
author | Brian Pruitt-Goddard <pruittgoddard.b@gmail.com> | 2018-05-29 15:55:47 -0700 |
---|---|---|
committer | Drashna Jaelre <drashna@live.com> | 2018-05-29 15:55:47 -0700 |
commit | 8a9c19ee93d38ab7c5cf145472e4e3fc16901fc3 (patch) | |
tree | f03f182667e2a32f2beb8f9c8107a97aa0b4613e /keyboards/ergodox_ez/keymaps | |
parent | 751719e6cb547db753b2f33f06ee6fa61607d544 (diff) |
Add bpruitt-goddard Ergodox Layout (#3080)
* Feat: Create personal ergodox keymap
* FEAT: Update bpruitt-goddard keymap with custom layout
* Fix: Remove unused pieces from bpruitt-goddard keyboard
* Feat: Add QWERTY layer to bpruitt-goddard ergodox keymap
* Refactor: Remove unused layers from bpruitt-goddard keymap
* Fix: Update base layer for bpruitt-goddard keymap
* Fix: Remove un-reachable key combo from FN layer
* Fix: Rename FN layer to numpad layer
* Feat: Create one-shot modifier layer for mac os use
* Doc: Update readme to reflect my keymap
* Feat: Add mac desktop space switching
* feat: Update keymap layers to use ergodox pretty format
Diffstat (limited to 'keyboards/ergodox_ez/keymaps')
4 files changed, 300 insertions, 0 deletions
diff --git a/keyboards/ergodox_ez/keymaps/bpruitt-goddard/config.h b/keyboards/ergodox_ez/keymaps/bpruitt-goddard/config.h new file mode 100644 index 0000000000..11c81f2eba --- /dev/null +++ b/keyboards/ergodox_ez/keymaps/bpruitt-goddard/config.h @@ -0,0 +1,28 @@ +#include "../../config.h" + +// Sets good default for the speed of the mouse. +#undef MOUSEKEY_INTERVAL +#undef MOUSEKEY_DELAY +#undef MOUSEKEY_TIME_TO_MAX +#undef MOUSEKEY_MAX_SPEED + +#define MOUSEKEY_INTERVAL 20 +#define MOUSEKEY_DELAY 100 +#define MOUSEKEY_TIME_TO_MAX 60 +#define MOUSEKEY_MAX_SPEED 7 + +#undef MOUSEKEY_WHEEL_MAX_SPEED +#undef MOUSEKEY_WHEEL_TIME_TO_MAX +#undef MOUSEKEY_WHEEL_DELAY + +#define MOUSEKEY_WHEEL_MAX_SPEED 5 +#define MOUSEKEY_WHEEL_TIME_TO_MAX 60 +#define MOUSEKEY_WHEEL_DELAY 100 + +#undef TAPPING_TOGGLE +#undef TAPPING_TERM +#undef IGNORE_MOD_TAP_INTERRUPT + +#define TAPPING_TOGGLE 1 +#define TAPPING_TERM 150 +#define IGNORE_MOD_TAP_INTERRUPT diff --git a/keyboards/ergodox_ez/keymaps/bpruitt-goddard/keymap.c b/keyboards/ergodox_ez/keymaps/bpruitt-goddard/keymap.c new file mode 100644 index 0000000000..ec77b6aa0f --- /dev/null +++ b/keyboards/ergodox_ez/keymaps/bpruitt-goddard/keymap.c @@ -0,0 +1,234 @@ +// An Ergodox EZ keymap mostly following the programmer's dvorak layout. +// There is a standard QWERTY layer as well +// +// See the README.md file for an image of this keymap. + +#include QMK_KEYBOARD_H + +// The layers that we are defining for this keyboards. +#define BASE 0 +#define NUM 1 +#define QWERTY 2 +#define MAC 3 + +// The Tap Dance identifiers, used in the TD keycode and tap_dance_actions array. +#define TAP_MACRO 0 + +// SAFE_RANGE must be used to tag the first element of the enum. +// DYNAMIC_MACRO_RANGE must always be the last element of the enum if other +// values are added (as its value is used to create a couple of other keycodes +// after it). +enum custom_keycodes { + MC_ARROW = SAFE_RANGE, + DYNAMIC_MACRO_RANGE +}; + +// A 'transparent' key code (that falls back to the layers below it). +#define ___ KC_TRANSPARENT + +// A 'blocking' key code. Does nothing but prevent falling back to another layer. +#define XXX KC_NO + +// Some combined keys (one normal keycode when tapped and one modifier or layer +// toggle when held). +#define SPC_RALT MT(MOD_RALT, KC_SPC) // SPACE key and right alt modifier. + +// The most portable copy/paste keys (windows (mostly), linux, and some terminal emulators). +#define MK_CUT LSFT(KC_DEL) // shift + delete +#define MK_COPY LCTL(KC_INS) // ctrl + insert +#define MK_PASTE LSFT(KC_INS) // shift + insert +//Move mac desktop spaces +#define MAC_L LGUI(LSFT(KC_UP)) // cmd + shift + up +#define MAC_R LGUI(LSFT(KC_DOWN)) // cmd + shift + down + +// This file must be included after DYNAMIC_MACRO_RANGE is defined... +#include "dynamic_macro.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + // Layer 0: basic keys. + [BASE] = LAYOUT_ergodox_pretty( + KC_DLR, KC_AMPR, KC_LBRC, KC_LCBR, KC_RCBR, KC_LPRN, KC_CIRC, KC_F4, KC_EQUAL,KC_ASTR, KC_BSLASH, KC_PLUS, KC_RBRACKET, KC_EXLM, + GUI_T(KC_BSLASH), KC_SCOLON,KC_COMMA, KC_DOT, KC_P, KC_Y, KC_PERC, KC_DELETE, KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLASH, + MO(NUM), KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINUS, + KC_LSPO, KC_QUOTE, KC_Q, KC_J, KC_K, KC_X, KC_LALT, TD(TAP_MACRO),KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSPC, + KC_AT, KC_HASH, KC_GRAVE, KC_LEFT, KC_RIGHT, KC_UP, KC_DOWN, KC_HOME, KC_END, TO(QWERTY), + ALT_T(KC_APPLICATION), ALL_T(KC_NO), KC_PGUP, KC_LGUI, + KC_BSLASH, TO(MAC), + KC_ENTER, KC_TAB, CTL_T(KC_ESCAPE), CTL_T(KC_ESCAPE), KC_BSPACE, KC_SPACE), + + // Layer 1: function and numpad keys. + [NUM] = LAYOUT_ergodox_pretty( + ___, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, ___, ___, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, + ___, KC_EXLM, KC_COMMA, KC_DOT, KC_MS_BTN1, KC_MS_BTN2, ___, ___, KC_UP, KC_7, KC_8, KC_9, KC_ASTR, KC_F12, + XXX, ___, KC_LCBR, KC_RCBR, MC_ARROW, KC_GRAVE, KC_DOWN, KC_4, KC_5, KC_6, KC_PLUS, KC_UNDS, + ___, ___, KC_CIRC, KC_LBRACKET, KC_RBRACKET, KC_TILD, ___, ___, KC_0, KC_1, KC_2, KC_3, KC_KP_SLASH, KC_BSLASH, + ___, ___, ___, ___, ___, ___, KC_0, KC_KP_DOT, KC_EQUAL, ___, + ___, ___, KC_KP_ASTERISK, KC_KP_SLASH, + KC_LCTL, ___, + KC_KP_PLUS, KC_KP_MINUS, KC_DLR, KC_DELETE, KC_BSPACE, KC_SPACE), + + // Layer 2: QWERTY control. + [QWERTY] = LAYOUT_ergodox_pretty( + /* left hand */ + KC_EQUAL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LEFT, KC_RIGHT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINUS, + KC_DELETE, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, TO(BASE), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLASH, + MO(NUM), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, GUI_T(KC_QUOT), + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, ALT_T(KC_NO), MEH_T(KC_NO), KC_N, KC_M, KC_COMMA, KC_DOT, KC_SLASH, KC_RSPC, + KC_GRAVE, KC_QUOTE, LALT(KC_TAB), KC_LEFT, KC_RIGHT, KC_UP, KC_DOWN, KC_LBRACKET, KC_RBRACKET, TO(BASE), + ___, KC_LGUI, ___, KC_ESCAPE, + KC_HOME, KC_PGUP, + KC_ENTER, KC_TAB, KC_END, KC_PGDOWN, KC_BSPACE, KC_SPACE), + + // Layer 3: Mac layer + [MAC] = LAYOUT_ergodox_pretty( + /* left hand */ + ___, KC_1, KC_2, KC_3, KC_4, KC_5, ___, ___, KC_6, KC_7, KC_8, KC_9, KC_0, ___, + ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, + ___, ___, ___, MAC_L, MAC_R, ___, ___, ___, ___, ___, + ___, ___, ___, ___, + ___, TO(BASE), + KC_LGUI, KC_LALT, KC_LGUI, KC_LGUI, KC_LALT, KC_LGUI), +}; + +// Whether the macro 1 is currently being recorded. +static bool is_macro1_recording = false; + +// The current set of active layers (as a bitmask). +// There is a global 'layer_state' variable but it is set after the call +// to layer_state_set_user(). +static uint32_t current_layer_state = 0; +uint32_t layer_state_set_user(uint32_t state); + +// Method called at the end of the tap dance on the TAP_MACRO key. That key is +// used to start recording a macro (double tap or more), to stop recording (any +// number of tap), or to play the recorded macro (1 tap). +void macro_tapdance_fn(qk_tap_dance_state_t *state, void *user_data) { + uint16_t keycode; + keyrecord_t record; + dprintf("macro_tap_dance_fn %d\n", state->count); + if (is_macro1_recording) { + keycode = DYN_REC_STOP; + is_macro1_recording = false; + layer_state_set_user(current_layer_state); + } else if (state->count == 1) { + keycode = DYN_MACRO_PLAY1; + } else { + keycode = DYN_REC_START1; + is_macro1_recording = true; + layer_state_set_user(current_layer_state); + } + + record.event.pressed = true; + process_record_dynamic_macro(keycode, &record); + record.event.pressed = false; + process_record_dynamic_macro(keycode, &record); +} + +// The definition of the tap dance actions: +qk_tap_dance_action_t tap_dance_actions[] = { + // This Tap dance plays the macro 1 on TAP and records it on double tap. + [TAP_MACRO] = ACTION_TAP_DANCE_FN(macro_tapdance_fn) +}; + +// Runs for each key down or up event. +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (keycode != TD(TAP_MACRO)) { + // That key is processed by the macro_tapdance_fn. Not ignoring it here is + // mostly a no-op except that it is recorded in the macros (and uses space). + // We can't just return false when the key is a tap dance, because + // process_record_user, is called before the tap dance processing (and + // returning false would eat the tap dance). + if (!process_record_dynamic_macro(keycode, record)) { + return false; + } + + if(record->event.pressed) { + switch(keycode) { + case MC_ARROW: + SEND_STRING("=>"); + return false; + break; + } + } + } + + return true; // Let QMK send the enter press/release events +} + +// Runs just one time when the keyboard initializes. +void matrix_init_user(void) { + ergodox_right_led_1_off(); + ergodox_right_led_2_off(); + ergodox_right_led_3_off(); +}; + +// Runs constantly in the background, in a loop. +void matrix_scan_user(void) { + +}; + +// Value to use to switch LEDs on. The default value of 255 is far too bright. +static const uint8_t max_led_value = 20; + +// Whether the given layer (one of the constant defined at the top) is active. +#define LAYER_ON(layer) (current_layer_state & (1<<layer)) + +void led_1_on(void) { + ergodox_right_led_1_on(); + ergodox_right_led_1_set(max_led_value); +} + +void led_2_on(void) { + ergodox_right_led_2_on(); + ergodox_right_led_2_set(max_led_value); +} + +void led_3_on(void) { + ergodox_right_led_3_on(); + ergodox_right_led_3_set(max_led_value); +} + +void led_1_off(void) { + ergodox_right_led_1_off(); +} + +void led_2_off(void) { + ergodox_right_led_2_off(); +} + +void led_3_off(void) { + ergodox_right_led_3_off(); +} + +uint32_t layer_state_set_user(uint32_t state) { + current_layer_state = state; + + if (is_macro1_recording) { + led_1_on(); + led_2_on(); + led_3_on(); + return state; + } + + if (LAYER_ON(NUM)) { + led_1_on(); + } else { + led_1_off(); + } + + if (LAYER_ON(MAC)) { + led_2_on(); + } else { + led_2_off(); + } + + if (LAYER_ON(QWERTY)) { + led_3_on(); + } else { + led_3_off(); + } + + return state; +}; diff --git a/keyboards/ergodox_ez/keymaps/bpruitt-goddard/readme.md b/keyboards/ergodox_ez/keymaps/bpruitt-goddard/readme.md new file mode 100644 index 0000000000..33040800e9 --- /dev/null +++ b/keyboards/ergodox_ez/keymaps/bpruitt-goddard/readme.md @@ -0,0 +1,23 @@ +# Ergodox EZ Layout by bpruitt-goddard +![Layout Image](https://i.imgur.com/kVPmpFG.png) + +[KLE link](http://www.keyboard-layout-editor.com/#/gists/5896c5a729a64633d3f63de71e7e0e79) + +## Layers +| Layer | Legend | +| ----- | ------ | +| Base | Top (black) | +| Num | Center (blue) | +| QWERTY | Bottom (Red) | +| MAC | Front/Bottom-most (Yellow) | + +## Features +* Tap-dance dynamic macro key. + * Tap twice for starting macro. Then tap once to complete the macro + * Tap one for replaying macro +* Numpad on right hand with momentary Num layer +* QWERTY layer for non-dvorak users +* Mac layer for changing thumbpad modifier keys with Command +* Uses the following dual function keys + * Space Cadet shifts (shift/paren) + * Ctrl/Esc diff --git a/keyboards/ergodox_ez/keymaps/bpruitt-goddard/rules.mk b/keyboards/ergodox_ez/keymaps/bpruitt-goddard/rules.mk new file mode 100644 index 0000000000..6ed55e72b4 --- /dev/null +++ b/keyboards/ergodox_ez/keymaps/bpruitt-goddard/rules.mk @@ -0,0 +1,15 @@ +MOUSEKEY_ENABLE = yes # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +COMMAND_ENABLE = yes # Commands for debug and configuration +NKRO_ENABLE = yes # USB Nkey Rollover - for issues, see github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +ONEHAND_ENABLE = yes # Allow swapping hands of keyboard +KEY_LOCK_ENABLE = yes # Enable the KC_LOCK key +TAP_DANCE_ENABLE = yes # Enable the tap dance feature. +CONSOLE_ENABLE = yes # Console for debug + +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration +UNICODE_ENABLE = no +SLEEP_LED_ENABLE = no +API_SYSEX_ENABLE = no +RGBLIGHT_ENABLE = no +RGBLIGHT_ANIMATION = no |