diff options
author | Stanley Lai <stanleylai.sg@gmail.com> | 2016-12-18 15:35:59 -0800 |
---|---|---|
committer | Stanley Lai <stanleylai.sg@gmail.com> | 2016-12-18 15:35:59 -0800 |
commit | 5834d4b262180f6ef4755bca6001c30d7a945a39 (patch) | |
tree | 930069cec9ce088a7010a32de56eb76779ce0999 /keyboards/ergodox | |
parent | 91913146db64bc560be5d658a4e1d9257bbff32c (diff) | |
parent | 8a65c640ecdaacfd57b86b684ec80b481f5d4b3b (diff) |
Merge remote-tracking branch 'refs/remotes/jackhumbert/master'
Diffstat (limited to 'keyboards/ergodox')
-rw-r--r-- | keyboards/ergodox/ez/config.h | 2 | ||||
-rw-r--r-- | keyboards/ergodox/keymaps/default/keymap.c | 12 | ||||
-rw-r--r-- | keyboards/ergodox/keymaps/pvinis/keymap.c | 171 | ||||
-rw-r--r-- | keyboards/ergodox/keymaps/reset_eeprom/keymap.c | 140 |
4 files changed, 256 insertions, 69 deletions
diff --git a/keyboards/ergodox/ez/config.h b/keyboards/ergodox/ez/config.h index c2750a321f..a3dc5bf152 100644 --- a/keyboards/ergodox/ez/config.h +++ b/keyboards/ergodox/ez/config.h @@ -56,6 +56,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. /* Set 0 if debouncing isn't needed */ #define DEBOUNCE 5 +#define USB_MAX_POWER_CONSUMPTION 50 + /* * Feature disable options * These options are also useful to firmware size reduction. diff --git a/keyboards/ergodox/keymaps/default/keymap.c b/keyboards/ergodox/keymaps/default/keymap.c index 4eff280850..4477cab310 100644 --- a/keyboards/ergodox/keymaps/default/keymap.c +++ b/keyboards/ergodox/keymaps/default/keymap.c @@ -22,7 +22,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| * | Del | Q | W | E | R | T | L1 | | L1 | Y | U | I | O | P | \ | * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| - * | BkSp | A | S | D | F | G |------| |------| H |J/Alt | K | L |; / L2|' / Cmd | + * | BkSp | A | S | D | F | G |------| |------| H | J | K | L |; / L2|' / Cmd | * |--------+------+------+------+------+------| Hyper| | Meh |------+------+------+------+------+--------| * | LShift |Z/Ctrl| X | C | V | B | | | | N | M | , | . |//Ctrl| RShift | * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' @@ -49,11 +49,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_HOME, KC_SPC,KC_BSPC,KC_END, // right hand - KC_RGHT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, - TG(SYMB), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, - KC_H, ALT_T(KC_J), KC_K, KC_L, LT(MDIA, KC_SCLN),GUI_T(KC_QUOT), - MEH_T(KC_NO),KC_N, KC_M, KC_COMM,KC_DOT, CTL_T(KC_SLSH), KC_RSFT, - KC_UP, KC_DOWN,KC_LBRC,KC_RBRC, KC_FN1, + KC_RGHT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, + TG(SYMB), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, + KC_H, KC_J, KC_K, KC_L, LT(MDIA, KC_SCLN),GUI_T(KC_QUOT), + MEH_T(KC_NO),KC_N, KC_M, KC_COMM,KC_DOT, CTL_T(KC_SLSH), KC_RSFT, + KC_UP, KC_DOWN,KC_LBRC,KC_RBRC, KC_FN1, KC_LALT, CTL_T(KC_ESC), KC_PGUP, KC_PGDN,KC_TAB, KC_ENT diff --git a/keyboards/ergodox/keymaps/pvinis/keymap.c b/keyboards/ergodox/keymaps/pvinis/keymap.c index df906201a8..87ad70c919 100644 --- a/keyboards/ergodox/keymaps/pvinis/keymap.c +++ b/keyboards/ergodox/keymaps/pvinis/keymap.c @@ -13,20 +13,16 @@ enum { QWERTY, CARPALX, SYSCTL, + MOUSE, }; // extra keys enum { NONE = 0, - // mouse - MS_UL, // up left - MS_UR, // up right - MS_DL, // down left - MS_DR, // down right - // tap dance TD_FLSH, // flash keyboard + TD_LAYR, // SYSCTL and MOUSE layer switch }; // application selection @@ -52,7 +48,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | | | | | | | | | | | | * `----------------------------------' `----------------------------------' * ,-------------. ,-------------. - * |BEGIN |QWERTY| |SYSCTL| | + * |BEGIN |QWERTY| | | | * ,------|------|------| |------+--------+------. * | | |CARPAL| |Slack | | | * |Backsp|LShift|------| |------| Enter |Space | @@ -66,9 +62,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO - ,TG(BEGIN) ,TG(QWERTY) - ,TG(CARPALX) - ,KC_BSPC ,KC_LSFT ,TG(SYSCTL) + ,TG(BEGIN) ,TD(TD_LAYR) + ,TG(MOUSE) + ,KC_BSPC ,KC_LSFT ,TD(TD_LAYR) ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO @@ -85,7 +81,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * a beginner's keymap i currently use. * * ,--------------------------------------------------. ,--------------------------------------------------. - * | | 1 | 2 | 3 | 4 | 5 | 6 | | 6 | 7 | 8 | 9 | 0 | - | = | + * | | 1 | 2 | 3 | 4 | 5 | opt | | 6 | 7 | 8 | 9 | 0 | - | = | * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| * | Tab | Q | W | E | R | T | [ | | ] | Y | U | I | O | P | \ | * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| @@ -104,7 +100,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `--------------------' `----------------------' */ [BEGIN] = KEYMAP( - KC_TRNS ,KC_1 ,KC_2 ,KC_3 ,KC_4 ,KC_5 ,KC_6 + KC_TRNS ,KC_1 ,KC_2 ,KC_3 ,KC_4 ,KC_5 ,KC_LALT ,KC_TAB ,KC_Q ,KC_W ,KC_E ,KC_R ,KC_T ,KC_LBRC ,CTL_T(KC_ESC) ,KC_A ,KC_S ,KC_D ,KC_F ,KC_G ,KC_LSFT ,KC_Z ,KC_X ,KC_C ,KC_V ,KC_B ,KC_LPRN @@ -213,30 +209,73 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ,KC_TRNS ,KC_TRNS ,KC_TRNS ), - /* SYSCTL * a keymap to control my system. * + * ,--------------------------------------------------. ,------------------------------------------------------. + * | ^ | | | | | | | | | | | | | | | + * |--------+------+------+------+------+-------------| |------+------+------+----------+------+------+--------| + * | | | | | | | | | | Mute | Home | Up | End | | | + * |--------+------+------+------+------+------| | | |------+------+----------+------+------+--------| + * | | | | | | |------| |------|VolUp | Left | Down |Right | | Lock | + * |--------+------+------+------+------+------| | | |------+------+----------+------+------+--------| + * | | | | | | | | | |VolDn | Prev |Play/Pause| Next | | Sleep | + * `--------+------+------+------+------+-------------' `-------------+------+----------+------+------+--------' + * | | | | | | | | | | | Power| + * `----------------------------------' `--------------------------------------' + * ,-------------. ,-------------. + * | | | | | | + * ,------|------|------| |------+------+------. + * | | | | | | | | + * | | |------| |------| | | + * | | | ^ | | | | | + * `--------------------' `--------------------' + */ +[SYSCTL] = KEYMAP( + KC_TRNS ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO +,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO +,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO +,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO +,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO + + ,KC_NO ,KC_NO + ,KC_NO + ,KC_NO ,KC_NO ,KC_TRNS + + /*,KC_POP /// */,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO + /* /// ,KC_PTRN*/,KC_NO ,KC_MUTE ,KC_HOME ,KC_UP ,KC_END ,KC_NO ,KC_NO + ,KC_VOLU ,KC_LEFT ,KC_DOWN ,KC_RGHT ,KC_NO ,LCTL(LSFT(KC_PWR)) + ,KC_NO ,KC_VOLD ,KC_MPRV ,KC_MPLY ,KC_MNXT ,KC_NO ,KC_SLEP + ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_PWR + + ,KC_NO ,KC_NO + ,KC_NO + ,KC_NO ,KC_NO ,KC_NO +), + +/* MOUSE + * a keymap to control my system. + * * ,--------------------------------------------------. ,--------------------------------------------------. - * | | | | | | | | | | | | Mute |VolDn |VolUp | | + * | ^ | | | | | | | | | | | | | | | * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| - * | | | | | | | | | | |MsUpL | MsUp |MsUpR | | | + * | | | | | | | | | | | | MsUp | | | | * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| - * | | | | | | |------| |------| |MsLeft| MsDn |MsRght| | Lock | + * | | | | | | |------| |------| |MsLeft| MsDn |MsRght| | | * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| - * | | | | | | | | | | |MsDnL | MsDn | | | Sleep | + * | | | | | | | | | | | | | | | | * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' - * | | | | | | | | | | | Power| + * | | | | | | | | | | | | * `----------------------------------' `----------------------------------' * ,-------------. ,-------------. * | | | | |MidClk| * ,------|------|------| |------+------+------. * | | | | | |Left |Right | * | | |------| |------| Click| Click| - * | | | | | | | | + * | | | ^ | | | | | * `--------------------' `--------------------' */ -[SYSCTL] = KEYMAP( +[MOUSE] = KEYMAP( KC_TRNS ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO @@ -245,13 +284,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ,KC_NO ,KC_NO ,KC_NO - ,KC_NO ,KC_NO ,KC_NO + ,KC_NO ,KC_NO ,KC_TRNS - /*,KC_POP*/,KC_NO ,KC_NO ,KC_NO ,KC_MUTE ,KC_VOLD ,KC_VOLU ,KC_NO - /*,KC_PTRN*/,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO - ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,LCTL(LSFT(KC_PWR)) - ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_SLEP - ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_PWR + ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO + ,KC_NO ,KC_NO ,KC_NO ,KC_MS_U ,KC_NO ,KC_NO ,KC_NO + ,KC_NO ,KC_MS_L ,KC_MS_D ,KC_MS_R ,KC_NO ,KC_NO + ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO + ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO @@ -341,48 +380,29 @@ void matrix_init_user() { ergodox_led_all_off(); } -// extra keys -const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { - switch (id) { +// light up leds based on the layer +void matrix_scan_user(void) { + uint8_t layer = biton32(layer_state); - // mouse - case MS_UL: - if (record->event.pressed) { - mousekey_on(KC_MS_UP); - mousekey_on(KC_MS_LEFT); - } else { - mousekey_off(KC_MS_UP); - mousekey_off(KC_MS_LEFT); - } - break; - case MS_UR: - if (record->event.pressed) { - mousekey_on(KC_MS_UP); - mousekey_on(KC_MS_RIGHT); - } else { - mousekey_off(KC_MS_UP); - mousekey_off(KC_MS_RIGHT); - } + switch(layer) { + case SYSCTL: + ergodox_right_led_3_on(); break; - case MS_DL: - if (record->event.pressed) { - mousekey_on(KC_MS_DOWN); - mousekey_on(KC_MS_LEFT); - } else { - mousekey_off(KC_MS_DOWN); - mousekey_off(KC_MS_LEFT); - } + case MOUSE: + ergodox_right_led_2_on(); break; - case MS_DR: - if (record->event.pressed) { - mousekey_on(KC_MS_DOWN); - mousekey_on(KC_MS_RIGHT); - } else { - mousekey_off(KC_MS_DOWN); - mousekey_off(KC_MS_RIGHT); - } + default: + ergodox_right_led_1_off(); + ergodox_right_led_2_off(); + ergodox_right_led_3_off(); break; } +} + +// extra keys +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { + switch (id) { + } return MACRO_NONE; } @@ -425,6 +445,31 @@ void flash_dance_reset(qk_tap_dance_state_t *state, void *user_data) { ergodox_right_led_3_off(); } +// SYSCTL on first tap, MOUSE ON second tap +void layers_dance_finished(qk_tap_dance_state_t *state, void *user_data) { + uint8_t layer = biton32(layer_state); + + switch(state->count) { + case 1: + switch(layer) { + case SYSCTL: + layer_off(SYSCTL); + break; + case MOUSE: + layer_off(MOUSE); + break; + default: + layer_on(SYSCTL); + break; + } + break; + case 2: + layer_on(MOUSE); + break; + } +} + qk_tap_dance_action_t tap_dance_actions[] = { [TD_FLSH] = ACTION_TAP_DANCE_FN_ADVANCED( flash_each_tap, flash_dance_finished, flash_dance_reset ), + [TD_LAYR] = ACTION_TAP_DANCE_FN_ADVANCED( NULL, layers_dance_finished, NULL ), }; diff --git a/keyboards/ergodox/keymaps/reset_eeprom/keymap.c b/keyboards/ergodox/keymaps/reset_eeprom/keymap.c new file mode 100644 index 0000000000..f708454ce2 --- /dev/null +++ b/keyboards/ergodox/keymaps/reset_eeprom/keymap.c @@ -0,0 +1,140 @@ +#include "ergodox.h" +#include "debug.h" +#include "action_layer.h" +#include "version.h" + +#define BASE 0 // default layer +#define SYMB 1 // symbols +#define MDIA 2 // media keys + +enum custom_keycodes { + PLACEHOLDER = SAFE_RANGE, // can always be here + EPRM, + VRSN, + RGB_SLD +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +/* Keymap 0: Basic layer + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | = | 1 | 2 | 3 | 4 | 5 | LEFT | | RIGHT| 6 | 7 | 8 | 9 | 0 | - | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | Del | Q | W | E | R | T | L1 | | L1 | Y | U | I | O | P | \ | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | BkSp | A | S | D | F | G |------| |------| H | J | K | L |; / L2|' / Cmd | + * |--------+------+------+------+------+------| Hyper| | Meh |------+------+------+------+------+--------| + * | LShift |Z/Ctrl| X | C | V | B | | | | N | M | , | . |//Ctrl| RShift | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * |Grv/L1| '" |AltShf| Left | Right| | Up | Down | [ | ] | ~L1 | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | App | LGui | | Alt |Ctrl/Esc| + * ,------|------|------| |------+--------+------. + * | | | Home | | PgUp | | | + * | Space|Backsp|------| |------| Tab |Enter | + * | |ace | End | | PgDn | | | + * `--------------------' `----------------------' + */ +// If it accepts an argument (i.e, is a function), it doesn't need KC_. +// Otherwise, it needs KC_* +[BASE] = KEYMAP( // layer 0 : default + // left hand + EPRM, EPRM, EPRM, EPRM, EPRM, EPRM, EPRM, + EPRM, EPRM, EPRM, EPRM, EPRM, EPRM, EPRM, + EPRM, EPRM, EPRM, EPRM, EPRM, EPRM, + EPRM, EPRM, EPRM, EPRM, EPRM, EPRM, EPRM, + EPRM, EPRM, EPRM, EPRM,EPRM, + EPRM, EPRM, + EPRM, + EPRM,EPRM,EPRM, + // right hand + EPRM, EPRM, EPRM, EPRM, EPRM, EPRM, EPRM, + EPRM, EPRM, EPRM, EPRM, EPRM, EPRM, EPRM, + EPRM, EPRM, EPRM, EPRM, EPRM,EPRM, + EPRM,EPRM, EPRM, EPRM,EPRM, EPRM, EPRM, + EPRM, EPRM,EPRM,EPRM, EPRM, + EPRM, EPRM, + EPRM, + EPRM,EPRM, EPRM + ) +}; + +const uint16_t PROGMEM fn_actions[] = { + [1] = ACTION_LAYER_TAP_TOGGLE(SYMB) // FN1 - Momentary Layer 1 (Symbols) +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + // MACRODOWN only works in this function + switch(id) { + case 0: + if (record->event.pressed) { + SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); + } + break; + case 1: + if (record->event.pressed) { // For resetting EEPROM + eeconfig_init(); + } + break; + } + return MACRO_NONE; +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + // dynamically generate these. + case EPRM: + if (record->event.pressed) { + eeconfig_init(); + } + return false; + break; + case VRSN: + if (record->event.pressed) { + SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); + } + return false; + break; + case RGB_SLD: + if (record->event.pressed) { + #ifdef RGBLIGHT_ENABLE + rgblight_mode(1); + #endif + } + return false; + break; + } + return true; +} + +// Runs just one time when the keyboard initializes. +void matrix_init_user(void) { + +}; + + +// Runs constantly in the background, in a loop. +void matrix_scan_user(void) { + + uint8_t layer = biton32(layer_state); + + ergodox_board_led_off(); + ergodox_right_led_1_off(); + ergodox_right_led_2_off(); + ergodox_right_led_3_off(); + switch (layer) { + // TODO: Make this relevant to the ErgoDox EZ. + case 1: + ergodox_right_led_1_on(); + break; + case 2: + ergodox_right_led_2_on(); + break; + default: + // none + break; + } + +}; |