diff options
author | Chris <chris@rootiest.com> | 2021-08-09 05:25:43 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-09 02:25:43 -0700 |
commit | 79d5b279931cf98d635181235c0301ba7053f9d5 (patch) | |
tree | 8f5040428bc3e2701bca72bac476633ae8d2cade | |
parent | 59b5c884ff539952fa68df0405ed8ea0f5c652d0 (diff) |
[Keymap] rootiest for planck/rev6/ (#13294)
* squashed commits to master
* Fix in case of missing user_song_list
Substitutes missing songs with safe versions
Also updated and added detail to keymap readme
* Adjust Readme to match qmk contrib conventions
* Update keyboards/planck/keymaps/rootiest/config.h
* Update keyboards/planck/keymaps/rootiest/keymap.c
* Update keyboards/planck/keymaps/rootiest/keymap.c
* Update keyboards/planck/keymaps/rootiest/keymap.c
* Update keyboards/planck/keymaps/rootiest/keymap.c
* Fixed license header to GPLv2+
* Fix Volume key delay
Use a static number instead of removed MEDIA_KEY_DELAY
* Use TAP_CODE_DELAY
* added license to config.h
* Clean up formatting
- Fixed markdown in readme
- Removed extra commented line from config.h
* Update keyboards/planck/keymaps/rootiest/config.h
-rw-r--r-- | keyboards/planck/keymaps/rootiest/config.h | 146 | ||||
-rw-r--r-- | keyboards/planck/keymaps/rootiest/keymap.c | 1928 | ||||
-rw-r--r-- | keyboards/planck/keymaps/rootiest/readme.md | 37 | ||||
-rw-r--r-- | keyboards/planck/keymaps/rootiest/rules.mk | 26 |
4 files changed, 2137 insertions, 0 deletions
diff --git a/keyboards/planck/keymaps/rootiest/config.h b/keyboards/planck/keymaps/rootiest/config.h new file mode 100644 index 0000000000..fc1fc81761 --- /dev/null +++ b/keyboards/planck/keymaps/rootiest/config.h @@ -0,0 +1,146 @@ +/* Copyright 2021 Chris Laprade + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#pragma once + +/* + * USB/POWER OPTIONS + */ +// #define USB_MAX_POWER_CONSUMPTION 500 +#define USB_SUSPEND_WAKEUP_DELAY 200 +#define USB_POLLING_INTERVAL_MS 1 + +/* + * MUSIC/AUDIO options + */ +#ifdef AUDIO_ENABLE +# define AUDIO_CLICKY +# define MUSIC_MAP +# define AUDIO_VOICES +# define AUDIO_VOICE_DEFAULT something +# define AUDIO_DAC_SAMPLE_MAX 2732U + +# define DEFAULT_LAYER_SONGS \ + { SONG(QWERTY_SOUND), SONG(COLEMAK_SOUND), SONG(DVORAK_SOUND) } + +/* Plays during keyboard startup */ +# define STARTUP_SONG SONG(NO_SOUND) + +#endif + +/* + * MIDI options + */ +/* 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 + +/* + * ENCODER options + */ +#define ENCODER_DIRECTION_FLIP +#define ENCODER_RESOLUTION 4 // Define number of stages between detents on encoders +#define ENCODERS_PAD_A \ + { B12 } +#define ENCODERS_PAD_B \ + { B13 } + +/* + * RGB options + */ +#ifdef RGBLIGHT_ENABLE +# define RGBLIGHT_SLEEP // Allows rgb to sleep when the host/keyboard does +# define RGBLIGHT_ANIMATIONS // Enable using rgb animations +# define RGBLIGHT_LAYERS // Enable indicating layers using layered rgb assignments +# define RGBLIGHT_LAYER_BLINK // Allows rgb layers to be blinked (activate for a set amount of time) +# define RGBLIGHT_MAX_LAYERS 32 // Overides the default (8) max number of rgb layers +# define RGBLIGHT_LAYERS_OVERRIDE_RGB_OFF // Allows rgb layers to work even when rgb is toggled off +#endif + +/* + * UNICODE options + */ +#define UNICODE_SELECTED_MODES UC_WINC, UC_LNX, UC_MAC // Define the methods used for in/outputting unicode + +/* + * TAP-DANCE options + */ +#define TAPPING_TERM 250 // Default time allowed before resetting a Tap-Dance combo +#define ONESHOT_TAP_TOGGLE 5 /* Tapping this number of times holds the key until tapped once again. */ +#define ONESHOT_TIMEOUT 5000 /* Time (in ms) before the one shot key is released */ +#define TAPPING_TOGGLE 3 + +/* + * LEADER-KEY options + */ // Used for on-board chording +#define LEADER_PER_KEY_TIMING +#define LEADER_TIMEOUT 500 + +/* + * COMBO-KEY options + */ +#define COMBO_COUNT 2 +#define COMBO_TERM 300 +/* + * MACRO per-key options + */ +#define RETRO_TAPPING_PER_KEY // Control Retro-Tap individually by key +#define TAPPING_FORCE_HOLD_PER_KEY // Control Force-Hold individually by key +#define IGNORE_MOD_TAP_INTERRUPT_PER_KEY // Control Mod-Tap-Interrupt individually by key +#define PERMISSIVE_HOLD_PER_KEY // Control Permissive-Hold individually by key + +#define MK_KINETIC_SPEED // Use kinetic acceleration for mouse-keys + +// Fall-back defines to prevent compile errors if user_song_list is missing +#ifndef ZELDA_PUZZLE2 +# define ZELDA_PUZZLE2 Q__NOTE(_G5) +#endif +#ifndef SONIC_RING2 +# define SONIC_RING2 E__NOTE(_E6) +#endif +#ifndef ZELDA_CHEST2 +# define ZELDA_CHEST2 Q__NOTE(_G5) +#endif +#ifndef COIN_SOUND2 +# define COIN_SOUND2 E__NOTE(_A5) +#endif +#ifndef ONE_UP_SOUND2 +# define ONE_UP_SOUND2 Q__NOTE(_E6) +#endif +#ifndef IMPERIAL_MARCH +# define IMPERIAL_MARCH HD_NOTE(_A4) +#endif +#ifndef MARIO_GAMEOVER +# define MARIO_GAMEOVER HD_NOTE(_C5) +#endif +#ifndef LEAD_START_SOUND +# define LEAD_START_SOUND E__NOTE(_C5) +#endif +#ifndef LEAD_SUCCESS_SOUND +# define LEAD_SUCCESS_SOUND E__NOTE(_A5), HD_NOTE(_E6), +#endif +#ifndef LEAD_FAIL_SOUND +# define LEAD_FAIL_SOUND E__NOTE(_A5), HD_NOTE(_E4), +#endif diff --git a/keyboards/planck/keymaps/rootiest/keymap.c b/keyboards/planck/keymaps/rootiest/keymap.c new file mode 100644 index 0000000000..634bf2829e --- /dev/null +++ b/keyboards/planck/keymaps/rootiest/keymap.c @@ -0,0 +1,1928 @@ +/* Copyright 2021 Chris Laprade + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include QMK_KEYBOARD_H +#include "raw_hid.h" +#include "print.h" +#include "muse.h" + +/* + * Define keyboard name to be used by UI. + * This allows for using a different name + * than the one defined by QMK for your board. + */ +#define KEEB_MODEL_NAME "The Rootiest BoogieBoard" + +// Give names to the layers so they are easier to reference +enum custom_layers { + _BASE, + _QWERTY = _BASE, + _COLEMAK, + _DVORAK, + _SYMBLS, + _RAISE = _SYMBLS, + _NUMBRS, + _LOWER = _NUMBRS, + _PLOVER, + _FEATURS, + _ADJUST = _FEATURS, + _NUMPD, + _TABULA, + _MOUSY, +}; + +#define LOWER MO(_NUMBRS) +#define RAISE MO(_SYMBLS) + +// unicode hexes +#define UC_DEG UC(0x00B0) // ° +#define UC_DEGF UC(0x2109) // ℉ + +// Time (ms) to wait between frames for the wake rgb animation +#define WAKE_ANIMATION_TIMER_FREQUENCY 50 + +// Is a display connected +// #define USING_OLED_DISPLAY false + +// wait DELAY ms before unregistering media keys +#define TAP_CODE_DELAY 10 + +// Modifier remover +#define WITHOUT_MODS(...) \ + do { \ + const uint8_t _real_mods = get_mods(); \ + clear_mods(); \ + {__VA_ARGS__} set_mods(_real_mods); \ + } while (0) + +// A whole boatload of audio "songs" defined for use by the keyboard +#ifdef AUDIO_ENABLE +float planck_song[][2] = SONG(PLANCK_SOUND); +float hello_song[][2] = SONG(ONE_UP_SOUND2); +float bye_song[][2] = SONG(GOODBYE_SOUND); +float num_song[][2] = SONG(DVORAK_SOUND); +float qwerty_song[][2] = SONG(QWERTY_SOUND); +float colemak_song[][2] = SONG(COLEMAK_SOUND); +float dvorak_song[][2] = SONG(DVORAK_SOUND); +float funk_song[][2] = SONG(COLEMAK_SOUND); +float workman_song[][2] = SONG(WORKMAN_SOUND); +float term_song[][2] = SONG(TERMINAL_SOUND); +float lover_song[][2] = SONG(PLOVER_SOUND); +float ode_song[][2] = SONG(ODE_TO_JOY); +float rock_song[][2] = SONG(ROCK_A_BYE_BABY); +float clue_song[][2] = SONG(CLUEBOARD_SOUND); +float camp_song[][2] = SONG(CAMPANELLA); +float imp_march_song[][2] = SONG(IMPERIAL_MARCH); +float gameover_song[][2] = SONG(MARIO_GAMEOVER); +float puzzle_song[][2] = SONG(ZELDA_PUZZLE2); +float caps_on[][2] = SONG(CAPS_LOCK_ON_SOUND); +float caps_off[][2] = SONG(CAPS_LOCK_OFF_SOUND); +float slctl_on[][2] = SONG(SCROLL_LOCK_ON_SOUND); +float slctl_off[][2] = SONG(SCROLL_LOCK_OFF_SOUND); +float slalt_on[][2] = SONG(NUM_LOCK_ON_SOUND); +float slalt_off[][2] = SONG(NUM_LOCK_OFF_SOUND); +float leader_started[][2] = SONG(LEAD_START_SOUND); +float leader_succeed[][2] = SONG(LEAD_SUCCESS_SOUND); +float leader_fail[][2] = SONG(LEAD_FAIL_SOUND); +float plover_song[][2] = SONG(PLOVER_SOUND); +float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND); +#endif + +// Declare stored memory config +typedef union { + uint32_t raw; + struct { + bool do_wakeup_animation : 1; + uint8_t rgbcon_tracker : 8; + bool do_wakeup_audio : 1; + }; +} user_config_t; + +user_config_t user_config; + +// Initialize variable holding the binary +// representation of active modifiers. +uint8_t mod_state = 0; + +// Declare custom keycodes +enum custom_keycodes { + MO_BASE = SAFE_RANGE, + MO_SYMBLS, + MO_NUMBRS, + MO_FEATURS, + QWERTY, + COLEMAK, + DVORAK, + PLOVER, + BACKLIT, + MUSIC_ON, + MUSIC_OFF, + EXT_PLV, + MY_RGBCON, + MY_DEGREES, + ALT_TAB, + PRINT_WPM_KEY, + IRONY, + WAKE_ANI_TOG, + WAKE_AUD_TOG, + DO_RESET, + KC_PRVWD, + KC_NXTWD, + KC_LSTRT, + KC_LEND, + KC_DLINE, + KC_REDO, + KC_SAVE, + KC_SLCTALL, + KC_ALTF4, + KC_KILL, + KC_LCUT, + KC_LCOPY, + KC_NXTAB, + KC_PRVTAB, +}; + +// Declare unicode map array +enum unicode_names { BANG, SNEK }; +const uint32_t PROGMEM unicode_map[] = { + //[UCD_BANG] = 0x203D, // ‽ + //[UCD_IRONY] = 0x2E2E, // ⸮ + [SNEK] = 0x1F40D, // 🐍 +}; + +enum combo_events { ZC_COPY, XV_PASTE }; + +const uint16_t PROGMEM copy_combo[] = {KC_Z, KC_C, COMBO_END}; +const uint16_t PROGMEM paste_combo[] = {KC_X, KC_V, COMBO_END}; + +combo_t key_combos[COMBO_COUNT] = { + [ZC_COPY] = COMBO_ACTION(copy_combo), + [XV_PASTE] = COMBO_ACTION(paste_combo), +}; + +// Tap Dance key declarations +enum { + TD_DEG_DEGF, + TD_SMILEY, + TD_LSHFT_CAPS, + TD_LCTL_STICKY, + TD_LALT_STICKY, + TD_LOWER, + TD_RAISE, +}; + +// Declare available Tap-Dance states +typedef enum { + TD_NONE, + TD_SINGLE_TAP, + TD_DOUBLE_TAP, + TD_TRIPLE_TAP, + TD_DOUBLE_SINGLE_TAP, + TD_SINGLE_HOLD, + TD_DOUBLE_HOLD, + TD_TRIPLE_HOLD, + TD_UNKNOWN, +} td_state_t; + +// Tap-Dance struct +typedef struct { + bool is_press_action; + td_state_t state; +} td_tap_t; + +// Whether or not to do the wake animation+sound +bool do_wake_animation; + +// Variable to keep track of the rgb mode assigned by the RGB_CON key +static uint8_t rgbcon_tracker = 0; + +// Used by the on-board WPM tracker +char wpm_str[12]; + +// Variables used for the alt-tab key +bool is_alt_tab_active = false; +uint16_t alt_tab_timer = 0; + +// Variables used by the Irony key +#define IRONY_HOLD_DELAY 500 +uint16_t irony_pressed_time; +bool irony_active = false; +bool irony_shifted = false; +char irony_str[4] = "⸮"; +char bang_str[4] = "‽"; + +// Variables used for the rgb wakeup animation +static uint16_t wake_rgb_timer; +static uint8_t wake_rgb_count = 0; +bool waking_up = false; +bool do_wake_audio = false; + +// Muse variables +bool muse_mode = false; +bool musical_mode = false; +uint8_t last_muse_note = 0; +uint16_t muse_counter = 0; +uint8_t muse_offset = 70; +uint16_t muse_tempo = 50; + +// Used by Leader key chords +bool did_leader_succeed; +LEADER_EXTERNS(); + +// Tap-Dance stuffs, initializing functions that are coded further below +td_state_t cur_dance(qk_tap_dance_state_t* state); +void sml_finished(qk_tap_dance_state_t* state, void* user_data); +void sml_reset(qk_tap_dance_state_t* state, void* user_data); +void scap_finished(qk_tap_dance_state_t* state, void* user_data); +void scap_reset(qk_tap_dance_state_t* state, void* user_data); +void slctl_finished(qk_tap_dance_state_t* state, void* user_data); +void slctl_reset(qk_tap_dance_state_t* state, void* user_data); +void slalt_finished(qk_tap_dance_state_t* state, void* user_data); +void slalt_reset(qk_tap_dance_state_t* state, void* user_data); +bool lctl_sticky = false; +bool lalt_sticky = false; + +// This function is called when lock indicators (caps-lock led) are changed/toggled/updated +bool led_update_user(led_t led_state) { + rgblight_set_layer_state(10, led_state.caps_lock); +#ifdef AUDIO_ENABLE + static uint8_t caps_state = 0; + if (caps_state != led_state.caps_lock) { + // When the caps-lock led state changes play sounds + led_state.caps_lock ? PLAY_SONG(caps_on) : PLAY_SONG(caps_off); + caps_state = led_state.caps_lock; + } +#endif + return true; +} + +// Define key layout/layers +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // Define all the layers + [_BASE] = LAYOUT_planck_mit( // + KC_GESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, // + LT(_TABULA, KC_TAB), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, // + TD(TD_LSHFT_CAPS), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_SFTENT, // + TD(TD_LCTL_STICKY), KC_LEAD, KC_LGUI, TD(TD_LALT_STICKY), MO(_SYMBLS), KC_SPC, MO(_NUMBRS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT), + /* + Base Layer [0] + * ,-----------------------------------------------------------------------------------. + * |Gr/ESC| Q | W | E | R | T | Y | U | I | O | P |BckSpc| + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |Tabula| A | S | D | F | G | H | J | K | L | ; | ' | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |SH/CAP| Z | X | C | V | B | N | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | LCtrl|Leader| OS | Alt |Symbol| Space |Number| Left | Dwn | Up | Right| + * `-----------------------------------------------------------------------------------' + */ + + [_COLEMAK] = LAYOUT_planck_mit( // + KC_GESC, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, // + LT(_TABULA, KC_TAB), KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, // + TD(TD_LSHFT_CAPS), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_SFTENT, // + TD(TD_LCTL_STICKY), KC_LEAD, KC_LGUI, TD(TD_LALT_STICKY), MO(_SYMBLS), KC_SPC, MO(_NUMBRS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT), + /* + Colemak Layer [1] + * ,-----------------------------------------------------------------------------------. + * |Gr/ESC| Q | W | F | P | G | J | L | U | Y | ; | Bksp | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |Tabula| A | R | S | T | D | H | N | E | I | O | " | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |SH/CAP| Z | X | C | V | B | K | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | LCtrl|Leader| OS | Alt |Symbol| Space |Number| Left | Dwn | Up | Right| + * `-----------------------------------------------------------------------------------' + */ + + [_DVORAK] = LAYOUT_planck_mit( // + KC_GESC, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, // + LT(_TABULA, KC_TAB), KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_TRNS, KC_S, KC_SLSH, // + TD(TD_LSHFT_CAPS), KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_SFTENT, // + TD(TD_LCTL_STICKY), KC_LEAD, KC_LGUI, TD(TD_LALT_STICKY), MO(_SYMBLS), KC_SPC, MO(_NUMBRS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT), + /* Dvorak Layer [2] + * ,-----------------------------------------------------------------------------------. + * |Gr/ESC| " | , | . | P | Y | F | G | C | R | L | Bksp | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |Tabula| A | O | E | U | I | D | H | T | N | S | / | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |SH/CAP| ; | Q | J | K | X | B | M | W | V | Z |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | LCtrl|Leader| OS | Alt |Symbol| Space |Number| Left | Dwn | Up | Right| + * `-----------------------------------------------------------------------------------' + */ + [_SYMBLS] = LAYOUT_planck_mit( // + KC_MPLY, 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_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, LSFT(KC_LCTL), LSFT(KC_LCTL), KC_HOME, KC_END, KC_TRNS, // + TG(_NUMPD), KC_TRNS, KC_TRNS, KC_TRNS, TO(_BASE), KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY), + /* + Symbols Layer [3] + * ,-----------------------------------------------------------------------------------. + * | Play | ! | @ | # | $ | % | ^ | & | * | ( | ) |BckSpc| + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |Delete| F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Shift| F7 | F8 | F9 | F10 | F11 | F12 |LShLCt|LShLCt| Home | End |------| + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | TG(7)|------|------|------| Base | ----- | MO(4)| Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' + */ + + [_NUMBRS] = LAYOUT_planck_mit( // + KC_MPLY, 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_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, KC_PGUP, KC_PGDN, KC_TRNS, // + TG(_NUMPD), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, TO(_BASE), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY), + + /* + Numbers Layer [4] + * ,-----------------------------------------------------------------------------------. + * | Play | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 |BckSpc| + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |Delete| F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Shift| F7 | F8 | F9 | F10 | F11 | F12 | # | / | PgUp | PgDwn|------| + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | TG(7)|------|------|------| MO(3)| ----- | Base | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' + */ + + [_PLOVER] = LAYOUT_planck_mit( // + 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, // + XXXXXXX, 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, KC_N, KC_M, XXXXXXX, XXXXXXX, XXXXXXX), + /* Plover Layer [5] + * ,-----------------------------------------------------------------------------------. + * | # | # | # | # | # | # | # | # | # | # | # | # | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | S | T | P | H | * | * | F | P | L | T | D | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | S | K | W | R | * | * | R | B | G | S | Z | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Exit | | | A | O | | E | U | | | | + * `-----------------------------------------------------------------------------------' + */ + + [_FEATURS] = LAYOUT_planck_mit( // + LCTL(LALT(KC_DEL)), DO_RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, TD(TD_DEG_DEGF), TD(TD_SMILEY), KC_DEL, // + RGB_VAI, RGB_VAD, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, DF(_BASE), DF(_COLEMAK), DF(_DVORAK), TO(_PLOVER), MY_RGBCON, // + KC_TRNS, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, TERM_ON, TERM_OFF, CK_ON, CK_OFF, KC_ENTER, // + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, TG(_MOUSY), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), + /* + Special Features Layer [6] + * ,-----------------------------------------------------------------------------------. + * |C+A+DL| Reset| Debug|RGBTog|RGBMod| Hue+ | Hue- | Sat+ | Sat- |Unicod| Emoji|Delete| + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |RGBVAI|RGBVAD|MU_MOD| AU_ON|AU_OFF|RALTGU|SALTGU| Base |Colemk|Dvorak|Plover|RGBCON| + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |------|MUV_DE|MUV_IN| MU_ON|MU_OFF| MI_ON|MI_OFF|TERMON|TRMOFF|CLK-ON|CLKOFF|Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |------|------|------|------|------| TG(8) |------|------|------|------|------| + * `-----------------------------------------------------------------------------------' + */ + + [_NUMPD] = LAYOUT_planck_mit( // + KC_ESC, KC_HOME, KC_UP, KC_END, KC_PERC, KC_LCBR, KC_RCBR, KC_TAB, KC_P7, KC_P8, KC_P9, KC_BSPC, // + KC_TILD, KC_LEFT, KC_DOWN, KC_RGHT, KC_BSLS, KC_LBRC, KC_RBRC, KC_PSLS, KC_P4, KC_P5, KC_P6, KC_PMNS, // + KC_LSFT, KC_SLSH, KC_CUT, KC_COPY, KC_PASTE, KC_LT, KC_GT, KC_PAST, KC_P1, KC_P2, KC_P3, KC_PPLS, // + TO(_BASE), KC_LEAD, KC_LGUI, KC_LALT, KC_LCPO, KC_SPC, KC_RCPC, KC_HASH, KC_P0, KC_PDOT, KC_PENT), + /* + Numpad Layer [7] + * ,-----------------------------------------------------------------------------------. + * | Esc | Home | Up | End | % | { | } | Tab | 7 | 8 | 9 |BckSpc| + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | ~ | Left | Down | Right| \ | [ | ] | / | 4 | 5 | 6 | - | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Shift| / |Ctrl+X|Ctrl+C|Ctrl+V| < | > | * | 1 | 2 | 3 | + | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Base |Leader| Alt | OS |LCtl/(| Space |)/RCtl| # | 0 | . |Enter | + * `-----------------------------------------------------------------------------------' + */ + [_TABULA] = LAYOUT_planck_mit( // + KC_ESC, KC_ALTF4, VLK_TOG, PRINT_WPM_KEY, WAKE_ANI_TOG, WAKE_AUD_TOG, KC_REDO, UC_MOD, UC_M_WC, CG_TOGG, AG_TOGG, KC_DLINE, // + KC_NXTAB, KC_SLCTALL, KC_SAVE, KC_TRNS, KC_FIND, SH_TG, SH_TG, IRONY, KC_LCUT, KC_LCOPY, KC_TRNS, KC_KILL, // + KC_LSFT, KC_UNDO, KC_CUT, KC_COPY, KC_PASTE, KC_PRVWD, KC_NXTWD, TG(_MOUSY), KC_TRNS, KC_HOME, KC_END, KC_SFTENT, // + TO(_BASE), KC_LCTL, KC_LGUI, KC_LALT, KC_LSPO, ALT_TAB, KC_RSPC, KC_PRVWD, KC_BRID, KC_BRIU, KC_NXTWD), + /* Tabular Layer [8] + * ,-----------------------------------------------------------------------------------. + * | Esc |Alt+F4|Veloci| WPM |WakANI|WakAUD|Ctrl+Y|UCMode|UCWinC|CtGUTg|AltGTg| DLine| + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Tab |Ctrl+A|Ctrl+S|------|Ctrl+F| SWAP | SWAP | ⸮^‽ |CutLin|CpyLin|------|DelLin| + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Shift|Ctrl+Z|Ctrl+X|Ctrl+C|Ctrl+V|PrVWin|NxtWin| TG(8)|------| Home | End |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Base | LCtrl| Alt | OS |LSft/(| Alt+Tab |)/RSft|PrvSel|ScrBr-|ScrBr+|NxtSel| + * `-----------------------------------------------------------------------------------' + */ + + [_MOUSY] = LAYOUT_planck_mit( // + KC_ESC, KC_BTN1, KC_MS_U, KC_BTN2, KC_TRNS, KC_TRNS, KC_TRNS, UC_MOD, UC_M_WC, CG_TOGG, AG_TOGG, KC_BSPC, // + KC_TAB, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS, KC_TRNS, KC_TRNS, IRONY, VLK_TOG, KC_TRNS, KC_TRNS, KC_TRNS, // + KC_LSFT, KC_UNDO, KC_CUT, KC_COPY, KC_PASTE, KC_PRVWD, KC_NXTWD, KC_TRNS, KC_HOME, KC_BTN3, KC_END, KC_SFTENT, // + TO(_BASE), KC_LCTL, KC_LGUI, KC_LALT, KC_BTN1, ALT_TAB, KC_BTN2, KC_WH_L, KC_WH_D, KC_WH_U, KC_WH_R)}; +/* MousePad Layer [9] + * ,-----------------------------------------------------------------------------------. + * | Esc |MsBtn1| MsUp |MsBtn2|------|------|------|UCMode|UCWinC|CtGUTg|AltGTg|BckSpc| + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | ~ |MsLeft|MsDown|MsRigt|------|------|------| ⸮^‽ |Veloci|------|------|------| + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Shift|------|Ctrl+X|Ctrl+C|Ctrl+V|------|------|------| Home |MsBtn3| End |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Base | LCtrl| Alt | OS |MsBtn1| Alt+Tab |MsBtn2|MsWhlL|MsWhlD|MsWhlU|MsWhlR| + * `-----------------------------------------------------------------------------------' + */ + +// Define RGB layers | assign leds and their values for each rgb layer +const rgblight_segment_t PROGMEM my_warning_layer[] = RGBLIGHT_LAYER_SEGMENTS({1, 9, HSV_RED}, {0, 1, HSV_RED}); +const rgblight_segment_t PROGMEM my_allgood_layer[] = RGBLIGHT_LAYER_SEGMENTS({1, 9, HSV_GREEN}, {0, 1, HSV_GREEN}); +const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS({1, 1, HSV_RED}, {8, 1, HSV_RED}); +const rgblight_segment_t PROGMEM my_number_layer[] = RGBLIGHT_LAYER_SEGMENTS({1, 1, HSV_MAGENTA}, {8, 1, HSV_MAGENTA}); +const rgblight_segment_t PROGMEM my_symbol_layer[] = RGBLIGHT_LAYER_SEGMENTS({1, 1, HSV_GREEN}, {8, 1, HSV_GREEN}); +const rgblight_segment_t PROGMEM my_tabula_layer[] = RGBLIGHT_LAYER_SEGMENTS({3, 4, HSV_CORAL}, {1, 1, HSV_CORAL}, {8, 1, HSV_CORAL}); +const rgblight_segment_t PROGMEM my_mousy_layer[] = RGBLIGHT_LAYER_SEGMENTS({3, 4, HSV_TURQUOISE}, {1, 1, HSV_TURQUOISE}, {8, 1, HSV_TURQUOISE}, {7, 1, HSV_MAGENTA}); +const rgblight_segment_t PROGMEM my_numpad_layer[] = RGBLIGHT_LAYER_SEGMENTS({3, 4, HSV_GOLD}, {1, 1, HSV_GOLD}, {8, 1, HSV_GOLD}, {7, 1, HSV_BLUE}); +const rgblight_segment_t PROGMEM my_features_layer[] = RGBLIGHT_LAYER_SEGMENTS({3, 4, HSV_BLUE}, {1, 1, HSV_BLUE}, {8, 1, HSV_BLUE}); +const rgblight_segment_t PROGMEM my_base_layer[] = RGBLIGHT_LAYER_SEGMENTS({0, 0, HSV_BLACK}); +const rgblight_segment_t PROGMEM my_colemak_layer[] = RGBLIGHT_LAYER_SEGMENTS({1, 1, HSV_GREEN}); +const rgblight_segment_t PROGMEM my_dvorak_layer[] = RGBLIGHT_LAYER_SEGMENTS({1, 1, HSV_ORANGE}); +const rgblight_segment_t PROGMEM my_plover_layer[] = RGBLIGHT_LAYER_SEGMENTS({1, 1, HSV_GOLD}); + +// Define the array of rgb layers. Later layers take precedence +const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST(my_base_layer, // Base Layer + my_colemak_layer, // Overrides previous layer + my_dvorak_layer, // Overrides previous layers + my_symbol_layer, // Overrides previous layers + my_number_layer, // ...etc my_features_layer, // Overrides layers + my_plover_layer, // + my_features_layer, // + my_numpad_layer, // + my_tabula_layer, // + my_mousy_layer, // + my_capslock_layer, // + my_warning_layer, // + my_allgood_layer); // CapsLock Layer); + +// Configure encoders +bool encoder_update_user(uint8_t index, bool clockwise) { + if (musical_mode) { + if (clockwise) { + tap_code16(MU_MOD); + } else { + tap_code16(MU_MOD); + } + } else { + if (muse_mode) { + if (IS_LAYER_ON(_RAISE)) { + if (clockwise) { + muse_offset++; + } else { + muse_offset--; + } + } else { + if (clockwise) { + muse_tempo += 1; + } else { + muse_tempo -= 1; + } + } + } else { + if (index == 0) { /* First encoder */ + uint16_t held_keycode_timer = timer_read(); + switch (biton32(layer_state)) { + case 0: // Base Layer + if ((get_mods() & MOD_MASK_GUI)) { // GUI-ed + if (clockwise) { + tap_code(KC_RIGHT); + + } else { + tap_code(KC_LEFT); + } + } else if ((get_mods() & MOD_MASK_ALT)) { // Alt-ed + if (clockwise) { + tap_code16(LALT(KC_TAB)); // Alt+Tabbing + } else { + tap_code16(LSA(KC_TAB)); + } + } else if ((get_mods() & MOD_MASK_SHIFT)) { // Shifted + const uint8_t _real_mods = get_mods(); + unregister_code16(KC_LSFT); + unregister_code16(KC_RSFT); + clear_mods(); + if (clockwise) { + tap_code16(KC_MS_WH_DOWN); + } else { + tap_code16(KC_MS_WH_UP); + } + set_mods(_real_mods); + } else if ((get_mods() & MOD_MASK_CTRL)) { // Ctrl-ed + if (clockwise) { + tap_code16(RCTL(KC_TAB)); // Ctrl+Tabbing + } else { + tap_code16(RCS(KC_TAB)); + } + } else { // Normal or unspecified modifiers + if (clockwise) { + // Volume control requires extra timer to function correctly + register_code(KC_VOLU); + while (timer_elapsed(held_keycode_timer) < TAP_CODE_DELAY) { + // no-op + } + unregister_code(KC_VOLD); + } else { + register_code(KC_VOLD); + while (timer_elapsed(held_keycode_timer) < TAP_CODE_DELAY) { + // no-op + } + unregister_code(KC_VOLU); + } + } + return false; + break; + case 3: // Symbols Layer + if (clockwise) { + tap_code(KC_WH_D); // Mouse wheeling + } else { + tap_code(KC_WH_U); + } + return false; + break; + case 4: // Numbers Layer + if (clockwise) { + tap_code(KC_WH_D); // Mouse wheeling + } else { + tap_code(KC_WH_U); + } + return false; + break; + case 6: // Features Layer + if (clockwise) { + tap_code16(KC_DOWN); + } else { + tap_code16(KC_UP); + } + default: // Any other layer + if ((get_mods() & MOD_MASK_CSAG)) { + if (clockwise) { + WITHOUT_MODS({ SEND_STRING(SS_TAP(X_RIGHT)); }); + } else { + WITHOUT_MODS({ SEND_STRING(SS_TAP(X_LEFT)); }); + } + } else { + if (clockwise) { + tap_code(KC_DOWN); // Simple Up/Down + } else { + tap_code(KC_UP); + } + } + return false; + break; + } + } else if (index == 1) { /* Second encoder (if we had one) */ + if (clockwise) { + tap_code16(LCTL(KC_LEFT)); // Ctrl+Left/Right + } else { + tap_code16(LCTL(KC_RIGHT)); + } + } + } + } + return true; +} + +// OLED CONFIGURATION +/* +static void render_logo(void) { + static const char PROGMEM qmk_logo[] = {0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92, 0x93, 0x94, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0x00}; + + oled_write_P(qmk_logo, false); +} +*/ + +// Process Combo events +void process_combo_event(uint16_t combo_index, bool pressed) { + switch (combo_index) { + case ZC_COPY: + if (pressed) { + tap_code16(LCTL(KC_C)); + } + break; + case XV_PASTE: + if (pressed) { + tap_code16(LCTL(KC_V)); + } + break; + } +} + +// Runs every time a key is pressed or released +bool process_record_user(uint16_t keycode, keyrecord_t* record) { +#ifdef CONSOLE_ENABLE + dprintf("KL: kc: 0x%04X, col: %u, row: %u, pressed: %b, time: %u, interrupt: %b, count: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed, record->event.time, record->tap.interrupted, record->tap.count); +#endif + // Store the current modifier state in the variable for later reference + mod_state = get_mods(); + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + set_single_persistent_default_layer(_QWERTY); + PLAY_SONG(qwerty_song); + } + return false; + break; + case COLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_COLEMAK); + PLAY_SONG(colemak_song); + } + return false; + break; + case DVORAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_DVORAK); + PLAY_SONG(dvorak_song); + } + return false; + break; + case PLOVER: + if (record->event.pressed) { +#ifdef AUDIO_ENABLE + stop_all_notes(); + PLAY_SONG(plover_song); +#endif + layer_off(_RAISE); + layer_off(_LOWER); + layer_off(_ADJUST); + layer_on(_PLOVER); + if (!eeconfig_is_enabled()) { + eeconfig_init(); + } + keymap_config.raw = eeconfig_read_keymap( |