From 065f4a7fa495e27ba7b13dfc448962af94ae84f9 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Fri, 24 Jun 2016 01:18:18 -0500 Subject: [PATCH] added doubled layers --- planck/lytedev/Makefile | 4 +- planck/lytedev/keymap.c | 128 ++++++++++++++++++++++++---------------- 2 files changed, 79 insertions(+), 53 deletions(-) diff --git a/planck/lytedev/Makefile b/planck/lytedev/Makefile index 9d64af4..eb7e24c 100644 --- a/planck/lytedev/Makefile +++ b/planck/lytedev/Makefile @@ -9,9 +9,9 @@ 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 = yes # Enable keyboard backlight functionality -MIDI_ENABLE = yes # MIDI controls +MIDI_ENABLE = no # MIDI controls AUDIO_ENABLE = yes # Audio output on port C6 -UNICODE_ENABLE = yes # Unicode +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. diff --git a/planck/lytedev/keymap.c b/planck/lytedev/keymap.c index e48bdcc..bbf7f44 100644 --- a/planck/lytedev/keymap.c +++ b/planck/lytedev/keymap.c @@ -11,18 +11,23 @@ extern keymap_config_t keymap_config; #define _QWERTY 0 #define _COLEMAK 1 -#define _DVORAK 2 -#define _LOWER 3 +#define _LOWER 2 +#define _LOWER2 3 #define _RAISE 4 -#define _ADJUST 16 +#define _RAISE2 5 +#define _PLOVER 6 +#define _ADJUST 7 // macro shortcuts #define QWERTY M(_QWERTY) #define COLEMAK M(_COLEMAK) -#define DVORAK M(_DVORAK) #define LOWER M(_LOWER) #define RAISE M(_RAISE) -#define M_BL 5 +#define PLOVER M(_PLOVER) +#define ADJUST MO(_ADJUST) +#define LOWER2 M(_LOWER2) +#define RAISE2 M(_RAISE2) +#define EXT_PLV M(13) #define TOG_OUT M(14) // visually clearer key notation @@ -34,37 +39,49 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, - {KC_LCTL, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} + {KC_LCTL, ADJUST, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} }, [_COLEMAK] = { {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC}, {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT}, {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, - {KC_LCTL, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} - }, - [_DVORAK] = { - {KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC}, - {KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH}, - {KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT }, - {KC_LCTL, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} + {KC_LCTL, ADJUST, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} }, [_LOWER] = { {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC}, {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE}, - {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),_______, _______, _______}, - {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} + {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),_______, _______, RESET}, + {_______, _______, _______, _______, _______, _______, _______, LOWER2, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} + }, + [_LOWER2] = { + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} }, [_RAISE] = { {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL }, {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_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______}, - {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_PGDN, KC_PGUP, KC_MPLY} + {ADJUST, _______, _______, _______, RAISE2, _______, _______, _______, KC_MNXT, KC_PGDN, KC_PGUP, KC_MPLY} + }, + [_RAISE2] = { + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} + }, + [_PLOVER] = { + {KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1 }, + {XXXXXXX, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC}, + {TOG_OUT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, + {EXT_PLV, XXXXXXX, XXXXXXX, KC_C, KC_V, XXXXXXX, XXXXXXX, KC_N, KC_M, XXXXXXX, XXXXXXX, XXXXXXX} }, [_ADJUST] = { - {_______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL}, - {_______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______}, - {_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______}, - {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} + {KC_J, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL}, + {MUV_IN, _______, _______, _______, _______, _______, _______, QWERTY, COLEMAK, PLOVER, _______, _______}, + {MUV_DE, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, + {MU_TOG, _______, AU_TOG, _______, _______, _______, _______, _______, _______, _______, _______, RESET } } }; @@ -76,8 +93,9 @@ const uint16_t PROGMEM fn_actions[] = { float tone_startup[][2] = SONG(STARTUP_SOUND); float tone_qwerty[][2] = SONG(QWERTY_SOUND); -float tone_dvorak[][2] = SONG(DVORAK_SOUND); float tone_colemak[][2] = SONG(COLEMAK_SOUND); +float tone_plover[][2] = SONG(PLOVER_SOUND); +float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND); float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); float tone_goodbye[][2] = SONG(GOODBYE_SOUND); @@ -93,30 +111,22 @@ void persistant_default_layer_set(uint16_t default_layer) { const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { switch(id) { - /* case _QWERTY: */ - /* if (record->event.pressed) { */ - /* #ifdef AUDIO_ENABLE */ - /* PLAY_NOTE_ARRAY(tone_qwerty, false, 0); */ - /* #endif */ - /* persistant_default_layer_set(1UL<<_QWERTY); */ - /* } */ - /* break; */ - /* case _COLEMAK: */ - /* if (record->event.pressed) { */ - /* #ifdef AUDIO_ENABLE */ - /* PLAY_NOTE_ARRAY(tone_colemak, false, 0); */ - /* #endif */ - /* persistant_default_layer_set(1UL<<_COLEMAK); */ - /* } */ - /* break; */ - /* case _DVORAK: */ - /* if (record->event.pressed) { */ - /* #ifdef AUDIO_ENABLE */ - /* PLAY_NOTE_ARRAY(tone_dvorak, false, 0); */ - /* #endif */ - /* persistant_default_layer_set(1UL<<_DVORAK); */ - /* } */ - /* break; */ + case _QWERTY: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_qwerty, false, 0); + #endif + persistant_default_layer_set(1UL<<_QWERTY); + } + break; + case _COLEMAK: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_colemak, false, 0); + #endif + persistant_default_layer_set(1UL<<_COLEMAK); + } + break; case _LOWER: if (record->event.pressed) { layer_on(_LOWER); @@ -135,14 +145,30 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) update_tri_layer(_LOWER, _RAISE, _ADJUST); } break; - case M_BL: + case 12: if (record->event.pressed) { - register_code(KC_RSFT); - #ifdef BACKLIGHT_ENABLE - backlight_step(); + #ifdef AUDIO_ENABLE + stop_all_notes(); + PLAY_NOTE_ARRAY(tone_plover, false, 0); #endif - } else { - unregister_code(KC_RSFT); + layer_off(_RAISE); + layer_off(_LOWER); + layer_off(_ADJUST); + layer_on(_PLOVER); + if (!eeconfig_is_enabled()) { + eeconfig_init(); + } + keymap_config.raw = eeconfig_read_keymap(); + keymap_config.nkro = 1; + eeconfig_update_keymap(keymap_config.raw); + } + break; + case 13: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_plover_gb, false, 0); + #endif + layer_off(_PLOVER); } break; case 14: