From bc437c712387fb1aacc9d5eb7b0e85ddacc58061 Mon Sep 17 00:00:00 2001 From: Jakob Weickmann Date: Wed, 8 Sep 2021 17:01:41 +0200 Subject: [PATCH 01/31] Added my own keymap --- keyboards/planck/keymaps/jweickm/config.h | 201 ++++ .../planck/keymaps/jweickm/config.h_qwerty | 199 ++++ .../planck/keymaps/jweickm/config_kopie.h | 44 + ... - \343\202\263\343\203\224\343\203\274.c" | 862 ++++++++++++++++++ keyboards/planck/keymaps/jweickm/keymap.c | 839 +++++++++++++++++ .../planck/keymaps/jweickm/keymap_halfwide.c | 583 ++++++++++++ .../planck/keymaps/jweickm/keymap_narrow.c | 572 ++++++++++++ .../planck/keymaps/jweickm/keymap_qwerty.c | 479 ++++++++++ .../keymaps/jweickm/keymap_triple_tap.c | 731 +++++++++++++++ .../planck/keymaps/jweickm/keymap_unicode.c | 425 +++++++++ keyboards/planck/keymaps/jweickm/readme.md | 2 + keyboards/planck/keymaps/jweickm/rules.mk | 39 + .../planck/keymaps/jweickm/rules_kopie.mk | 1 + 13 files changed, 4977 insertions(+) create mode 100644 keyboards/planck/keymaps/jweickm/config.h create mode 100644 keyboards/planck/keymaps/jweickm/config.h_qwerty create mode 100644 keyboards/planck/keymaps/jweickm/config_kopie.h create mode 100644 "keyboards/planck/keymaps/jweickm/keymap - \343\202\263\343\203\224\343\203\274.c" create mode 100644 keyboards/planck/keymaps/jweickm/keymap.c create mode 100644 keyboards/planck/keymaps/jweickm/keymap_halfwide.c create mode 100644 keyboards/planck/keymaps/jweickm/keymap_narrow.c create mode 100644 keyboards/planck/keymaps/jweickm/keymap_qwerty.c create mode 100644 keyboards/planck/keymaps/jweickm/keymap_triple_tap.c create mode 100644 keyboards/planck/keymaps/jweickm/keymap_unicode.c create mode 100644 keyboards/planck/keymaps/jweickm/readme.md create mode 100644 keyboards/planck/keymaps/jweickm/rules.mk create mode 100644 keyboards/planck/keymaps/jweickm/rules_kopie.mk diff --git a/keyboards/planck/keymaps/jweickm/config.h b/keyboards/planck/keymaps/jweickm/config.h new file mode 100644 index 000000000000..010c4bd17334 --- /dev/null +++ b/keyboards/planck/keymaps/jweickm/config.h @@ -0,0 +1,201 @@ +#pragma once +/* + * Copyright 2018 Jack Humbert + * + * 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 . + */ + +#ifndef REV6_CONFIG_H +#define REV6_CONFIG_H + +/* USB Device descriptor parameter */ +#define PRODUCT_ID 0xA4F9 +#define DEVICE_VER 0x0006 + +#undef MATRIX_ROWS +#undef MATRIX_COLS +/* key matrix size */ +#define MATRIX_ROWS 8 +#define MATRIX_COLS 6 + +/* + * Keyboard Matrix Assignments + * + * Change this to how you wired your keyboard + * COLS: AVR pins used for columns, left to right + * ROWS: AVR pins used for rows, top to bottom + * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) + * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) + * +*/ +/* Note: These are not used for arm boards. They're here purely as documentation. */ +#undef MATRIX_ROW_PINS +#undef MATRIX_COL_PINS + +#define MATRIX_ROW_PINS { A10, A9, A8, B15, C13, C14, C15, A2 } +#define MATRIX_COL_PINS { B11, B10, B2, B1, A7, B0 } + +#define UNUSED_PINS + +#define ENCODERS_PAD_A { B12 } +#define ENCODERS_PAD_B { B13 } + +#define DIP_SWITCH_PINS { B14, A15, A0, B9 } + +#define MUSIC_MAP +#undef AUDIO_VOICES +#undef AUDIO_PIN +#define AUDIO_PIN A5 +#define AUDIO_PIN_ALT A4 +#define AUDIO_PIN_ALT_AS_NEGATIVE + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +// #define DEBOUNCE 6 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +//#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +//#define LOCKING_RESYNC_ENABLE + +/* + * Force NKRO + * + * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved + * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the + * makefile for this to work.) + * + * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) + * until the next keyboard reset. + * + * NKRO may prevent your keystrokes from being detected in the BIOS, but it is + * fully operational during normal computer usage. + * + * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) + * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by + * bootmagic, NKRO mode will always be enabled until it is toggled again during a + * power-up. + * + */ +//#define FORCE_NKRO + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +//#define NO_DEBUG + +/* disable print */ +//#define NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +//#define NO_ACTION_MACRO +//#define NO_ACTION_FUNCTION + +/* + * 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 + +/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ +//#define MIDI_TONE_KEYCODE_OCTAVES 1 + + +/* + * WS2812 Underglow Matrix options + */ +#define RGB_DI_PIN A1 +#define RGBLED_NUM 9 +#define DRIVER_LED_TOTAL RGBLED_NUM + +#define WS2812_PWM_DRIVER PWMD2 +#define WS2812_PWM_CHANNEL 2 +#define WS2812_PWM_PAL_MODE 1 +#define WS2812_DMA_STREAM STM32_DMA1_STREAM2 +#define WS2812_DMA_CHANNEL 2 + +#ifndef RGB_DISABLE_WHEN_USB_SUSPENDED +# define RGB_DISABLE_WHEN_USB_SUSPENDED true +#endif + +#endif + +#define RGBLIGHT_LAYERS + +#pragma once + +#ifdef AUDIO_ENABLE + #define STARTUP_SONG SONG(PLANCK_SOUND) + // #define STARTUP_SONG SONG(NO_SOUND) + + #define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \ + SONG(COLEMAK_SOUND), \ + SONG(DVORAK_SOUND), \ + SONG(WORKMAN_SOUND), \ + SONG(PLOVER_SOUND), \ + SONG(STARTUP_SOUND), \ + SONG(PREONIC_SOUND), \ + SONG(GOODBYE_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 + +/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ +//#define MIDI_TONE_KEYCODE_OCTAVES 2 + +// Most tactile encoders have detents every 4 stages +#define ENCODER_RESOLUTION 4 + +//settings for home row mods +#define TAPPING_TERM 160 // 200 ms is the default value +#define TAPPING_TERM_PER_KEY + +//#define PERMISSIVE_HOLD + +#define IGNORE_MOD_TAP_INTERRUPT + +#define TAPPING_FORCE_HOLD_PER_KEY diff --git a/keyboards/planck/keymaps/jweickm/config.h_qwerty b/keyboards/planck/keymaps/jweickm/config.h_qwerty new file mode 100644 index 000000000000..3facfcafbea9 --- /dev/null +++ b/keyboards/planck/keymaps/jweickm/config.h_qwerty @@ -0,0 +1,199 @@ +/* + * Copyright 2018 Jack Humbert + * + * 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 . + */ + +#ifndef REV6_CONFIG_H +#define REV6_CONFIG_H + +/* USB Device descriptor parameter */ +#define PRODUCT_ID 0xA4F9 +#define DEVICE_VER 0x0006 + +#undef MATRIX_ROWS +#undef MATRIX_COLS +/* key matrix size */ +#define MATRIX_ROWS 8 +#define MATRIX_COLS 6 + +/* + * Keyboard Matrix Assignments + * + * Change this to how you wired your keyboard + * COLS: AVR pins used for columns, left to right + * ROWS: AVR pins used for rows, top to bottom + * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) + * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) + * +*/ +/* Note: These are not used for arm boards. They're here purely as documentation. */ +#undef MATRIX_ROW_PINS +#undef MATRIX_COL_PINS + +#define MATRIX_ROW_PINS { A10, A9, A8, B15, C13, C14, C15, A2 } +#define MATRIX_COL_PINS { B11, B10, B2, B1, A7, B0 } + +#define UNUSED_PINS + +#define ENCODERS_PAD_A { B12 } +#define ENCODERS_PAD_B { B13 } + +#define DIP_SWITCH_PINS { B14, A15, A0, B9 } + +#define MUSIC_MAP +#undef AUDIO_VOICES +#undef AUDIO_PIN +#define AUDIO_PIN A5 +#define AUDIO_PIN_ALT A4 +#define AUDIO_PIN_ALT_AS_NEGATIVE + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +// #define DEBOUNCE 6 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +//#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +//#define LOCKING_RESYNC_ENABLE + +/* + * Force NKRO + * + * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved + * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the + * makefile for this to work.) + * + * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) + * until the next keyboard reset. + * + * NKRO may prevent your keystrokes from being detected in the BIOS, but it is + * fully operational during normal computer usage. + * + * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) + * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by + * bootmagic, NKRO mode will always be enabled until it is toggled again during a + * power-up. + * + */ +//#define FORCE_NKRO + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +//#define NO_DEBUG + +/* disable print */ +//#define NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +//#define NO_ACTION_MACRO +//#define NO_ACTION_FUNCTION + +/* + * 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 + +/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ +//#define MIDI_TONE_KEYCODE_OCTAVES 1 + + +/* + * WS2812 Underglow Matrix options + */ +#define RGB_DI_PIN A1 +#define RGBLED_NUM 9 +#define DRIVER_LED_TOTAL RGBLED_NUM + +#define WS2812_PWM_DRIVER PWMD2 +#define WS2812_PWM_CHANNEL 2 +#define WS2812_PWM_PAL_MODE 1 +#define WS2812_DMA_STREAM STM32_DMA1_STREAM2 +#define WS2812_DMA_CHANNEL 2 + +#ifndef RGB_DISABLE_WHEN_USB_SUSPENDED +# define RGB_DISABLE_WHEN_USB_SUSPENDED true +#endif + +#endif + +#define RGBLIGHT_LAYERS + +#pragma once + +#ifdef AUDIO_ENABLE + #define STARTUP_SONG SONG(PLANCK_SOUND) + // #define STARTUP_SONG SONG(NO_SOUND) + + #define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \ + SONG(COLEMAK_SOUND), \ + SONG(DVORAK_SOUND), \ + SONG(WORKMAN_SOUND), \ + SONG(PLOVER_SOUND), \ + SONG(STARTUP_SOUND), \ + SONG(PREONIC_SOUND), \ + SONG(GOODBYE_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 + +/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ +//#define MIDI_TONE_KEYCODE_OCTAVES 2 + +// Most tactile encoders have detents every 4 stages +#define ENCODER_RESOLUTION 4 + +//settings for home row mods +#define TAPPING_TERM 200 // 200 ms is the default value + +#define PERMISSIVE_HOLD + +#define IGNORE_MOD_TAP_INTERRUPT + +#define TAPPING_FORCE_HOLD_PER_KEY diff --git a/keyboards/planck/keymaps/jweickm/config_kopie.h b/keyboards/planck/keymaps/jweickm/config_kopie.h new file mode 100644 index 000000000000..2ab74b82daa8 --- /dev/null +++ b/keyboards/planck/keymaps/jweickm/config_kopie.h @@ -0,0 +1,44 @@ +#pragma once + +#ifdef AUDIO_ENABLE + #define STARTUP_SONG SONG(PLANCK_SOUND) + // #define STARTUP_SONG SONG(NO_SOUND) + + #define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \ + SONG(COLEMAK_SOUND), \ + SONG(DVORAK_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 + +/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ +//#define MIDI_TONE_KEYCODE_OCTAVES 2 + +// Most tactile encoders have detents every 4 stages +#define ENCODER_RESOLUTION 4 + +//settings for home row mods +#define TAPPING_TERM 200 // 200 ms is the default value + +#define PERMISSIVE_HOLD + +#define IGNORE_MOD_TAP_INTERRUPT + +#define TAPPING_FORCE_HOLD_PER_KEY diff --git "a/keyboards/planck/keymaps/jweickm/keymap - \343\202\263\343\203\224\343\203\274.c" "b/keyboards/planck/keymaps/jweickm/keymap - \343\202\263\343\203\224\343\203\274.c" new file mode 100644 index 000000000000..36cf513fe9b9 --- /dev/null +++ "b/keyboards/planck/keymaps/jweickm/keymap - \343\202\263\343\203\224\343\203\274.c" @@ -0,0 +1,862 @@ +/* Copyright 2015-2017 Jack Humbert + * Copyright 2021 Jakob Weickmann + * + * 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 . + */ +#include QMK_KEYBOARD_H +#include "muse.h" +#include "quantum.h" + + +enum planck_layers { + _COLEMAK, + _HRCOLEMAK, + _HRWIDECOLEMAK, + _GAMING, + _WIDECOLEMAK, + _LOWER, + _RAISE, + _LOWER2, + _RAISE2, + _ADJUST, + _NAV, + _NAV2, + _NUM, + _NUM2, + _MOUSE, + _PLOVER +}; + +enum planck_keycodes { + COLEMAK = SAFE_RANGE, + HRCOLEMAK, + HRWIDECOLEMAK, + PLOVER, + BACKLIT, + EXT_PLV, + GAMING, + WIDECOLEMAK, + TG_COLEMAK, + VIM_O, + VIM_V, + KC_SVD_BD, + KC_SVU_BU, + KC_TAB_MPLY, + ALT_TAB, + CTL_TAB, + DE_AE, + DE_OE, + DE_UE, + DE_SZ, + DE_EGRAVE, + DE_EAIGU, + KC_CURRENCY, + KC_UE_SWITCH, + LANG_SWITCH +}; + +// Tap Dance declarations +enum tap_dance_codes{ + TD_PRN, // round brackets (parentheses) + TD_BRC, // square brackets + TD_CBR, // curly brackets + TD_ESC_CAPS, // double tap for caps lock + TD_QUO_BRC, // double function on quotes to enable typing ü in german layout + TD_COMM_SLSH, // comma that doubles as a slash + TD_MPLY, // play/pause, double for next, triple for previous song + TD_Q_TAB // double tap q to register tab +}; + +#define LOWER MO(_LOWER) +#define RAISE MO(_RAISE) + +#define MODS_SHIFT_MASK (MOD_BIT(KC_LSFT)|MOD_BIT(KC_RSFT)) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +[_COLEMAK] = LAYOUT_planck_grid( + LT(_NUM,KC_TAB), KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, + LCTL_T(KC_ESC), KC_A, KC_R, KC_S, KC_T, KC_G, KC_M, KC_N, KC_E, KC_I, KC_O, TD(TD_QUO_BRC), + OSM(MOD_LSFT), KC_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, RSFT_T(KC_ENT), + LCTL_T(KC_CAPS), RALT_T(KC_APP), LGUI_T(KC_TAB), LT(_MOUSE, KC_ESC), LT(_LOWER,KC_BSPC), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE,KC_DEL), RCTL_T(KC_ENT), TG(_NAV), RALT_T(KC_UP), CTL_T(KC_CAPS) +), + +[_HRCOLEMAK] = LAYOUT_planck_grid( + LT(_NUM,KC_TAB), LGUI_T(KC_Q), LALT_T(KC_W), LT(_NUM, KC_F), KC_P, KC_B, KC_J, KC_L, LT(_NUM,KC_U), LALT_T(KC_Y), RGUI_T(KC_SCLN), KC_LBRC, + TD(TD_ESC_CAPS), KC_A, KC_R, LSFT_T(KC_S), LCTL_T(KC_T), KC_G, KC_M, RCTL_T(KC_N), RSFT_T(KC_E), KC_I, KC_O, KC_QUOT, + OSM(MOD_LSFT), KC_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, RSFT_T(KC_ENT), + LCTL_T(KC_CAPS), RALT_T(KC_APP), LGUI_T(KC_TAB), LT(_MOUSE, KC_ESC), LT(_LOWER,KC_BSPC), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE,KC_DEL), RCTL_T(KC_ENT), TG(_NAV), RALT_T(KC_UP), CTL_T(KC_CAPS) +), + +[_HRWIDECOLEMAK] = LAYOUT_planck_grid( + LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM2,KC_B), KC_SVU_BU, LT(_NUM2,KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Y), RGUI_T(KC_SCLN), DE_UE, + KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB_MPLY, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, + LT(_MOUSE,KC_Z), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, LT(_MOUSE,KC_SLSH), KC_MINS, + KC_CAPS, LT(_NUM,KC_TAB), LGUI_T(KC_ESC), LT(_LOWER2, KC_BSPC), OSM(MOD_LSFT), LT(_NAV2,KC_SPC), LT(_NAV2,KC_SPC), LT(_RAISE2, KC_DEL), RCTL_T(KC_ENT), KC_LALT, KC_LEFT, KC_RIGHT +), + +[_GAMING] = LAYOUT_planck_grid( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_F5, KC_F8, KC_F9, KC_VOLU, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_VOLD, + KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_Z, KC_M, KC_SCLN, TG_COLEMAK, + KC_LCTL, KC_NUBS, KC_B, KC_X, KC_C, KC_SPC, KC_SPC, KC_LALT, KC_TRNS, KC_TRNS, ALT_TAB, GAMING +), + +/* WIDECOLEMAK + * ,-----------------------------------------------------------------------------------. + * |_NUM(Tab)| Q | W | E | R | T | Y | U | I | O | P | Bksp | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |CTL(Esc)| A | S | D | F | G | H | J | K | L | ; | " | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_WIDECOLEMAK] = LAYOUT_planck_grid( + TD(TD_Q_TAB), KC_W, KC_F, KC_P, KC_B, KC_SVU_BU, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, DE_UE, + KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB_MPLY, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, + KC_Z, KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, TG_COLEMAK, + KC_CAPS, LT(_NUM,KC_TAB), LGUI_T(KC_ESC), LT(_LOWER2, KC_BSPC), OSM(MOD_LSFT), LT(_NAV2,KC_SPC), LT(_NAV2,KC_SPC), LT(_RAISE2, KC_DEL), RCTL_T(KC_ENT), KC_LALT, KC_LEFT, KC_RIGHT +), + +[_LOWER] = LAYOUT_planck_grid( + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, TD(TD_PRN), KC_RPRN, KC_DEL, + KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, TD(TD_CBR), KC_RCBR, KC_PIPE, + KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, LSFT(KC_NUHS), LSFT(KC_BSLS), KC_JYEN, KC_EQL, KC_TRNS, + TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_DEL, KC_VOLD, KC_VOLU, KC_MPLY +), + +[_RAISE] = LAYOUT_planck_grid( + 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, TD(TD_BRC), KC_RBRC,KC_BSLS, + KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_COMM, KC_DOT, KC_SLSH, KC_TRNS, + TG(_MOUSE), KC_TRNS, KC_BSPC, KC_DEL, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY +), + +[_LOWER2] = LAYOUT_planck_grid( + KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_TILD, KC_CIRC, KC_AMPR, KC_ASTR, TD(TD_PRN), KC_RPRN, DE_AE, + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, DE_SZ, KC_UNDS, KC_PLUS, TD(TD_CBR), KC_RCBR, KC_PIPE, + KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, LSFT(KC_NUHS), LSFT(KC_BSLS), KC_NUBS, KC_CURRENCY, DE_EGRAVE, + TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_DEL, KC_VOLD, KC_VOLU, KC_MPLY +), + +[_RAISE2] = LAYOUT_planck_grid( + KC_1, KC_2, KC_3, KC_4, KC_5, KC_GRV, KC_6, KC_7, KC_8, KC_9, KC_0, DE_OE, + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, DE_SZ, KC_MINS, KC_EQL, TD(TD_BRC), KC_RBRC,KC_BSLS, + KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, KC_NUHS, KC_COMM, KC_DOT, KC_SLSH, DE_EAIGU, + TG(_MOUSE), KC_TRNS, KC_BSPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY +), + +[_ADJUST] = LAYOUT_planck_grid( + LALT(KC_LSFT), RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_INS, + LALT(KC_GRV), EEP_RST, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, COLEMAK, HRCOLEMAK, WIDECOLEMAK, HRWIDECOLEMAK, GAMING, + KC_TRNS, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, KC_SVD_BD, KC_MPLY, KC_SVU_BU, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS +), + +[_NAV] = LAYOUT_planck_grid( + LALT(KC_LSFT), KC_NO, LCTL(KC_RGHT), KC_MS_U, LCTL(KC_V), LCTL(KC_LEFT), LCTL(KC_V), KC_RIGHT, KC_PGUP, LCTL(KC_C), KC_NO, KC_NO, + LALT(KC_GRV), KC_HOME, KC_MS_L, KC_MS_D, KC_MS_R, KC_BTN1, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_END, VIM_O, + KC_TRNS, KC_NO, LCTL(KC_X), LCTL(KC_X), KC_BTN2, VIM_V, KC_NO, KC_PGDN, TG(_NAV), KC_NO, LCTL(KC_F), KC_TRNS, + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRNS, KC_TRNS, KC_NO, KC_NO, KC_TRNS, KC_NO, KC_NO +), + +[_NAV2] = LAYOUT_planck_grid( + ALT_TAB, LCTL(KC_RGHT), LANG_SWITCH, LALT(KC_GRV), LCTL(KC_LEFT), KC_BRIU, KC_DOWN, KC_RIGHT, KC_PGUP, LCTL(KC_C), KC_NO, KC_UE_SWITCH, + CTL_TAB, KC_TAB, KC_ESC, LT(_NUM2,KC_ENT), KC_TAB, KC_MUTE, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_END, VIM_O, + KC_LSFT, KC_NO, LCTL(KC_X), TD(TD_ESC_CAPS), VIM_V, KC_BRID, KC_HOME, KC_PGDN, KC_NO, KC_NO, LCTL(KC_F), KC_TRNS, + KC_NO, KC_NO, KC_NO, KC_TRNS, KC_TRNS, LT(_NAV2,KC_SPC), LT(_NAV2,KC_SPC), KC_NO, KC_NO, KC_TRNS, KC_NO, KC_NO +), + +[_NUM] = LAYOUT_planck_grid( + KC_TAB, KC_F1, KC_F2, LT(_NUM,KC_F3), KC_F4, KC_SVU_BU, KC_NLCK, KC_P7, LT(_NUM,KC_P8), KC_P9, KC_PMNS, KC_TRNS, + KC_TRNS, KC_F5, KC_F6, KC_F7, KC_F8, KC_MPLY, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, KC_TRNS, + KC_TRNS, KC_F9,KC_F10,KC_F11,KC_F12, KC_SVD_BD, KC_TRNS, KC_P1, KC_P2, KC_P3, KC_PSLS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P0, KC_DOT, KC_COMM, KC_EQL, KC_TRNS +), + +[_NUM2] = LAYOUT_planck_grid( + KC_F1, KC_F2, KC_F3, KC_F4, KC_MPRV, KC_NLCK, KC_MNXT, KC_P7, KC_P8, KC_P9, KC_PMNS, KC_TRNS, + KC_F5, KC_F6, KC_F7, KC_F8, KC_VOLU, KC_MPLY, KC_BRIU, KC_P4, KC_P5, KC_P6, KC_PPLS, KC_TRNS, + KC_F9,KC_F10,KC_F11,KC_F12, KC_VOLD, KC_MUTE, KC_BRID, KC_P1, KC_P2, KC_P3, KC_PSLS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P0, KC_DOT, KC_COMM, KC_EQL, KC_TRNS +), + +[_MOUSE] = LAYOUT_planck_grid( + KC_NO, KC_NO, KC_BTN4, KC_BTN5, KC_NO, KC_NO, KC_NO, KC_WH_U, KC_MS_U, KC_WH_U, KC_NO, KC_NO, + KC_NO, KC_BTN3, KC_BTN2, KC_BTN1, KC_NO, KC_NO, KC_NO, KC_MS_L, KC_MS_D, KC_MS_R, KC_NO, KC_NO, + KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_WH_D, KC_NO, KC_NO, KC_TRNS, KC_NO, + TG(_MOUSE), KC_NO, KC_NO, KC_TRNS, KC_NO, KC_ACL2, KC_ACL2, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO +) + +}; + +// define the tap dance functions +void dance_prn(qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + tap_code16(KC_LPRN); + } else { + tap_code16(KC_LPRN); + tap_code16(KC_RPRN); + tap_code(KC_LEFT); + } +} +void dance_brc(qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + tap_code(KC_LBRC); + } else { + tap_code(KC_LBRC); + tap_code(KC_RBRC); + tap_code(KC_LEFT); + } +} +void dance_cbr(qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + tap_code16(KC_LCBR); + } else { + tap_code16(KC_LCBR); + tap_code16(KC_RCBR); + tap_code(KC_LEFT); + } +} + +qk_tap_dance_action_t tap_dance_actions[] = { + // declare tap dance actions here + [TD_PRN] = ACTION_TAP_DANCE_FN(dance_prn), + [TD_BRC] = ACTION_TAP_DANCE_FN(dance_brc), + [TD_CBR] = ACTION_TAP_DANCE_FN(dance_cbr), + [TD_MPLY] = ACTION_TAP_DANCE_DOUBLE(KC_MPLY, KC_MNXT), + [TD_ESC_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_ESC, KC_CAPS), + [TD_QUO_BRC] = ACTION_TAP_DANCE_DOUBLE(KC_QUOT, KC_LBRC), + [TD_COMM_SLSH] = ACTION_TAP_DANCE_DOUBLE(KC_COMMA, KC_SLSH), + [TD_Q_TAB] = ACTION_TAP_DANCE_DOUBLE(KC_Q, KC_TAB) +}; + +// TD(TD_ESC_CAPS), LGUI_T(KC_A), LALT_T(KC_R), LSFT_T(KC_S), LCTL_T(KC_T), KC_G, KC_M, RCTL_T(KC_N), RSFT_T(KC_E), LALT_T(KC_I), RGUI_T(KC_O), KC_TRNS, +// define the per_key_tapping_term +uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case TD(TD_ESC_CAPS): + return TAPPING_TERM * 1.5; + case LGUI_T(KC_A): + return TAPPING_TERM * 1.4; + case LGUI_T(KC_Q): + return TAPPING_TERM * 1.1; + case RGUI_T(KC_O): + return TAPPING_TERM * 1.45; + case RGUI_T(KC_SCLN): + return TAPPING_TERM * 1.1; + case LALT_T(KC_R): + return TAPPING_TERM * 1.3; + case LALT_T(KC_W): + return TAPPING_TERM * 1.25; + case LALT_T(KC_I): + return TAPPING_TERM * 1.35; + case LALT_T(KC_Y): + return TAPPING_TERM * 1.25; + case LCTL_T(KC_T): + return TAPPING_TERM * 1.1; + case LCTL_T(KC_P): + return TAPPING_TERM * 1.1; + case RCTL_T(KC_N): + return TAPPING_TERM * 1.1; + case RCTL_T(KC_L): + return TAPPING_TERM * 1.1; + case LSFT_T(KC_S): + return TAPPING_TERM * 1.1; + case LSFT_T(KC_F): + return TAPPING_TERM * 1.2; + case RSFT_T(KC_E): + return TAPPING_TERM * 1.1; + case RSFT_T(KC_U): + return TAPPING_TERM * 1.2; + case LT(_NUM, KC_F): + return TAPPING_TERM * 1.2; + case LT(_NUM2, KC_B): + return TAPPING_TERM * 1.1; + case LT(_NUM2, KC_J): + return TAPPING_TERM * 1.1; + case LT(_MOUSE, KC_Z): + return TAPPING_TERM * 1.15; + case LT(_MOUSE, KC_SLSH): + return TAPPING_TERM * 1.15; + case TD(TD_QUO_BRC): + return TAPPING_TERM * 1.1; + case TD(TD_Q_TAB): + return TAPPING_TERM * 1.1; + default: + return TAPPING_TERM; + } +} + +#ifdef AUDIO_ENABLE + float plover_song[][2] = SONG(PLOVER_SOUND); + float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND); +#endif + +// alt tab function setup +bool is_alt_tab_active = false; +uint16_t alt_tab_timer = 0; +bool is_ctl_tab_active = false; +uint16_t ctl_tab_timer = 0; +bool de_layout_active = false; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case COLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_COLEMAK); + } + return false; + break; + case WIDECOLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_WIDECOLEMAK); + } + return false; + break; + case HRCOLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_HRCOLEMAK); + } + return false; + break; + case HRWIDECOLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_HRWIDECOLEMAK); + } + return false; + break; + case GAMING: + if (record->event.pressed) { + layer_invert(_GAMING); + } + return false; + break; + case TG_COLEMAK: + if (record->event.pressed) { + tap_code(KC_ENT); + layer_invert(_WIDECOLEMAK); + } + return false; + break; + case VIM_O: + if (record->event.pressed) { + tap_code(KC_END); + tap_code(KC_ENT); + } + return false; + break; + case VIM_V: + if (record->event.pressed) { + if (get_mods() & MOD_BIT(KC_LSFT)) { + unregister_code(KC_LSFT); + } else { + register_code(KC_LSFT); + } + } + return false; + break; + case KC_SVU_BU: // increase backlight when pressing shift and vol up + if (record->event.pressed) { + if (get_mods() & MOD_BIT(KC_LSFT) || get_mods() & MOD_BIT(KC_RSFT)) { + register_code(KC_BRIU); + } else if (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTL)){ + register_code(KC_MNXT); + } else { + register_code(KC_VOLU); + } + } else { + unregister_code(KC_BRIU); + unregister_code(KC_MNXT); + unregister_code(KC_VOLU); + } + return false; + case KC_SVD_BD: // decrease backlight when pressing shift and vol up + if (record->event.pressed) { + if (get_mods() & MOD_BIT(KC_LSFT) || get_mods() & MOD_BIT(KC_RSFT)) { + register_code(KC_BRID); + } else if (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTL)){ + register_code(KC_MPRV); + } else { + register_code(KC_VOLD); + } + } else { + unregister_code(KC_BRID); + unregister_code(KC_MPRV); + unregister_code(KC_VOLD); + } + return false; + case KC_TAB_MPLY: // press tab or play/pause when ctrl is pressed + if (record->event.pressed) { + if (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTL)){ + register_code(KC_MPLY); + } else { + register_code(KC_TAB); + } + } else { + unregister_code(KC_MPLY); + unregister_code(KC_TAB); + } + return false; + case ALT_TAB: + if (record->event.pressed) { + if (!is_alt_tab_active) { + is_alt_tab_active = true; + register_code(KC_LALT); + } + alt_tab_timer = timer_read(); + register_code(KC_TAB); + } else { + unregister_code(KC_TAB); + } + break; + case CTL_TAB: + if (record->event.pressed) { + if (!is_ctl_tab_active) { + is_ctl_tab_active = true; + register_code(KC_LCTL); + } + ctl_tab_timer = timer_read(); + register_code(KC_TAB); + } else { + unregister_code(KC_TAB); + } + break; + case DE_AE: + if (record->event.pressed) { + uint8_t temp_mod = get_mods(); + if (temp_mod & MODS_SHIFT_MASK) { + if (!de_layout_active) { + clear_mods(); + register_code(KC_LALT); + tap_code(KC_P0); tap_code(KC_P1); tap_code(KC_P9); tap_code(KC_P6); // Ä + unregister_code(KC_LALT); + } else { + register_code(KC_QUOT); + } + } else { + if (!de_layout_active) { + clear_mods(); + register_code(KC_LALT); + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P2); tap_code(KC_P8); // ä + unregister_code(KC_LALT); + } else { + register_code(KC_QUOT); + } + } + unregister_code(KC_QUOT); + return false; + } + break; + case DE_OE: + if (record->event.pressed) { + uint8_t temp_mod = get_mods(); + if (temp_mod & MODS_SHIFT_MASK) { + if (!de_layout_active) { + clear_mods(); + register_code(KC_LALT); + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P1); tap_code(KC_P4); // Ö + unregister_code(KC_LALT); + } else { + register_code(KC_SCLN); + } + } else { + if (!de_layout_active) { + clear_mods(); + register_code(KC_LALT); + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P4); tap_code(KC_P6); // ö + unregister_code(KC_LALT); + } else { + register_code(KC_SCLN); + } + } + unregister_code(KC_SCLN); + return false; + } + break; + case DE_UE: + if (record->event.pressed) { + uint8_t temp_mod = get_mods(); + if (temp_mod & MODS_SHIFT_MASK) { + if (!de_layout_active) { + clear_mods(); + register_code(KC_LALT); + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P2); tap_code(KC_P0); // Ü + unregister_code(KC_LALT); + } else { + register_code(KC_LBRC); + } + } else { + if (!de_layout_active) { + clear_mods(); + register_code(KC_LALT); + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P5); tap_code(KC_P2); // ü + unregister_code(KC_LALT); + } else { + register_code(KC_LBRC); + } + } + unregister_code(KC_LBRC); + return false; + } + break; + case KC_UE_SWITCH: + if (record->event.pressed) { + if (de_layout_active) { + de_layout_active = false;// deactivate ü if it was active + } else { + de_layout_active = true; // activate ü if it was deactivated + } + return false; + } + break; + case LANG_SWITCH: + if (record->event.pressed) { + register_code(KC_LALT); + tap_code(KC_LSFT); + unregister_code(KC_LALT); + if (de_layout_active) { + de_layout_active = false;// deactivate ü if it was active + } else { + de_layout_active = true; // activate ü if it was deactivated + } + return false; + } + break; + case DE_SZ: + if (record->event.pressed) { + uint8_t temp_mod = get_mods(); + clear_mods(); + register_code(KC_LALT); + if (temp_mod & MODS_SHIFT_MASK) { + tap_code(KC_P0); tap_code(KC_P1); tap_code(KC_P7); tap_code(KC_P6); // ° + } else { + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P2); tap_code(KC_P3); // ß + } + unregister_code(KC_LALT); + return false; + } + break; + case DE_EGRAVE: + if (record->event.pressed) { + uint8_t temp_mod = get_mods(); + clear_mods(); + register_code(KC_LALT); + if (temp_mod & MODS_SHIFT_MASK) { + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P0); tap_code(KC_P0); // È + } else { + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P3); tap_code(KC_P2); // è + } + unregister_code(KC_LALT); + return false; + } + break; + case DE_EAIGU: + if (record->event.pressed) { + uint8_t temp_mod = get_mods(); + clear_mods(); + register_code(KC_LALT); + if (temp_mod & MODS_SHIFT_MASK) { + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P0); tap_code(KC_P1); // É + } else { + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P3); tap_code(KC_P3); // é + } + unregister_code(KC_LALT); + return false; + } + break; + case KC_CURRENCY: + if (record->event.pressed) { + uint8_t temp_mod = get_mods(); + clear_mods(); + register_code(KC_LALT); + if (temp_mod & MODS_SHIFT_MASK) { + tap_code(KC_P1); tap_code(KC_P5); tap_code(KC_P7); // ¥ + } else { + tap_code(KC_P0); tap_code(KC_P1); tap_code(KC_P2); tap_code(KC_P8); // € + } + unregister_code(KC_LALT); + return false; + } + break; + case BACKLIT: + if (record->event.pressed) { + register_code(KC_RSFT); + #ifdef BACKLIGHT_ENABLE + backlight_step(); + #endif + #ifdef KEYBOARD_planck_rev5 + writePinLow(E6); + #endif + } else { + unregister_code(KC_RSFT); + #ifdef KEYBOARD_planck_rev5 + writePinHigh(E6); + #endif + } + 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(); + keymap_config.nkro = 1; + eeconfig_update_keymap(keymap_config.raw); + } + return false; + break; + case EXT_PLV: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_SONG(plover_gb_song); + #endif + layer_off(_PLOVER); + } + return false; + break; + } + return true; +} + +bool muse_mode = false; +uint8_t last_muse_note = 0; +uint16_t muse_counter = 0; +uint8_t muse_offset = 70; +uint16_t muse_tempo = 50; + +bool encoder_update(bool clockwise) { + 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 (clockwise) { + #ifdef MOUSEKEY_ENABLE + tap_code(KC_MS_WH_DOWN); + #else + tap_code(KC_PGDN); + #endif + } else { + #ifdef MOUSEKEY_ENABLE + tap_code(KC_MS_WH_UP); + #else + tap_code(KC_PGUP); + #endif + } + } + return true; +} + +void dip_switch_update_user(uint8_t index, bool active) { + switch (index) { + case 0: { +#ifdef AUDIO_ENABLE + static bool play_sound = false; +#endif + if (active) { +#ifdef AUDIO_ENABLE + if (play_sound) { PLAY_SONG(plover_song); } +#endif + layer_on(_ADJUST); + } else { +#ifdef AUDIO_ENABLE + if (play_sound) { PLAY_SONG(plover_gb_song); } +#endif + layer_off(_ADJUST); + } +#ifdef AUDIO_ENABLE + play_sound = true; +#endif + break; + } + case 1: + if (active) { + muse_mode = true; + } else { + muse_mode = false; + } + } +} + +void matrix_scan_user(void) { + // set the timeout for the alt-tab function + if (is_alt_tab_active) { + if (timer_elapsed(alt_tab_timer) > 700) { + unregister_code(KC_LALT); + is_alt_tab_active = false; + } + } + if (is_ctl_tab_active) { + if (timer_elapsed(ctl_tab_timer) > 700) { + unregister_code(KC_LCTL); + is_ctl_tab_active = false; + } + } + #ifdef AUDIO_ENABLE + if (muse_mode) { + if (muse_counter == 0) { + uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()]; + if (muse_note != last_muse_note) { + stop_note(compute_freq_for_midi_note(last_muse_note)); + play_note(compute_freq_for_midi_note(muse_note), 0xF); + last_muse_note = muse_note; + } + } + muse_counter = (muse_counter + 1) % muse_tempo; + } else { + if (muse_counter) { + stop_all_notes(); + muse_counter = 0; + } + } +#endif +} + +bool music_mask_user(uint16_t keycode) { + switch (keycode) { + case RAISE: + case LOWER: + return false; + default: + return true; + } +} + +bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case LSFT_T(KC_S): + return true; + case RSFT_T(KC_E): + return true; + case LSFT_T(KC_D): + return true; + case RSFT_T(KC_K): + return true; + case LSFT_T(KC_F): + return true; + case RSFT_T(KC_U): + return true; + default: + return false; + } +} + +// Set RGB to change with layer changes +#define HSV_DARKORANGE 10, 255, 255 +#define HSV_DARKPINK 150, 100, 255 + +// Light LEDs 1 to 9 in darkorange when HRCOLEMAK is active +const rgblight_segment_t PROGMEM my_layer0_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {1, 10, HSV_DARKORANGE} +); +// Light LEDs 1 to 9 in green when HRWIDECOLEMAK is active +const rgblight_segment_t PROGMEM my_layer1_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {0, 10, HSV_CYAN} +); +// Light LEDs 1 to 9 in red when GAMING layer is active +const rgblight_segment_t PROGMEM my_layer2_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {1, 10, HSV_RED} +); +// Light LEDs 1 to 9 in white when WIDECOLEMAK is active +const rgblight_segment_t PROGMEM my_layer3_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {1, 10, HSV_WHITE} +); +// Light bottom LEDs in purple when ADJUST layer is active +const rgblight_segment_t PROGMEM my_layer4_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {1, 2, HSV_PURPLE}, + {7, 3, HSV_PURPLE} +); +// Light LEDs 1 to 9 in darkorange when de_layout_active is true +const rgblight_segment_t PROGMEM my_de_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {3, 4, HSV_DARKORANGE} +); +// Light bottom LEDs in red when caps lock is active. Hard to ignore! +const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {1, 2, HSV_RED}, + {7, 3, HSV_RED} +); +// Light LEDs 1 to 9 in white when NAVIGATION is active +const rgblight_segment_t PROGMEM my_nav_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {1, 10, HSV_WHITE} +); + +// Now define the array of layers. Later layers take precedence +const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST( + my_layer0_layer, // hrcolemak + my_layer1_layer, // hrwidecolemak + my_layer2_layer, // gaming + my_layer3_layer, // widecolemak + my_layer4_layer, // adjust + my_nav_layer, // nav + my_de_layer, // de_layout + my_capslock_layer // capslock +); + +void keyboard_post_init_user(void) { + // Enable the LED layers + rgblight_layers = my_rgb_layers; +} + +bool led_update_user(led_t led_state) { + rgblight_set_layer_state(7, led_state.caps_lock); + return true; +} + +layer_state_t layer_state_set_user(layer_state_t state) { + rgblight_set_layer_state(4, layer_state_cmp(state, _ADJUST)); + rgblight_set_layer_state(2, layer_state_cmp(state, _GAMING)); + rgblight_set_layer_state(5, layer_state_cmp(state, _NAV)); + rgblight_set_layer_state(3, layer_state_cmp(state, _WIDECOLEMAK)); + rgblight_set_layer_state(6, de_layout_active); + if ( + ( layer_state_cmp(state, _LOWER) && layer_state_cmp(state, _RAISE ) ) || + ( layer_state_cmp(state, _LOWER2) && layer_state_cmp(state, _RAISE2 ) ) ) { + return state | (1UL<<_ADJUST); + } else { + return state & ~(1UL<<_ADJUST); + } + + //state = update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); + //return state; +} + +layer_state_t default_layer_state_set_user(layer_state_t state) { + rgblight_set_layer_state(3, layer_state_cmp(state, _WIDECOLEMAK)); + rgblight_set_layer_state(0, layer_state_cmp(state, _HRCOLEMAK)); + rgblight_set_layer_state(1, layer_state_cmp(state, _HRWIDECOLEMAK)); + return state; +} + diff --git a/keyboards/planck/keymaps/jweickm/keymap.c b/keyboards/planck/keymaps/jweickm/keymap.c new file mode 100644 index 000000000000..b168f5874dd8 --- /dev/null +++ b/keyboards/planck/keymaps/jweickm/keymap.c @@ -0,0 +1,839 @@ +/* Copyright 2015-2017 Jack Humbert + * Copyright 2021 Jakob Weickmann + * + * 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 . + */ +#include QMK_KEYBOARD_H +#include "muse.h" +#include "quantum.h" + + +enum planck_layers { + _COLEMAK, + _HRCOLEMAK, + _HRWIDECOLEMAK, + _HRWIDECOLEMAK_DE, + _GAMING, + _WIDECOLEMAK, + _LOWER, + _RAISE, + _LOWER_DE, + _RAISE_DE, + _ADJUST, + _NAV, + _NUM, + _MOUSE, + _PLOVER +}; + +enum planck_keycodes { + COLEMAK = SAFE_RANGE, + HRCOLEMAK, + HRWIDECOLEMAK, + PLOVER, + BACKLIT, + EXT_PLV, + GAMING, + WIDECOLEMAK, + TG_COLEMAK, + VIM_O, + VIM_V, + KC_SVD_BD, + KC_SVU_BU, + KC_TAB_MPLY, + ALT_TAB, + CTL_TAB, + DE_AE, + DE_OE, + DE_UE, + DE_SZ, + DE_EGRAVE, + DE_EAIGU, + KC_CURRENCY, + KC_DE_SWITCH, + LANG_SWITCH, + DE_SLSH_QUST, + DE_QUOT +}; + +// Tap Dance declarations +enum tap_dance_codes{ + TD_PRN, // round brackets (parentheses) + TD_BRC, // square brackets + TD_CBR, // curly brackets + TD_ESC_CAPS, // double tap for caps lock + TD_QUO_BRC, // double function on quotes to enable typing ü in german layout + TD_COMM_SLSH, // comma that doubles as a slash + TD_MPLY, // play/pause, double for next, triple for previous song + TD_Q_TAB // double tap q to register tab +}; + +#define LOWER MO(_LOWER) +#define RAISE MO(_RAISE) + +#define MODS_SHIFT_MASK (MOD_BIT(KC_LSFT)|MOD_BIT(KC_RSFT)) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +[_HRWIDECOLEMAK] = LAYOUT_planck_grid( + LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM,KC_B), KC_SVU_BU, LT(_NUM,KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Y), RGUI_T(KC_SCLN), DE_UE, + KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, + LT(_MOUSE,KC_Z), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, LT(_MOUSE,KC_MINS), KC_SLSH, + KC_CAPS, LT(_NUM,KC_TAB), LGUI_T(KC_ESC), LT(_LOWER, KC_BSPC), OSM(MOD_LSFT), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE, KC_DEL), RCTL_T(KC_ENT), KC_LALT, KC_LEFT, KC_RIGHT +), + +[_HRWIDECOLEMAK_DE] = LAYOUT_planck_grid( + LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM,KC_B), KC_SVU_BU, LT(_NUM,KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Z), RGUI_T(KC_SCLN), KC_LBRC, + KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB, KC_M, KC_N, KC_E, KC_I, KC_O, DE_QUOT, + LT(_MOUSE,KC_Y), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, LT(_MOUSE,KC_SLSH), DE_SLSH_QUST, + KC_CAPS, LT(_NUM,KC_TAB), LGUI_T(KC_ESC), LT(_LOWER_DE, KC_BSPC), OSM(MOD_LSFT), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE_DE, KC_DEL), RCTL_T(KC_ENT), KC_LALT, KC_LEFT, KC_RIGHT +), + +[_GAMING] = LAYOUT_planck_grid( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_F5, KC_F8, KC_F9, KC_VOLU, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_VOLD, + KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_Z, KC_M, KC_SCLN, KC_ENT, + KC_LCTL, KC_LALT, KC_B, KC_X, KC_C, KC_SPC, KC_SPC, KC_LALT, TG_COLEMAK, KC_TRNS, KC_TRNS, GAMING +), + +/* WIDECOLEMAK + * ,-----------------------------------------------------------------------------------. + * |_NUM(Tab)| Q | W | E | R | T | Y | U | I | O | P | Bksp | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |CTL(Esc)| A | S | D | F | G | H | J | K | L | ; | " | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_WIDECOLEMAK] = LAYOUT_planck_grid( + KC_Q, KC_W, KC_F, KC_P, KC_B, KC_SVU_BU, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, DE_UE, + KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB_MPLY, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, + KC_Z, KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, LSFT_T(KC_ENT), + KC_CAPS, LT(_NUM,KC_TAB), LGUI_T(KC_ESC), LT(_LOWER, KC_BSPC), OSM(MOD_LSFT), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE, KC_DEL), TG_COLEMAK, KC_LALT, KC_LEFT, KC_RIGHT +), + +[_LOWER] = LAYOUT_planck_grid( + KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_TILD, KC_CIRC, KC_AMPR, KC_ASTR, TD(TD_PRN), KC_RPRN, DE_AE, + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, DE_SZ, KC_UNDS, KC_PLUS, TD(TD_CBR), KC_RCBR, KC_PIPE, + KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, KC_SLSH, KC_NUBS, LSFT(KC_NUBS), KC_CURRENCY, DE_EGRAVE, + TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_DOWN, KC_UP +), + +[_LOWER_DE] = LAYOUT_planck_grid( + KC_EXLM, RALT(KC_Q), KC_BSLS, KC_DLR, KC_PERC, RALT(KC_RBRC), KC_GRV, KC_CIRC, KC_RCBR, KC_ASTR, KC_LPRN, KC_QUOT, + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, DE_SZ, LSFT(KC_SLSH), KC_RBRC, RALT(KC_7), RALT(KC_0), RALT(KC_NUBS), + KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, LSFT(KC_7), KC_NUBS, LSFT(KC_NUBS), KC_CURRENCY, DE_EGRAVE, + TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_DOWN, KC_UP +), + +[_RAISE] = LAYOUT_planck_grid( + KC_1, KC_2, KC_3, KC_4, KC_5, KC_GRV, KC_6, KC_7, KC_8, KC_9, KC_0, DE_OE, + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, DE_SZ, KC_MINS, KC_EQL, TD(TD_BRC), KC_RBRC, KC_BSLS, + KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, KC_BSLS, KC_COMM, KC_DOT, KC_SLSH, DE_EAIGU, + TG(_MOUSE), KC_TRNS, KC_BSPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_DOWN, KC_UP +), + +[_RAISE_DE] = LAYOUT_planck_grid( + KC_1, KC_2, KC_3, KC_4, KC_5, KC_GRV, KC_6, KC_7, KC_8, KC_9, KC_0, KC_SCLN, + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, DE_SZ, KC_SLSH, LSFT(KC_0), RALT(KC_8), RALT(KC_9), RALT(KC_MINS), + KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, RALT(KC_MINS), KC_COMM, KC_DOT, KC_SLSH, DE_EAIGU, + TG(_MOUSE), KC_TRNS, KC_BSPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_DOWN, KC_UP +), + +[_ADJUST] = LAYOUT_planck_grid( + LALT(KC_LSFT), RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DE_SWITCH, + LALT(KC_GRV), EEP_RST, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, HRWIDECOLEMAK, WIDECOLEMAK, LCTL(KC_RGHT), LANG_SWITCH, GAMING, + KC_TRNS, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, KC_SVD_BD, KC_MPLY, KC_SVU_BU, KC_TRNS, , + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS +), + +[_NAV] = LAYOUT_planck_grid( + ALT_TAB, LCTL(KC_RGHT), LANG_SWITCH, LALT(KC_GRV), LCTL(KC_LEFT), KC_MNXT, KC_DOWN, KC_RIGHT, KC_PGUP, LCTL(KC_C), KC_NO, KC_DE_SWITCH, + CTL_TAB, KC_TAB, KC_ESC, LT(_NUM,KC_ENT), KC_TAB, KC_MPLY, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_END, VIM_O, + KC_LSFT, KC_NO, LCTL(KC_X), TD(TD_ESC_CAPS), VIM_V, KC_MUTE, KC_HOME, KC_PGDN, KC_NO, KC_NO, LCTL(KC_F), LCTL(KC_F), + KC_NO, KC_NO, KC_NO, KC_TRNS, KC_TRNS, LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), KC_NO, KC_NO, KC_TRNS, KC_NO, KC_NO +), + +[_NUM] = LAYOUT_planck_grid( + KC_F1, KC_F2, KC_F3, KC_F4, KC_MPRV, KC_NLCK, KC_MNXT, KC_P7, KC_P8, KC_P9, KC_PMNS, KC_TRNS, + KC_F5, KC_F6, KC_F7, KC_F8, KC_VOLU, KC_MPLY, KC_BRIU, KC_P4, KC_P5, KC_P6, KC_PPLS, KC_TRNS, + KC_F9,KC_F10,KC_F11,KC_F12, KC_VOLD, KC_MUTE, KC_BRID, KC_P1, KC_P2, KC_P3, KC_PSLS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P0, KC_DOT, KC_COMM, KC_EQL, KC_TRNS +), + +[_MOUSE] = LAYOUT_planck_grid( + KC_NO, KC_NO, KC_BTN4, KC_BTN5, KC_NO, KC_NO, KC_NO, KC_WH_U, KC_MS_U, KC_WH_U, KC_NO, KC_NO, + KC_NO, KC_BTN3, KC_BTN2, KC_BTN1, KC_NO, KC_NO, KC_NO, KC_MS_L, KC_MS_D, KC_MS_R, KC_NO, KC_NO, + KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_WH_D, KC_NO, KC_NO, KC_TRNS, KC_NO, + TG(_MOUSE), KC_NO, KC_NO, KC_TRNS, KC_NO, KC_ACL2, KC_ACL2, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO +) + +}; + +// define the tap dance functions +void dance_prn(qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + tap_code16(KC_LPRN); + } else { + tap_code16(KC_LPRN); + tap_code16(KC_RPRN); + tap_code(KC_LEFT); + } +} +void dance_brc(qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + tap_code(KC_LBRC); + } else { + tap_code(KC_LBRC); + tap_code(KC_RBRC); + tap_code(KC_LEFT); + } +} +void dance_cbr(qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + tap_code16(KC_LCBR); + } else { + tap_code16(KC_LCBR); + tap_code16(KC_RCBR); + tap_code(KC_LEFT); + } +} + +qk_tap_dance_action_t tap_dance_actions[] = { + // declare tap dance actions here + [TD_PRN] = ACTION_TAP_DANCE_FN(dance_prn), + [TD_BRC] = ACTION_TAP_DANCE_FN(dance_brc), + [TD_CBR] = ACTION_TAP_DANCE_FN(dance_cbr), + [TD_MPLY] = ACTION_TAP_DANCE_DOUBLE(KC_MPLY, KC_MNXT), + [TD_ESC_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_ESC, KC_CAPS), + [TD_QUO_BRC] = ACTION_TAP_DANCE_DOUBLE(KC_QUOT, KC_LBRC), + [TD_COMM_SLSH] = ACTION_TAP_DANCE_DOUBLE(KC_COMMA, KC_SLSH), + [TD_Q_TAB] = ACTION_TAP_DANCE_DOUBLE(KC_Q, KC_TAB) +}; + +// TD(TD_ESC_CAPS), LGUI_T(KC_A), LALT_T(KC_R), LSFT_T(KC_S), LCTL_T(KC_T), KC_G, KC_M, RCTL_T(KC_N), RSFT_T(KC_E), LALT_T(KC_I), RGUI_T(KC_O), KC_TRNS, +// define the per_key_tapping_term +uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case TD(TD_ESC_CAPS): + return TAPPING_TERM * 1.5; + case LGUI_T(KC_A): + return TAPPING_TERM * 1.4; + case LGUI_T(KC_Q): + return TAPPING_TERM * 1.1; + case RGUI_T(KC_O): + return TAPPING_TERM * 1.45; + case RGUI_T(KC_SCLN): + return TAPPING_TERM * 1.1; + case LALT_T(KC_R): + return TAPPING_TERM * 1.3; + case LALT_T(KC_W): + return TAPPING_TERM * 1.25; + case LALT_T(KC_I): + return TAPPING_TERM * 1.35; + case LALT_T(KC_Y): + return TAPPING_TERM * 1.25; + case LCTL_T(KC_T): + return TAPPING_TERM * 1.1; + case LCTL_T(KC_P): + return TAPPING_TERM * 1.1; + case RCTL_T(KC_N): + return TAPPING_TERM * 1.1; + case RCTL_T(KC_L): + return TAPPING_TERM * 1.1; + case LSFT_T(KC_S): + return TAPPING_TERM * 1.1; + case LSFT_T(KC_F): + return TAPPING_TERM * 1.2; + case RSFT_T(KC_E): + return TAPPING_TERM * 1.1; + case RSFT_T(KC_U): + return TAPPING_TERM * 1.2; + case LT(_NUM, KC_F): + return TAPPING_TERM * 1.2; + case LT(_NUM, KC_B): + return TAPPING_TERM * 1.1; + case LT(_NUM, KC_J): + return TAPPING_TERM * 1.1; + case LT(_MOUSE, KC_Z): + return TAPPING_TERM * 1.15; + case LT(_MOUSE, KC_SLSH): + return TAPPING_TERM * 1.15; + case TD(TD_QUO_BRC): + return TAPPING_TERM * 1.1; + case TD(TD_Q_TAB): + return TAPPING_TERM * 1.1; + case TD(TD_PRN): + return TAPPING_TERM * 1.4; + case TD(TD_BRC): + return TAPPING_TERM * 1.4; + case TD(TD_CBR): + return TAPPING_TERM * 1.4; + default: + return TAPPING_TERM; + } +} + +#ifdef AUDIO_ENABLE + float plover_song[][2] = SONG(PLOVER_SOUND); + float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND); +#endif + +// alt tab function setup +bool is_alt_tab_active = false; +bool is_ctl_tab_active = false; +bool de_layout_active = false; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case COLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_COLEMAK); + } + return false; + break; + case WIDECOLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_WIDECOLEMAK); + } + return false; + break; + case HRCOLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_HRCOLEMAK); + } + return false; + break; + case HRWIDECOLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_HRWIDECOLEMAK); + } + return false; + break; + case GAMING: + if (record->event.pressed) { + layer_invert(_GAMING); + } + return false; + break; + case TG_COLEMAK: + if (record->event.pressed) { + tap_code(KC_ENT); + layer_invert(_WIDECOLEMAK); + } + return false; + break; + case VIM_O: + if (record->event.pressed) { + tap_code(KC_END); + tap_code(KC_ENT); + } + return false; + break; + case VIM_V: + if (record->event.pressed) { + if (get_mods() & MOD_BIT(KC_LSFT)) { + unregister_mods(MOD_LSFT); + } else { + register_mods(MOD_LSFT); + } + } + return false; + break; + case KC_SVU_BU: // increase backlight when pressing shift and vol up + if (record->event.pressed) { + if (get_mods() & MOD_BIT(KC_LSFT) || get_mods() & MOD_BIT(KC_RSFT)) { + register_code(KC_BRIU); + } else if (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTL)){ + register_code(KC_MNXT); + } else { + register_code(KC_VOLU); + } + } else { + unregister_code(KC_BRIU); + unregister_code(KC_MNXT); + unregister_code(KC_VOLU); + } + return false; + case KC_SVD_BD: // decrease backlight when pressing shift and vol up + if (record->event.pressed) { + if (get_mods() & MOD_BIT(KC_LSFT) || get_mods() & MOD_BIT(KC_RSFT)) { + register_code(KC_BRID); + } else if (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTL)){ + register_code(KC_MPRV); + } else { + register_code(KC_VOLD); + } + } else { + unregister_code(KC_BRID); + unregister_code(KC_MPRV); + unregister_code(KC_VOLD); + } + return false; + case KC_TAB_MPLY: // press tab or play/pause when ctrl is pressed + if (record->event.pressed) { + if (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTL)){ + register_code(KC_MPLY); + } else { + register_code(KC_TAB); + } + } else { + unregister_code(KC_MPLY); + unregister_code(KC_TAB); + } + return false; + case ALT_TAB: + if (record->event.pressed) { + if (!is_alt_tab_active) { + is_alt_tab_active = true; + register_mods(MOD_LALT); + } + register_code(KC_TAB); + } else { + unregister_code(KC_TAB); + } + break; + case CTL_TAB: + if (record->event.pressed) { + if (!is_ctl_tab_active) { + is_ctl_tab_active = true; + register_mods(MOD_LCTL); + } + register_code(KC_TAB); + } else { + unregister_code(KC_TAB); + } + break; + // the next case allows us to use alt_tab without a timer + case LT(_NAV,KC_SPC): + if (record->event.pressed) { + } else { + unregister_mods(MOD_LALT); + unregister_mods(MOD_LCTL); + is_alt_tab_active = false; + is_ctl_tab_active = false; + } + break; + case DE_AE: + if (record->event.pressed) { + uint8_t temp_mod = get_mods(); + if (temp_mod & MODS_SHIFT_MASK) { + clear_mods(); + register_mods(MOD_LALT); + tap_code(KC_P0); tap_code(KC_P1); tap_code(KC_P9); tap_code(KC_P6); // Ä + unregister_mods(MOD_LALT); + } else { + clear_mods(); + register_mods(MOD_LALT); + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P2); tap_code(KC_P8); // ä + unregister_mods(MOD_LALT); + } + return false; + } + break; + case DE_OE: + if (record->event.pressed) { + uint8_t temp_mod = get_mods(); + if (temp_mod & MODS_SHIFT_MASK) { + clear_mods(); + register_mods(MOD_LALT); + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P1); tap_code(KC_P4); // Ö + unregister_mods(MOD_LALT); + } else { + clear_mods(); + register_mods(MOD_LALT); + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P4); tap_code(KC_P6); // ö + unregister_mods(MOD_LALT); + } + return false; + } + break; + case DE_UE: + if (record->event.pressed) { + uint8_t temp_mod = get_mods(); + if (temp_mod & MODS_SHIFT_MASK) { + clear_mods(); + register_mods(MOD_LALT); + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P2); tap_code(KC_P0); // Ü + unregister_mods(MOD_LALT); + } else { + clear_mods(); + register_mods(MOD_LALT); + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P5); tap_code(KC_P2); // ü + unregister_mods(MOD_LALT); + } + return false; + } + break; + case KC_DE_SWITCH: + if (record->event.pressed) { + if (de_layout_active) { + de_layout_active = false;// deactivate German overlay + set_single_persistent_default_layer(_HRWIDECOLEMAK); + } else { + de_layout_active = true; // activate German overlay + set_single_persistent_default_layer(_HRWIDECOLEMAK_DE); + } + return false; + } + break; + case LANG_SWITCH: + if (record->event.pressed) { + register_mods(MOD_LALT); + tap_code(KC_LSFT); + unregister_mods(MOD_LALT); + if (de_layout_active) { + de_layout_active = false; // deactivate German overlay + set_single_persistent_default_layer(_HRWIDECOLEMAK); + } else { + de_layout_active = true; // activate German overlay + set_single_persistent_default_layer(_HRWIDECOLEMAK_DE); + } + return false; + } + break; + case DE_SZ: + if (record->event.pressed) { + uint8_t temp_mod = get_mods(); + clear_mods(); + register_mods(MOD_LALT); + if (temp_mod & MODS_SHIFT_MASK) { + tap_code(KC_P0); tap_code(KC_P1); tap_code(KC_P7); tap_code(KC_P6); // ° + } else { + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P2); tap_code(KC_P3); // ß + } + unregister_mods(MOD_LALT); + return false; + } + break; + case DE_EGRAVE: + if (record->event.pressed) { + uint8_t temp_mod = get_mods(); + clear_mods(); + register_mods(MOD_LALT); + if (temp_mod & MODS_SHIFT_MASK) { + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P0); tap_code(KC_P0); // È + } else { + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P3); tap_code(KC_P2); // è + } + unregister_mods(MOD_LALT); + return false; + } + break; + case DE_EAIGU: + if (record->event.pressed) { + uint8_t temp_mod = get_mods(); + clear_mods(); + register_mods(MOD_LALT); + if (temp_mod & MODS_SHIFT_MASK) { + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P0); tap_code(KC_P1); // É + } else { + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P3); tap_code(KC_P3); // é + } + unregister_mods(MOD_LALT); + return false; + } + break; + case KC_CURRENCY: + if (record->event.pressed) { + uint8_t temp_mod = get_mods(); + clear_mods(); + register_mods(MOD_LALT); + if (temp_mod & MODS_SHIFT_MASK) { + tap_code(KC_P1); tap_code(KC_P5); tap_code(KC_P7); // ¥ + } else { + tap_code(KC_P0); tap_code(KC_P1); tap_code(KC_P2); tap_code(KC_P8); // € + } + unregister_mods(MOD_LALT); + return false; + } + break; + case DE_SLSH_QUST: + if (record->event.pressed) { + uint8_t temp_mod = get_mods(); + if (temp_mod & MODS_SHIFT_MASK) { + tap_code(KC_MINS); // ? + } else { + tap_code16(KC_AMPR); // / + } + return false; + } + break; + case DE_QUOT: + if (record->event.pressed) { + uint8_t temp_mod = get_mods(); + if (temp_mod & MODS_SHIFT_MASK) { + tap_code(KC_2); // \" + } else { + tap_code16(KC_PIPE); // /' + } + return false; + } + break; + case BACKLIT: + if (record->event.pressed) { + register_code(KC_RSFT); + #ifdef BACKLIGHT_ENABLE + backlight_step(); + #endif + #ifdef KEYBOARD_planck_rev5 + writePinLow(E6); + #endif + } else { + unregister_code(KC_RSFT); + #ifdef KEYBOARD_planck_rev5 + writePinHigh(E6); + #endif + } + 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(); + keymap_config.nkro = 1; + eeconfig_update_keymap(keymap_config.raw); + } + return false; + break; + case EXT_PLV: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_SONG(plover_gb_song); + #endif + layer_off(_PLOVER); + } + return false; + break; + } + return true; +} + +bool muse_mode = false; +uint8_t last_muse_note = 0; +uint16_t muse_counter = 0; +uint8_t muse_offset = 70; +uint16_t muse_tempo = 50; + +bool encoder_update(bool clockwise) { + 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 (clockwise) { + #ifdef MOUSEKEY_ENABLE + tap_code(KC_MS_WH_DOWN); + #else + tap_code(KC_PGDN); + #endif + } else { + #ifdef MOUSEKEY_ENABLE + tap_code(KC_MS_WH_UP); + #else + tap_code(KC_PGUP); + #endif + } + } + return true; +} + +void dip_switch_update_user(uint8_t index, bool active) { + switch (index) { + case 0: { +#ifdef AUDIO_ENABLE + static bool play_sound = false; +#endif + if (active) { +#ifdef AUDIO_ENABLE + if (play_sound) { PLAY_SONG(plover_song); } +#endif + layer_on(_ADJUST); + } else { +#ifdef AUDIO_ENABLE + if (play_sound) { PLAY_SONG(plover_gb_song); } +#endif + layer_off(_ADJUST); + } +#ifdef AUDIO_ENABLE + play_sound = true; +#endif + break; + } + case 1: + if (active) { + muse_mode = true; + } else { + muse_mode = false; + } + } +} + +void matrix_scan_user(void) { + #ifdef AUDIO_ENABLE + if (muse_mode) { + if (muse_counter == 0) { + uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()]; + if (muse_note != last_muse_note) { + stop_note(compute_freq_for_midi_note(last_muse_note)); + play_note(compute_freq_for_midi_note(muse_note), 0xF); + last_muse_note = muse_note; + } + } + muse_counter = (muse_counter + 1) % muse_tempo; + } else { + if (muse_counter) { + stop_all_notes(); + muse_counter = 0; + } + } +#endif +} + +bool music_mask_user(uint16_t keycode) { + switch (keycode) { + case RAISE: + case LOWER: + return false; + default: + return true; + } +} + +bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case LSFT_T(KC_S): + return true; + case RSFT_T(KC_E): + return true; + case LSFT_T(KC_D): + return true; + case RSFT_T(KC_K): + return true; + case LSFT_T(KC_F): + return true; + case RSFT_T(KC_U): + return true; + default: + return false; + } +} + +// Set RGB to change with layer changes +#define HSV_DARKORANGE 10, 255, 255 +#define HSV_DARKPINK 150, 100, 255 + +// Light LEDs 1 to 9 in darkorange when HRCOLEMAK is active +const rgblight_segment_t PROGMEM my_layer0_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {0, 10, HSV_DARKORANGE} +); +// Light LEDs 1 to 9 in green when HRWIDECOLEMAK is active +const rgblight_segment_t PROGMEM my_layer1_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {0, 10, HSV_CYAN} +); +// Light LEDs 1 to 9 in red when GAMING layer is active +const rgblight_segment_t PROGMEM my_layer2_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {0, 10, HSV_RED} +); +// Light LEDs 1 to 9 in white when WIDECOLEMAK is active +const rgblight_segment_t PROGMEM my_layer3_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {0, 10, HSV_WHITE} +); +// Light bottom LEDs in purple when ADJUST layer is active +const rgblight_segment_t PROGMEM my_layer4_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {0, 2, HSV_PURPLE}, + {7, 3, HSV_PURPLE} +); +// Light LEDs 1 to 9 in darkorange when de_layout_active is true +const rgblight_segment_t PROGMEM my_de_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {3, 4, HSV_DARKORANGE}, + {0, 3, HSV_CYAN}, + {8, 3, HSV_CYAN} +); +// Light bottom LEDs in red when caps lock is active. Hard to ignore! +const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {0, 3, HSV_MAGENTA}, + {7, 3, HSV_MAGENTA} +); +// Light LEDs 1 to 9 in white when NAVIGATION is active +const rgblight_segment_t PROGMEM my_nav_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {0, 10, HSV_WHITE} +); + +// Now define the array of layers. Later layers take precedence +const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST( + my_layer0_layer, // hrcolemak + my_layer1_layer, // hrwidecolemak + my_layer2_layer, // gaming + my_layer3_layer, // widecolemak + my_layer4_layer, // adjust + my_nav_layer, // nav + my_de_layer, // de_layout + my_capslock_layer // capslock +); + +void keyboard_post_init_user(void) { + // Enable the LED layers + rgblight_layers = my_rgb_layers; +} + +bool led_update_user(led_t led_state) { + rgblight_set_layer_state(7, led_state.caps_lock); + return true; +} + +layer_state_t layer_state_set_user(layer_state_t state) { + rgblight_set_layer_state(2, layer_state_cmp(state, _GAMING)); + rgblight_set_layer_state(3, layer_state_cmp(state, _WIDECOLEMAK)); + if ( + ( layer_state_cmp(state, _LOWER) && layer_state_cmp(state, _RAISE ) ) || + ( layer_state_cmp(state, _LOWER_DE) && layer_state_cmp(state, _RAISE_DE ) ) ) { + return state | (1UL<<_ADJUST); + } else { + return state & ~(1UL<<_ADJUST); + } + // state = update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); + rgblight_set_layer_state(4, layer_state_cmp(state, _ADJUST)); + //return state; +} + +layer_state_t default_layer_state_set_user(layer_state_t state) { + rgblight_set_layer_state(3, layer_state_cmp(state, _WIDECOLEMAK)); + rgblight_set_layer_state(1, layer_state_cmp(state, _HRWIDECOLEMAK)); + rgblight_set_layer_state(6, layer_state_cmp(state, _HRWIDECOLEMAK_DE)); + return state; +} + diff --git a/keyboards/planck/keymaps/jweickm/keymap_halfwide.c b/keyboards/planck/keymaps/jweickm/keymap_halfwide.c new file mode 100644 index 000000000000..545794222789 --- /dev/null +++ b/keyboards/planck/keymaps/jweickm/keymap_halfwide.c @@ -0,0 +1,583 @@ +/* Copyright 2015-2017 Jack Humbert + * Copyright 2021 Jakob Weickmann + * + * 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 . + */ +#include QMK_KEYBOARD_H +#include "muse.h" +#include "quantum.h" + +enum planck_layers { + _COLEMAK, + _WIDECOLEMAK, + _HRCOLEMAK, + _HRWIDECOLEMAK, + _GAMING, + _LOWER, + _RAISE, + _ADJUST, + _NAV, + _NAV2, + _NUM, + _FN, + _MEDIA, + _MOUSE, + _PLOVER +}; + +enum planck_keycodes { + COLEMAK = SAFE_RANGE, + PLOVER, + BACKLIT, + EXT_PLV, + WIDECOLEMAK, + HRCOLEMAK, + HRWIDECOLEMAK, + GAMING, + VIM_O, + VIM_V, + KC_SVD_BD, + KC_SVU_BU +}; + +// Tap Dance declarations +enum { + TD_PRN, // round brackets (parentheses) + TD_BRC, // square brackets + TD_CBR, // curly brackets + TD_ESC_CAPS, // double tap for caps lock + TD_QUO_BRC, // double function on quotes to enable typing ü in german layout + TD_COMM_SLSH, // comma that doubles as a slash + TD_MPLY_MNXT_MPRV +}; + +#define LOWER MO(_LOWER) +#define RAISE MO(_RAISE) + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +[_COLEMAK] = LAYOUT_planck_grid( + LT(_NUM,KC_TAB), KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, + LCTL_T(KC_ESC), KC_A, KC_R, KC_S, KC_T, KC_G, KC_M, KC_N, KC_E, KC_I, KC_O, TD(TD_QUO_BRC), + OSM(MOD_LSFT), KC_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, RSFT_T(KC_ENT), + LCTL_T(KC_CAPS), RALT_T(KC_APP), LGUI_T(KC_TAB), LT(_MOUSE, KC_ESC), LT(_LOWER,KC_BSPC), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE,KC_DEL), LT(_MEDIA, KC_ENT), TG(_NAV), RALT_T(KC_UP), CTL_T(KC_CAPS) +), + +/* WIDECOLEMAK + * ,-----------------------------------------------------------------------------------. + * |_NUM(Tab)| Q | W | E | R | T | Y | U | I | O | P | Bksp | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |CTL(Esc)| A | S | D | F | G | H | J | K | L | ; | " | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_WIDECOLEMAK] = LAYOUT_planck_grid( + KC_Q, KC_W, KC_F, KC_P, KC_B, KC_SVU_BU, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_LBRC, + KC_A, KC_R, KC_S, KC_T, KC_G, TD(TD_MPLY_MNXT_MPRV), KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, + KC_Z, KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, KC_MINS, + TG(_MOUSE), LT(_NUM,KC_TAB), LCTL_T(KC_ESC), OSM(MOD_LSFT), LT(_LOWER, KC_BSPC), LT(_NAV2,KC_ENT), LT(_NAV2,KC_ENT), LT(_RAISE, KC_SPC), RCTL_T(KC_TAB), RGUI_T(KC_LALT), KC_LEFT, KC_RIGHT +), + +[_HRCOLEMAK] = LAYOUT_planck_grid( + KC_TRNS, KC_Q, KC_W, LT(_NUM, KC_F), KC_P, KC_B, KC_J, KC_L, LT(_FN, KC_U), KC_Y, KC_SCLN, KC_LBRC, + TD(TD_ESC_CAPS), LGUI_T(KC_A), LALT_T(KC_R), LSFT_T(KC_S), LCTL_T(KC_T), KC_G, KC_M, RCTL_T(KC_N), RSFT_T(KC_E), LALT_T(KC_I), RGUI_T(KC_O), KC_QUOT, + KC_TRNS, KC_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, KC_MINS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS +), + +[_HRWIDECOLEMAK] = LAYOUT_planck_grid( + KC_Q, KC_W, LT(_NUM,KC_F), KC_P, KC_B, KC_SVU_BU, KC_J, KC_L, LT(_FN,KC_U), KC_Y, KC_SCLN, KC_LBRC, + LGUI_T(KC_A), LALT_T(KC_R), LSFT_T(KC_S), LCTL_T(KC_T), KC_G, TD(TD_MPLY_MNXT_MPRV), KC_M, RCTL_T(KC_N), RSFT_T(KC_E), LALT_T(KC_I), RGUI_T(KC_O), KC_QUOT, + KC_Z, KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, KC_MINS, + TG(_MOUSE), LT(_NUM,KC_TAB), LCTL_T(KC_ESC), OSM(MOD_LSFT), LT(_LOWER, KC_BSPC), LT(_NAV2,KC_ENT), LT(_NAV2,KC_ENT), LT(_RAISE, KC_SPC), RCTL_T(KC_TAB), RGUI_T(KC_LALT), KC_LEFT, KC_RIGHT +), + +[_GAMING] = LAYOUT_planck_grid( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, GAMING, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_QUOT, + KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_Z, KC_M, KC_SCLN, KC_SFTENT, + KC_LCTL, KC_NUBS, KC_B, KC_X, KC_C, KC_SPC, KC_SPC, KC_LALT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS +), + +[_LOWER] = LAYOUT_planck_grid( + KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_TILD, KC_CIRC, KC_AMPR, KC_ASTR, TD(TD_PRN), KC_RPRN, KC_DEL, + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_DEL, KC_UNDS, KC_PLUS, TD(TD_CBR), KC_RCBR, KC_PIPE, + KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, LSFT(KC_NUHS), LSFT(KC_BSLS), KC_JYEN, KC_EQL, KC_TRNS, + TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_DEL, KC_VOLD, KC_VOLU, KC_MPLY +), + +[_RAISE] = LAYOUT_planck_grid( + KC_1, KC_2, KC_3, KC_4, KC_5, KC_GRV, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_DEL, KC_MINS, KC_EQL, TD(TD_BRC), KC_RBRC,KC_BSLS, + KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, KC_NUHS, KC_COMM, KC_DOT, KC_SLSH, KC_TRNS, + TG(_MOUSE), KC_TRNS, KC_BSPC, KC_DEL, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY +), + +[_ADJUST] = LAYOUT_planck_grid( + LALT(KC_LSFT), RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_INS, + LALT(KC_GRV), EEP_RST, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, COLEMAK, HRCOLEMAK, WIDECOLEMAK, HRWIDECOLEMAK, GAMING, + KC_TRNS, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, KC_NO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS +), + +[_NAV] = LAYOUT_planck_grid( + LALT(KC_LSFT), KC_NO, LCTL(KC_RGHT), KC_MS_U, LCTL(KC_V), LCTL(KC_LEFT), LCTL(KC_V), KC_RIGHT, KC_PGUP, LCTL(KC_C), KC_NO, KC_NO, + LALT(KC_GRV), KC_HOME, KC_MS_L, KC_MS_D, KC_MS_R, KC_BTN1, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_END, VIM_O, + KC_TRNS, KC_NO, LCTL(KC_X), LCTL(KC_X), KC_BTN2, VIM_V, KC_NO, KC_PGDN, TG(_NAV), KC_NO, LCTL(KC_F), KC_TRNS, + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRNS, KC_TRNS, KC_NO, KC_NO, KC_TRNS, KC_NO, KC_NO +), + +[_NAV2] = LAYOUT_planck_grid( + KC_TAB, LCTL(KC_RGHT), LALT(KC_LSFT), LALT(KC_GRV), LCTL(KC_LEFT), KC_BRIU, KC_CAPS, KC_RIGHT, KC_PGUP, LCTL(KC_C), KC_NO, KC_BSPC, + OSM(MOD_LGUI), OSM(MOD_LALT), OSM(MOD_LSFT), OSM(MOD_LCTL), KC_TAB, KC_MUTE, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_END, VIM_O, + KC_TRNS, KC_NO, LALT(KC_LSFT), TD(TD_ESC_CAPS), VIM_V, KC_BRID, KC_HOME, KC_PGDN, KC_NO, KC_NO, LCTL(KC_F), KC_TRNS, + KC_NO, KC_NO, KC_NO, KC_TRNS, KC_DEL, LT(_NAV2,KC_ENT), LT(_NAV2,KC_ENT), KC_NO, KC_NO, KC_TRNS, KC_NO, KC_NO +), + +[_NUM] = LAYOUT_planck_grid( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NLCK, KC_P7, KC_P8, KC_P9, KC_PMNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PAST, KC_P4, KC_P5, KC_P6, KC_PPLS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P1, KC_P2, KC_P3, KC_PSLS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P0, KC_PDOT, KC_PCMM, KC_PEQL, KC_TRNS +), + +[_MEDIA] = LAYOUT_planck_grid( + LALT(KC_LSFT), KC_NO, KC_NO, KC_NO, KC_NO, KC_BRID, KC_BRIU, KC_MUTE, KC_MPLY, KC_NO, KC_NO, KC_NO, + LALT(KC_GRV), KC_NO, KC_NO, KC_BRID, KC_BRIU, KC_NO, KC_MPRV, KC_VOLD, KC_VOLU, KC_MNXT, KC_NO, 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 +), + +[_MOUSE] = LAYOUT_planck_grid( + KC_NO, KC_NO, KC_BTN4, KC_BTN5, KC_NO, KC_NO, KC_NO, KC_WH_U, KC_MS_U, KC_WH_U, KC_NO, KC_NO, + KC_NO, KC_NO, KC_BTN3, KC_BTN2, KC_BTN1, 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_WH_D, KC_NO, KC_NO, KC_NO, KC_NO, + TG(_MOUSE), KC_NO, KC_NO, KC_TRNS, KC_NO, KC_ACL2, KC_ACL2, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO +), + +[_FN] = LAYOUT_planck_grid( + KC_NO, KC_F1, KC_F2, KC_F3, KC_F4, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_NO, KC_F5, KC_F6, KC_F7, KC_F8, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_NO, KC_F9,KC_F10,KC_F11,KC_F12, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_NO, KC_NO, KC_TRNS, KC_NO, KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO +) +}; + + +// define the tap dance functions +void dance_prn(qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + tap_code16(KC_LPRN); + } else { + tap_code16(KC_LPRN); + tap_code16(KC_RPRN); + tap_code(KC_LEFT); + } +} +void dance_brc(qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + tap_code(KC_LBRC); + } else { + tap_code(KC_LBRC); + tap_code(KC_RBRC); + tap_code(KC_LEFT); + } +} +void dance_cbr(qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + tap_code16(KC_LCBR); + } else { + tap_code16(KC_LCBR); + tap_code16(KC_RCBR); + tap_code(KC_LEFT); + } +} +void dance_mply_mnxt_mprv(qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + tap_code(KC_MPLY); + } if (state->count == 2) { + tap_code(KC_MNXT); + } else { + tap_code(KC_MPRV); + } +} + +qk_tap_dance_action_t tap_dance_actions[] = { + // declare tap dance actions here + [TD_PRN] = ACTION_TAP_DANCE_FN(dance_prn), + [TD_BRC] = ACTION_TAP_DANCE_FN(dance_brc), + [TD_CBR] = ACTION_TAP_DANCE_FN(dance_cbr), + [TD_ESC_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_ESC, KC_CAPS), + [TD_QUO_BRC] = ACTION_TAP_DANCE_DOUBLE(KC_QUOT, KC_LBRC), + [TD_COMM_SLSH] = ACTION_TAP_DANCE_DOUBLE(KC_COMMA, KC_SLSH), + [TD_MPLY_MNXT_MPRV] = ACTION_TAP_DANCE_FN(dance_mply_mnxt_mprv) +}; + +// TD(TD_ESC_CAPS), LGUI_T(KC_A), LALT_T(KC_R), LSFT_T(KC_S), LCTL_T(KC_T), KC_G, KC_M, RCTL_T(KC_N), RSFT_T(KC_E), LALT_T(KC_I), RGUI_T(KC_O), KC_TRNS, +// define the per_key_tapping_term +uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case TD(TD_ESC_CAPS): + return TAPPING_TERM * 1.5; + case LGUI_T(KC_A): + return TAPPING_TERM * 1.4; + case RGUI(KC_O): + return TAPPING_TERM * 1.45; + case LALT_T(KC_R): + return TAPPING_TERM * 1.3; + case LALT_T(KC_I): + return TAPPING_TERM * 1.35; + case LCTL_T(KC_T): + return TAPPING_TERM * 1.1; + case LCTL_T(KC_N): + return TAPPING_TERM * 1.1; + case LSFT_T(KC_S): + return TAPPING_TERM * 1.0; + case RSFT_T(KC_E): + return TAPPING_TERM * 1.0; + case LT(_NUM, KC_F): + return TAPPING_TERM * 1.2; + case LT(_FN, KC_U): + return TAPPING_TERM * 1.2; + case TD(TD_QUO_BRC): + return TAPPING_TERM * 1.2; + default: + return TAPPING_TERM; + } +} + +#ifdef AUDIO_ENABLE + float plover_song[][2] = SONG(PLOVER_SOUND); + float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND); +#endif + + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case COLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_COLEMAK); + } + return false; + break; + case WIDECOLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_WIDECOLEMAK); + } + return false; + break; + case HRCOLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_HRCOLEMAK); + } + return false; + break; + case HRWIDECOLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_HRWIDECOLEMAK); + } + return false; + break; + case GAMING: + if (record->event.pressed) { + layer_invert(_GAMING); + } + return false; + break; + case VIM_O: + if (record->event.pressed) { + tap_code(KC_END); + tap_code(KC_ENT); + } + return false; + break; + case VIM_V: + if (record->event.pressed) { + if (get_mods() & MOD_BIT(KC_LSFT)) { + unregister_code(KC_LSFT); + } else { + register_code(KC_LSFT); + } + } + return false; + break; + case KC_SVU_BU: // increase backlight when pressing shift and vol up + if (record->event.pressed) { + if (get_mods() & MOD_BIT(KC_LSFT) || get_mods() & MOD_BIT(KC_RSFT)) { + register_code(KC_BRIU); + } else { + register_code(KC_VOLU); + } + } else { + unregister_code(KC_BRIU); + unregister_code(KC_VOLU); + } + return false; + case KC_SVD_BD: // increase backlight when pressing shift and vol up + if (record->event.pressed) { + if (get_mods() & MOD_BIT(KC_LSFT) || get_mods() & MOD_BIT(KC_RSFT)) { + register_code(KC_BRID); + } else { + register_code(KC_VOLD); + } + } else { + unregister_code(KC_BRID); + unregister_code(KC_VOLD); + } + return false; + case BACKLIT: + if (record->event.pressed) { + register_code(KC_RSFT); + #ifdef BACKLIGHT_ENABLE + backlight_step(); + #endif + #ifdef KEYBOARD_planck_rev5 + writePinLow(E6); + #endif + } else { + unregister_code(KC_RSFT); + #ifdef KEYBOARD_planck_rev5 + writePinHigh(E6); + #endif + } + 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(); + keymap_config.nkro = 1; + eeconfig_update_keymap(keymap_config.raw); + } + return false; + break; + case EXT_PLV: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_SONG(plover_gb_song); + #endif + layer_off(_PLOVER); + } + return false; + break; + } + return true; +} + +bool muse_mode = false; +uint8_t last_muse_note = 0; +uint16_t muse_counter = 0; +uint8_t muse_offset = 70; +uint16_t muse_tempo = 50; + +bool encoder_update(bool clockwise) { + 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 (clockwise) { + #ifdef MOUSEKEY_ENABLE + tap_code(KC_MS_WH_DOWN); + #else + tap_code(KC_PGDN); + #endif + } else { + #ifdef MOUSEKEY_ENABLE + tap_code(KC_MS_WH_UP); + #else + tap_code(KC_PGUP); + #endif + } + } + return true; +} + +void dip_switch_update_user(uint8_t index, bool active) { + switch (index) { + case 0: { +#ifdef AUDIO_ENABLE + static bool play_sound = false; +#endif + if (active) { +#ifdef AUDIO_ENABLE + if (play_sound) { PLAY_SONG(plover_song); } +#endif + layer_on(_ADJUST); + } else { +#ifdef AUDIO_ENABLE + if (play_sound) { PLAY_SONG(plover_gb_song); } +#endif + layer_off(_ADJUST); + } +#ifdef AUDIO_ENABLE + play_sound = true; +#endif + break; + } + case 1: + if (active) { + muse_mode = true; + } else { + muse_mode = false; + } + } +} + +void matrix_scan_user(void) { +#ifdef AUDIO_ENABLE + if (muse_mode) { + if (muse_counter == 0) { + uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()]; + if (muse_note != last_muse_note) { + stop_note(compute_freq_for_midi_note(last_muse_note)); + play_note(compute_freq_for_midi_note(muse_note), 0xF); + last_muse_note = muse_note; + } + } + muse_counter = (muse_counter + 1) % muse_tempo; + } else { + if (muse_counter) { + stop_all_notes(); + muse_counter = 0; + } + } +#endif +} + +bool music_mask_user(uint16_t keycode) { + switch (keycode) { + case RAISE: + case LOWER: + return false; + default: + return true; + } +} + +bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case LSFT_T(KC_S): + return true; + case RSFT_T(KC_E): + return true; + case LSFT_T(KC_D): + return true; + case RSFT_T(KC_K): + return true; + default: + return false; + } +} + +// Set RGB to change with layer changes +#define HSV_DARKORANGE 10, 255, 255 +#define HSV_DARKPINK 150, 100, 255 + +// Light LEDs 1 to 9 in goldenrod when COLEMAK is active +const rgblight_segment_t PROGMEM my_layer0_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {1, 10, HSV_GOLDENROD} +); +// Light LEDs 1 to 9 in white when WIDECOLEMAK is active +const rgblight_segment_t PROGMEM my_layer1_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {1, 10, HSV_WHITE} +); +// Light LEDs 1 to 9 in darkorange when HRCOLEMAK is active +const rgblight_segment_t PROGMEM my_layer2_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {1, 10, HSV_DARKORANGE} +); +// Light LEDs 1 to 9 in green when HRWIDECOLEMAK is active +const rgblight_segment_t PROGMEM my_layer3_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {1, 10, HSV_GREEN} +); +// Light LEDs 1 to 9 in green when HRWIDECOLEMAK is active +const rgblight_segment_t PROGMEM my_nav_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {1, 10, HSV_GREEN} +); +// Light LEDs 1 to 9 in red when GAMING layer is active +const rgblight_segment_t PROGMEM my_layer4_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {1, 10, HSV_RED} +); +// Light bottom LEDs in purple when ADJUST layer is active +const rgblight_segment_t PROGMEM my_layer5_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {1, 2, HSV_PURPLE}, + {7, 2, HSV_PURPLE} +); +// Light bottom LEDs in red when caps lock is active. Hard to ignore! +const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {1, 2, HSV_DARKPINK}, + {7, 2, HSV_DARKPINK} +); + +// Now define the array of layers. Later layers take precedence +const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST( + my_layer0_layer, // colemak + my_layer1_layer, // widecolemak + my_layer2_layer, // hrcolemak + my_layer3_layer, // hrwidecolemak + my_layer4_layer, // gaming + my_layer5_layer, // adjust + my_capslock_layer, // capslock + my_nav_layer // nav +); + +void keyboard_post_init_user(void) { + // Enable the LED layers + rgblight_layers = my_rgb_layers; +} + +bool led_update_user(led_t led_state) { + rgblight_set_layer_state(6, led_state.caps_lock); + return true; +} + +layer_state_t layer_state_set_user(layer_state_t state) { + state = update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); + rgblight_set_layer_state(5, layer_state_cmp(state, _ADJUST)); + rgblight_set_layer_state(4, layer_state_cmp(state, _GAMING)); + rgblight_set_layer_state(7, layer_state_cmp(state, _NAV)); + return state; +} + +layer_state_t default_layer_state_set_user(layer_state_t state) { + rgblight_set_layer_state(0, layer_state_cmp(state, _COLEMAK)); + rgblight_set_layer_state(1, layer_state_cmp(state, _WIDECOLEMAK)); + rgblight_set_layer_state(2, layer_state_cmp(state, _HRCOLEMAK)); + rgblight_set_layer_state(3, layer_state_cmp(state, _HRWIDECOLEMAK)); + return state; +} diff --git a/keyboards/planck/keymaps/jweickm/keymap_narrow.c b/keyboards/planck/keymaps/jweickm/keymap_narrow.c new file mode 100644 index 000000000000..0d686c6a5414 --- /dev/null +++ b/keyboards/planck/keymaps/jweickm/keymap_narrow.c @@ -0,0 +1,572 @@ +/* Copyright 2015-2017 Jack Humbert + * Copyright 2021 Jakob Weickmann + * + * 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 . + */ +#include QMK_KEYBOARD_H +#include "muse.h" +#include "quantum.h" + +enum planck_layers { + _QWERTY, + _COLEMAK, + _WIDECOLEMAK, + _HRCOLEMAK, + _HRWIDECOLEMAK, + _GAMING, + _LOWER, + _RAISE, + _ADJUST, + _NAV, + _NAV2, + _NUM, + _FN, + _MEDIA, + _MOUSE, + _PLOVER +}; + +enum planck_keycodes { + QWERTY = SAFE_RANGE, + COLEMAK, + PLOVER, + BACKLIT, + EXT_PLV, + WIDECOLEMAK, + HRCOLEMAK, + HRWIDECOLEMAK, + GAMING, + VIM_O, + VIM_V +}; + +// Tap Dance declarations +enum { + TD_PRN, // round brackets (parentheses) + TD_BRC, // square brackets + TD_CBR, // curly brackets + TD_ESC_CAPS, // double tap for caps lock + TD_QUO_BRC, // double function on quotes to enable typing ü in german layout + TD_COMM_SLSH // comma that doubles as a slash +}; + +#define LOWER MO(_LOWER) +#define RAISE MO(_RAISE) + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* Qwerty + * ,-----------------------------------------------------------------------------------. + * |_NUM(Tab)| Q | W | E | R | T | Y | U | I | O | P | Bksp | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |CTL(Esc)| A | S | D | F | G | H | J | K | L | ; | " | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_QWERTY] = LAYOUT_planck_grid( + LT(_NUM,KC_TAB), KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, + LCTL_T(KC_ESC), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, TD(TD_QUO_BRC), + OSM(MOD_LSFT), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, RSFT_T(KC_ENT), + LCTL_T(KC_CAPS), RALT_T(KC_APP), LGUI_T(KC_TAB), LT(_MOUSE, KC_ESC), LT(_LOWER,KC_BSPC), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE,KC_DEL), LT(_MEDIA, KC_ENT), TG(_NAV), RALT_T(KC_UP), CTL_T(KC_CAPS) +), + +[_COLEMAK] = LAYOUT_planck_grid( + KC_TRNS, KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_TRNS, + KC_TRNS, KC_A, KC_R, KC_S, KC_T, KC_G, KC_M, KC_N, KC_E, KC_I, KC_O, KC_TRNS, + KC_TRNS, KC_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS +), + +/* WIDECOLEMAK + * ,-----------------------------------------------------------------------------------. + * |_NUM(Tab)| Q | W | E | R | T | Y | U | I | O | P | Bksp | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |CTL(Esc)| A | S | D | F | G | H | J | K | L | ; | " | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_WIDECOLEMAK] = LAYOUT_planck_grid( + KC_Q, KC_W, KC_F, KC_P, KC_B, KC_LBRC, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_LBRC, + KC_A, KC_R, KC_S, KC_T, KC_G, KC_GRV, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, + KC_Z, KC_X, KC_C, KC_D, KC_V, KC_LPRN, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, KC_MINS, + KC_TRNS, KC_TRNS, LCTL_T(KC_ESC), OSM(MOD_LSFT), LT(_LOWER, KC_BSPC), KC_TRNS, KC_TRNS, LT(_RAISE, KC_TAB), RCTL_T(KC_SPC), RSFT_T(KC_ENT), KC_LEFT, KC_RIGHT +), + +[_HRCOLEMAK] = LAYOUT_planck_grid( + KC_TRNS, KC_Q, KC_W, LT(_NUM, KC_F), KC_P, KC_B, KC_J, KC_L, LT(_FN, KC_U), KC_Y, KC_SCLN, KC_LBRC, + TD(TD_ESC_CAPS), LGUI_T(KC_A), LALT_T(KC_R), LSFT_T(KC_S), LCTL_T(KC_T), KC_G, KC_M, RCTL_T(KC_N), RSFT_T(KC_E), LALT_T(KC_I), RGUI_T(KC_O), KC_QUOT, + KC_TRNS, KC_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, KC_MINS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS +), + +[_HRWIDECOLEMAK] = LAYOUT_planck_grid( + KC_Q, KC_W, KC_F, KC_P, KC_B, KC_LBRC, KC_RBRC, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, + LGUI_T(KC_A), LALT_T(KC_R), LSFT_T(KC_S), LCTL_T(KC_T), KC_G, KC_GRV, KC_QUOT, KC_M, RCTL_T(KC_N), RSFT_T(KC_E), RALT_T(KC_I), RGUI_T(KC_O), + KC_Z, KC_X, KC_C, KC_D, KC_V, KC_LPRN, KC_RPRN, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, + KC_TRNS, KC_TRNS, LCTL_T(KC_ESC), OSM(MOD_LSFT), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, LSFT_T(KC_SPC), LCTL_T(KC_TAB), KC_TRNS, HRCOLEMAK +), + +[_GAMING] = LAYOUT_planck_grid( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, GAMING, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_QUOT, + KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_Z, KC_M, KC_SCLN, KC_SFTENT, + KC_LCTL, KC_NUBS, KC_B, KC_X, KC_C, KC_SPC, KC_SPC, KC_LALT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS +), + +[_LOWER] = LAYOUT_planck_grid( + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, TD(TD_PRN), KC_RPRN, KC_DEL, + KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, TD(TD_CBR), KC_RCBR, KC_PIPE, + KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, LSFT(KC_NUHS), LSFT(KC_BSLS), KC_JYEN, KC_EQL, KC_TRNS, + TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY +), + +[_RAISE] = LAYOUT_planck_grid( + 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, TD(TD_BRC), KC_RBRC,KC_BSLS, + KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_COMM, KC_DOT, KC_SLSH, KC_TRNS, + TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY +), + +[_ADJUST] = LAYOUT_planck_grid( + LALT(KC_LSFT), RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_INS, + LALT(KC_GRV), EEP_RST, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, WIDECOLEMAK, HRWIDECOLEMAK, GAMING, + KC_TRNS, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, KC_NO, HRCOLEMAK, KC_TRNS, TERM_OFF, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS +), + +[_NAV] = LAYOUT_planck_grid( + LALT(KC_LSFT), KC_NO, LCTL(KC_RGHT), KC_MS_U, LCTL(KC_V), LCTL(KC_LEFT), LCTL(KC_V), KC_RIGHT, KC_PGUP, LCTL(KC_C), KC_NO, KC_NO, + LALT(KC_GRV), KC_HOME, KC_MS_L, KC_MS_D, KC_MS_R, KC_BTN1, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_END, VIM_O, + MO(_NAV2), KC_NO, LCTL(KC_X), LCTL(KC_X), KC_BTN2, VIM_V, KC_NO, KC_PGDN, TG(_NAV), KC_NO, LCTL(KC_F), KC_TRNS, + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRNS, KC_TRNS, KC_NO, KC_NO, KC_TRNS, KC_NO, KC_NO +), + +[_NAV2] = LAYOUT_planck_grid( + 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_HOME, KC_PGDN, KC_PGUP, KC_END, KC_NO, KC_NO, + 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 +), + +[_NUM] = LAYOUT_planck_grid( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NLCK, KC_P7, KC_P8, KC_P9, KC_PMNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PAST, KC_P4, KC_P5, KC_P6, KC_PPLS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P1, KC_P2, KC_P3, KC_PSLS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P0, KC_PDOT, KC_PCMM, KC_PEQL, KC_TRNS +), + +[_MEDIA] = LAYOUT_planck_grid( + LALT(KC_LSFT), KC_NO, KC_NO, KC_NO, KC_NO, KC_BRID, KC_BRIU, KC_MUTE, KC_MPLY, KC_NO, KC_NO, KC_NO, + LALT(KC_GRV), KC_NO, KC_NO, KC_BRID, KC_BRIU, KC_NO, KC_MPRV, KC_VOLD, KC_VOLU, KC_MNXT, KC_NO, 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 +), + +[_MOUSE] = LAYOUT_planck_grid( + KC_NO, KC_NO, KC_BTN4, KC_BTN5, KC_NO, KC_NO, KC_NO, KC_WH_U, KC_MS_U, KC_WH_U, KC_NO, KC_NO, + KC_NO, KC_NO, KC_BTN3, KC_BTN2, KC_BTN1, 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_WH_D, KC_NO, KC_NO, KC_NO, KC_NO, + KC_TRNS, KC_NO, KC_NO, KC_TRNS, KC_NO, KC_ACL2, KC_ACL2, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO +), + +[_FN] = LAYOUT_planck_grid( + KC_NO, KC_F1, KC_F2, KC_F3, KC_F4, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_NO, KC_F5, KC_F6, KC_F7, KC_F8, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_NO, KC_F9,KC_F10,KC_F11,KC_F12, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_NO, KC_NO, KC_TRNS, KC_NO, KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO +) +}; + + +// define the tap dance functions +void dance_prn(qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + tap_code16(KC_LPRN); + } else { + tap_code16(KC_LPRN); + tap_code16(KC_RPRN); + tap_code(KC_LEFT); + } +} +void dance_brc(qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + tap_code(KC_LBRC); + } else { + tap_code(KC_LBRC); + tap_code(KC_RBRC); + tap_code(KC_LEFT); + } +} +void dance_cbr(qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + tap_code16(KC_LCBR); + } else { + tap_code16(KC_LCBR); + tap_code16(KC_RCBR); + tap_code(KC_LEFT); + } +} + +qk_tap_dance_action_t tap_dance_actions[] = { + // declare tap dance actions here + [TD_PRN] = ACTION_TAP_DANCE_FN(dance_prn), + [TD_BRC] = ACTION_TAP_DANCE_FN(dance_brc), + [TD_CBR] = ACTION_TAP_DANCE_FN(dance_cbr), + [TD_ESC_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_ESC, KC_CAPS), + [TD_QUO_BRC] = ACTION_TAP_DANCE_DOUBLE(KC_QUOT, KC_LBRC), + [TD_COMM_SLSH] = ACTION_TAP_DANCE_DOUBLE(KC_COMMA, KC_SLSH) +}; + +// TD(TD_ESC_CAPS), LGUI_T(KC_A), LALT_T(KC_R), LSFT_T(KC_S), LCTL_T(KC_T), KC_G, KC_M, RCTL_T(KC_N), RSFT_T(KC_E), LALT_T(KC_I), RGUI_T(KC_O), KC_TRNS, +// define the per_key_tapping_term +uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case TD(TD_ESC_CAPS): + return TAPPING_TERM * 1.5; + case LGUI_T(KC_A): + return TAPPING_TERM * 1.4; + case RGUI(KC_O): + return TAPPING_TERM * 1.45; + case LALT_T(KC_R): + return TAPPING_TERM * 1.3; + case LALT_T(KC_I): + return TAPPING_TERM * 1.35; + case LCTL_T(KC_T): + return TAPPING_TERM * 1.1; + case LCTL_T(KC_N): + return TAPPING_TERM * 1.1; + case LSFT_T(KC_S): + return TAPPING_TERM * 1.0; + case RSFT_T(KC_E): + return TAPPING_TERM * 1.0; + case LT(_NUM, KC_F): + return TAPPING_TERM * 1.2; + case LT(_FN, KC_U): + return TAPPING_TERM * 1.2; + case TD(TD_QUO_BRC): + return TAPPING_TERM * 1.2; + default: + return TAPPING_TERM; + } +} + +#ifdef AUDIO_ENABLE + float plover_song[][2] = SONG(PLOVER_SOUND); + float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND); +#endif + + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + set_single_persistent_default_layer(_QWERTY); + } + return false; + break; + case COLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_COLEMAK); + } + return false; + break; + case WIDECOLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_WIDECOLEMAK); + } + return false; + break; + case HRCOLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_HRCOLEMAK); + } + return false; + break; + case HRWIDECOLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_HRWIDECOLEMAK); + } + return false; + break; + case GAMING: + if (record->event.pressed) { + layer_invert(_GAMING); + } + return false; + break; + case VIM_O: + if (record->event.pressed) { + tap_code(KC_END); + tap_code(KC_ENT); + } + return false; + break; + case VIM_V: + if (record->event.pressed) { + if (get_mods() & MOD_BIT(KC_LSFT)) { + unregister_code(KC_LSFT); + } else { + register_code(KC_LSFT); + } + } + return false; + break; + case BACKLIT: + if (record->event.pressed) { + register_code(KC_RSFT); + #ifdef BACKLIGHT_ENABLE + backlight_step(); + #endif + #ifdef KEYBOARD_planck_rev5 + writePinLow(E6); + #endif + } else { + unregister_code(KC_RSFT); + #ifdef KEYBOARD_planck_rev5 + writePinHigh(E6); + #endif + } + 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(); + keymap_config.nkro = 1; + eeconfig_update_keymap(keymap_config.raw); + } + return false; + break; + case EXT_PLV: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_SONG(plover_gb_song); + #endif + layer_off(_PLOVER); + } + return false; + break; + } + return true; +} + +bool muse_mode = false; +uint8_t last_muse_note = 0; +uint16_t muse_counter = 0; +uint8_t muse_offset = 70; +uint16_t muse_tempo = 50; + +bool encoder_update(bool clockwise) { + 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 (clockwise) { + #ifdef MOUSEKEY_ENABLE + tap_code(KC_MS_WH_DOWN); + #else + tap_code(KC_PGDN); + #endif + } else { + #ifdef MOUSEKEY_ENABLE + tap_code(KC_MS_WH_UP); + #else + tap_code(KC_PGUP); + #endif + } + } + return true; +} + +void dip_switch_update_user(uint8_t index, bool active) { + switch (index) { + case 0: { +#ifdef AUDIO_ENABLE + static bool play_sound = false; +#endif + if (active) { +#ifdef AUDIO_ENABLE + if (play_sound) { PLAY_SONG(plover_song); } +#endif + layer_on(_ADJUST); + } else { +#ifdef AUDIO_ENABLE + if (play_sound) { PLAY_SONG(plover_gb_song); } +#endif + layer_off(_ADJUST); + } +#ifdef AUDIO_ENABLE + play_sound = true; +#endif + break; + } + case 1: + if (active) { + muse_mode = true; + } else { + muse_mode = false; + } + } +} + +void matrix_scan_user(void) { +#ifdef AUDIO_ENABLE + if (muse_mode) { + if (muse_counter == 0) { + uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()]; + if (muse_note != last_muse_note) { + stop_note(compute_freq_for_midi_note(last_muse_note)); + play_note(compute_freq_for_midi_note(muse_note), 0xF); + last_muse_note = muse_note; + } + } + muse_counter = (muse_counter + 1) % muse_tempo; + } else { + if (muse_counter) { + stop_all_notes(); + muse_counter = 0; + } + } +#endif +} + +bool music_mask_user(uint16_t keycode) { + switch (keycode) { + case RAISE: + case LOWER: + return false; + default: + return true; + } +} + +bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case LSFT_T(KC_S): + return true; + case RSFT_T(KC_E): + return true; + case LSFT_T(KC_D): + return true; + case RSFT_T(KC_K): + return true; + default: + return false; + } +} + +// Set RGB to change with layer changes +#define HSV_DARKORANGE 10, 255, 255 +#define HSV_DARKPINK 150, 100, 255 + +// Light LEDs 1 to 9 in goldenrod when COLEMAK is active +const rgblight_segment_t PROGMEM my_layer0_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {1, 10, HSV_GOLDENROD} +); +// Light LEDs 1 to 9 in white when WIDECOLEMAK is active +const rgblight_segment_t PROGMEM my_layer1_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {1, 10, HSV_WHITE} +); +// Light LEDs 1 to 9 in darkorange when HRCOLEMAK is active +const rgblight_segment_t PROGMEM my_layer2_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {1, 10, HSV_DARKORANGE} +); +// Light LEDs 1 to 9 in green when HRWIDECOLEMAK is active +const rgblight_segment_t PROGMEM my_layer3_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {1, 10, HSV_GREEN} +); +// Light LEDs 1 to 9 in green when HRWIDECOLEMAK is active +const rgblight_segment_t PROGMEM my_nav_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {1, 10, HSV_GREEN} +); +// Light LEDs 1 to 9 in red when GAMING layer is active +const rgblight_segment_t PROGMEM my_layer4_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {1, 10, HSV_RED} +); +// Light bottom LEDs in purple when ADJUST layer is active +const rgblight_segment_t PROGMEM my_layer5_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {1, 2, HSV_PURPLE}, + {7, 2, HSV_PURPLE} +); +// Light bottom LEDs in red when caps lock is active. Hard to ignore! +const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {1, 2, HSV_DARKPINK}, + {7, 2, HSV_DARKPINK} +); + +// Now define the array of layers. Later layers take precedence +const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST( + my_layer0_layer, // colemak + my_layer1_layer, // widecolemak + my_layer2_layer, // hrcolemak + my_layer3_layer, // hrwidecolemak + my_layer4_layer, // gaming + my_layer5_layer, // adjust + my_capslock_layer, // capslock + my_nav_layer // nav +); + +void keyboard_post_init_user(void) { + // Enable the LED layers + rgblight_layers = my_rgb_layers; +} + +bool led_update_user(led_t led_state) { + rgblight_set_layer_state(6, led_state.caps_lock); + return true; +} + +layer_state_t layer_state_set_user(layer_state_t state) { + state = update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); + rgblight_set_layer_state(5, layer_state_cmp(state, _ADJUST)); + rgblight_set_layer_state(4, layer_state_cmp(state, _GAMING)); + rgblight_set_layer_state(7, layer_state_cmp(state, _NAV)); + return state; +} + +layer_state_t default_layer_state_set_user(layer_state_t state) { + rgblight_set_layer_state(0, layer_state_cmp(state, _COLEMAK)); + rgblight_set_layer_state(1, layer_state_cmp(state, _WIDECOLEMAK)); + rgblight_set_layer_state(2, layer_state_cmp(state, _HRCOLEMAK)); + rgblight_set_layer_state(3, layer_state_cmp(state, _HRWIDECOLEMAK)); + return state; +} diff --git a/keyboards/planck/keymaps/jweickm/keymap_qwerty.c b/keyboards/planck/keymaps/jweickm/keymap_qwerty.c new file mode 100644 index 000000000000..608f6f27aa76 --- /dev/null +++ b/keyboards/planck/keymaps/jweickm/keymap_qwerty.c @@ -0,0 +1,479 @@ +/* Copyright 2015-2017 Jack Humbert + * Copyright 2021 Jakob Weickmann + * + * 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 . + */ +#include QMK_KEYBOARD_H +#include "muse.h" +#include "quantum.h" + +enum planck_layers { + _QWERTY, + _COLEMAK, + _DVORAK, + _WIDEQWERTY, + _WIDECOLEMAK, + _HRQWERTY, + _HRCOLEMAK, + _GAMING, + _LOWER, + _RAISE, + _ADJUST, + _NAV, + _NAV2, + _NUM, + _MEDIA, + _MOUSE, + _PLOVER +}; + +enum planck_keycodes { + QWERTY = SAFE_RANGE, + COLEMAK, + DVORAK, + PLOVER, + BACKLIT, + EXT_PLV, + WIDECOLEMAK, + WIDEQWERTY, + HRQWERTY, + HRCOLEMAK, + GAMING +}; + +#define LOWER MO(_LOWER) +#define RAISE MO(_RAISE) + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* Qwerty + * ,-----------------------------------------------------------------------------------. + * |_NUM(Tab)| Q | W | E | R | T | Y | U | I | O | P | Bksp | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |CTL(Esc)| A | S | D | F | G | H | J | K | L | ; | " | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_QWERTY] = LAYOUT_planck_grid( + LT(_NUM,KC_TAB), KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, + LCTL_T(KC_ESC), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, RSFT_T(KC_QUOT), + OSM(MOD_LSFT), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, RSFT_T(KC_ENT), + LCTL_T(KC_CAPS), RALT_T(KC_APP), KC_LGUI, KC_LALT, LT(_LOWER,KC_BSPC), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE,KC_DEL), RCTL_T(KC_LEFT), LT(_MEDIA,KC_DOWN), RALT_T(KC_UP), RCTL_T(KC_RGHT) +), + +[_COLEMAK] = LAYOUT_planck_grid( + KC_TRNS, KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_TRNS, + KC_TRNS, KC_A, KC_R, KC_S, KC_T, KC_G, KC_M, KC_N, KC_E, KC_I, KC_O, KC_TRNS, + KC_TRNS, KC_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS +), + +[_WIDEQWERTY] = LAYOUT_planck_grid( + KC_Q, KC_W, KC_E, KC_R, KC_T, KC_LBRC, KC_RBRC, KC_Y, KC_U, KC_I, KC_O, KC_P, + LGUI_T(KC_A), LALT_T(KC_S), LCTL_T(KC_D), LSFT_T(KC_F), KC_G, KC_GRV, KC_QUOT, KC_H, RSFT_T(KC_J), RCTL_T(KC_K), RALT_T(KC_L), RGUI_T(KC_SCLN), + KC_Z, KC_X, KC_C, KC_V, KC_B, KC_LPRN, KC_RPRN, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, + KC_TRNS, KC_TRNS, LCTL_T(KC_ESC), OSM(MOD_LSFT), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, LSFT_T(KC_SPC), LCTL_T(KC_TAB), KC_TRNS, KC_TRNS +), + +[_WIDECOLEMAK] = LAYOUT_planck_grid( + KC_Q, KC_W, KC_F, KC_P, KC_B, KC_LBRC, KC_RBRC, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, + LGUI_T(KC_A), LALT_T(KC_R), LSFT_T(KC_S), LCTL_T(KC_T), KC_G, KC_GRV, KC_QUOT, KC_M, RCTL_T(KC_N), RSFT_T(KC_E), RALT_T(KC_I), RGUI_T(KC_O), + KC_Z, KC_X, KC_C, KC_D, KC_V, KC_LPRN, KC_RPRN, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, + KC_TRNS, KC_TRNS, LCTL_T(KC_ESC), OSM(MOD_LSFT), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, LSFT_T(KC_SPC), LCTL_T(KC_TAB), KC_TRNS, KC_TRNS +), + +[_HRQWERTY] = LAYOUT_planck_grid( + KC_TRNS, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_TRNS, + KC_TRNS, LGUI_T(KC_A), LALT_T(KC_S), LSFT_T(KC_D), LCTL_T(KC_F), KC_G, KC_H, RCTL_T(KC_J), RSFT_T(KC_K), LALT_T(KC_L), RGUI_T(KC_SCLN), KC_TRNS, + KC_TRNS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS +), + +[_HRCOLEMAK] = LAYOUT_planck_grid( + KC_TRNS, KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_TRNS, + KC_TRNS, LGUI_T(KC_A), LALT_T(KC_R), LSFT_T(KC_S), LCTL_T(KC_T), KC_G, KC_M, RCTL_T(KC_N), RSFT_T(KC_E), LALT_T(KC_I), RGUI_T(KC_O), KC_TRNS, + KC_TRNS, KC_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS +), + +[_GAMING] = LAYOUT_planck_grid( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, GAMING, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_QUOT, + KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_Z, KC_M, KC_SCLN, KC_SFTENT, + KC_LCTL, KC_NUBS, KC_B, KC_X, KC_C, KC_SPC, KC_SPC, KC_LALT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS +), + +[_LOWER] = LAYOUT_planck_grid( + 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_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_NUHS), LSFT(KC_BSLS), KC_JYEN, KC_EQL, KC_TRNS, + TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY +), + +[_RAISE] = LAYOUT_planck_grid( + 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_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_COMM, KC_DOT, KC_SLSH, KC_TRNS, + TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY +), + +[_ADJUST] = LAYOUT_planck_grid( + LALT(KC_LSFT), RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_INS, + LALT(KC_GRV), EEP_RST, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, WIDEQWERTY, WIDECOLEMAK, GAMING, + KC_TRNS, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, HRQWERTY, HRCOLEMAK, TERM_ON, TERM_OFF, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS +), + +[_NAV] = LAYOUT_planck_grid( + LALT(KC_LSFT), KC_NO, LCTL(KC_RGHT), LCTL(KC_RGHT), LCTL(KC_Y), KC_NO, LCTL(KC_C), LCTL(KC_Z), KC_PGUP, KC_NO, LCTL(KC_V), KC_NO, + LALT(KC_GRV), KC_NO, KC_NO, LCTL(KC_X), KC_NO, KC_NO, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_NO, KC_NO, + MO(_NAV2), KC_NO, LCTL(KC_X), LCTL(KC_X), KC_NO, LCTL(KC_LEFT), KC_NO, KC_PGDN, KC_NO, KC_NO, LCTL(KC_F), 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 +), + +[_NAV2] = LAYOUT_planck_grid( + 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_HOME, KC_PGDN, KC_PGUP, KC_END, KC_NO, KC_NO, + 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 +), + +[_NUM] = LAYOUT_planck_grid( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NLCK, KC_P7, KC_P8, KC_P9, KC_PMNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PAST, KC_P4, KC_P5, KC_P6, KC_PPLS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P1, KC_P2, KC_P3, KC_PSLS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P0, KC_PDOT, KC_PCMM, KC_PEQL, KC_TRNS +), + +[_MEDIA] = LAYOUT_planck_grid( + LALT(KC_LSFT), KC_NO, KC_NO, KC_NO, KC_NO, KC_BRID, KC_BRIU, KC_MUTE, KC_MPLY, KC_NO, KC_NO, KC_NO, + LALT(KC_GRV), KC_NO, KC_NO, KC_BRID, KC_BRIU, KC_NO, KC_MPRV, KC_VOLD, KC_VOLU, KC_MNXT, KC_NO, 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 +), + +[_MOUSE] = LAYOUT_planck_grid( + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_WH_U, KC_NO, KC_NO, KC_NO, + KC_NO, KC_NO, KC_BTN3, KC_BTN2, KC_BTN1, KC_NO, KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R, KC_NO, KC_NO, + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_WH_D, KC_NO, KC_NO, KC_NO, + KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_ACL2, KC_ACL2, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO +) +}; + + +qk_tap_dance_action_t tap_dance_actions[] = { + // declare tap dance actions here +}; + +#ifdef AUDIO_ENABLE + float plover_song[][2] = SONG(PLOVER_SOUND); + float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND); +#endif + +layer_state_t layer_state_set_user(layer_state_t state) { + state = update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); + rgblight_set_layer_state(6, layer_state_cmp(state, _ADJUST)); + rgblight_set_layer_state(5, layer_state_cmp(state, _GAMING)); + return state; +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + set_single_persistent_default_layer(_QWERTY); + } + return false; + break; + case COLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_COLEMAK); + } + return false; + break; + case WIDEQWERTY: + if (record->event.pressed) { + set_single_persistent_default_layer(_WIDEQWERTY); + } + return false; + break; + case WIDECOLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_WIDECOLEMAK); + } + return false; + break; + case HRQWERTY: + if (record->event.pressed) { + set_single_persistent_default_layer(_HRQWERTY); + } + return false; + break; + case HRCOLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_HRCOLEMAK); + } + return false; + break; + case DVORAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_DVORAK); + } + return false; + break; + case GAMING: + if (record->event.pressed) { + layer_invert(_GAMING); + } + return false; + break; + case BACKLIT: + if (record->event.pressed) { + register_code(KC_RSFT); + #ifdef BACKLIGHT_ENABLE + backlight_step(); + #endif + #ifdef KEYBOARD_planck_rev5 + writePinLow(E6); + #endif + } else { + unregister_code(KC_RSFT); + #ifdef KEYBOARD_planck_rev5 + writePinHigh(E6); + #endif + } + 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(); + keymap_config.nkro = 1; + eeconfig_update_keymap(keymap_config.raw); + } + return false; + break; + case EXT_PLV: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_SONG(plover_gb_song); + #endif + layer_off(_PLOVER); + } + return false; + break; + } + return true; +} + +bool muse_mode = false; +uint8_t last_muse_note = 0; +uint16_t muse_counter = 0; +uint8_t muse_offset = 70; +uint16_t muse_tempo = 50; + +bool encoder_update(bool clockwise) { + 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 (clockwise) { + #ifdef MOUSEKEY_ENABLE + tap_code(KC_MS_WH_DOWN); + #else + tap_code(KC_PGDN); + #endif + } else { + #ifdef MOUSEKEY_ENABLE + tap_code(KC_MS_WH_UP); + #else + tap_code(KC_PGUP); + #endif + } + } + return true; +} + +void dip_switch_update_user(uint8_t index, bool active) { + switch (index) { + case 0: { +#ifdef AUDIO_ENABLE + static bool play_sound = false; +#endif + if (active) { +#ifdef AUDIO_ENABLE + if (play_sound) { PLAY_SONG(plover_song); } +#endif + layer_on(_ADJUST); + } else { +#ifdef AUDIO_ENABLE + if (play_sound) { PLAY_SONG(plover_gb_song); } +#endif + layer_off(_ADJUST); + } +#ifdef AUDIO_ENABLE + play_sound = true; +#endif + break; + } + case 1: + if (active) { + muse_mode = true; + } else { + muse_mode = false; + } + } +} + +void matrix_scan_user(void) { +#ifdef AUDIO_ENABLE + if (muse_mode) { + if (muse_counter == 0) { + uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()]; + if (muse_note != last_muse_note) { + stop_note(compute_freq_for_midi_note(last_muse_note)); + play_note(compute_freq_for_midi_note(muse_note), 0xF); + last_muse_note = muse_note; + } + } + muse_counter = (muse_counter + 1) % muse_tempo; + } else { + if (muse_counter) { + stop_all_notes(); + muse_counter = 0; + } + } +#endif +} + +bool music_mask_user(uint16_t keycode) { + switch (keycode) { + case RAISE: + case LOWER: + return false; + default: + return true; + } +} + +bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case LSFT_T(KC_S): + return true; + case RSFT_T(KC_E): + return true; + case LSFT_T(KC_D): + return true; + case RSFT_T(KC_K): + return true; + default: + return false; + } +} + +// Set RGB to change with layer changes +#define HSV_DARKORANGE 10, 255, 255 +#define HSV_DARKPINK 150, 100, 255 + +// Light LEDs 1 to 9 in goldenrod when COLEMAK is active +const rgblight_segment_t PROGMEM my_layer0_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {1, 9, HSV_GOLDENROD} +); +// Light LEDs 1 to 9 in orange when WIDEQWERTY is active +const rgblight_segment_t PROGMEM my_layer1_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {1, 9, HSV_CYAN} +); +// Light LEDs 1 to 9 in yellow when WIDECOLEMAK is active +const rgblight_segment_t PROGMEM my_layer2_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {1, 9, HSV_WHITE} +); +// Light LEDs 1 to 9 in red when HRQWERTY is active +const rgblight_segment_t PROGMEM my_layer3_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {1, 9, HSV_GREEN} +); +// Light LEDs 1 to 9 in red when HRCOLEMAK is active +const rgblight_segment_t PROGMEM my_layer4_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {1, 9, HSV_DARKORANGE} +); +// Light LEDs 1 to 9 in red when GAMING layer is active +const rgblight_segment_t PROGMEM my_layer5_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {1, 9, HSV_RED} +); +// Light bottom LEDs in purple when ADJUST layer is active +const rgblight_segment_t PROGMEM my_layer6_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {1, 2, HSV_PURPLE}, + {7, 2, HSV_PURPLE} +); +// Light bottom LEDs in red when caps lock is active. Hard to ignore! +const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {1, 2, HSV_DARKPINK}, + {7, 2, HSV_DARKPINK} +); + +// Now define the array of layers. Later layers take precedence +const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST( + my_layer0_layer, // colemak + my_layer1_layer, // wideqwerty + my_layer2_layer, // widecolemak + my_layer3_layer, // hrqwerty + my_layer4_layer, // hrcolemak + my_layer5_layer, // gaming + my_layer6_layer, // adjust + my_capslock_layer +); + +void keyboard_post_init_user(void) { + // Enable the LED layers + rgblight_layers = my_rgb_layers; +} + +bool led_update_user(led_t led_state) { + rgblight_set_layer_state(7, led_state.caps_lock); + return true; +} + +layer_state_t default_layer_state_set_user(layer_state_t state) { + rgblight_set_layer_state(0, layer_state_cmp(state, _COLEMAK)); + rgblight_set_layer_state(1, layer_state_cmp(state, _WIDEQWERTY)); + rgblight_set_layer_state(2, layer_state_cmp(state, _WIDECOLEMAK)); + rgblight_set_layer_state(3, layer_state_cmp(state, _HRQWERTY)); + rgblight_set_layer_state(4, layer_state_cmp(state, _HRCOLEMAK)); + return state; +} + diff --git a/keyboards/planck/keymaps/jweickm/keymap_triple_tap.c b/keyboards/planck/keymaps/jweickm/keymap_triple_tap.c new file mode 100644 index 000000000000..94b06e30c510 --- /dev/null +++ b/keyboards/planck/keymaps/jweickm/keymap_triple_tap.c @@ -0,0 +1,731 @@ +/* Copyright 2015-2017 Jack Humbert + * Copyright 2021 Jakob Weickmann + * + * 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 . + */ +#include QMK_KEYBOARD_H +#include "muse.h" +#include "quantum.h" + +// for advanced tap dance actions +typedef enum { + TD_NONE, + TD_UNKNOWN, + TD_SINGLE_TAP, + TD_SINGLE_HOLD, + TD_DOUBLE_TAP, + TD_DOUBLE_HOLD, + TD_DOUBLE_SINGLE_TAP, // Send two single taps + TD_TRIPLE_TAP, + TD_TRIPLE_HOLD +} td_state_t; +typedef struct { + bool is_press_action; + td_state_t state; +} td_tap_t; + +enum planck_layers { + _COLEMAK, + _WIDECOLEMAK, + _HRCOLEMAK, + _HRWIDECOLEMAK, + _GAMING, + _LOWER, + _RAISE, + _LOWER2, + _RAISE2, + _ADJUST, + _NAV, + _NAV2, + _NUM, + _MEDIA, + _MOUSE, + _PLOVER +}; + +enum planck_keycodes { + COLEMAK = SAFE_RANGE, + PLOVER, + BACKLIT, + EXT_PLV, + WIDECOLEMAK, + HRCOLEMAK, + HRWIDECOLEMAK, + GAMING, + VIM_O, + VIM_V, + KC_SVD_BD, + KC_SVU_BU, + ALT_TAB +}; + +// Tap Dance declarations +enum tap_dance_codes{ + TD_PRN, // round brackets (parentheses) + TD_BRC, // square brackets + TD_CBR, // curly brackets + TD_ESC_CAPS, // double tap for caps lock + TD_QUO_BRC, // double function on quotes to enable typing ü in german layout + TD_COMM_SLSH, // comma that doubles as a slash + TD_MPLY, // play/pause, double for next, triple for previous song + TD_Q_TAB // double tap q to register tab +}; + +#define LOWER MO(_LOWER) +#define RAISE MO(_RAISE) + +// also for tap dance +td_state_t cur_dance(qk_tap_dance_state_t *state); + +// For the mply tap dance. Put it here so it can be used in any keymap +void mply_finished(qk_tap_dance_state_t *state, void *user_data); +void mply_reset(qk_tap_dance_state_t *state, void *user_data); + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +[_COLEMAK] = LAYOUT_planck_grid( + LT(_NUM,KC_TAB), KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, + LCTL_T(KC_ESC), KC_A, KC_R, KC_S, KC_T, KC_G, KC_M, KC_N, KC_E, KC_I, KC_O, TD(TD_QUO_BRC), + OSM(MOD_LSFT), KC_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, RSFT_T(KC_ENT), + LCTL_T(KC_CAPS), RALT_T(KC_APP), LGUI_T(KC_TAB), LT(_MOUSE, KC_ESC), LT(_LOWER,KC_BSPC), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE,KC_DEL), LT(_MEDIA, KC_ENT), TG(_NAV), RALT_T(KC_UP), CTL_T(KC_CAPS) +), + +/* WIDECOLEMAK + * ,-----------------------------------------------------------------------------------. + * |_NUM(Tab)| Q | W | E | R | T | Y | U | I | O | P | Bksp | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |CTL(Esc)| A | S | D | F | G | H | J | K | L | ; | " | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_WIDECOLEMAK] = LAYOUT_planck_grid( + TD(TD_Q_TAB), KC_W, KC_F, KC_P, KC_B, KC_SVU_BU, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_LBRC, + KC_A, KC_R, KC_S, KC_T, KC_G, TD(TD_MPLY), KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, + KC_Z, KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, KC_MINS, + KC_CAPS, LT(_NUM,KC_TAB), LGUI_T(KC_ESC), LT(_LOWER2, KC_BSPC), OSM(MOD_LSFT), LT(_NAV2,KC_SPC), LT(_NAV2,KC_SPC), LT(_RAISE2, KC_DEL), RCTL_T(KC_ENT), KC_LALT, KC_LEFT, KC_RIGHT +), + +[_HRCOLEMAK] = LAYOUT_planck_grid( + KC_TRNS, LGUI_T(KC_Q), LALT_T(KC_W), LT(_NUM, KC_F), KC_P, KC_B, KC_J, KC_L, LT(_NUM,KC_U), LALT_T(KC_Y), RGUI_T(KC_SCLN), KC_LBRC, + TD(TD_ESC_CAPS), KC_A, KC_R, LSFT_T(KC_S), LCTL_T(KC_T), KC_G, KC_M, RCTL_T(KC_N), RSFT_T(KC_E), KC_I, KC_O, KC_QUOT, + KC_TRNS, KC_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, KC_MINS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS +), + +[_HRWIDECOLEMAK] = LAYOUT_planck_grid( + LGUI_T(KC_Q), LALT_T(KC_W), LT(_NUM,KC_F), KC_P, KC_B, KC_SVU_BU, KC_J, KC_L, LT(_NUM,KC_U), LALT_T(KC_Y), RGUI_T(KC_SCLN), KC_LBRC, + KC_A, KC_R, LSFT_T(KC_S), LCTL_T(KC_T), KC_G, TD(TD_MPLY), KC_M, RCTL_T(KC_N), RSFT_T(KC_E), KC_I, KC_O, KC_QUOT, + KC_Z, KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, KC_MINS, + KC_CAPS, LT(_NUM,KC_TAB), LGUI_T(KC_ESC), LT(_LOWER2, KC_BSPC), OSM(MOD_LSFT), LT(_NAV2,KC_SPC), LT(_NAV2,KC_SPC), LT(_RAISE2, KC_DEL), RCTL_T(KC_ENT), KC_LALT, KC_LEFT, KC_RIGHT +), + +[_GAMING] = LAYOUT_planck_grid( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, GAMING, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_QUOT, + KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_Z, KC_M, KC_SCLN, KC_SFTENT, + KC_LCTL, KC_NUBS, KC_B, KC_X, KC_C, KC_SPC, KC_SPC, KC_LALT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS +), + +[_LOWER] = LAYOUT_planck_grid( + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, TD(TD_PRN), KC_RPRN, KC_DEL, + KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, TD(TD_CBR), KC_RCBR, KC_PIPE, + KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, LSFT(KC_NUHS), LSFT(KC_BSLS), KC_JYEN, KC_EQL, KC_TRNS, + TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_DEL, KC_VOLD, KC_VOLU, KC_MPLY +), + +[_RAISE] = LAYOUT_planck_grid( + 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, TD(TD_BRC), KC_RBRC,KC_BSLS, + KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_COMM, KC_DOT, KC_SLSH, KC_TRNS, + TG(_MOUSE), KC_TRNS, KC_BSPC, KC_DEL, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY +), + +[_LOWER2] = LAYOUT_planck_grid( + KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_TILD, KC_CIRC, KC_AMPR, KC_ASTR, TD(TD_PRN), KC_RPRN, KC_DEL, + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_DEL, KC_UNDS, KC_PLUS, TD(TD_CBR), KC_RCBR, KC_PIPE, + KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, LSFT(KC_NUHS), LSFT(KC_BSLS), KC_JYEN, KC_EQL, KC_TRNS, + TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_DEL, KC_VOLD, KC_VOLU, KC_MPLY +), + +[_RAISE2] = LAYOUT_planck_grid( + KC_1, KC_2, KC_3, KC_4, KC_5, KC_GRV, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_DEL, KC_MINS, KC_EQL, TD(TD_BRC), KC_RBRC,KC_BSLS, + KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, KC_NUHS, KC_COMM, KC_DOT, KC_SLSH, KC_TRNS, + TG(_MOUSE), KC_TRNS, KC_BSPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY +), + +[_ADJUST] = LAYOUT_planck_grid( + LALT(KC_LSFT), RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_INS, + LALT(KC_GRV), EEP_RST, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, COLEMAK, HRCOLEMAK, WIDECOLEMAK, HRWIDECOLEMAK, GAMING, + KC_TRNS, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, KC_SVD_BD, KC_MPLY, KC_SVU_BU, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS +), + +[_NAV] = LAYOUT_planck_grid( + LALT(KC_LSFT), KC_NO, LCTL(KC_RGHT), KC_MS_U, LCTL(KC_V), LCTL(KC_LEFT), LCTL(KC_V), KC_RIGHT, KC_PGUP, LCTL(KC_C), KC_NO, KC_NO, + LALT(KC_GRV), KC_HOME, KC_MS_L, KC_MS_D, KC_MS_R, KC_BTN1, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_END, VIM_O, + KC_TRNS, KC_NO, LCTL(KC_X), LCTL(KC_X), KC_BTN2, VIM_V, KC_NO, KC_PGDN, TG(_NAV), KC_NO, LCTL(KC_F), KC_TRNS, + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRNS, KC_TRNS, KC_NO, KC_NO, KC_TRNS, KC_NO, KC_NO +), + +[_NAV2] = LAYOUT_planck_grid( + ALT_TAB, LCTL(KC_RGHT), LALT(KC_LSFT), LALT(KC_GRV), LCTL(KC_LEFT), KC_BRIU, KC_CAPS, KC_RIGHT, KC_PGUP, LCTL(KC_C), KC_NO, KC_BSPC, + OSM(MOD_LGUI), OSM(MOD_LALT), OSM(MOD_LSFT), OSM(MOD_LCTL), KC_TAB, KC_MUTE, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_END, VIM_O, + KC_TRNS, KC_NO, LCTL(KC_X), TD(TD_ESC_CAPS), VIM_V, KC_BRID, KC_HOME, KC_PGDN, KC_NO, KC_NO, LCTL(KC_F), KC_TRNS, + KC_NO, KC_NO, KC_NO, KC_TRNS, KC_TAB, LT(_NAV2,KC_SPC), LT(_NAV2,KC_SPC), KC_NO, KC_NO, KC_TRNS, KC_NO, KC_NO +), + +[_NUM] = LAYOUT_planck_grid( + KC_TAB, KC_F1, LT(_NUM,KC_F2), LT(_NUM,KC_F3), KC_F4, KC_TRNS, KC_NLCK, KC_P7, LT(_NUM,KC_P8), KC_P9, KC_PMNS, KC_TRNS, + KC_TRNS, KC_F5, KC_F6, KC_F7, KC_F8, KC_TRNS, KC_PAST, KC_P4, KC_P5, KC_P6, KC_PPLS, KC_TRNS, + KC_TRNS, KC_F9,KC_F10,KC_F11,KC_F12, KC_TRNS, KC_TRNS, KC_P1, KC_P2, KC_P3, KC_PSLS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P0, KC_DOT, KC_COMM, KC_EQL, KC_TRNS +), + +[_MEDIA] = LAYOUT_planck_grid( + LALT(KC_LSFT), KC_NO, KC_NO, KC_NO, KC_NO, KC_BRID, KC_BRIU, KC_MUTE, KC_MPLY, KC_NO, KC_NO, KC_NO, + LALT(KC_GRV), KC_NO, KC_NO, KC_BRID, KC_BRIU, KC_NO, KC_MPRV, KC_VOLD, KC_VOLU, KC_MNXT, KC_NO, 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 +), + +[_MOUSE] = LAYOUT_planck_grid( + KC_NO, KC_NO, KC_BTN4, KC_BTN5, KC_NO, KC_NO, KC_NO, KC_WH_U, KC_MS_U, KC_WH_U, KC_NO, KC_NO, + KC_NO, KC_NO, KC_BTN3, KC_BTN2, KC_BTN1, 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_WH_D, KC_NO, KC_NO, KC_NO, KC_NO, + TG(_MOUSE), KC_NO, KC_NO, KC_TRNS, KC_NO, KC_ACL2, KC_ACL2, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO +) + +}; + + +// define the tap dance functions +void dance_prn(qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + tap_code16(KC_LPRN); + } else { + tap_code16(KC_LPRN); + tap_code16(KC_RPRN); + tap_code(KC_LEFT); + } +} +void dance_brc(qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + tap_code(KC_LBRC); + } else { + tap_code(KC_LBRC); + tap_code(KC_RBRC); + tap_code(KC_LEFT); + } +} +void dance_cbr(qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + tap_code16(KC_LCBR); + } else { + tap_code16(KC_LCBR); + tap_code16(KC_RCBR); + tap_code(KC_LEFT); + } +} + +qk_tap_dance_action_t tap_dance_actions[] = { + // declare tap dance actions here + [TD_PRN] = ACTION_TAP_DANCE_FN(dance_prn), + [TD_BRC] = ACTION_TAP_DANCE_FN(dance_brc), + [TD_CBR] = ACTION_TAP_DANCE_FN(dance_cbr), + [TD_MPLY] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, mply_finished, mply_reset), + [TD_ESC_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_ESC, KC_CAPS), + [TD_QUO_BRC] = ACTION_TAP_DANCE_DOUBLE(KC_QUOT, KC_LBRC), + [TD_COMM_SLSH] = ACTION_TAP_DANCE_DOUBLE(KC_COMMA, KC_SLSH), + [TD_Q_TAB] = ACTION_TAP_DANCE_DOUBLE(KC_Q, KC_TAB) +}; + +// TD(TD_ESC_CAPS), LGUI_T(KC_A), LALT_T(KC_R), LSFT_T(KC_S), LCTL_T(KC_T), KC_G, KC_M, RCTL_T(KC_N), RSFT_T(KC_E), LALT_T(KC_I), RGUI_T(KC_O), KC_TRNS, +// define the per_key_tapping_term +uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case TD(TD_ESC_CAPS): + return TAPPING_TERM * 1.5; + case LGUI_T(KC_A): + return TAPPING_TERM * 1.4; + case LGUI_T(KC_Q): + return TAPPING_TERM * 1.3; + case RGUI_T(KC_O): + return TAPPING_TERM * 1.45; + case RGUI_T(KC_SCLN): + return TAPPING_TERM * 1.3; + case LALT_T(KC_R): + return TAPPING_TERM * 1.3; + case LALT_T(KC_W): + return TAPPING_TERM * 1.3; + case LALT_T(KC_I): + return TAPPING_TERM * 1.35; + case LALT_T(KC_Y): + return TAPPING_TERM * 1.3; + case LCTL_T(KC_T): + return TAPPING_TERM * 1.1; + case LCTL_T(KC_N): + return TAPPING_TERM * 1.1; + case LSFT_T(KC_S): + return TAPPING_TERM * 1.0; + case RSFT_T(KC_E): + return TAPPING_TERM * 1.0; + case LT(_NUM, KC_F): + return TAPPING_TERM * 1.2; + case LT(_NUM, KC_U): + return TAPPING_TERM * 1.2; + case LT(_NUM, KC_F3): + return TAPPING_TERM * 1.2; + case LT(_NUM, KC_F2): + return TAPPING_TERM * 1.2; + case LT(_NUM, KC_P8): + return TAPPING_TERM * 1.2; + case TD(TD_QUO_BRC): + return TAPPING_TERM * 1.2; + case TD(TD_Q_TAB): + return TAPPING_TERM * 1.2; + default: + return TAPPING_TERM; + } +} + +#ifdef AUDIO_ENABLE + float plover_song[][2] = SONG(PLOVER_SOUND); + float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND); +#endif + +// alt tab function setup +bool is_alt_tab_active = false; +uint16_t alt_tab_timer = 0; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case COLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_COLEMAK); + } + return false; + break; + case WIDECOLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_WIDECOLEMAK); + } + return false; + break; + case HRCOLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_HRCOLEMAK); + } + return false; + break; + case HRWIDECOLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_HRWIDECOLEMAK); + } + return false; + break; + case GAMING: + if (record->event.pressed) { + layer_invert(_GAMING); + } + return false; + break; + case VIM_O: + if (record->event.pressed) { + tap_code(KC_END); + tap_code(KC_ENT); + } + return false; + break; + case VIM_V: + if (record->event.pressed) { + if (get_mods() & MOD_BIT(KC_LSFT)) { + unregister_code(KC_LSFT); + } else { + register_code(KC_LSFT); + } + } + return false; + break; + case KC_SVU_BU: // increase backlight when pressing shift and vol up + if (record->event.pressed) { + if (get_mods() & MOD_BIT(KC_LSFT) || get_mods() & MOD_BIT(KC_RSFT)) { + register_code(KC_BRIU); + } else { + register_code(KC_VOLU); + } + } else { + unregister_code(KC_BRIU); + unregister_code(KC_VOLU); + } + return false; + case KC_SVD_BD: // increase backlight when pressing shift and vol up + if (record->event.pressed) { + if (get_mods() & MOD_BIT(KC_LSFT) || get_mods() & MOD_BIT(KC_RSFT)) { + register_code(KC_BRID); + } else { + register_code(KC_VOLD); + } + } else { + unregister_code(KC_BRID); + unregister_code(KC_VOLD); + } + return false; + case ALT_TAB: + if (record->event.pressed) { + if (!is_alt_tab_active) { + is_alt_tab_active = true; + register_code(KC_LALT); + } + alt_tab_timer = timer_read(); + register_code(KC_TAB); + } else { + unregister_code(KC_TAB); + } + break; + case BACKLIT: + if (record->event.pressed) { + register_code(KC_RSFT); + #ifdef BACKLIGHT_ENABLE + backlight_step(); + #endif + #ifdef KEYBOARD_planck_rev5 + writePinLow(E6); + #endif + } else { + unregister_code(KC_RSFT); + #ifdef KEYBOARD_planck_rev5 + writePinHigh(E6); + #endif + } + 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(); + keymap_config.nkro = 1; + eeconfig_update_keymap(keymap_config.raw); + } + return false; + break; + case EXT_PLV: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_SONG(plover_gb_song); + #endif + layer_off(_PLOVER); + } + return false; + break; + } + return true; +} + +bool muse_mode = false; +uint8_t last_muse_note = 0; +uint16_t muse_counter = 0; +uint8_t muse_offset = 70; +uint16_t muse_tempo = 50; + +bool encoder_update(bool clockwise) { + 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 (clockwise) { + #ifdef MOUSEKEY_ENABLE + tap_code(KC_MS_WH_DOWN); + #else + tap_code(KC_PGDN); + #endif + } else { + #ifdef MOUSEKEY_ENABLE + tap_code(KC_MS_WH_UP); + #else + tap_code(KC_PGUP); + #endif + } + } + return true; +} + +void dip_switch_update_user(uint8_t index, bool active) { + switch (index) { + case 0: { +#ifdef AUDIO_ENABLE + static bool play_sound = false; +#endif + if (active) { +#ifdef AUDIO_ENABLE + if (play_sound) { PLAY_SONG(plover_song); } +#endif + layer_on(_ADJUST); + } else { +#ifdef AUDIO_ENABLE + if (play_sound) { PLAY_SONG(plover_gb_song); } +#endif + layer_off(_ADJUST); + } +#ifdef AUDIO_ENABLE + play_sound = true; +#endif + break; + } + case 1: + if (active) { + muse_mode = true; + } else { + muse_mode = false; + } + } +} + +void matrix_scan_user(void) { + if (is_alt_tab_active) { + if (timer_elapsed(alt_tab_timer) > 600) { + unregister_code(KC_LALT); + is_alt_tab_active = false; + } + } + #ifdef AUDIO_ENABLE + if (muse_mode) { + if (muse_counter == 0) { + uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()]; + if (muse_note != last_muse_note) { + stop_note(compute_freq_for_midi_note(last_muse_note)); + play_note(compute_freq_for_midi_note(muse_note), 0xF); + last_muse_note = muse_note; + } + } + muse_counter = (muse_counter + 1) % muse_tempo; + } else { + if (muse_counter) { + stop_all_notes(); + muse_counter = 0; + } + } +#endif +} + +bool music_mask_user(uint16_t keycode) { + switch (keycode) { + case RAISE: + case LOWER: + return false; + default: + return true; + } +} + +bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case LSFT_T(KC_S): + return true; + case RSFT_T(KC_E): + return true; + case LSFT_T(KC_D): + return true; + case RSFT_T(KC_K): + return true; + default: + return false; + } +} + +// Set RGB to change with layer changes +#define HSV_DARKORANGE 10, 255, 255 +#define HSV_DARKPINK 150, 100, 255 + +// Light LEDs 1 to 9 in goldenrod when COLEMAK is active +const rgblight_segment_t PROGMEM my_layer0_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {1, 10, HSV_GOLDENROD} +); +// Light LEDs 1 to 9 in white when WIDECOLEMAK is active +const rgblight_segment_t PROGMEM my_layer1_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {1, 10, HSV_WHITE} +); +// Light LEDs 1 to 9 in darkorange when HRCOLEMAK is active +const rgblight_segment_t PROGMEM my_layer2_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {1, 10, HSV_DARKORANGE} +); +// Light LEDs 1 to 9 in green when HRWIDECOLEMAK is active +const rgblight_segment_t PROGMEM my_layer3_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {1, 10, HSV_GREEN} +); +// Light LEDs 1 to 9 in green when HRWIDECOLEMAK is active +const rgblight_segment_t PROGMEM my_nav_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {1, 10, HSV_GREEN} +); +// Light LEDs 1 to 9 in red when GAMING layer is active +const rgblight_segment_t PROGMEM my_layer4_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {1, 10, HSV_RED} +); +// Light bottom LEDs in purple when ADJUST layer is active +const rgblight_segment_t PROGMEM my_layer5_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {1, 2, HSV_PURPLE}, + {7, 2, HSV_PURPLE} +); +// Light bottom LEDs in red when caps lock is active. Hard to ignore! +const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {1, 2, HSV_DARKPINK}, + {7, 2, HSV_DARKPINK} +); + +// Now define the array of layers. Later layers take precedence +const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST( + my_layer0_layer, // colemak + my_layer1_layer, // widecolemak + my_layer2_layer, // hrcolemak + my_layer3_layer, // hrwidecolemak + my_layer4_layer, // gaming + my_layer5_layer, // adjust + my_capslock_layer, // capslock + my_nav_layer // nav +); + +void keyboard_post_init_user(void) { + // Enable the LED layers + rgblight_layers = my_rgb_layers; +} + +bool led_update_user(led_t led_state) { + rgblight_set_layer_state(6, led_state.caps_lock); + return true; +} + +layer_state_t layer_state_set_user(layer_state_t state) { + if ( + ( layer_state_cmp(state, _LOWER) && layer_state_cmp(state, _RAISE ) ) || + ( layer_state_cmp(state, _LOWER2) && layer_state_cmp(state, _RAISE2 ) ) ) { + return state | (1UL<<_ADJUST); + } else { + return state & ~(1UL<<_ADJUST); + } + //state = update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); + rgblight_set_layer_state(5, layer_state_cmp(state, _ADJUST)); + rgblight_set_layer_state(4, layer_state_cmp(state, _GAMING)); + rgblight_set_layer_state(7, layer_state_cmp(state, _NAV)); + return state; +} + +layer_state_t default_layer_state_set_user(layer_state_t state) { + rgblight_set_layer_state(0, layer_state_cmp(state, _COLEMAK)); + rgblight_set_layer_state(1, layer_state_cmp(state, _WIDECOLEMAK)); + rgblight_set_layer_state(2, layer_state_cmp(state, _HRCOLEMAK)); + rgblight_set_layer_state(3, layer_state_cmp(state, _HRWIDECOLEMAK)); + return state; +} + +/* Return an integer that corresponds to what kind of tap dance should be executed. + * + * How to figure out tap dance state: interrupted and pressed. + * + * Interrupted: If the state of a dance dance is "interrupted", that means that another key has been hit + * under the tapping term. This is typically indicitive that you are trying to "tap" the key. + * + * Pressed: Whether or not the key is still being pressed. If this value is true, that means the tapping term + * has ended, but the key is still being pressed down. This generally means the key is being "held". + * + * One thing that is currenlty not possible with qmk software in regards to tap dance is to mimic the "permissive hold" + * feature. In general, advanced tap dances do not work well if they are used with commonly typed letters. + * For example "A". Tap dances are best used on non-letter keys that are not hit while typing letters. + * + * Good places to put an advanced tap dance: + * z,q,x,j,k,v,b, any function key, home/end, comma, semi-colon + * + * Criteria for "good placement" of a tap dance key: + * Not a key that is hit frequently in a sentence + * Not a key that is used frequently to double tap, for example 'tab' is often double tapped in a terminal, or + * in a web form. So 'tab' would be a poor choice for a tap dance. + * Letters used in common words as a double. For example 'p' in 'pepper'. If a tap dance function existed on the + * letter 'p', the word 'pepper' would be quite frustating to type. + * + * For the third point, there does exist the 'TD_DOUBLE_SINGLE_TAP', however this is not fully tested + * + */ +td_state_t cur_dance(qk_tap_dance_state_t *state) { + if (state->count == 1) { + if (state->interrupted || !state->pressed) return TD_SINGLE_TAP; + // Key has not been interrupted, but the key is still held. Means you want to send a 'HOLD'. + else return TD_SINGLE_HOLD; + } else if (state->count == 2) { + // TD_DOUBLE_SINGLE_TAP is to distinguish between typing "pepper", and actually wanting a double tap + // action when hitting 'pp'. Suggested use case for this return value is when you want to send two + // keystrokes of the key, and not the 'double tap' action/macro. + if (state->interrupted) return TD_DOUBLE_SINGLE_TAP; + else if (state->pressed) return TD_DOUBLE_HOLD; + else return TD_DOUBLE_TAP; + } + + // Assumes no one is trying to type the same letter three times (at least not quickly). + // If your tap dance key is 'KC_W', and you want to type "www." quickly - then you will need to add + // an exception here to return a 'TD_TRIPLE_SINGLE_TAP', and define that enum just like 'TD_DOUBLE_SINGLE_TAP' + if (state->count == 3) { + if (state->interrupted || !state->pressed) return TD_TRIPLE_TAP; + else return TD_TRIPLE_HOLD; + } else return TD_UNKNOWN; +} + +// Create an instance of 'td_tap_t' for the 'mply' tap dance. +static td_tap_t mplytap_state = { + .is_press_action = true, + .state = TD_NONE +}; + +void mply_finished(qk_tap_dance_state_t *state, void *user_data) { + mplytap_state.state = cur_dance(state); + switch (mplytap_state.state) { + case TD_SINGLE_TAP: register_code16(KC_MPLY); break; + case TD_SINGLE_HOLD: register_code16(KC_MUTE); break; + case TD_DOUBLE_TAP: register_code16(KC_MNXT); break; + case TD_TRIPLE_TAP: register_code16(KC_MPRV); break; + default: break; + } +} + +void mply_reset(qk_tap_dance_state_t *state, void *user_data) { + switch (mplytap_state.state) { + case TD_SINGLE_TAP: unregister_code16(KC_MPLY); break; + case TD_SINGLE_HOLD: unregister_code16(KC_MUTE); break; + case TD_DOUBLE_TAP: unregister_code16(KC_MNXT); break; + case TD_TRIPLE_TAP: unregister_code16(KC_MPRV); break; + default: break; + } + mplytap_state.state = TD_NONE; +} diff --git a/keyboards/planck/keymaps/jweickm/keymap_unicode.c b/keyboards/planck/keymaps/jweickm/keymap_unicode.c new file mode 100644 index 000000000000..3c95cf4fb397 --- /dev/null +++ b/keyboards/planck/keymaps/jweickm/keymap_unicode.c @@ -0,0 +1,425 @@ +/* Copyright 2015-2017 Jack Humbert + * Copyright 2021 Jakob Weickmann + * + * 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 . + */ +#include QMK_KEYBOARD_H +#include "muse.h" + +enum planck_layers { + _QWERTY, + _COLEMAK, + _DVORAK, + _WIDEQWERTY, + _WIDECOLEMAK, + _HRQWERTY, + _HRCOLEMAK, + _GAMING, + _LOWER, + _RAISE, + _ADJUST, + _NAV, + _NAV2, + _NUM, + _MEDIA, + _MOUSE, + _PLOVER +}; + +enum planck_keycodes { + QWERTY = SAFE_RANGE, + COLEMAK, + DVORAK, + PLOVER, + BACKLIT, + EXT_PLV, + WIDECOLEMAK, + WIDEQWERTY +}; + +enum unicode_names { + KC_DE_EUR, + KC_DE_AE, + KC_DE_ae, + KC_DE_OE, + KC_DE_oe, + KC_DE_UE, + KC_DE_ue, + KC_DE_SZ +}; + +const uint32_t PROGMEM unicode_map[] = { + [KC_DE_EUR] = 0x20AC, // € + [KC_DE_AE] = 0x00C4, // Ä + [KC_DE_ae] = 0x00E4, // ä + [KC_DE_OE] = 0x00D6, // Ö + [KC_DE_oe] = 0x00F6, // ö + [KC_DE_UE] = 0x00DC, // Ü + [KC_DE_ue] = 0x00FC, // ü + [KC_DE_SZ] = 0x00DF, // ß +}; + +#define LOWER MO(_LOWER) +#define RAISE MO(_RAISE) + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* Qwerty + * ,-----------------------------------------------------------------------------------. + * |_NUM(Tab)| Q | W | E | R | T | Y | U | I | O | P | Bksp | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |CTL(Esc)| A | S | D | F | G | H | J | K | L | ; | " | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_QWERTY] = LAYOUT_planck_grid( + LT(_NUM,KC_TAB), KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, + LCTL_T(KC_ESC), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, RSFT_T(KC_QUOT), + OSM(MOD_LSFT), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_SFTENT, + LCTL_T(KC_CAPS), RALT_T(KC_APP), KC_LGUI, KC_LALT, LT(_LOWER,KC_BSPC), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE,KC_DEL), RCTL_T(KC_LEFT), LT(_MEDIA,KC_DOWN), RALT_T(KC_UP), RCTL_T(KC_RGHT) +), + + +[_COLEMAK] = LAYOUT_planck_grid( + KC_TRNS, KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_TRNS, + KC_TRNS, KC_A, KC_R, KC_S, KC_T, KC_G, KC_M, KC_N, KC_E, KC_I, KC_O, KC_TRNS, + KC_TRNS, KC_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS +), + +[_WIDEQWERTY] = LAYOUT_planck_grid( + KC_Q, KC_W, KC_E, KC_R, KC_T, KC_LBRC, KC_RBRC, KC_Y, KC_U, KC_I, KC_O, KC_P, + LGUI_T(KC_A), LALT_T(KC_S), LCTL_T(KC_D), LSFT_T(KC_F), KC_G, KC_GRV, KC_QUOT, KC_H, RSFT_T(KC_J), RCTL_T(KC_K), RALT_T(KC_L), RGUI_T(KC_SCLN), + KC_Z, KC_X, KC_C, KC_V, KC_B, KC_LPRN, KC_RPRN, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, + KC_TRNS, KC_TRNS, LCTL_T(KC_ESC), OSM(MOD_LSFT), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, LSFT_T(KC_SPC), LCTL_T(KC_TAB), KC_TRNS, KC_TRNS +), + +[_WIDECOLEMAK] = LAYOUT_planck_grid( + KC_Q, KC_W, KC_F, KC_P, KC_B, KC_LBRC, KC_RBRC, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, + LGUI_T(KC_A), LALT_T(KC_R), LSFT_T(KC_S), LCTL_T(KC_T), KC_G, KC_GRV, KC_QUOT, KC_M, RCTL_T(KC_N), RSFT_T(KC_E), RALT_T(KC_I), RGUI_T(KC_O), + KC_Z, KC_X, KC_C, KC_D, KC_V, KC_LPRN, KC_RPRN, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, + KC_TRNS, KC_TRNS, LCTL_T(KC_ESC), OSM(MOD_LSFT), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, LSFT_T(KC_SPC), LCTL_T(KC_TAB), KC_TRNS, KC_TRNS +), + +[_HRQWERTY] = LAYOUT_planck_grid( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, LGUI_T(KC_A), LALT_T(KC_S), LSFT_T(KC_D), LCTL_T(KC_F), KC_TRNS, KC_TRNS, RCTL_T(KC_J), RSFT_T(KC_K), LALT_T(KC_L), RGUI_T(KC_SCLN), KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS +), + +[_HRCOLEMAK] = LAYOUT_planck_grid( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, LGUI_T(KC_A), LALT_T(KC_R), LSFT_T(KC_S), LCTL_T(KC_T), KC_TRNS, KC_TRNS, RCTL_T(KC_N), RSFT_T(KC_E), LALT_T(KC_I), RGUI_T(KC_O), KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS +), + +[_GAMING] = LAYOUT_planck_grid( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, TG(_GAMING), + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_TRNS, + KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_Z, KC_M, KC_SCLN, KC_QUOT, + KC_LCTL, KC_NUBS, KC_B, KC_X, KC_C, KC_SPC, KC_SPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS +), + +[_LOWER] = LAYOUT_planck_grid( + 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_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_NUHS), LSFT(KC_BSLS), KC_JYEN, KC_EQL, KC_TRNS, + TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY +), + +[_RAISE] = LAYOUT_planck_grid( + 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_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_COMM, KC_DOT, KC_SLSH, KC_TRNS, + TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY +), + +[_ADJUST] = LAYOUT_planck_grid( + LALT(KC_LSFT), RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_INS, + LALT(KC_GRV), EEP_RST, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, WIDEQWERTY, WIDECOLEMAK, TG(_GAMING), + KC_TRNS, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, TG(_HRQWERTY), TG(_HRCOLEMAK), TERM_ON, TERM_OFF, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS +), + +[_NAV] = LAYOUT_planck_grid( + LALT(KC_LSFT), KC_NO, LCTL(KC_RGHT), LCTL(KC_RGHT), LCTL(KC_Y), KC_NO, LCTL(KC_C), LCTL(KC_Z), KC_PGUP, XP(KC_DE_ue,KC_DE_UE), LCTL(KC_V), XP(KC_DE_ue,KC_DE_UE), + LALT(KC_GRV), XP(KC_DE_ae,KC_DE_AE), X(KC_DE_SZ), X(KC_DE_SZ), KC_NO, KC_NO, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, XP(KC_DE_oe, KC_DE_OE), XP(KC_DE_ae, KC_DE_AE), + MO(_NAV2), KC_NO, KC_DEL, LCTL(KC_X), KC_NO, LCTL(KC_LEFT), KC_NO, KC_PGDN, KC_NO, KC_NO, LCTL(KC_F), 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 +), + +[_NAV2] = LAYOUT_planck_grid( + 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_HOME, KC_PGDN, KC_PGUP, KC_END, KC_NO, KC_NO, + 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 +), + +[_NUM] = LAYOUT_planck_grid( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NLCK, KC_P7, KC_P8, KC_P9, KC_PMNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PAST, KC_P4, KC_P5, KC_P6, KC_PPLS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P1, KC_P2, KC_P3, KC_PSLS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P0, KC_PDOT, KC_PCMM, KC_PEQL, KC_TRNS +), + +[_MEDIA] = LAYOUT_planck_grid( + LALT(KC_LSFT), KC_NO, KC_NO, KC_NO, KC_NO, KC_BRID, KC_BRIU, KC_MUTE, KC_MPLY, KC_NO, KC_NO, KC_NO, + LALT(KC_GRV), KC_NO, KC_NO, KC_BRID, KC_BRIU, KC_NO, KC_MPRV, KC_VOLD, KC_VOLU, KC_MNXT, KC_NO, 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 +), + +[_MOUSE] = LAYOUT_planck_grid( + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_WH_U, KC_NO, KC_NO, KC_NO, + KC_NO, KC_NO, KC_BTN3, KC_BTN2, KC_BTN1, KC_NO, KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R, KC_NO, KC_NO, + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_WH_D, KC_NO, KC_NO, KC_NO, + KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_ACL2, KC_ACL2, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO +) +}; + +#ifdef AUDIO_ENABLE + float plover_song[][2] = SONG(PLOVER_SOUND); + float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND); +#endif + +layer_state_t layer_state_set_user(layer_state_t state) { + return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + set_single_persistent_default_layer(_QWERTY); + } + return false; + break; + case COLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_COLEMAK); + } + return false; + break; + case WIDEQWERTY: + if (record->event.pressed) { + set_single_persistent_default_layer(_WIDEQWERTY); + } + return false; + break; + case WIDECOLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_WIDECOLEMAK); + } + return false; + break; + case DVORAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_DVORAK); + } + return false; + break; + case BACKLIT: + if (record->event.pressed) { + register_code(KC_RSFT); + #ifdef BACKLIGHT_ENABLE + backlight_step(); + #endif + #ifdef KEYBOARD_planck_rev5 + writePinLow(E6); + #endif + } else { + unregister_code(KC_RSFT); + #ifdef KEYBOARD_planck_rev5 + writePinHigh(E6); + #endif + } + 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(); + keymap_config.nkro = 1; + eeconfig_update_keymap(keymap_config.raw); + } + return false; + break; + case EXT_PLV: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_SONG(plover_gb_song); + #endif + layer_off(_PLOVER); + } + return false; + break; + } + return true; +} + +bool muse_mode = false; +uint8_t last_muse_note = 0; +uint16_t muse_counter = 0; +uint8_t muse_offset = 70; +uint16_t muse_tempo = 50; + +bool encoder_update(bool clockwise) { + 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 (clockwise) { + #ifdef MOUSEKEY_ENABLE + tap_code(KC_MS_WH_DOWN); + #else + tap_code(KC_PGDN); + #endif + } else { + #ifdef MOUSEKEY_ENABLE + tap_code(KC_MS_WH_UP); + #else + tap_code(KC_PGUP); + #endif + } + } + return true; +} + +void dip_switch_update_user(uint8_t index, bool active) { + switch (index) { + case 0: { +#ifdef AUDIO_ENABLE + static bool play_sound = false; +#endif + if (active) { +#ifdef AUDIO_ENABLE + if (play_sound) { PLAY_SONG(plover_song); } +#endif + layer_on(_ADJUST); + } else { +#ifdef AUDIO_ENABLE + if (play_sound) { PLAY_SONG(plover_gb_song); } +#endif + layer_off(_ADJUST); + } +#ifdef AUDIO_ENABLE + play_sound = true; +#endif + break; + } + case 1: + if (active) { + muse_mode = true; + } else { + muse_mode = false; + } + } +} + +void matrix_scan_user(void) { +#ifdef AUDIO_ENABLE + if (muse_mode) { + if (muse_counter == 0) { + uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()]; + if (muse_note != last_muse_note) { + stop_note(compute_freq_for_midi_note(last_muse_note)); + play_note(compute_freq_for_midi_note(muse_note), 0xF); + last_muse_note = muse_note; + } + } + muse_counter = (muse_counter + 1) % muse_tempo; + } else { + if (muse_counter) { + stop_all_notes(); + muse_counter = 0; + } + } +#endif +} + +bool music_mask_user(uint16_t keycode) { + switch (keycode) { + case RAISE: + case LOWER: + return false; + default: + return true; + } +} + +bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case LT(_HRQWERTY, LGUI_T(KC_A)): + return true; + case LT(_HRQWERTY, LALT_T(KC_S)): + return true; + case LT(_HRQWERTY, LSFT_T(KC_D)): + return true; + case LT(_HRQWERTY, LCTL_T(KC_F)): + return true; + case LT(_HRQWERTY, RCTL_T(KC_J)): + return true; + case LT(_HRQWERTY, RSFT_T(KC_K)): + return true; + case LT(_HRQWERTY, LALT_T(KC_L)): + return true; + case LT(_HRQWERTY, RGUI_T(KC_SCOLON)): + return true; + case LT(_HRCOLEMAK, LGUI_T(KC_A)): + return true; + case LT(_HRCOLEMAK, LALT_T(KC_R)): + return true; + case LT(_HRCOLEMAK, LSFT_T(KC_S)): + return true; + case LT(_HRCOLEMAK, LCTL_T(KC_T)): + return true; + case LT(_HRCOLEMAK, RCTL_T(KC_N)): + return true; + case LT(_HRCOLEMAK, RSFT_T(KC_E)): + return true; + case LT(_HRCOLEMAK, LALT_T(KC_I)): + return true; + case LT(_HRCOLEMAK, RGUI_T(KC_O)): + return true; + default: + return false; + } +} diff --git a/keyboards/planck/keymaps/jweickm/readme.md b/keyboards/planck/keymaps/jweickm/readme.md new file mode 100644 index 000000000000..de9680b49851 --- /dev/null +++ b/keyboards/planck/keymaps/jweickm/readme.md @@ -0,0 +1,2 @@ +# The Default Planck Layout + diff --git a/keyboards/planck/keymaps/jweickm/rules.mk b/keyboards/planck/keymaps/jweickm/rules.mk new file mode 100644 index 000000000000..96e89a0dccc5 --- /dev/null +++ b/keyboards/planck/keymaps/jweickm/rules.mk @@ -0,0 +1,39 @@ +# MCU name +MCU = STM32F303 +BOARD = QMK_PROTON_C + +# Bootloader selection +BOOTLOADER = stm32-dfu + +# Build Options +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration +MOUSEKEY_ENABLE = yes # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +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 +UNICODE_ENABLE = yes # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. +WS2812_DRIVER = pwm +API_SYSEX_ENABLE = no +TAP_DANCE_ENABLE = yes # enable tap dance functionality + +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + +RGB_MATRIX_ENABLE = no +RGB_MATRIX_DRIVER = WS2812 +ENCODER_ENABLE = yes +DIP_SWITCH_ENABLE = yes + +LAYOUTS = ortho_4x12 planck_mit +LAYOUTS_HAS_RGB = no + +SRC += muse.c diff --git a/keyboards/planck/keymaps/jweickm/rules_kopie.mk b/keyboards/planck/keymaps/jweickm/rules_kopie.mk new file mode 100644 index 000000000000..acf0896a321b --- /dev/null +++ b/keyboards/planck/keymaps/jweickm/rules_kopie.mk @@ -0,0 +1 @@ +SRC += muse.c \ No newline at end of file From 39787db522809fa4408c3f6d008ce569f59ac9e2 Mon Sep 17 00:00:00 2001 From: Jakob Weickmann Date: Wed, 8 Sep 2021 20:17:20 +0200 Subject: [PATCH 02/31] fixed my planck again --- .../keymaps/jweickm/config_before_break.h | 201 +++++ .../planck/keymaps/jweickm/keymap-backup.c | 839 ++++++++++++++++++ keyboards/planck/keymaps/jweickm/keymap.c | 22 +- .../planck/keymaps/jweickm/keymap_backup.c | 839 ++++++++++++++++++ .../planck/keymaps/jweickm/keymap_default.c | 353 ++++++++ keyboards/planck/keymaps/jweickm/rules.mk | 2 +- .../keymaps/jweickm/rules_before_break.mk | 39 + .../planck/keymaps/jweickm/rules_default.mk | 1 + 8 files changed, 2277 insertions(+), 19 deletions(-) create mode 100644 keyboards/planck/keymaps/jweickm/config_before_break.h create mode 100644 keyboards/planck/keymaps/jweickm/keymap-backup.c create mode 100644 keyboards/planck/keymaps/jweickm/keymap_backup.c create mode 100644 keyboards/planck/keymaps/jweickm/keymap_default.c create mode 100644 keyboards/planck/keymaps/jweickm/rules_before_break.mk create mode 100644 keyboards/planck/keymaps/jweickm/rules_default.mk diff --git a/keyboards/planck/keymaps/jweickm/config_before_break.h b/keyboards/planck/keymaps/jweickm/config_before_break.h new file mode 100644 index 000000000000..010c4bd17334 --- /dev/null +++ b/keyboards/planck/keymaps/jweickm/config_before_break.h @@ -0,0 +1,201 @@ +#pragma once +/* + * Copyright 2018 Jack Humbert + * + * 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 . + */ + +#ifndef REV6_CONFIG_H +#define REV6_CONFIG_H + +/* USB Device descriptor parameter */ +#define PRODUCT_ID 0xA4F9 +#define DEVICE_VER 0x0006 + +#undef MATRIX_ROWS +#undef MATRIX_COLS +/* key matrix size */ +#define MATRIX_ROWS 8 +#define MATRIX_COLS 6 + +/* + * Keyboard Matrix Assignments + * + * Change this to how you wired your keyboard + * COLS: AVR pins used for columns, left to right + * ROWS: AVR pins used for rows, top to bottom + * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) + * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) + * +*/ +/* Note: These are not used for arm boards. They're here purely as documentation. */ +#undef MATRIX_ROW_PINS +#undef MATRIX_COL_PINS + +#define MATRIX_ROW_PINS { A10, A9, A8, B15, C13, C14, C15, A2 } +#define MATRIX_COL_PINS { B11, B10, B2, B1, A7, B0 } + +#define UNUSED_PINS + +#define ENCODERS_PAD_A { B12 } +#define ENCODERS_PAD_B { B13 } + +#define DIP_SWITCH_PINS { B14, A15, A0, B9 } + +#define MUSIC_MAP +#undef AUDIO_VOICES +#undef AUDIO_PIN +#define AUDIO_PIN A5 +#define AUDIO_PIN_ALT A4 +#define AUDIO_PIN_ALT_AS_NEGATIVE + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +// #define DEBOUNCE 6 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +//#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +//#define LOCKING_RESYNC_ENABLE + +/* + * Force NKRO + * + * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved + * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the + * makefile for this to work.) + * + * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) + * until the next keyboard reset. + * + * NKRO may prevent your keystrokes from being detected in the BIOS, but it is + * fully operational during normal computer usage. + * + * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) + * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by + * bootmagic, NKRO mode will always be enabled until it is toggled again during a + * power-up. + * + */ +//#define FORCE_NKRO + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +//#define NO_DEBUG + +/* disable print */ +//#define NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +//#define NO_ACTION_MACRO +//#define NO_ACTION_FUNCTION + +/* + * 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 + +/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ +//#define MIDI_TONE_KEYCODE_OCTAVES 1 + + +/* + * WS2812 Underglow Matrix options + */ +#define RGB_DI_PIN A1 +#define RGBLED_NUM 9 +#define DRIVER_LED_TOTAL RGBLED_NUM + +#define WS2812_PWM_DRIVER PWMD2 +#define WS2812_PWM_CHANNEL 2 +#define WS2812_PWM_PAL_MODE 1 +#define WS2812_DMA_STREAM STM32_DMA1_STREAM2 +#define WS2812_DMA_CHANNEL 2 + +#ifndef RGB_DISABLE_WHEN_USB_SUSPENDED +# define RGB_DISABLE_WHEN_USB_SUSPENDED true +#endif + +#endif + +#define RGBLIGHT_LAYERS + +#pragma once + +#ifdef AUDIO_ENABLE + #define STARTUP_SONG SONG(PLANCK_SOUND) + // #define STARTUP_SONG SONG(NO_SOUND) + + #define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \ + SONG(COLEMAK_SOUND), \ + SONG(DVORAK_SOUND), \ + SONG(WORKMAN_SOUND), \ + SONG(PLOVER_SOUND), \ + SONG(STARTUP_SOUND), \ + SONG(PREONIC_SOUND), \ + SONG(GOODBYE_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 + +/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ +//#define MIDI_TONE_KEYCODE_OCTAVES 2 + +// Most tactile encoders have detents every 4 stages +#define ENCODER_RESOLUTION 4 + +//settings for home row mods +#define TAPPING_TERM 160 // 200 ms is the default value +#define TAPPING_TERM_PER_KEY + +//#define PERMISSIVE_HOLD + +#define IGNORE_MOD_TAP_INTERRUPT + +#define TAPPING_FORCE_HOLD_PER_KEY diff --git a/keyboards/planck/keymaps/jweickm/keymap-backup.c b/keyboards/planck/keymaps/jweickm/keymap-backup.c new file mode 100644 index 000000000000..b168f5874dd8 --- /dev/null +++ b/keyboards/planck/keymaps/jweickm/keymap-backup.c @@ -0,0 +1,839 @@ +/* Copyright 2015-2017 Jack Humbert + * Copyright 2021 Jakob Weickmann + * + * 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 . + */ +#include QMK_KEYBOARD_H +#include "muse.h" +#include "quantum.h" + + +enum planck_layers { + _COLEMAK, + _HRCOLEMAK, + _HRWIDECOLEMAK, + _HRWIDECOLEMAK_DE, + _GAMING, + _WIDECOLEMAK, + _LOWER, + _RAISE, + _LOWER_DE, + _RAISE_DE, + _ADJUST, + _NAV, + _NUM, + _MOUSE, + _PLOVER +}; + +enum planck_keycodes { + COLEMAK = SAFE_RANGE, + HRCOLEMAK, + HRWIDECOLEMAK, + PLOVER, + BACKLIT, + EXT_PLV, + GAMING, + WIDECOLEMAK, + TG_COLEMAK, + VIM_O, + VIM_V, + KC_SVD_BD, + KC_SVU_BU, + KC_TAB_MPLY, + ALT_TAB, + CTL_TAB, + DE_AE, + DE_OE, + DE_UE, + DE_SZ, + DE_EGRAVE, + DE_EAIGU, + KC_CURRENCY, + KC_DE_SWITCH, + LANG_SWITCH, + DE_SLSH_QUST, + DE_QUOT +}; + +// Tap Dance declarations +enum tap_dance_codes{ + TD_PRN, // round brackets (parentheses) + TD_BRC, // square brackets + TD_CBR, // curly brackets + TD_ESC_CAPS, // double tap for caps lock + TD_QUO_BRC, // double function on quotes to enable typing ü in german layout + TD_COMM_SLSH, // comma that doubles as a slash + TD_MPLY, // play/pause, double for next, triple for previous song + TD_Q_TAB // double tap q to register tab +}; + +#define LOWER MO(_LOWER) +#define RAISE MO(_RAISE) + +#define MODS_SHIFT_MASK (MOD_BIT(KC_LSFT)|MOD_BIT(KC_RSFT)) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +[_HRWIDECOLEMAK] = LAYOUT_planck_grid( + LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM,KC_B), KC_SVU_BU, LT(_NUM,KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Y), RGUI_T(KC_SCLN), DE_UE, + KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, + LT(_MOUSE,KC_Z), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, LT(_MOUSE,KC_MINS), KC_SLSH, + KC_CAPS, LT(_NUM,KC_TAB), LGUI_T(KC_ESC), LT(_LOWER, KC_BSPC), OSM(MOD_LSFT), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE, KC_DEL), RCTL_T(KC_ENT), KC_LALT, KC_LEFT, KC_RIGHT +), + +[_HRWIDECOLEMAK_DE] = LAYOUT_planck_grid( + LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM,KC_B), KC_SVU_BU, LT(_NUM,KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Z), RGUI_T(KC_SCLN), KC_LBRC, + KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB, KC_M, KC_N, KC_E, KC_I, KC_O, DE_QUOT, + LT(_MOUSE,KC_Y), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, LT(_MOUSE,KC_SLSH), DE_SLSH_QUST, + KC_CAPS, LT(_NUM,KC_TAB), LGUI_T(KC_ESC), LT(_LOWER_DE, KC_BSPC), OSM(MOD_LSFT), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE_DE, KC_DEL), RCTL_T(KC_ENT), KC_LALT, KC_LEFT, KC_RIGHT +), + +[_GAMING] = LAYOUT_planck_grid( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_F5, KC_F8, KC_F9, KC_VOLU, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_VOLD, + KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_Z, KC_M, KC_SCLN, KC_ENT, + KC_LCTL, KC_LALT, KC_B, KC_X, KC_C, KC_SPC, KC_SPC, KC_LALT, TG_COLEMAK, KC_TRNS, KC_TRNS, GAMING +), + +/* WIDECOLEMAK + * ,-----------------------------------------------------------------------------------. + * |_NUM(Tab)| Q | W | E | R | T | Y | U | I | O | P | Bksp | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |CTL(Esc)| A | S | D | F | G | H | J | K | L | ; | " | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_WIDECOLEMAK] = LAYOUT_planck_grid( + KC_Q, KC_W, KC_F, KC_P, KC_B, KC_SVU_BU, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, DE_UE, + KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB_MPLY, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, + KC_Z, KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, LSFT_T(KC_ENT), + KC_CAPS, LT(_NUM,KC_TAB), LGUI_T(KC_ESC), LT(_LOWER, KC_BSPC), OSM(MOD_LSFT), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE, KC_DEL), TG_COLEMAK, KC_LALT, KC_LEFT, KC_RIGHT +), + +[_LOWER] = LAYOUT_planck_grid( + KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_TILD, KC_CIRC, KC_AMPR, KC_ASTR, TD(TD_PRN), KC_RPRN, DE_AE, + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, DE_SZ, KC_UNDS, KC_PLUS, TD(TD_CBR), KC_RCBR, KC_PIPE, + KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, KC_SLSH, KC_NUBS, LSFT(KC_NUBS), KC_CURRENCY, DE_EGRAVE, + TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_DOWN, KC_UP +), + +[_LOWER_DE] = LAYOUT_planck_grid( + KC_EXLM, RALT(KC_Q), KC_BSLS, KC_DLR, KC_PERC, RALT(KC_RBRC), KC_GRV, KC_CIRC, KC_RCBR, KC_ASTR, KC_LPRN, KC_QUOT, + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, DE_SZ, LSFT(KC_SLSH), KC_RBRC, RALT(KC_7), RALT(KC_0), RALT(KC_NUBS), + KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, LSFT(KC_7), KC_NUBS, LSFT(KC_NUBS), KC_CURRENCY, DE_EGRAVE, + TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_DOWN, KC_UP +), + +[_RAISE] = LAYOUT_planck_grid( + KC_1, KC_2, KC_3, KC_4, KC_5, KC_GRV, KC_6, KC_7, KC_8, KC_9, KC_0, DE_OE, + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, DE_SZ, KC_MINS, KC_EQL, TD(TD_BRC), KC_RBRC, KC_BSLS, + KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, KC_BSLS, KC_COMM, KC_DOT, KC_SLSH, DE_EAIGU, + TG(_MOUSE), KC_TRNS, KC_BSPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_DOWN, KC_UP +), + +[_RAISE_DE] = LAYOUT_planck_grid( + KC_1, KC_2, KC_3, KC_4, KC_5, KC_GRV, KC_6, KC_7, KC_8, KC_9, KC_0, KC_SCLN, + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, DE_SZ, KC_SLSH, LSFT(KC_0), RALT(KC_8), RALT(KC_9), RALT(KC_MINS), + KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, RALT(KC_MINS), KC_COMM, KC_DOT, KC_SLSH, DE_EAIGU, + TG(_MOUSE), KC_TRNS, KC_BSPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_DOWN, KC_UP +), + +[_ADJUST] = LAYOUT_planck_grid( + LALT(KC_LSFT), RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DE_SWITCH, + LALT(KC_GRV), EEP_RST, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, HRWIDECOLEMAK, WIDECOLEMAK, LCTL(KC_RGHT), LANG_SWITCH, GAMING, + KC_TRNS, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, KC_SVD_BD, KC_MPLY, KC_SVU_BU, KC_TRNS, , + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS +), + +[_NAV] = LAYOUT_planck_grid( + ALT_TAB, LCTL(KC_RGHT), LANG_SWITCH, LALT(KC_GRV), LCTL(KC_LEFT), KC_MNXT, KC_DOWN, KC_RIGHT, KC_PGUP, LCTL(KC_C), KC_NO, KC_DE_SWITCH, + CTL_TAB, KC_TAB, KC_ESC, LT(_NUM,KC_ENT), KC_TAB, KC_MPLY, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_END, VIM_O, + KC_LSFT, KC_NO, LCTL(KC_X), TD(TD_ESC_CAPS), VIM_V, KC_MUTE, KC_HOME, KC_PGDN, KC_NO, KC_NO, LCTL(KC_F), LCTL(KC_F), + KC_NO, KC_NO, KC_NO, KC_TRNS, KC_TRNS, LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), KC_NO, KC_NO, KC_TRNS, KC_NO, KC_NO +), + +[_NUM] = LAYOUT_planck_grid( + KC_F1, KC_F2, KC_F3, KC_F4, KC_MPRV, KC_NLCK, KC_MNXT, KC_P7, KC_P8, KC_P9, KC_PMNS, KC_TRNS, + KC_F5, KC_F6, KC_F7, KC_F8, KC_VOLU, KC_MPLY, KC_BRIU, KC_P4, KC_P5, KC_P6, KC_PPLS, KC_TRNS, + KC_F9,KC_F10,KC_F11,KC_F12, KC_VOLD, KC_MUTE, KC_BRID, KC_P1, KC_P2, KC_P3, KC_PSLS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P0, KC_DOT, KC_COMM, KC_EQL, KC_TRNS +), + +[_MOUSE] = LAYOUT_planck_grid( + KC_NO, KC_NO, KC_BTN4, KC_BTN5, KC_NO, KC_NO, KC_NO, KC_WH_U, KC_MS_U, KC_WH_U, KC_NO, KC_NO, + KC_NO, KC_BTN3, KC_BTN2, KC_BTN1, KC_NO, KC_NO, KC_NO, KC_MS_L, KC_MS_D, KC_MS_R, KC_NO, KC_NO, + KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_WH_D, KC_NO, KC_NO, KC_TRNS, KC_NO, + TG(_MOUSE), KC_NO, KC_NO, KC_TRNS, KC_NO, KC_ACL2, KC_ACL2, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO +) + +}; + +// define the tap dance functions +void dance_prn(qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + tap_code16(KC_LPRN); + } else { + tap_code16(KC_LPRN); + tap_code16(KC_RPRN); + tap_code(KC_LEFT); + } +} +void dance_brc(qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + tap_code(KC_LBRC); + } else { + tap_code(KC_LBRC); + tap_code(KC_RBRC); + tap_code(KC_LEFT); + } +} +void dance_cbr(qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + tap_code16(KC_LCBR); + } else { + tap_code16(KC_LCBR); + tap_code16(KC_RCBR); + tap_code(KC_LEFT); + } +} + +qk_tap_dance_action_t tap_dance_actions[] = { + // declare tap dance actions here + [TD_PRN] = ACTION_TAP_DANCE_FN(dance_prn), + [TD_BRC] = ACTION_TAP_DANCE_FN(dance_brc), + [TD_CBR] = ACTION_TAP_DANCE_FN(dance_cbr), + [TD_MPLY] = ACTION_TAP_DANCE_DOUBLE(KC_MPLY, KC_MNXT), + [TD_ESC_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_ESC, KC_CAPS), + [TD_QUO_BRC] = ACTION_TAP_DANCE_DOUBLE(KC_QUOT, KC_LBRC), + [TD_COMM_SLSH] = ACTION_TAP_DANCE_DOUBLE(KC_COMMA, KC_SLSH), + [TD_Q_TAB] = ACTION_TAP_DANCE_DOUBLE(KC_Q, KC_TAB) +}; + +// TD(TD_ESC_CAPS), LGUI_T(KC_A), LALT_T(KC_R), LSFT_T(KC_S), LCTL_T(KC_T), KC_G, KC_M, RCTL_T(KC_N), RSFT_T(KC_E), LALT_T(KC_I), RGUI_T(KC_O), KC_TRNS, +// define the per_key_tapping_term +uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case TD(TD_ESC_CAPS): + return TAPPING_TERM * 1.5; + case LGUI_T(KC_A): + return TAPPING_TERM * 1.4; + case LGUI_T(KC_Q): + return TAPPING_TERM * 1.1; + case RGUI_T(KC_O): + return TAPPING_TERM * 1.45; + case RGUI_T(KC_SCLN): + return TAPPING_TERM * 1.1; + case LALT_T(KC_R): + return TAPPING_TERM * 1.3; + case LALT_T(KC_W): + return TAPPING_TERM * 1.25; + case LALT_T(KC_I): + return TAPPING_TERM * 1.35; + case LALT_T(KC_Y): + return TAPPING_TERM * 1.25; + case LCTL_T(KC_T): + return TAPPING_TERM * 1.1; + case LCTL_T(KC_P): + return TAPPING_TERM * 1.1; + case RCTL_T(KC_N): + return TAPPING_TERM * 1.1; + case RCTL_T(KC_L): + return TAPPING_TERM * 1.1; + case LSFT_T(KC_S): + return TAPPING_TERM * 1.1; + case LSFT_T(KC_F): + return TAPPING_TERM * 1.2; + case RSFT_T(KC_E): + return TAPPING_TERM * 1.1; + case RSFT_T(KC_U): + return TAPPING_TERM * 1.2; + case LT(_NUM, KC_F): + return TAPPING_TERM * 1.2; + case LT(_NUM, KC_B): + return TAPPING_TERM * 1.1; + case LT(_NUM, KC_J): + return TAPPING_TERM * 1.1; + case LT(_MOUSE, KC_Z): + return TAPPING_TERM * 1.15; + case LT(_MOUSE, KC_SLSH): + return TAPPING_TERM * 1.15; + case TD(TD_QUO_BRC): + return TAPPING_TERM * 1.1; + case TD(TD_Q_TAB): + return TAPPING_TERM * 1.1; + case TD(TD_PRN): + return TAPPING_TERM * 1.4; + case TD(TD_BRC): + return TAPPING_TERM * 1.4; + case TD(TD_CBR): + return TAPPING_TERM * 1.4; + default: + return TAPPING_TERM; + } +} + +#ifdef AUDIO_ENABLE + float plover_song[][2] = SONG(PLOVER_SOUND); + float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND); +#endif + +// alt tab function setup +bool is_alt_tab_active = false; +bool is_ctl_tab_active = false; +bool de_layout_active = false; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case COLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_COLEMAK); + } + return false; + break; + case WIDECOLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_WIDECOLEMAK); + } + return false; + break; + case HRCOLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_HRCOLEMAK); + } + return false; + break; + case HRWIDECOLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_HRWIDECOLEMAK); + } + return false; + break; + case GAMING: + if (record->event.pressed) { + layer_invert(_GAMING); + } + return false; + break; + case TG_COLEMAK: + if (record->event.pressed) { + tap_code(KC_ENT); + layer_invert(_WIDECOLEMAK); + } + return false; + break; + case VIM_O: + if (record->event.pressed) { + tap_code(KC_END); + tap_code(KC_ENT); + } + return false; + break; + case VIM_V: + if (record->event.pressed) { + if (get_mods() & MOD_BIT(KC_LSFT)) { + unregister_mods(MOD_LSFT); + } else { + register_mods(MOD_LSFT); + } + } + return false; + break; + case KC_SVU_BU: // increase backlight when pressing shift and vol up + if (record->event.pressed) { + if (get_mods() & MOD_BIT(KC_LSFT) || get_mods() & MOD_BIT(KC_RSFT)) { + register_code(KC_BRIU); + } else if (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTL)){ + register_code(KC_MNXT); + } else { + register_code(KC_VOLU); + } + } else { + unregister_code(KC_BRIU); + unregister_code(KC_MNXT); + unregister_code(KC_VOLU); + } + return false; + case KC_SVD_BD: // decrease backlight when pressing shift and vol up + if (record->event.pressed) { + if (get_mods() & MOD_BIT(KC_LSFT) || get_mods() & MOD_BIT(KC_RSFT)) { + register_code(KC_BRID); + } else if (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTL)){ + register_code(KC_MPRV); + } else { + register_code(KC_VOLD); + } + } else { + unregister_code(KC_BRID); + unregister_code(KC_MPRV); + unregister_code(KC_VOLD); + } + return false; + case KC_TAB_MPLY: // press tab or play/pause when ctrl is pressed + if (record->event.pressed) { + if (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTL)){ + register_code(KC_MPLY); + } else { + register_code(KC_TAB); + } + } else { + unregister_code(KC_MPLY); + unregister_code(KC_TAB); + } + return false; + case ALT_TAB: + if (record->event.pressed) { + if (!is_alt_tab_active) { + is_alt_tab_active = true; + register_mods(MOD_LALT); + } + register_code(KC_TAB); + } else { + unregister_code(KC_TAB); + } + break; + case CTL_TAB: + if (record->event.pressed) { + if (!is_ctl_tab_active) { + is_ctl_tab_active = true; + register_mods(MOD_LCTL); + } + register_code(KC_TAB); + } else { + unregister_code(KC_TAB); + } + break; + // the next case allows us to use alt_tab without a timer + case LT(_NAV,KC_SPC): + if (record->event.pressed) { + } else { + unregister_mods(MOD_LALT); + unregister_mods(MOD_LCTL); + is_alt_tab_active = false; + is_ctl_tab_active = false; + } + break; + case DE_AE: + if (record->event.pressed) { + uint8_t temp_mod = get_mods(); + if (temp_mod & MODS_SHIFT_MASK) { + clear_mods(); + register_mods(MOD_LALT); + tap_code(KC_P0); tap_code(KC_P1); tap_code(KC_P9); tap_code(KC_P6); // Ä + unregister_mods(MOD_LALT); + } else { + clear_mods(); + register_mods(MOD_LALT); + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P2); tap_code(KC_P8); // ä + unregister_mods(MOD_LALT); + } + return false; + } + break; + case DE_OE: + if (record->event.pressed) { + uint8_t temp_mod = get_mods(); + if (temp_mod & MODS_SHIFT_MASK) { + clear_mods(); + register_mods(MOD_LALT); + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P1); tap_code(KC_P4); // Ö + unregister_mods(MOD_LALT); + } else { + clear_mods(); + register_mods(MOD_LALT); + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P4); tap_code(KC_P6); // ö + unregister_mods(MOD_LALT); + } + return false; + } + break; + case DE_UE: + if (record->event.pressed) { + uint8_t temp_mod = get_mods(); + if (temp_mod & MODS_SHIFT_MASK) { + clear_mods(); + register_mods(MOD_LALT); + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P2); tap_code(KC_P0); // Ü + unregister_mods(MOD_LALT); + } else { + clear_mods(); + register_mods(MOD_LALT); + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P5); tap_code(KC_P2); // ü + unregister_mods(MOD_LALT); + } + return false; + } + break; + case KC_DE_SWITCH: + if (record->event.pressed) { + if (de_layout_active) { + de_layout_active = false;// deactivate German overlay + set_single_persistent_default_layer(_HRWIDECOLEMAK); + } else { + de_layout_active = true; // activate German overlay + set_single_persistent_default_layer(_HRWIDECOLEMAK_DE); + } + return false; + } + break; + case LANG_SWITCH: + if (record->event.pressed) { + register_mods(MOD_LALT); + tap_code(KC_LSFT); + unregister_mods(MOD_LALT); + if (de_layout_active) { + de_layout_active = false; // deactivate German overlay + set_single_persistent_default_layer(_HRWIDECOLEMAK); + } else { + de_layout_active = true; // activate German overlay + set_single_persistent_default_layer(_HRWIDECOLEMAK_DE); + } + return false; + } + break; + case DE_SZ: + if (record->event.pressed) { + uint8_t temp_mod = get_mods(); + clear_mods(); + register_mods(MOD_LALT); + if (temp_mod & MODS_SHIFT_MASK) { + tap_code(KC_P0); tap_code(KC_P1); tap_code(KC_P7); tap_code(KC_P6); // ° + } else { + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P2); tap_code(KC_P3); // ß + } + unregister_mods(MOD_LALT); + return false; + } + break; + case DE_EGRAVE: + if (record->event.pressed) { + uint8_t temp_mod = get_mods(); + clear_mods(); + register_mods(MOD_LALT); + if (temp_mod & MODS_SHIFT_MASK) { + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P0); tap_code(KC_P0); // È + } else { + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P3); tap_code(KC_P2); // è + } + unregister_mods(MOD_LALT); + return false; + } + break; + case DE_EAIGU: + if (record->event.pressed) { + uint8_t temp_mod = get_mods(); + clear_mods(); + register_mods(MOD_LALT); + if (temp_mod & MODS_SHIFT_MASK) { + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P0); tap_code(KC_P1); // É + } else { + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P3); tap_code(KC_P3); // é + } + unregister_mods(MOD_LALT); + return false; + } + break; + case KC_CURRENCY: + if (record->event.pressed) { + uint8_t temp_mod = get_mods(); + clear_mods(); + register_mods(MOD_LALT); + if (temp_mod & MODS_SHIFT_MASK) { + tap_code(KC_P1); tap_code(KC_P5); tap_code(KC_P7); // ¥ + } else { + tap_code(KC_P0); tap_code(KC_P1); tap_code(KC_P2); tap_code(KC_P8); // € + } + unregister_mods(MOD_LALT); + return false; + } + break; + case DE_SLSH_QUST: + if (record->event.pressed) { + uint8_t temp_mod = get_mods(); + if (temp_mod & MODS_SHIFT_MASK) { + tap_code(KC_MINS); // ? + } else { + tap_code16(KC_AMPR); // / + } + return false; + } + break; + case DE_QUOT: + if (record->event.pressed) { + uint8_t temp_mod = get_mods(); + if (temp_mod & MODS_SHIFT_MASK) { + tap_code(KC_2); // \" + } else { + tap_code16(KC_PIPE); // /' + } + return false; + } + break; + case BACKLIT: + if (record->event.pressed) { + register_code(KC_RSFT); + #ifdef BACKLIGHT_ENABLE + backlight_step(); + #endif + #ifdef KEYBOARD_planck_rev5 + writePinLow(E6); + #endif + } else { + unregister_code(KC_RSFT); + #ifdef KEYBOARD_planck_rev5 + writePinHigh(E6); + #endif + } + 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(); + keymap_config.nkro = 1; + eeconfig_update_keymap(keymap_config.raw); + } + return false; + break; + case EXT_PLV: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_SONG(plover_gb_song); + #endif + layer_off(_PLOVER); + } + return false; + break; + } + return true; +} + +bool muse_mode = false; +uint8_t last_muse_note = 0; +uint16_t muse_counter = 0; +uint8_t muse_offset = 70; +uint16_t muse_tempo = 50; + +bool encoder_update(bool clockwise) { + 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 (clockwise) { + #ifdef MOUSEKEY_ENABLE + tap_code(KC_MS_WH_DOWN); + #else + tap_code(KC_PGDN); + #endif + } else { + #ifdef MOUSEKEY_ENABLE + tap_code(KC_MS_WH_UP); + #else + tap_code(KC_PGUP); + #endif + } + } + return true; +} + +void dip_switch_update_user(uint8_t index, bool active) { + switch (index) { + case 0: { +#ifdef AUDIO_ENABLE + static bool play_sound = false; +#endif + if (active) { +#ifdef AUDIO_ENABLE + if (play_sound) { PLAY_SONG(plover_song); } +#endif + layer_on(_ADJUST); + } else { +#ifdef AUDIO_ENABLE + if (play_sound) { PLAY_SONG(plover_gb_song); } +#endif + layer_off(_ADJUST); + } +#ifdef AUDIO_ENABLE + play_sound = true; +#endif + break; + } + case 1: + if (active) { + muse_mode = true; + } else { + muse_mode = false; + } + } +} + +void matrix_scan_user(void) { + #ifdef AUDIO_ENABLE + if (muse_mode) { + if (muse_counter == 0) { + uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()]; + if (muse_note != last_muse_note) { + stop_note(compute_freq_for_midi_note(last_muse_note)); + play_note(compute_freq_for_midi_note(muse_note), 0xF); + last_muse_note = muse_note; + } + } + muse_counter = (muse_counter + 1) % muse_tempo; + } else { + if (muse_counter) { + stop_all_notes(); + muse_counter = 0; + } + } +#endif +} + +bool music_mask_user(uint16_t keycode) { + switch (keycode) { + case RAISE: + case LOWER: + return false; + default: + return true; + } +} + +bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case LSFT_T(KC_S): + return true; + case RSFT_T(KC_E): + return true; + case LSFT_T(KC_D): + return true; + case RSFT_T(KC_K): + return true; + case LSFT_T(KC_F): + return true; + case RSFT_T(KC_U): + return true; + default: + return false; + } +} + +// Set RGB to change with layer changes +#define HSV_DARKORANGE 10, 255, 255 +#define HSV_DARKPINK 150, 100, 255 + +// Light LEDs 1 to 9 in darkorange when HRCOLEMAK is active +const rgblight_segment_t PROGMEM my_layer0_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {0, 10, HSV_DARKORANGE} +); +// Light LEDs 1 to 9 in green when HRWIDECOLEMAK is active +const rgblight_segment_t PROGMEM my_layer1_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {0, 10, HSV_CYAN} +); +// Light LEDs 1 to 9 in red when GAMING layer is active +const rgblight_segment_t PROGMEM my_layer2_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {0, 10, HSV_RED} +); +// Light LEDs 1 to 9 in white when WIDECOLEMAK is active +const rgblight_segment_t PROGMEM my_layer3_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {0, 10, HSV_WHITE} +); +// Light bottom LEDs in purple when ADJUST layer is active +const rgblight_segment_t PROGMEM my_layer4_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {0, 2, HSV_PURPLE}, + {7, 3, HSV_PURPLE} +); +// Light LEDs 1 to 9 in darkorange when de_layout_active is true +const rgblight_segment_t PROGMEM my_de_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {3, 4, HSV_DARKORANGE}, + {0, 3, HSV_CYAN}, + {8, 3, HSV_CYAN} +); +// Light bottom LEDs in red when caps lock is active. Hard to ignore! +const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {0, 3, HSV_MAGENTA}, + {7, 3, HSV_MAGENTA} +); +// Light LEDs 1 to 9 in white when NAVIGATION is active +const rgblight_segment_t PROGMEM my_nav_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {0, 10, HSV_WHITE} +); + +// Now define the array of layers. Later layers take precedence +const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST( + my_layer0_layer, // hrcolemak + my_layer1_layer, // hrwidecolemak + my_layer2_layer, // gaming + my_layer3_layer, // widecolemak + my_layer4_layer, // adjust + my_nav_layer, // nav + my_de_layer, // de_layout + my_capslock_layer // capslock +); + +void keyboard_post_init_user(void) { + // Enable the LED layers + rgblight_layers = my_rgb_layers; +} + +bool led_update_user(led_t led_state) { + rgblight_set_layer_state(7, led_state.caps_lock); + return true; +} + +layer_state_t layer_state_set_user(layer_state_t state) { + rgblight_set_layer_state(2, layer_state_cmp(state, _GAMING)); + rgblight_set_layer_state(3, layer_state_cmp(state, _WIDECOLEMAK)); + if ( + ( layer_state_cmp(state, _LOWER) && layer_state_cmp(state, _RAISE ) ) || + ( layer_state_cmp(state, _LOWER_DE) && layer_state_cmp(state, _RAISE_DE ) ) ) { + return state | (1UL<<_ADJUST); + } else { + return state & ~(1UL<<_ADJUST); + } + // state = update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); + rgblight_set_layer_state(4, layer_state_cmp(state, _ADJUST)); + //return state; +} + +layer_state_t default_layer_state_set_user(layer_state_t state) { + rgblight_set_layer_state(3, layer_state_cmp(state, _WIDECOLEMAK)); + rgblight_set_layer_state(1, layer_state_cmp(state, _HRWIDECOLEMAK)); + rgblight_set_layer_state(6, layer_state_cmp(state, _HRWIDECOLEMAK_DE)); + return state; +} + diff --git a/keyboards/planck/keymaps/jweickm/keymap.c b/keyboards/planck/keymaps/jweickm/keymap.c index b168f5874dd8..fb1ab7d8f9a9 100644 --- a/keyboards/planck/keymaps/jweickm/keymap.c +++ b/keyboards/planck/keymaps/jweickm/keymap.c @@ -20,7 +20,6 @@ enum planck_layers { - _COLEMAK, _HRCOLEMAK, _HRWIDECOLEMAK, _HRWIDECOLEMAK_DE, @@ -38,9 +37,7 @@ enum planck_layers { }; enum planck_keycodes { - COLEMAK = SAFE_RANGE, - HRCOLEMAK, - HRWIDECOLEMAK, + HRWIDECOLEMAK = SAFE_RANGE, PLOVER, BACKLIT, EXT_PLV, @@ -299,23 +296,11 @@ bool de_layout_active = false; bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { - case COLEMAK: - if (record->event.pressed) { - set_single_persistent_default_layer(_COLEMAK); - } - return false; - break; case WIDECOLEMAK: if (record->event.pressed) { set_single_persistent_default_layer(_WIDECOLEMAK); } return false; - break; - case HRCOLEMAK: - if (record->event.pressed) { - set_single_persistent_default_layer(_HRCOLEMAK); - } - return false; break; case HRWIDECOLEMAK: if (record->event.pressed) { @@ -582,7 +567,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return false; } - break; + break; case BACKLIT: if (record->event.pressed) { register_code(KC_RSFT); @@ -671,7 +656,7 @@ bool encoder_update(bool clockwise) { return true; } -void dip_switch_update_user(uint8_t index, bool active) { +bool dip_switch_update_user(uint8_t index, bool active) { switch (index) { case 0: { #ifdef AUDIO_ENABLE @@ -700,6 +685,7 @@ void dip_switch_update_user(uint8_t index, bool active) { muse_mode = false; } } + return true; } void matrix_scan_user(void) { diff --git a/keyboards/planck/keymaps/jweickm/keymap_backup.c b/keyboards/planck/keymaps/jweickm/keymap_backup.c new file mode 100644 index 000000000000..4df199968664 --- /dev/null +++ b/keyboards/planck/keymaps/jweickm/keymap_backup.c @@ -0,0 +1,839 @@ +/* Copyright 2015-2017 Jack Humbert + * Copyright 2021 Jakob Weickmann + * + * 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 . + */ +#include QMK_KEYBOARD_H +#include "muse.h" +#include "quantum.h" + + +enum planck_layers { + _COLEMAK, + _HRCOLEMAK, + _HRWIDECOLEMAK, + _HRWIDECOLEMAK_DE, + _GAMING, + _WIDECOLEMAK, + _LOWER, + _RAISE, + _LOWER_DE, + _RAISE_DE, + _ADJUST, + _NAV, + _NUM, + _MOUSE, + _PLOVER +}; + +enum planck_keycodes { + COLEMAK = SAFE_RANGE, + HRCOLEMAK, + HRWIDECOLEMAK, + PLOVER, + BACKLIT, + EXT_PLV, + GAMING, + WIDECOLEMAK, + TG_COLEMAK, + VIM_O, + VIM_V, + KC_SVD_BD, + KC_SVU_BU, + KC_TAB_MPLY, + ALT_TAB, + CTL_TAB, + DE_AE, + DE_OE, + DE_UE, + DE_SZ, + DE_EGRAVE, + DE_EAIGU, + KC_CURRENCY, + KC_DE_SWITCH, + LANG_SWITCH, + DE_SLSH_QUST, + DE_QUOT +}; + +// Tap Dance declarations +enum tap_dance_codes{ + TD_PRN, // round brackets (parentheses) + TD_BRC, // square brackets + TD_CBR, // curly brackets + TD_ESC_CAPS, // double tap for caps lock + TD_QUO_BRC, // double function on quotes to enable typing ü in german layout + TD_COMM_SLSH, // comma that doubles as a slash + TD_MPLY, // play/pause, double for next, triple for previous song + TD_Q_TAB // double tap q to register tab +}; + +#define LOWER MO(_LOWER) +#define RAISE MO(_RAISE) + +#define MODS_SHIFT_MASK (MOD_BIT(KC_LSFT)|MOD_BIT(KC_RSFT)) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +[_HRWIDECOLEMAK] = LAYOUT_planck_grid( + LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM,KC_B), KC_SVU_BU, LT(_NUM,KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Y), RGUI_T(KC_SCLN), DE_UE, + KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, + LT(_MOUSE,KC_Z), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, LT(_MOUSE,KC_MINS), KC_SLSH, + KC_CAPS, LT(_NUM,KC_TAB), LGUI_T(KC_ESC), LT(_LOWER, KC_BSPC), OSM(MOD_LSFT), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE, KC_DEL), RCTL_T(KC_ENT), KC_LALT, KC_LEFT, KC_RIGHT +), + +[_HRWIDECOLEMAK_DE] = LAYOUT_planck_grid( + LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM,KC_B), KC_SVU_BU, LT(_NUM,KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Z), RGUI_T(KC_SCLN), KC_LBRC, + KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB, KC_M, KC_N, KC_E, KC_I, KC_O, DE_QUOT, + LT(_MOUSE,KC_Y), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, LT(_MOUSE,KC_SLSH), DE_SLSH_QUST, + KC_CAPS, LT(_NUM,KC_TAB), LGUI_T(KC_ESC), LT(_LOWER_DE, KC_BSPC), OSM(MOD_LSFT), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE_DE, KC_DEL), RCTL_T(KC_ENT), KC_LALT, KC_LEFT, KC_RIGHT +), + +[_GAMING] = LAYOUT_planck_grid( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_F5, KC_F8, KC_F9, KC_VOLU, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_VOLD, + KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_Z, KC_M, KC_SCLN, KC_ENT, + KC_LCTL, KC_LALT, KC_B, KC_X, KC_C, KC_SPC, KC_SPC, KC_LALT, TG_COLEMAK, KC_TRNS, KC_TRNS, GAMING +), + +/* WIDECOLEMAK + * ,-----------------------------------------------------------------------------------. + * |_NUM(Tab)| Q | W | E | R | T | Y | U | I | O | P | Bksp | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |CTL(Esc)| A | S | D | F | G | H | J | K | L | ; | " | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_WIDECOLEMAK] = LAYOUT_planck_grid( + KC_Q, KC_W, KC_F, KC_P, KC_B, KC_SVU_BU, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, DE_UE, + KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB_MPLY, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, + KC_Z, KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, LSFT_T(KC_ENT), + KC_CAPS, LT(_NUM,KC_TAB), LGUI_T(KC_ESC), LT(_LOWER, KC_BSPC), OSM(MOD_LSFT), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE, KC_DEL), TG_COLEMAK, KC_LALT, KC_LEFT, KC_RIGHT +), + +[_LOWER] = LAYOUT_planck_grid( + KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_TILD, KC_CIRC, KC_AMPR, KC_ASTR, TD(TD_PRN), KC_RPRN, DE_AE, + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, DE_SZ, KC_UNDS, KC_PLUS, TD(TD_CBR), KC_RCBR, KC_PIPE, + KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, KC_SLSH, KC_NUBS, LSFT(KC_NUBS), KC_CURRENCY, DE_EGRAVE, + TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_DOWN, KC_UP +), + +[_LOWER_DE] = LAYOUT_planck_grid( + KC_EXLM, RALT(KC_Q), KC_BSLS, KC_DLR, KC_PERC, RALT(KC_RBRC), KC_GRV, KC_CIRC, KC_RCBR, KC_ASTR, KC_LPRN, KC_QUOT, + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, DE_SZ, LSFT(KC_SLSH), KC_RBRC, RALT(KC_7), RALT(KC_0), RALT(KC_NUBS), + KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, LSFT(KC_7), KC_NUBS, LSFT(KC_NUBS), KC_CURRENCY, DE_EGRAVE, + TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_DOWN, KC_UP +), + +[_RAISE] = LAYOUT_planck_grid( + KC_1, KC_2, KC_3, KC_4, KC_5, KC_GRV, KC_6, KC_7, KC_8, KC_9, KC_0, DE_OE, + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, DE_SZ, KC_MINS, KC_EQL, TD(TD_BRC), KC_RBRC, KC_BSLS, + KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, KC_BSLS, KC_COMM, KC_DOT, KC_SLSH, DE_EAIGU, + TG(_MOUSE), KC_TRNS, KC_BSPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_DOWN, KC_UP +), + +[_RAISE_DE] = LAYOUT_planck_grid( + KC_1, KC_2, KC_3, KC_4, KC_5, KC_GRV, KC_6, KC_7, KC_8, KC_9, KC_0, KC_SCLN, + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, DE_SZ, KC_SLSH, LSFT(KC_0), RALT(KC_8), RALT(KC_9), RALT(KC_MINS), + KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, RALT(KC_MINS), KC_COMM, KC_DOT, KC_SLSH, DE_EAIGU, + TG(_MOUSE), KC_TRNS, KC_BSPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_DOWN, KC_UP +), + +[_ADJUST] = LAYOUT_planck_grid( + LALT(KC_LSFT), RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DE_SWITCH, + LALT(KC_GRV), EEP_RST, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, HRWIDECOLEMAK, WIDECOLEMAK, LCTL(KC_RGHT), LANG_SWITCH, GAMING, + KC_TRNS, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, KC_SVD_BD, KC_MPLY, KC_SVU_BU, KC_TRNS, , + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS +), + +[_NAV] = LAYOUT_planck_grid( + ALT_TAB, LCTL(KC_RGHT), LANG_SWITCH, LALT(KC_GRV), LCTL(KC_LEFT), KC_MNXT, KC_DOWN, KC_RIGHT, KC_PGUP, LCTL(KC_C), KC_NO, KC_DE_SWITCH, + CTL_TAB, KC_TAB, KC_ESC, LT(_NUM,KC_ENT), KC_TAB, KC_MPLY, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_END, VIM_O, + KC_LSFT, KC_NO, LCTL(KC_X), TD(TD_ESC_CAPS), VIM_V, KC_MUTE, KC_HOME, KC_PGDN, KC_NO, KC_NO, LCTL(KC_F), LCTL(KC_F), + KC_NO, KC_NO, KC_NO, KC_TRNS, KC_TRNS, LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), KC_NO, KC_NO, KC_TRNS, KC_NO, KC_NO +), + +[_NUM] = LAYOUT_planck_grid( + KC_F1, KC_F2, KC_F3, KC_F4, KC_MPRV, KC_NLCK, KC_MNXT, KC_P7, KC_P8, KC_P9, KC_PMNS, KC_TRNS, + KC_F5, KC_F6, KC_F7, KC_F8, KC_VOLU, KC_MPLY, KC_BRIU, KC_P4, KC_P5, KC_P6, KC_PPLS, KC_TRNS, + KC_F9,KC_F10,KC_F11,KC_F12, KC_VOLD, KC_MUTE, KC_BRID, KC_P1, KC_P2, KC_P3, KC_PSLS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P0, KC_DOT, KC_COMM, KC_EQL, KC_TRNS +), + +[_MOUSE] = LAYOUT_planck_grid( + KC_NO, KC_NO, KC_BTN4, KC_BTN5, KC_NO, KC_NO, KC_NO, KC_WH_U, KC_MS_U, KC_WH_U, KC_NO, KC_NO, + KC_NO, KC_BTN3, KC_BTN2, KC_BTN1, KC_NO, KC_NO, KC_NO, KC_MS_L, KC_MS_D, KC_MS_R, KC_NO, KC_NO, + KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_WH_D, KC_NO, KC_NO, KC_TRNS, KC_NO, + TG(_MOUSE), KC_NO, KC_NO, KC_TRNS, KC_NO, KC_ACL2, KC_ACL2, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO +) + +}; + +// define the tap dance functions +void dance_prn(qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + tap_code16(KC_LPRN); + } else { + tap_code16(KC_LPRN); + tap_code16(KC_RPRN); + tap_code(KC_LEFT); + } +} +void dance_brc(qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + tap_code(KC_LBRC); + } else { + tap_code(KC_LBRC); + tap_code(KC_RBRC); + tap_code(KC_LEFT); + } +} +void dance_cbr(qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + tap_code16(KC_LCBR); + } else { + tap_code16(KC_LCBR); + tap_code16(KC_RCBR); + tap_code(KC_LEFT); + } +} + +qk_tap_dance_action_t tap_dance_actions[] = { + // declare tap dance actions here + [TD_PRN] = ACTION_TAP_DANCE_FN(dance_prn), + [TD_BRC] = ACTION_TAP_DANCE_FN(dance_brc), + [TD_CBR] = ACTION_TAP_DANCE_FN(dance_cbr), + [TD_MPLY] = ACTION_TAP_DANCE_DOUBLE(KC_MPLY, KC_MNXT), + [TD_ESC_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_ESC, KC_CAPS), + [TD_QUO_BRC] = ACTION_TAP_DANCE_DOUBLE(KC_QUOT, KC_LBRC), + [TD_COMM_SLSH] = ACTION_TAP_DANCE_DOUBLE(KC_COMMA, KC_SLSH), + [TD_Q_TAB] = ACTION_TAP_DANCE_DOUBLE(KC_Q, KC_TAB) +}; + +// TD(TD_ESC_CAPS), LGUI_T(KC_A), LALT_T(KC_R), LSFT_T(KC_S), LCTL_T(KC_T), KC_G, KC_M, RCTL_T(KC_N), RSFT_T(KC_E), LALT_T(KC_I), RGUI_T(KC_O), KC_TRNS, +// define the per_key_tapping_term +uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case TD(TD_ESC_CAPS): + return TAPPING_TERM * 1.5; + case LGUI_T(KC_A): + return TAPPING_TERM * 1.4; + case LGUI_T(KC_Q): + return TAPPING_TERM * 1.1; + case RGUI_T(KC_O): + return TAPPING_TERM * 1.45; + case RGUI_T(KC_SCLN): + return TAPPING_TERM * 1.1; + case LALT_T(KC_R): + return TAPPING_TERM * 1.3; + case LALT_T(KC_W): + return TAPPING_TERM * 1.25; + case LALT_T(KC_I): + return TAPPING_TERM * 1.35; + case LALT_T(KC_Y): + return TAPPING_TERM * 1.25; + case LCTL_T(KC_T): + return TAPPING_TERM * 1.1; + case LCTL_T(KC_P): + return TAPPING_TERM * 1.1; + case RCTL_T(KC_N): + return TAPPING_TERM * 1.1; + case RCTL_T(KC_L): + return TAPPING_TERM * 1.1; + case LSFT_T(KC_S): + return TAPPING_TERM * 1.1; + case LSFT_T(KC_F): + return TAPPING_TERM * 1.2; + case RSFT_T(KC_E): + return TAPPING_TERM * 1.1; + case RSFT_T(KC_U): + return TAPPING_TERM * 1.2; + case LT(_NUM, KC_F): + return TAPPING_TERM * 1.2; + case LT(_NUM, KC_B): + return TAPPING_TERM * 1.1; + case LT(_NUM, KC_J): + return TAPPING_TERM * 1.1; + case LT(_MOUSE, KC_Z): + return TAPPING_TERM * 1.15; + case LT(_MOUSE, KC_SLSH): + return TAPPING_TERM * 1.15; + case TD(TD_QUO_BRC): + return TAPPING_TERM * 1.1; + case TD(TD_Q_TAB): + return TAPPING_TERM * 1.1; + case TD(TD_PRN): + return TAPPING_TERM * 1.4; + case TD(TD_BRC): + return TAPPING_TERM * 1.4; + case TD(TD_CBR): + return TAPPING_TERM * 1.4; + default: + return TAPPING_TERM; + } +} + +#ifdef AUDIO_ENABLE + float plover_song[][2] = SONG(PLOVER_SOUND); + float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND); +#endif + +// alt tab function setup +bool is_alt_tab_active = false; +bool is_ctl_tab_active = false; +bool de_layout_active = false; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case COLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_COLEMAK); + } + return false; + break; + case WIDECOLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_WIDECOLEMAK); + } + return false; + break; + case HRCOLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_HRCOLEMAK); + } + return false; + break; + case HRWIDECOLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_HRWIDECOLEMAK); + } + return false; + break; + case GAMING: + if (record->event.pressed) { + layer_invert(_GAMING); + } + return false; + break; + case TG_COLEMAK: + if (record->event.pressed) { + tap_code(KC_ENT); + layer_invert(_WIDECOLEMAK); + } + return false; + break; + case VIM_O: + if (record->event.pressed) { + tap_code(KC_END); + tap_code(KC_ENT); + } + return false; + break; + case VIM_V: + if (record->event.pressed) { + if (get_mods() & MOD_BIT(KC_LSFT)) { + unregister_mods(MOD_LSFT); + } else { + register_mods(MOD_LSFT); + } + } + return false; + break; + case KC_SVU_BU: // increase backlight when pressing shift and vol up + if (record->event.pressed) { + if (get_mods() & MOD_BIT(KC_LSFT) || get_mods() & MOD_BIT(KC_RSFT)) { + register_code(KC_BRIU); + } else if (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTL)){ + register_code(KC_MNXT); + } else { + register_code(KC_VOLU); + } + } else { + unregister_code(KC_BRIU); + unregister_code(KC_MNXT); + unregister_code(KC_VOLU); + } + return false; + case KC_SVD_BD: // decrease backlight when pressing shift and vol up + if (record->event.pressed) { + if (get_mods() & MOD_BIT(KC_LSFT) || get_mods() & MOD_BIT(KC_RSFT)) { + register_code(KC_BRID); + } else if (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTL)){ + register_code(KC_MPRV); + } else { + register_code(KC_VOLD); + } + } else { + unregister_code(KC_BRID); + unregister_code(KC_MPRV); + unregister_code(KC_VOLD); + } + return false; + case KC_TAB_MPLY: // press tab or play/pause when ctrl is pressed + if (record->event.pressed) { + if (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTL)){ + register_code(KC_MPLY); + } else { + register_code(KC_TAB); + } + } else { + unregister_code(KC_MPLY); + unregister_code(KC_TAB); + } + return false; + case ALT_TAB: + if (record->event.pressed) { + if (!is_alt_tab_active) { + is_alt_tab_active = true; + register_mods(MOD_LALT); + } + register_code(KC_TAB); + } else { + unregister_code(KC_TAB); + } + break; + case CTL_TAB: + if (record->event.pressed) { + if (!is_ctl_tab_active) { + is_ctl_tab_active = true; + register_mods(MOD_LCTL); + } + register_code(KC_TAB); + } else { + unregister_code(KC_TAB); + } + break; + // the next case allows us to use alt_tab without a timer + case LT(_NAV,KC_SPC): + if (record->event.pressed) { + } else { + unregister_mods(MOD_LALT); + unregister_mods(MOD_LCTL); + is_alt_tab_active = false; + is_ctl_tab_active = false; + } + break; + case DE_AE: + if (record->event.pressed) { + uint8_t temp_mod = get_mods(); + if (temp_mod & MODS_SHIFT_MASK) { + clear_mods(); + register_mods(MOD_LALT); + tap_code(KC_P0); tap_code(KC_P1); tap_code(KC_P9); tap_code(KC_P6); // Ä + unregister_mods(MOD_LALT); + } else { + clear_mods(); + register_mods(MOD_LALT); + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P2); tap_code(KC_P8); // ä + unregister_mods(MOD_LALT); + } + return false; + } + break; + case DE_OE: + if (record->event.pressed) { + uint8_t temp_mod = get_mods(); + if (temp_mod & MODS_SHIFT_MASK) { + clear_mods(); + register_mods(MOD_LALT); + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P1); tap_code(KC_P4); // Ö + unregister_mods(MOD_LALT); + } else { + clear_mods(); + register_mods(MOD_LALT); + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P4); tap_code(KC_P6); // ö + unregister_mods(MOD_LALT); + } + return false; + } + break; + case DE_UE: + if (record->event.pressed) { + uint8_t temp_mod = get_mods(); + if (temp_mod & MODS_SHIFT_MASK) { + clear_mods(); + register_mods(MOD_LALT); + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P2); tap_code(KC_P0); // Ü + unregister_mods(MOD_LALT); + } else { + clear_mods(); + register_mods(MOD_LALT); + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P5); tap_code(KC_P2); // ü + unregister_mods(MOD_LALT); + } + return false; + } + break; + case KC_DE_SWITCH: + if (record->event.pressed) { + if (de_layout_active) { + de_layout_active = false;// deactivate German overlay + set_single_persistent_default_layer(_HRWIDECOLEMAK); + } else { + de_layout_active = true; // activate German overlay + set_single_persistent_default_layer(_HRWIDECOLEMAK_DE); + } + return false; + } + break; + case LANG_SWITCH: + if (record->event.pressed) { + register_mods(MOD_LALT); + tap_code(KC_LSFT); + unregister_mods(MOD_LALT); + if (de_layout_active) { + de_layout_active = false; // deactivate German overlay + set_single_persistent_default_layer(_HRWIDECOLEMAK); + } else { + de_layout_active = true; // activate German overlay + set_single_persistent_default_layer(_HRWIDECOLEMAK_DE); + } + return false; + } + break; + case DE_SZ: + if (record->event.pressed) { + uint8_t temp_mod = get_mods(); + clear_mods(); + register_mods(MOD_LALT); + if (temp_mod & MODS_SHIFT_MASK) { + tap_code(KC_P0); tap_code(KC_P1); tap_code(KC_P7); tap_code(KC_P6); // ° + } else { + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P2); tap_code(KC_P3); // ß + } + unregister_mods(MOD_LALT); + return false; + } + break; + case DE_EGRAVE: + if (record->event.pressed) { + uint8_t temp_mod = get_mods(); + clear_mods(); + register_mods(MOD_LALT); + if (temp_mod & MODS_SHIFT_MASK) { + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P0); tap_code(KC_P0); // È + } else { + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P3); tap_code(KC_P2); // è + } + unregister_mods(MOD_LALT); + return false; + } + break; + case DE_EAIGU: + if (record->event.pressed) { + uint8_t temp_mod = get_mods(); + clear_mods(); + register_mods(MOD_LALT); + if (temp_mod & MODS_SHIFT_MASK) { + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P0); tap_code(KC_P1); // É + } else { + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P3); tap_code(KC_P3); // é + } + unregister_mods(MOD_LALT); + return false; + } + break; + case KC_CURRENCY: + if (record->event.pressed) { + uint8_t temp_mod = get_mods(); + clear_mods(); + register_mods(MOD_LALT); + if (temp_mod & MODS_SHIFT_MASK) { + tap_code(KC_P1); tap_code(KC_P5); tap_code(KC_P7); // ¥ + } else { + tap_code(KC_P0); tap_code(KC_P1); tap_code(KC_P2); tap_code(KC_P8); // € + } + unregister_mods(MOD_LALT); + return false; + } + break; + case DE_SLSH_QUST: + if (record->event.pressed) { + uint8_t temp_mod = get_mods(); + if (temp_mod & MODS_SHIFT_MASK) { + tap_code(KC_MINS); // ? + } else { + tap_code16(KC_AMPR); // / + } + return false; + } + break; + case DE_QUOT: + if (record->event.pressed) { + uint8_t temp_mod = get_mods(); + if (temp_mod & MODS_SHIFT_MASK) { + tap_code(KC_2); // \" + } else { + tap_code16(KC_PIPE); // /' + } + return false; + } + break; + case BACKLIT: + if (record->event.pressed) { + register_code(KC_RSFT); + #ifdef BACKLIGHT_ENABLE + backlight_step(); + #endif + #ifdef KEYBOARD_planck_rev5 + writePinLow(E6); + #endif + } else { + unregister_code(KC_RSFT); + #ifdef KEYBOARD_planck_rev5 + writePinHigh(E6); + #endif + } + 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(); + keymap_config.nkro = 1; + eeconfig_update_keymap(keymap_config.raw); + } + return false; + break; + case EXT_PLV: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_SONG(plover_gb_song); + #endif + layer_off(_PLOVER); + } + return false; + break; + } + return true; +} + +bool muse_mode = false; +uint8_t last_muse_note = 0; +uint16_t muse_counter = 0; +uint8_t muse_offset = 70; +uint16_t muse_tempo = 50; + +bool encoder_update(bool clockwise) { + 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 (clockwise) { + #ifdef MOUSEKEY_ENABLE + tap_code(KC_MS_WH_DOWN); + #else + tap_code(KC_PGDN); + #endif + } else { + #ifdef MOUSEKEY_ENABLE + tap_code(KC_MS_WH_UP); + #else + tap_code(KC_PGUP); + #endif + } + } + return true; +} + +// bool dip_switch_update_user(uint8_t index, bool active) { +// switch (index) { +// case 0: { +// #ifdef AUDIO_ENABLE +// static bool play_sound = false; +// #endif +// if (active) { +// #ifdef AUDIO_ENABLE +// if (play_sound) { PLAY_SONG(plover_song); } +// #endif +// layer_on(_ADJUST); +// } else { +// #ifdef AUDIO_ENABLE +// if (play_sound) { PLAY_SONG(plover_gb_song); } +// #endif +// layer_off(_ADJUST); +// } +// #ifdef AUDIO_ENABLE +// play_sound = true; +// #endif +// break; +// } +// case 1: +// if (active) { +// muse_mode = true; +// } else { +// muse_mode = false; +// } +// } +// } + +void matrix_scan_user(void) { + #ifdef AUDIO_ENABLE + if (muse_mode) { + if (muse_counter == 0) { + uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()]; + if (muse_note != last_muse_note) { + stop_note(compute_freq_for_midi_note(last_muse_note)); + play_note(compute_freq_for_midi_note(muse_note), 0xF); + last_muse_note = muse_note; + } + } + muse_counter = (muse_counter + 1) % muse_tempo; + } else { + if (muse_counter) { + stop_all_notes(); + muse_counter = 0; + } + } +#endif +} + +bool music_mask_user(uint16_t keycode) { + switch (keycode) { + case RAISE: + case LOWER: + return false; + default: + return true; + } +} + +bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case LSFT_T(KC_S): + return true; + case RSFT_T(KC_E): + return true; + case LSFT_T(KC_D): + return true; + case RSFT_T(KC_K): + return true; + case LSFT_T(KC_F): + return true; + case RSFT_T(KC_U): + return true; + default: + return false; + } +} + +// Set RGB to change with layer changes +#define HSV_DARKORANGE 10, 255, 255 +#define HSV_DARKPINK 150, 100, 255 + +// Light LEDs 1 to 9 in darkorange when HRCOLEMAK is active +const rgblight_segment_t PROGMEM my_layer0_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {0, 10, HSV_DARKORANGE} +); +// Light LEDs 1 to 9 in green when HRWIDECOLEMAK is active +const rgblight_segment_t PROGMEM my_layer1_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {0, 10, HSV_CYAN} +); +// Light LEDs 1 to 9 in red when GAMING layer is active +const rgblight_segment_t PROGMEM my_layer2_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {0, 10, HSV_RED} +); +// Light LEDs 1 to 9 in white when WIDECOLEMAK is active +const rgblight_segment_t PROGMEM my_layer3_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {0, 10, HSV_WHITE} +); +// Light bottom LEDs in purple when ADJUST layer is active +const rgblight_segment_t PROGMEM my_layer4_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {0, 2, HSV_PURPLE}, + {7, 3, HSV_PURPLE} +); +// Light LEDs 1 to 9 in darkorange when de_layout_active is true +const rgblight_segment_t PROGMEM my_de_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {3, 4, HSV_DARKORANGE}, + {0, 3, HSV_CYAN}, + {8, 3, HSV_CYAN} +); +// Light bottom LEDs in red when caps lock is active. Hard to ignore! +const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {0, 3, HSV_MAGENTA}, + {7, 3, HSV_MAGENTA} +); +// Light LEDs 1 to 9 in white when NAVIGATION is active +const rgblight_segment_t PROGMEM my_nav_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {0, 10, HSV_WHITE} +); + +// Now define the array of layers. Later layers take precedence +const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST( + my_layer0_layer, // hrcolemak + my_layer1_layer, // hrwidecolemak + my_layer2_layer, // gaming + my_layer3_layer, // widecolemak + my_layer4_layer, // adjust + my_nav_layer, // nav + my_de_layer, // de_layout + my_capslock_layer // capslock +); + +void keyboard_post_init_user(void) { + // Enable the LED layers + rgblight_layers = my_rgb_layers; +} + +bool led_update_user(led_t led_state) { + rgblight_set_layer_state(7, led_state.caps_lock); + return true; +} + +layer_state_t layer_state_set_user(layer_state_t state) { + rgblight_set_layer_state(2, layer_state_cmp(state, _GAMING)); + rgblight_set_layer_state(3, layer_state_cmp(state, _WIDECOLEMAK)); + if ( + ( layer_state_cmp(state, _LOWER) && layer_state_cmp(state, _RAISE ) ) || + ( layer_state_cmp(state, _LOWER_DE) && layer_state_cmp(state, _RAISE_DE ) ) ) { + return state | (1UL<<_ADJUST); + } else { + return state & ~(1UL<<_ADJUST); + } + // state = update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); + rgblight_set_layer_state(4, layer_state_cmp(state, _ADJUST)); + //return state; +} + +layer_state_t default_layer_state_set_user(layer_state_t state) { + rgblight_set_layer_state(3, layer_state_cmp(state, _WIDECOLEMAK)); + rgblight_set_layer_state(1, layer_state_cmp(state, _HRWIDECOLEMAK)); + rgblight_set_layer_state(6, layer_state_cmp(state, _HRWIDECOLEMAK_DE)); + return state; +} + diff --git a/keyboards/planck/keymaps/jweickm/keymap_default.c b/keyboards/planck/keymaps/jweickm/keymap_default.c new file mode 100644 index 000000000000..9a6e1189b690 --- /dev/null +++ b/keyboards/planck/keymaps/jweickm/keymap_default.c @@ -0,0 +1,353 @@ +/* Copyright 2015-2017 Jack Humbert + * + * 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 . + */ + +#include QMK_KEYBOARD_H +#include "muse.h" + + +enum planck_layers { + _QWERTY, + _COLEMAK, + _DVORAK, + _LOWER, + _RAISE, + _PLOVER, + _ADJUST +}; + +enum planck_keycodes { + QWERTY = SAFE_RANGE, + COLEMAK, + DVORAK, + PLOVER, + BACKLIT, + EXT_PLV +}; + +#define LOWER MO(_LOWER) +#define RAISE MO(_RAISE) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* Qwerty + * ,-----------------------------------------------------------------------------------. + * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Esc | A | S | D | F | G | H | J | K | L | ; | " | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_QWERTY] = LAYOUT_planck_grid( + 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 , + BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT +), + +/* Colemak + * ,-----------------------------------------------------------------------------------. + * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Esc | A | R | S | T | D | H | N | E | I | O | " | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | K | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_COLEMAK] = LAYOUT_planck_grid( + 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 , + BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT +), + +/* Dvorak + * ,-----------------------------------------------------------------------------------. + * | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Esc | A | O | E | U | I | D | H | T | N | S | / | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_DVORAK] = LAYOUT_planck_grid( + 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 , + BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT +), + +/* Lower + * ,-----------------------------------------------------------------------------------. + * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | Home | End | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' + */ +[_LOWER] = LAYOUT_planck_grid( + 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_HOME, KC_END, _______, + _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY +), + +/* Raise + * ,-----------------------------------------------------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / |Pg Up |Pg Dn | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' + */ +[_RAISE] = LAYOUT_planck_grid( + 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_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, KC_PGUP, KC_PGDN, _______, + _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY +), + +/* Plover layer (http://opensteno.org) + * ,-----------------------------------------------------------------------------------. + * | # | # | # | # | # | # | # | # | # | # | # | # | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | S | T | P | H | * | * | F | P | L | T | D | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | S | K | W | R | * | * | R | B | G | S | Z | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Exit | | | A | O | | E | U | | | | + * `-----------------------------------------------------------------------------------' + */ +[_PLOVER] = LAYOUT_planck_grid( + 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, XXXXXXX, KC_N, KC_M, XXXXXXX, XXXXXXX, XXXXXXX +), + +/* Adjust (Lower + Raise) + * v------------------------RGB CONTROL--------------------v + * ,-----------------------------------------------------------------------------------. + * | | Reset|Debug | RGB |RGBMOD| HUE+ | HUE- | SAT+ | SAT- |BRGTH+|BRGTH-| Del | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | |MUSmod|Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak|Plover| | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof|TermOn|TermOf| | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[_ADJUST] = LAYOUT_planck_grid( + _______, RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL , + _______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, PLOVER, _______, + _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, TERM_ON, TERM_OFF, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ +) + +}; + +#ifdef AUDIO_ENABLE + float plover_song[][2] = SONG(PLOVER_SOUND); + float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND); +#endif + +layer_state_t layer_state_set_user(layer_state_t state) { + return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + print("mode just switched to qwerty and this is a huge string\n"); + set_single_persistent_default_layer(_QWERTY); + } + return false; + break; + case COLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_COLEMAK); + } + return false; + break; + case DVORAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_DVORAK); + } + return false; + break; + case BACKLIT: + if (record->event.pressed) { + register_code(KC_RSFT); + #ifdef BACKLIGHT_ENABLE + backlight_step(); + #endif + #ifdef KEYBOARD_planck_rev5 + writePinLow(E6); + #endif + } else { + unregister_code(KC_RSFT); + #ifdef KEYBOARD_planck_rev5 + writePinHigh(E6); + #endif + } + 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(); + keymap_config.nkro = 1; + eeconfig_update_keymap(keymap_config.raw); + } + return false; + break; + case EXT_PLV: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_SONG(plover_gb_song); + #endif + layer_off(_PLOVER); + } + return false; + break; + } + return true; +} + +bool muse_mode = false; +uint8_t last_muse_note = 0; +uint16_t muse_counter = 0; +uint8_t muse_offset = 70; +uint16_t muse_tempo = 50; + +bool encoder_update_user(uint8_t index, bool clockwise) { + 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 (clockwise) { + #ifdef MOUSEKEY_ENABLE + tap_code(KC_MS_WH_DOWN); + #else + tap_code(KC_PGDN); + #endif + } else { + #ifdef MOUSEKEY_ENABLE + tap_code(KC_MS_WH_UP); + #else + tap_code(KC_PGUP); + #endif + } + } + return true; +} + +bool dip_switch_update_user(uint8_t index, bool active) { + switch (index) { + case 0: { +#ifdef AUDIO_ENABLE + static bool play_sound = false; +#endif + if (active) { +#ifdef AUDIO_ENABLE + if (play_sound) { PLAY_SONG(plover_song); } +#endif + layer_on(_ADJUST); + } else { +#ifdef AUDIO_ENABLE + if (play_sound) { PLAY_SONG(plover_gb_song); } +#endif + layer_off(_ADJUST); + } +#ifdef AUDIO_ENABLE + play_sound = true; +#endif + break; + } + case 1: + if (active) { + muse_mode = true; + } else { + muse_mode = false; + } + } + return true; +} + +void matrix_scan_user(void) { +#ifdef AUDIO_ENABLE + if (muse_mode) { + if (muse_counter == 0) { + uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()]; + if (muse_note != last_muse_note) { + stop_note(compute_freq_for_midi_note(last_muse_note)); + play_note(compute_freq_for_midi_note(muse_note), 0xF); + last_muse_note = muse_note; + } + } + muse_counter = (muse_counter + 1) % muse_tempo; + } else { + if (muse_counter) { + stop_all_notes(); + muse_counter = 0; + } + } +#endif +} + +bool music_mask_user(uint16_t keycode) { + switch (keycode) { + case RAISE: + case LOWER: + return false; + default: + return true; + } +} diff --git a/keyboards/planck/keymaps/jweickm/rules.mk b/keyboards/planck/keymaps/jweickm/rules.mk index 96e89a0dccc5..4b3192f614c8 100644 --- a/keyboards/planck/keymaps/jweickm/rules.mk +++ b/keyboards/planck/keymaps/jweickm/rules.mk @@ -9,7 +9,7 @@ BOOTLOADER = stm32-dfu # change to "no" to disable the options, or define them in the Makefile in # the appropriate keymap folder that will get included automatically # -BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration +BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite MOUSEKEY_ENABLE = yes # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control CONSOLE_ENABLE = no # Console for debug diff --git a/keyboards/planck/keymaps/jweickm/rules_before_break.mk b/keyboards/planck/keymaps/jweickm/rules_before_break.mk new file mode 100644 index 000000000000..96e89a0dccc5 --- /dev/null +++ b/keyboards/planck/keymaps/jweickm/rules_before_break.mk @@ -0,0 +1,39 @@ +# MCU name +MCU = STM32F303 +BOARD = QMK_PROTON_C + +# Bootloader selection +BOOTLOADER = stm32-dfu + +# Build Options +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration +MOUSEKEY_ENABLE = yes # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +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 +UNICODE_ENABLE = yes # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. +WS2812_DRIVER = pwm +API_SYSEX_ENABLE = no +TAP_DANCE_ENABLE = yes # enable tap dance functionality + +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + +RGB_MATRIX_ENABLE = no +RGB_MATRIX_DRIVER = WS2812 +ENCODER_ENABLE = yes +DIP_SWITCH_ENABLE = yes + +LAYOUTS = ortho_4x12 planck_mit +LAYOUTS_HAS_RGB = no + +SRC += muse.c diff --git a/keyboards/planck/keymaps/jweickm/rules_default.mk b/keyboards/planck/keymaps/jweickm/rules_default.mk new file mode 100644 index 000000000000..acf0896a321b --- /dev/null +++ b/keyboards/planck/keymaps/jweickm/rules_default.mk @@ -0,0 +1 @@ +SRC += muse.c \ No newline at end of file From 51da0b3a9cc1f0b5546ade62550a8989fe230a79 Mon Sep 17 00:00:00 2001 From: Jakob Weickmann Date: Wed, 8 Sep 2021 21:14:06 +0200 Subject: [PATCH 03/31] planck with german overlay --- .../keymaps/jweickm/config_before_break.h | 201 ----- .../planck/keymaps/jweickm/keymap-backup.c | 839 ------------------ keyboards/planck/keymaps/jweickm/keymap.c | 38 +- .../planck/keymaps/jweickm/keymap_default.c | 353 -------- .../keymaps/jweickm/rules_before_break.mk | 39 - .../planck/keymaps/jweickm/rules_default.mk | 1 - 6 files changed, 27 insertions(+), 1444 deletions(-) delete mode 100644 keyboards/planck/keymaps/jweickm/config_before_break.h delete mode 100644 keyboards/planck/keymaps/jweickm/keymap-backup.c delete mode 100644 keyboards/planck/keymaps/jweickm/keymap_default.c delete mode 100644 keyboards/planck/keymaps/jweickm/rules_before_break.mk delete mode 100644 keyboards/planck/keymaps/jweickm/rules_default.mk diff --git a/keyboards/planck/keymaps/jweickm/config_before_break.h b/keyboards/planck/keymaps/jweickm/config_before_break.h deleted file mode 100644 index 010c4bd17334..000000000000 --- a/keyboards/planck/keymaps/jweickm/config_before_break.h +++ /dev/null @@ -1,201 +0,0 @@ -#pragma once -/* - * Copyright 2018 Jack Humbert - * - * 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 . - */ - -#ifndef REV6_CONFIG_H -#define REV6_CONFIG_H - -/* USB Device descriptor parameter */ -#define PRODUCT_ID 0xA4F9 -#define DEVICE_VER 0x0006 - -#undef MATRIX_ROWS -#undef MATRIX_COLS -/* key matrix size */ -#define MATRIX_ROWS 8 -#define MATRIX_COLS 6 - -/* - * Keyboard Matrix Assignments - * - * Change this to how you wired your keyboard - * COLS: AVR pins used for columns, left to right - * ROWS: AVR pins used for rows, top to bottom - * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) - * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) - * -*/ -/* Note: These are not used for arm boards. They're here purely as documentation. */ -#undef MATRIX_ROW_PINS -#undef MATRIX_COL_PINS - -#define MATRIX_ROW_PINS { A10, A9, A8, B15, C13, C14, C15, A2 } -#define MATRIX_COL_PINS { B11, B10, B2, B1, A7, B0 } - -#define UNUSED_PINS - -#define ENCODERS_PAD_A { B12 } -#define ENCODERS_PAD_B { B13 } - -#define DIP_SWITCH_PINS { B14, A15, A0, B9 } - -#define MUSIC_MAP -#undef AUDIO_VOICES -#undef AUDIO_PIN -#define AUDIO_PIN A5 -#define AUDIO_PIN_ALT A4 -#define AUDIO_PIN_ALT_AS_NEGATIVE - -/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ -// #define DEBOUNCE 6 - -/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ -//#define LOCKING_SUPPORT_ENABLE -/* Locking resynchronize hack */ -//#define LOCKING_RESYNC_ENABLE - -/* - * Force NKRO - * - * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved - * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the - * makefile for this to work.) - * - * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) - * until the next keyboard reset. - * - * NKRO may prevent your keystrokes from being detected in the BIOS, but it is - * fully operational during normal computer usage. - * - * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) - * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by - * bootmagic, NKRO mode will always be enabled until it is toggled again during a - * power-up. - * - */ -//#define FORCE_NKRO - -/* - * Feature disable options - * These options are also useful to firmware size reduction. - */ - -/* disable debug print */ -//#define NO_DEBUG - -/* disable print */ -//#define NO_PRINT - -/* disable action features */ -//#define NO_ACTION_LAYER -//#define NO_ACTION_TAPPING -//#define NO_ACTION_ONESHOT -//#define NO_ACTION_MACRO -//#define NO_ACTION_FUNCTION - -/* - * 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 - -/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ -//#define MIDI_TONE_KEYCODE_OCTAVES 1 - - -/* - * WS2812 Underglow Matrix options - */ -#define RGB_DI_PIN A1 -#define RGBLED_NUM 9 -#define DRIVER_LED_TOTAL RGBLED_NUM - -#define WS2812_PWM_DRIVER PWMD2 -#define WS2812_PWM_CHANNEL 2 -#define WS2812_PWM_PAL_MODE 1 -#define WS2812_DMA_STREAM STM32_DMA1_STREAM2 -#define WS2812_DMA_CHANNEL 2 - -#ifndef RGB_DISABLE_WHEN_USB_SUSPENDED -# define RGB_DISABLE_WHEN_USB_SUSPENDED true -#endif - -#endif - -#define RGBLIGHT_LAYERS - -#pragma once - -#ifdef AUDIO_ENABLE - #define STARTUP_SONG SONG(PLANCK_SOUND) - // #define STARTUP_SONG SONG(NO_SOUND) - - #define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \ - SONG(COLEMAK_SOUND), \ - SONG(DVORAK_SOUND), \ - SONG(WORKMAN_SOUND), \ - SONG(PLOVER_SOUND), \ - SONG(STARTUP_SOUND), \ - SONG(PREONIC_SOUND), \ - SONG(GOODBYE_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 - -/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ -//#define MIDI_TONE_KEYCODE_OCTAVES 2 - -// Most tactile encoders have detents every 4 stages -#define ENCODER_RESOLUTION 4 - -//settings for home row mods -#define TAPPING_TERM 160 // 200 ms is the default value -#define TAPPING_TERM_PER_KEY - -//#define PERMISSIVE_HOLD - -#define IGNORE_MOD_TAP_INTERRUPT - -#define TAPPING_FORCE_HOLD_PER_KEY diff --git a/keyboards/planck/keymaps/jweickm/keymap-backup.c b/keyboards/planck/keymaps/jweickm/keymap-backup.c deleted file mode 100644 index b168f5874dd8..000000000000 --- a/keyboards/planck/keymaps/jweickm/keymap-backup.c +++ /dev/null @@ -1,839 +0,0 @@ -/* Copyright 2015-2017 Jack Humbert - * Copyright 2021 Jakob Weickmann - * - * 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 . - */ -#include QMK_KEYBOARD_H -#include "muse.h" -#include "quantum.h" - - -enum planck_layers { - _COLEMAK, - _HRCOLEMAK, - _HRWIDECOLEMAK, - _HRWIDECOLEMAK_DE, - _GAMING, - _WIDECOLEMAK, - _LOWER, - _RAISE, - _LOWER_DE, - _RAISE_DE, - _ADJUST, - _NAV, - _NUM, - _MOUSE, - _PLOVER -}; - -enum planck_keycodes { - COLEMAK = SAFE_RANGE, - HRCOLEMAK, - HRWIDECOLEMAK, - PLOVER, - BACKLIT, - EXT_PLV, - GAMING, - WIDECOLEMAK, - TG_COLEMAK, - VIM_O, - VIM_V, - KC_SVD_BD, - KC_SVU_BU, - KC_TAB_MPLY, - ALT_TAB, - CTL_TAB, - DE_AE, - DE_OE, - DE_UE, - DE_SZ, - DE_EGRAVE, - DE_EAIGU, - KC_CURRENCY, - KC_DE_SWITCH, - LANG_SWITCH, - DE_SLSH_QUST, - DE_QUOT -}; - -// Tap Dance declarations -enum tap_dance_codes{ - TD_PRN, // round brackets (parentheses) - TD_BRC, // square brackets - TD_CBR, // curly brackets - TD_ESC_CAPS, // double tap for caps lock - TD_QUO_BRC, // double function on quotes to enable typing ü in german layout - TD_COMM_SLSH, // comma that doubles as a slash - TD_MPLY, // play/pause, double for next, triple for previous song - TD_Q_TAB // double tap q to register tab -}; - -#define LOWER MO(_LOWER) -#define RAISE MO(_RAISE) - -#define MODS_SHIFT_MASK (MOD_BIT(KC_LSFT)|MOD_BIT(KC_RSFT)) - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - -[_HRWIDECOLEMAK] = LAYOUT_planck_grid( - LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM,KC_B), KC_SVU_BU, LT(_NUM,KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Y), RGUI_T(KC_SCLN), DE_UE, - KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, - LT(_MOUSE,KC_Z), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, LT(_MOUSE,KC_MINS), KC_SLSH, - KC_CAPS, LT(_NUM,KC_TAB), LGUI_T(KC_ESC), LT(_LOWER, KC_BSPC), OSM(MOD_LSFT), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE, KC_DEL), RCTL_T(KC_ENT), KC_LALT, KC_LEFT, KC_RIGHT -), - -[_HRWIDECOLEMAK_DE] = LAYOUT_planck_grid( - LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM,KC_B), KC_SVU_BU, LT(_NUM,KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Z), RGUI_T(KC_SCLN), KC_LBRC, - KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB, KC_M, KC_N, KC_E, KC_I, KC_O, DE_QUOT, - LT(_MOUSE,KC_Y), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, LT(_MOUSE,KC_SLSH), DE_SLSH_QUST, - KC_CAPS, LT(_NUM,KC_TAB), LGUI_T(KC_ESC), LT(_LOWER_DE, KC_BSPC), OSM(MOD_LSFT), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE_DE, KC_DEL), RCTL_T(KC_ENT), KC_LALT, KC_LEFT, KC_RIGHT -), - -[_GAMING] = LAYOUT_planck_grid( - KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_F5, KC_F8, KC_F9, KC_VOLU, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_VOLD, - KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_Z, KC_M, KC_SCLN, KC_ENT, - KC_LCTL, KC_LALT, KC_B, KC_X, KC_C, KC_SPC, KC_SPC, KC_LALT, TG_COLEMAK, KC_TRNS, KC_TRNS, GAMING -), - -/* WIDECOLEMAK - * ,-----------------------------------------------------------------------------------. - * |_NUM(Tab)| Q | W | E | R | T | Y | U | I | O | P | Bksp | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * |CTL(Esc)| A | S | D | F | G | H | J | K | L | ; | " | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | - * `-----------------------------------------------------------------------------------' - */ -[_WIDECOLEMAK] = LAYOUT_planck_grid( - KC_Q, KC_W, KC_F, KC_P, KC_B, KC_SVU_BU, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, DE_UE, - KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB_MPLY, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, - KC_Z, KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, LSFT_T(KC_ENT), - KC_CAPS, LT(_NUM,KC_TAB), LGUI_T(KC_ESC), LT(_LOWER, KC_BSPC), OSM(MOD_LSFT), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE, KC_DEL), TG_COLEMAK, KC_LALT, KC_LEFT, KC_RIGHT -), - -[_LOWER] = LAYOUT_planck_grid( - KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_TILD, KC_CIRC, KC_AMPR, KC_ASTR, TD(TD_PRN), KC_RPRN, DE_AE, - KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, DE_SZ, KC_UNDS, KC_PLUS, TD(TD_CBR), KC_RCBR, KC_PIPE, - KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, KC_SLSH, KC_NUBS, LSFT(KC_NUBS), KC_CURRENCY, DE_EGRAVE, - TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_DOWN, KC_UP -), - -[_LOWER_DE] = LAYOUT_planck_grid( - KC_EXLM, RALT(KC_Q), KC_BSLS, KC_DLR, KC_PERC, RALT(KC_RBRC), KC_GRV, KC_CIRC, KC_RCBR, KC_ASTR, KC_LPRN, KC_QUOT, - KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, DE_SZ, LSFT(KC_SLSH), KC_RBRC, RALT(KC_7), RALT(KC_0), RALT(KC_NUBS), - KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, LSFT(KC_7), KC_NUBS, LSFT(KC_NUBS), KC_CURRENCY, DE_EGRAVE, - TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_DOWN, KC_UP -), - -[_RAISE] = LAYOUT_planck_grid( - KC_1, KC_2, KC_3, KC_4, KC_5, KC_GRV, KC_6, KC_7, KC_8, KC_9, KC_0, DE_OE, - KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, DE_SZ, KC_MINS, KC_EQL, TD(TD_BRC), KC_RBRC, KC_BSLS, - KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, KC_BSLS, KC_COMM, KC_DOT, KC_SLSH, DE_EAIGU, - TG(_MOUSE), KC_TRNS, KC_BSPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_DOWN, KC_UP -), - -[_RAISE_DE] = LAYOUT_planck_grid( - KC_1, KC_2, KC_3, KC_4, KC_5, KC_GRV, KC_6, KC_7, KC_8, KC_9, KC_0, KC_SCLN, - KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, DE_SZ, KC_SLSH, LSFT(KC_0), RALT(KC_8), RALT(KC_9), RALT(KC_MINS), - KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, RALT(KC_MINS), KC_COMM, KC_DOT, KC_SLSH, DE_EAIGU, - TG(_MOUSE), KC_TRNS, KC_BSPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_DOWN, KC_UP -), - -[_ADJUST] = LAYOUT_planck_grid( - LALT(KC_LSFT), RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DE_SWITCH, - LALT(KC_GRV), EEP_RST, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, HRWIDECOLEMAK, WIDECOLEMAK, LCTL(KC_RGHT), LANG_SWITCH, GAMING, - KC_TRNS, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, KC_SVD_BD, KC_MPLY, KC_SVU_BU, KC_TRNS, , - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS -), - -[_NAV] = LAYOUT_planck_grid( - ALT_TAB, LCTL(KC_RGHT), LANG_SWITCH, LALT(KC_GRV), LCTL(KC_LEFT), KC_MNXT, KC_DOWN, KC_RIGHT, KC_PGUP, LCTL(KC_C), KC_NO, KC_DE_SWITCH, - CTL_TAB, KC_TAB, KC_ESC, LT(_NUM,KC_ENT), KC_TAB, KC_MPLY, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_END, VIM_O, - KC_LSFT, KC_NO, LCTL(KC_X), TD(TD_ESC_CAPS), VIM_V, KC_MUTE, KC_HOME, KC_PGDN, KC_NO, KC_NO, LCTL(KC_F), LCTL(KC_F), - KC_NO, KC_NO, KC_NO, KC_TRNS, KC_TRNS, LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), KC_NO, KC_NO, KC_TRNS, KC_NO, KC_NO -), - -[_NUM] = LAYOUT_planck_grid( - KC_F1, KC_F2, KC_F3, KC_F4, KC_MPRV, KC_NLCK, KC_MNXT, KC_P7, KC_P8, KC_P9, KC_PMNS, KC_TRNS, - KC_F5, KC_F6, KC_F7, KC_F8, KC_VOLU, KC_MPLY, KC_BRIU, KC_P4, KC_P5, KC_P6, KC_PPLS, KC_TRNS, - KC_F9,KC_F10,KC_F11,KC_F12, KC_VOLD, KC_MUTE, KC_BRID, KC_P1, KC_P2, KC_P3, KC_PSLS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P0, KC_DOT, KC_COMM, KC_EQL, KC_TRNS -), - -[_MOUSE] = LAYOUT_planck_grid( - KC_NO, KC_NO, KC_BTN4, KC_BTN5, KC_NO, KC_NO, KC_NO, KC_WH_U, KC_MS_U, KC_WH_U, KC_NO, KC_NO, - KC_NO, KC_BTN3, KC_BTN2, KC_BTN1, KC_NO, KC_NO, KC_NO, KC_MS_L, KC_MS_D, KC_MS_R, KC_NO, KC_NO, - KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_WH_D, KC_NO, KC_NO, KC_TRNS, KC_NO, - TG(_MOUSE), KC_NO, KC_NO, KC_TRNS, KC_NO, KC_ACL2, KC_ACL2, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO -) - -}; - -// define the tap dance functions -void dance_prn(qk_tap_dance_state_t *state, void *user_data) { - if (state->count == 1) { - tap_code16(KC_LPRN); - } else { - tap_code16(KC_LPRN); - tap_code16(KC_RPRN); - tap_code(KC_LEFT); - } -} -void dance_brc(qk_tap_dance_state_t *state, void *user_data) { - if (state->count == 1) { - tap_code(KC_LBRC); - } else { - tap_code(KC_LBRC); - tap_code(KC_RBRC); - tap_code(KC_LEFT); - } -} -void dance_cbr(qk_tap_dance_state_t *state, void *user_data) { - if (state->count == 1) { - tap_code16(KC_LCBR); - } else { - tap_code16(KC_LCBR); - tap_code16(KC_RCBR); - tap_code(KC_LEFT); - } -} - -qk_tap_dance_action_t tap_dance_actions[] = { - // declare tap dance actions here - [TD_PRN] = ACTION_TAP_DANCE_FN(dance_prn), - [TD_BRC] = ACTION_TAP_DANCE_FN(dance_brc), - [TD_CBR] = ACTION_TAP_DANCE_FN(dance_cbr), - [TD_MPLY] = ACTION_TAP_DANCE_DOUBLE(KC_MPLY, KC_MNXT), - [TD_ESC_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_ESC, KC_CAPS), - [TD_QUO_BRC] = ACTION_TAP_DANCE_DOUBLE(KC_QUOT, KC_LBRC), - [TD_COMM_SLSH] = ACTION_TAP_DANCE_DOUBLE(KC_COMMA, KC_SLSH), - [TD_Q_TAB] = ACTION_TAP_DANCE_DOUBLE(KC_Q, KC_TAB) -}; - -// TD(TD_ESC_CAPS), LGUI_T(KC_A), LALT_T(KC_R), LSFT_T(KC_S), LCTL_T(KC_T), KC_G, KC_M, RCTL_T(KC_N), RSFT_T(KC_E), LALT_T(KC_I), RGUI_T(KC_O), KC_TRNS, -// define the per_key_tapping_term -uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case TD(TD_ESC_CAPS): - return TAPPING_TERM * 1.5; - case LGUI_T(KC_A): - return TAPPING_TERM * 1.4; - case LGUI_T(KC_Q): - return TAPPING_TERM * 1.1; - case RGUI_T(KC_O): - return TAPPING_TERM * 1.45; - case RGUI_T(KC_SCLN): - return TAPPING_TERM * 1.1; - case LALT_T(KC_R): - return TAPPING_TERM * 1.3; - case LALT_T(KC_W): - return TAPPING_TERM * 1.25; - case LALT_T(KC_I): - return TAPPING_TERM * 1.35; - case LALT_T(KC_Y): - return TAPPING_TERM * 1.25; - case LCTL_T(KC_T): - return TAPPING_TERM * 1.1; - case LCTL_T(KC_P): - return TAPPING_TERM * 1.1; - case RCTL_T(KC_N): - return TAPPING_TERM * 1.1; - case RCTL_T(KC_L): - return TAPPING_TERM * 1.1; - case LSFT_T(KC_S): - return TAPPING_TERM * 1.1; - case LSFT_T(KC_F): - return TAPPING_TERM * 1.2; - case RSFT_T(KC_E): - return TAPPING_TERM * 1.1; - case RSFT_T(KC_U): - return TAPPING_TERM * 1.2; - case LT(_NUM, KC_F): - return TAPPING_TERM * 1.2; - case LT(_NUM, KC_B): - return TAPPING_TERM * 1.1; - case LT(_NUM, KC_J): - return TAPPING_TERM * 1.1; - case LT(_MOUSE, KC_Z): - return TAPPING_TERM * 1.15; - case LT(_MOUSE, KC_SLSH): - return TAPPING_TERM * 1.15; - case TD(TD_QUO_BRC): - return TAPPING_TERM * 1.1; - case TD(TD_Q_TAB): - return TAPPING_TERM * 1.1; - case TD(TD_PRN): - return TAPPING_TERM * 1.4; - case TD(TD_BRC): - return TAPPING_TERM * 1.4; - case TD(TD_CBR): - return TAPPING_TERM * 1.4; - default: - return TAPPING_TERM; - } -} - -#ifdef AUDIO_ENABLE - float plover_song[][2] = SONG(PLOVER_SOUND); - float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND); -#endif - -// alt tab function setup -bool is_alt_tab_active = false; -bool is_ctl_tab_active = false; -bool de_layout_active = false; - -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case COLEMAK: - if (record->event.pressed) { - set_single_persistent_default_layer(_COLEMAK); - } - return false; - break; - case WIDECOLEMAK: - if (record->event.pressed) { - set_single_persistent_default_layer(_WIDECOLEMAK); - } - return false; - break; - case HRCOLEMAK: - if (record->event.pressed) { - set_single_persistent_default_layer(_HRCOLEMAK); - } - return false; - break; - case HRWIDECOLEMAK: - if (record->event.pressed) { - set_single_persistent_default_layer(_HRWIDECOLEMAK); - } - return false; - break; - case GAMING: - if (record->event.pressed) { - layer_invert(_GAMING); - } - return false; - break; - case TG_COLEMAK: - if (record->event.pressed) { - tap_code(KC_ENT); - layer_invert(_WIDECOLEMAK); - } - return false; - break; - case VIM_O: - if (record->event.pressed) { - tap_code(KC_END); - tap_code(KC_ENT); - } - return false; - break; - case VIM_V: - if (record->event.pressed) { - if (get_mods() & MOD_BIT(KC_LSFT)) { - unregister_mods(MOD_LSFT); - } else { - register_mods(MOD_LSFT); - } - } - return false; - break; - case KC_SVU_BU: // increase backlight when pressing shift and vol up - if (record->event.pressed) { - if (get_mods() & MOD_BIT(KC_LSFT) || get_mods() & MOD_BIT(KC_RSFT)) { - register_code(KC_BRIU); - } else if (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTL)){ - register_code(KC_MNXT); - } else { - register_code(KC_VOLU); - } - } else { - unregister_code(KC_BRIU); - unregister_code(KC_MNXT); - unregister_code(KC_VOLU); - } - return false; - case KC_SVD_BD: // decrease backlight when pressing shift and vol up - if (record->event.pressed) { - if (get_mods() & MOD_BIT(KC_LSFT) || get_mods() & MOD_BIT(KC_RSFT)) { - register_code(KC_BRID); - } else if (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTL)){ - register_code(KC_MPRV); - } else { - register_code(KC_VOLD); - } - } else { - unregister_code(KC_BRID); - unregister_code(KC_MPRV); - unregister_code(KC_VOLD); - } - return false; - case KC_TAB_MPLY: // press tab or play/pause when ctrl is pressed - if (record->event.pressed) { - if (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTL)){ - register_code(KC_MPLY); - } else { - register_code(KC_TAB); - } - } else { - unregister_code(KC_MPLY); - unregister_code(KC_TAB); - } - return false; - case ALT_TAB: - if (record->event.pressed) { - if (!is_alt_tab_active) { - is_alt_tab_active = true; - register_mods(MOD_LALT); - } - register_code(KC_TAB); - } else { - unregister_code(KC_TAB); - } - break; - case CTL_TAB: - if (record->event.pressed) { - if (!is_ctl_tab_active) { - is_ctl_tab_active = true; - register_mods(MOD_LCTL); - } - register_code(KC_TAB); - } else { - unregister_code(KC_TAB); - } - break; - // the next case allows us to use alt_tab without a timer - case LT(_NAV,KC_SPC): - if (record->event.pressed) { - } else { - unregister_mods(MOD_LALT); - unregister_mods(MOD_LCTL); - is_alt_tab_active = false; - is_ctl_tab_active = false; - } - break; - case DE_AE: - if (record->event.pressed) { - uint8_t temp_mod = get_mods(); - if (temp_mod & MODS_SHIFT_MASK) { - clear_mods(); - register_mods(MOD_LALT); - tap_code(KC_P0); tap_code(KC_P1); tap_code(KC_P9); tap_code(KC_P6); // Ä - unregister_mods(MOD_LALT); - } else { - clear_mods(); - register_mods(MOD_LALT); - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P2); tap_code(KC_P8); // ä - unregister_mods(MOD_LALT); - } - return false; - } - break; - case DE_OE: - if (record->event.pressed) { - uint8_t temp_mod = get_mods(); - if (temp_mod & MODS_SHIFT_MASK) { - clear_mods(); - register_mods(MOD_LALT); - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P1); tap_code(KC_P4); // Ö - unregister_mods(MOD_LALT); - } else { - clear_mods(); - register_mods(MOD_LALT); - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P4); tap_code(KC_P6); // ö - unregister_mods(MOD_LALT); - } - return false; - } - break; - case DE_UE: - if (record->event.pressed) { - uint8_t temp_mod = get_mods(); - if (temp_mod & MODS_SHIFT_MASK) { - clear_mods(); - register_mods(MOD_LALT); - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P2); tap_code(KC_P0); // Ü - unregister_mods(MOD_LALT); - } else { - clear_mods(); - register_mods(MOD_LALT); - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P5); tap_code(KC_P2); // ü - unregister_mods(MOD_LALT); - } - return false; - } - break; - case KC_DE_SWITCH: - if (record->event.pressed) { - if (de_layout_active) { - de_layout_active = false;// deactivate German overlay - set_single_persistent_default_layer(_HRWIDECOLEMAK); - } else { - de_layout_active = true; // activate German overlay - set_single_persistent_default_layer(_HRWIDECOLEMAK_DE); - } - return false; - } - break; - case LANG_SWITCH: - if (record->event.pressed) { - register_mods(MOD_LALT); - tap_code(KC_LSFT); - unregister_mods(MOD_LALT); - if (de_layout_active) { - de_layout_active = false; // deactivate German overlay - set_single_persistent_default_layer(_HRWIDECOLEMAK); - } else { - de_layout_active = true; // activate German overlay - set_single_persistent_default_layer(_HRWIDECOLEMAK_DE); - } - return false; - } - break; - case DE_SZ: - if (record->event.pressed) { - uint8_t temp_mod = get_mods(); - clear_mods(); - register_mods(MOD_LALT); - if (temp_mod & MODS_SHIFT_MASK) { - tap_code(KC_P0); tap_code(KC_P1); tap_code(KC_P7); tap_code(KC_P6); // ° - } else { - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P2); tap_code(KC_P3); // ß - } - unregister_mods(MOD_LALT); - return false; - } - break; - case DE_EGRAVE: - if (record->event.pressed) { - uint8_t temp_mod = get_mods(); - clear_mods(); - register_mods(MOD_LALT); - if (temp_mod & MODS_SHIFT_MASK) { - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P0); tap_code(KC_P0); // È - } else { - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P3); tap_code(KC_P2); // è - } - unregister_mods(MOD_LALT); - return false; - } - break; - case DE_EAIGU: - if (record->event.pressed) { - uint8_t temp_mod = get_mods(); - clear_mods(); - register_mods(MOD_LALT); - if (temp_mod & MODS_SHIFT_MASK) { - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P0); tap_code(KC_P1); // É - } else { - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P3); tap_code(KC_P3); // é - } - unregister_mods(MOD_LALT); - return false; - } - break; - case KC_CURRENCY: - if (record->event.pressed) { - uint8_t temp_mod = get_mods(); - clear_mods(); - register_mods(MOD_LALT); - if (temp_mod & MODS_SHIFT_MASK) { - tap_code(KC_P1); tap_code(KC_P5); tap_code(KC_P7); // ¥ - } else { - tap_code(KC_P0); tap_code(KC_P1); tap_code(KC_P2); tap_code(KC_P8); // € - } - unregister_mods(MOD_LALT); - return false; - } - break; - case DE_SLSH_QUST: - if (record->event.pressed) { - uint8_t temp_mod = get_mods(); - if (temp_mod & MODS_SHIFT_MASK) { - tap_code(KC_MINS); // ? - } else { - tap_code16(KC_AMPR); // / - } - return false; - } - break; - case DE_QUOT: - if (record->event.pressed) { - uint8_t temp_mod = get_mods(); - if (temp_mod & MODS_SHIFT_MASK) { - tap_code(KC_2); // \" - } else { - tap_code16(KC_PIPE); // /' - } - return false; - } - break; - case BACKLIT: - if (record->event.pressed) { - register_code(KC_RSFT); - #ifdef BACKLIGHT_ENABLE - backlight_step(); - #endif - #ifdef KEYBOARD_planck_rev5 - writePinLow(E6); - #endif - } else { - unregister_code(KC_RSFT); - #ifdef KEYBOARD_planck_rev5 - writePinHigh(E6); - #endif - } - 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(); - keymap_config.nkro = 1; - eeconfig_update_keymap(keymap_config.raw); - } - return false; - break; - case EXT_PLV: - if (record->event.pressed) { - #ifdef AUDIO_ENABLE - PLAY_SONG(plover_gb_song); - #endif - layer_off(_PLOVER); - } - return false; - break; - } - return true; -} - -bool muse_mode = false; -uint8_t last_muse_note = 0; -uint16_t muse_counter = 0; -uint8_t muse_offset = 70; -uint16_t muse_tempo = 50; - -bool encoder_update(bool clockwise) { - 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 (clockwise) { - #ifdef MOUSEKEY_ENABLE - tap_code(KC_MS_WH_DOWN); - #else - tap_code(KC_PGDN); - #endif - } else { - #ifdef MOUSEKEY_ENABLE - tap_code(KC_MS_WH_UP); - #else - tap_code(KC_PGUP); - #endif - } - } - return true; -} - -void dip_switch_update_user(uint8_t index, bool active) { - switch (index) { - case 0: { -#ifdef AUDIO_ENABLE - static bool play_sound = false; -#endif - if (active) { -#ifdef AUDIO_ENABLE - if (play_sound) { PLAY_SONG(plover_song); } -#endif - layer_on(_ADJUST); - } else { -#ifdef AUDIO_ENABLE - if (play_sound) { PLAY_SONG(plover_gb_song); } -#endif - layer_off(_ADJUST); - } -#ifdef AUDIO_ENABLE - play_sound = true; -#endif - break; - } - case 1: - if (active) { - muse_mode = true; - } else { - muse_mode = false; - } - } -} - -void matrix_scan_user(void) { - #ifdef AUDIO_ENABLE - if (muse_mode) { - if (muse_counter == 0) { - uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()]; - if (muse_note != last_muse_note) { - stop_note(compute_freq_for_midi_note(last_muse_note)); - play_note(compute_freq_for_midi_note(muse_note), 0xF); - last_muse_note = muse_note; - } - } - muse_counter = (muse_counter + 1) % muse_tempo; - } else { - if (muse_counter) { - stop_all_notes(); - muse_counter = 0; - } - } -#endif -} - -bool music_mask_user(uint16_t keycode) { - switch (keycode) { - case RAISE: - case LOWER: - return false; - default: - return true; - } -} - -bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case LSFT_T(KC_S): - return true; - case RSFT_T(KC_E): - return true; - case LSFT_T(KC_D): - return true; - case RSFT_T(KC_K): - return true; - case LSFT_T(KC_F): - return true; - case RSFT_T(KC_U): - return true; - default: - return false; - } -} - -// Set RGB to change with layer changes -#define HSV_DARKORANGE 10, 255, 255 -#define HSV_DARKPINK 150, 100, 255 - -// Light LEDs 1 to 9 in darkorange when HRCOLEMAK is active -const rgblight_segment_t PROGMEM my_layer0_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {0, 10, HSV_DARKORANGE} -); -// Light LEDs 1 to 9 in green when HRWIDECOLEMAK is active -const rgblight_segment_t PROGMEM my_layer1_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {0, 10, HSV_CYAN} -); -// Light LEDs 1 to 9 in red when GAMING layer is active -const rgblight_segment_t PROGMEM my_layer2_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {0, 10, HSV_RED} -); -// Light LEDs 1 to 9 in white when WIDECOLEMAK is active -const rgblight_segment_t PROGMEM my_layer3_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {0, 10, HSV_WHITE} -); -// Light bottom LEDs in purple when ADJUST layer is active -const rgblight_segment_t PROGMEM my_layer4_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {0, 2, HSV_PURPLE}, - {7, 3, HSV_PURPLE} -); -// Light LEDs 1 to 9 in darkorange when de_layout_active is true -const rgblight_segment_t PROGMEM my_de_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {3, 4, HSV_DARKORANGE}, - {0, 3, HSV_CYAN}, - {8, 3, HSV_CYAN} -); -// Light bottom LEDs in red when caps lock is active. Hard to ignore! -const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {0, 3, HSV_MAGENTA}, - {7, 3, HSV_MAGENTA} -); -// Light LEDs 1 to 9 in white when NAVIGATION is active -const rgblight_segment_t PROGMEM my_nav_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {0, 10, HSV_WHITE} -); - -// Now define the array of layers. Later layers take precedence -const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST( - my_layer0_layer, // hrcolemak - my_layer1_layer, // hrwidecolemak - my_layer2_layer, // gaming - my_layer3_layer, // widecolemak - my_layer4_layer, // adjust - my_nav_layer, // nav - my_de_layer, // de_layout - my_capslock_layer // capslock -); - -void keyboard_post_init_user(void) { - // Enable the LED layers - rgblight_layers = my_rgb_layers; -} - -bool led_update_user(led_t led_state) { - rgblight_set_layer_state(7, led_state.caps_lock); - return true; -} - -layer_state_t layer_state_set_user(layer_state_t state) { - rgblight_set_layer_state(2, layer_state_cmp(state, _GAMING)); - rgblight_set_layer_state(3, layer_state_cmp(state, _WIDECOLEMAK)); - if ( - ( layer_state_cmp(state, _LOWER) && layer_state_cmp(state, _RAISE ) ) || - ( layer_state_cmp(state, _LOWER_DE) && layer_state_cmp(state, _RAISE_DE ) ) ) { - return state | (1UL<<_ADJUST); - } else { - return state & ~(1UL<<_ADJUST); - } - // state = update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); - rgblight_set_layer_state(4, layer_state_cmp(state, _ADJUST)); - //return state; -} - -layer_state_t default_layer_state_set_user(layer_state_t state) { - rgblight_set_layer_state(3, layer_state_cmp(state, _WIDECOLEMAK)); - rgblight_set_layer_state(1, layer_state_cmp(state, _HRWIDECOLEMAK)); - rgblight_set_layer_state(6, layer_state_cmp(state, _HRWIDECOLEMAK_DE)); - return state; -} - diff --git a/keyboards/planck/keymaps/jweickm/keymap.c b/keyboards/planck/keymaps/jweickm/keymap.c index fb1ab7d8f9a9..e9c011a608b8 100644 --- a/keyboards/planck/keymaps/jweickm/keymap.c +++ b/keyboards/planck/keymaps/jweickm/keymap.c @@ -61,7 +61,8 @@ enum planck_keycodes { KC_DE_SWITCH, LANG_SWITCH, DE_SLSH_QUST, - DE_QUOT + DE_QUOT, + DE_SCLN }; // Tap Dance declarations @@ -84,17 +85,17 @@ enum tap_dance_codes{ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_HRWIDECOLEMAK] = LAYOUT_planck_grid( - LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM,KC_B), KC_SVU_BU, LT(_NUM,KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Y), RGUI_T(KC_SCLN), DE_UE, + LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM,KC_B), KC_SVU_BU, LT(_NUM,KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Y), RGUI_T(KC_SCLN), DE_UE, KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, LT(_MOUSE,KC_Z), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, LT(_MOUSE,KC_MINS), KC_SLSH, - KC_CAPS, LT(_NUM,KC_TAB), LGUI_T(KC_ESC), LT(_LOWER, KC_BSPC), OSM(MOD_LSFT), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE, KC_DEL), RCTL_T(KC_ENT), KC_LALT, KC_LEFT, KC_RIGHT + LCTL_T(KC_CAPS), LT(_NUM,KC_TAB), LGUI_T(KC_ESC), LT(_LOWER, KC_BSPC), OSM(MOD_LSFT), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE, KC_DEL), RCTL_T(KC_ENT), KC_LALT, LT(_NAV,KC_LEFT), LT(_NAV,KC_RIGHT) ), [_HRWIDECOLEMAK_DE] = LAYOUT_planck_grid( - LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM,KC_B), KC_SVU_BU, LT(_NUM,KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Z), RGUI_T(KC_SCLN), KC_LBRC, + LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM,KC_B), KC_SVU_BU, LT(_NUM,KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Z), DE_SCLN, RGUI_T(KC_LBRC), KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB, KC_M, KC_N, KC_E, KC_I, KC_O, DE_QUOT, LT(_MOUSE,KC_Y), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, LT(_MOUSE,KC_SLSH), DE_SLSH_QUST, - KC_CAPS, LT(_NUM,KC_TAB), LGUI_T(KC_ESC), LT(_LOWER_DE, KC_BSPC), OSM(MOD_LSFT), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE_DE, KC_DEL), RCTL_T(KC_ENT), KC_LALT, KC_LEFT, KC_RIGHT + LCTL_T(KC_CAPS), LT(_NUM,KC_TAB), LGUI_T(KC_ESC), LT(_LOWER_DE, KC_BSPC), OSM(MOD_LSFT), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE_DE, KC_DEL), RCTL_T(KC_ENT), KC_LALT, LT(_NAV,KC_LEFT), LT(_NAV,KC_RIGHT) ), [_GAMING] = LAYOUT_planck_grid( @@ -132,7 +133,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_LOWER_DE] = LAYOUT_planck_grid( KC_EXLM, RALT(KC_Q), KC_BSLS, KC_DLR, KC_PERC, RALT(KC_RBRC), KC_GRV, KC_CIRC, KC_RCBR, KC_ASTR, KC_LPRN, KC_QUOT, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, DE_SZ, LSFT(KC_SLSH), KC_RBRC, RALT(KC_7), RALT(KC_0), RALT(KC_NUBS), - KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, LSFT(KC_7), KC_NUBS, LSFT(KC_NUBS), KC_CURRENCY, DE_EGRAVE, + KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, LSFT(KC_7), KC_NUBS, LSFT(KC_NUBS), KC_CURRENCY, KC_PLUS, TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_DOWN, KC_UP ), @@ -144,9 +145,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), [_RAISE_DE] = LAYOUT_planck_grid( - KC_1, KC_2, KC_3, KC_4, KC_5, KC_GRV, KC_6, KC_7, KC_8, KC_9, KC_0, KC_SCLN, + KC_1, KC_2, KC_3, KC_4, KC_5, LSFT(KC_GRV), KC_6, KC_7, KC_8, KC_9, KC_0, KC_SCLN, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, DE_SZ, KC_SLSH, LSFT(KC_0), RALT(KC_8), RALT(KC_9), RALT(KC_MINS), - KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, RALT(KC_MINS), KC_COMM, KC_DOT, KC_SLSH, DE_EAIGU, + KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, RALT(KC_MINS), KC_COMM, KC_DOT, KC_SLSH, KC_EQL, TG(_MOUSE), KC_TRNS, KC_BSPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_DOWN, KC_UP ), @@ -158,10 +159,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), [_NAV] = LAYOUT_planck_grid( - ALT_TAB, LCTL(KC_RGHT), LANG_SWITCH, LALT(KC_GRV), LCTL(KC_LEFT), KC_MNXT, KC_DOWN, KC_RIGHT, KC_PGUP, LCTL(KC_C), KC_NO, KC_DE_SWITCH, + ALT_TAB, LCTL(KC_RGHT), LANG_SWITCH, LALT(KC_GRV), LCTL(KC_LEFT), KC_MNXT, KC_DOWN, KC_RIGHT, KC_PGUP, LCTL(KC_C), KC_RGUI, KC_DE_SWITCH, CTL_TAB, KC_TAB, KC_ESC, LT(_NUM,KC_ENT), KC_TAB, KC_MPLY, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_END, VIM_O, - KC_LSFT, KC_NO, LCTL(KC_X), TD(TD_ESC_CAPS), VIM_V, KC_MUTE, KC_HOME, KC_PGDN, KC_NO, KC_NO, LCTL(KC_F), LCTL(KC_F), - KC_NO, KC_NO, KC_NO, KC_TRNS, KC_TRNS, LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), KC_NO, KC_NO, KC_TRNS, KC_NO, KC_NO + KC_LSFT, KC_NO, LCTL(KC_X), KC_CAPS, VIM_V, KC_MUTE, KC_HOME, KC_PGDN, KC_LSFT, KC_RSFT, LCTL(KC_F), LCTL(KC_F), + KC_NO, KC_NO, KC_NO, KC_TRNS, KC_TRNS, LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), KC_NO, KC_NO, KC_TRNS, KC_DOWN, KC_UP ), [_NUM] = LAYOUT_planck_grid( @@ -235,6 +236,8 @@ uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { return TAPPING_TERM * 1.45; case RGUI_T(KC_SCLN): return TAPPING_TERM * 1.1; + case RGUI_T(KC_LBRC): + return TAPPING_TERM * 1.1; case LALT_T(KC_R): return TAPPING_TERM * 1.3; case LALT_T(KC_W): @@ -568,6 +571,19 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return false; } break; + case DE_SCLN: + if (record->event.pressed) { + uint8_t temp_mod = get_mods(); + if (temp_mod & MODS_SHIFT_MASK) { + tap_code(KC_DOT); // ; + } else { + register_mods(MOD_LSFT); + tap_code(KC_COMM); // : + unregister_mods(MOD_LSFT); + } + return false; + } + break; case BACKLIT: if (record->event.pressed) { register_code(KC_RSFT); diff --git a/keyboards/planck/keymaps/jweickm/keymap_default.c b/keyboards/planck/keymaps/jweickm/keymap_default.c deleted file mode 100644 index 9a6e1189b690..000000000000 --- a/keyboards/planck/keymaps/jweickm/keymap_default.c +++ /dev/null @@ -1,353 +0,0 @@ -/* Copyright 2015-2017 Jack Humbert - * - * 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 . - */ - -#include QMK_KEYBOARD_H -#include "muse.h" - - -enum planck_layers { - _QWERTY, - _COLEMAK, - _DVORAK, - _LOWER, - _RAISE, - _PLOVER, - _ADJUST -}; - -enum planck_keycodes { - QWERTY = SAFE_RANGE, - COLEMAK, - DVORAK, - PLOVER, - BACKLIT, - EXT_PLV -}; - -#define LOWER MO(_LOWER) -#define RAISE MO(_RAISE) - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - -/* Qwerty - * ,-----------------------------------------------------------------------------------. - * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Esc | A | S | D | F | G | H | J | K | L | ; | " | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | - * `-----------------------------------------------------------------------------------' - */ -[_QWERTY] = LAYOUT_planck_grid( - 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 , - BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT -), - -/* Colemak - * ,-----------------------------------------------------------------------------------. - * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Esc | A | R | S | T | D | H | N | E | I | O | " | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Shift| Z | X | C | V | B | K | M | , | . | / |Enter | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | - * `-----------------------------------------------------------------------------------' - */ -[_COLEMAK] = LAYOUT_planck_grid( - 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 , - BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT -), - -/* Dvorak - * ,-----------------------------------------------------------------------------------. - * | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Esc | A | O | E | U | I | D | H | T | N | S | / | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | - * `-----------------------------------------------------------------------------------' - */ -[_DVORAK] = LAYOUT_planck_grid( - 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 , - BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT -), - -/* Lower - * ,-----------------------------------------------------------------------------------. - * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | Home | End | | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | | | | | | | Next | Vol- | Vol+ | Play | - * `-----------------------------------------------------------------------------------' - */ -[_LOWER] = LAYOUT_planck_grid( - 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_HOME, KC_END, _______, - _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY -), - -/* Raise - * ,-----------------------------------------------------------------------------------. - * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / |Pg Up |Pg Dn | | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | | | | | | | Next | Vol- | Vol+ | Play | - * `-----------------------------------------------------------------------------------' - */ -[_RAISE] = LAYOUT_planck_grid( - 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_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, KC_PGUP, KC_PGDN, _______, - _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY -), - -/* Plover layer (http://opensteno.org) - * ,-----------------------------------------------------------------------------------. - * | # | # | # | # | # | # | # | # | # | # | # | # | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | S | T | P | H | * | * | F | P | L | T | D | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | S | K | W | R | * | * | R | B | G | S | Z | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Exit | | | A | O | | E | U | | | | - * `-----------------------------------------------------------------------------------' - */ -[_PLOVER] = LAYOUT_planck_grid( - 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, XXXXXXX, KC_N, KC_M, XXXXXXX, XXXXXXX, XXXXXXX -), - -/* Adjust (Lower + Raise) - * v------------------------RGB CONTROL--------------------v - * ,-----------------------------------------------------------------------------------. - * | | Reset|Debug | RGB |RGBMOD| HUE+ | HUE- | SAT+ | SAT- |BRGTH+|BRGTH-| Del | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | |MUSmod|Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak|Plover| | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof|TermOn|TermOf| | | | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | | | | | | | | | | | - * `-----------------------------------------------------------------------------------' - */ -[_ADJUST] = LAYOUT_planck_grid( - _______, RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL , - _______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, PLOVER, _______, - _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, TERM_ON, TERM_OFF, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ -) - -}; - -#ifdef AUDIO_ENABLE - float plover_song[][2] = SONG(PLOVER_SOUND); - float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND); -#endif - -layer_state_t layer_state_set_user(layer_state_t state) { - return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); -} - -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case QWERTY: - if (record->event.pressed) { - print("mode just switched to qwerty and this is a huge string\n"); - set_single_persistent_default_layer(_QWERTY); - } - return false; - break; - case COLEMAK: - if (record->event.pressed) { - set_single_persistent_default_layer(_COLEMAK); - } - return false; - break; - case DVORAK: - if (record->event.pressed) { - set_single_persistent_default_layer(_DVORAK); - } - return false; - break; - case BACKLIT: - if (record->event.pressed) { - register_code(KC_RSFT); - #ifdef BACKLIGHT_ENABLE - backlight_step(); - #endif - #ifdef KEYBOARD_planck_rev5 - writePinLow(E6); - #endif - } else { - unregister_code(KC_RSFT); - #ifdef KEYBOARD_planck_rev5 - writePinHigh(E6); - #endif - } - 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(); - keymap_config.nkro = 1; - eeconfig_update_keymap(keymap_config.raw); - } - return false; - break; - case EXT_PLV: - if (record->event.pressed) { - #ifdef AUDIO_ENABLE - PLAY_SONG(plover_gb_song); - #endif - layer_off(_PLOVER); - } - return false; - break; - } - return true; -} - -bool muse_mode = false; -uint8_t last_muse_note = 0; -uint16_t muse_counter = 0; -uint8_t muse_offset = 70; -uint16_t muse_tempo = 50; - -bool encoder_update_user(uint8_t index, bool clockwise) { - 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 (clockwise) { - #ifdef MOUSEKEY_ENABLE - tap_code(KC_MS_WH_DOWN); - #else - tap_code(KC_PGDN); - #endif - } else { - #ifdef MOUSEKEY_ENABLE - tap_code(KC_MS_WH_UP); - #else - tap_code(KC_PGUP); - #endif - } - } - return true; -} - -bool dip_switch_update_user(uint8_t index, bool active) { - switch (index) { - case 0: { -#ifdef AUDIO_ENABLE - static bool play_sound = false; -#endif - if (active) { -#ifdef AUDIO_ENABLE - if (play_sound) { PLAY_SONG(plover_song); } -#endif - layer_on(_ADJUST); - } else { -#ifdef AUDIO_ENABLE - if (play_sound) { PLAY_SONG(plover_gb_song); } -#endif - layer_off(_ADJUST); - } -#ifdef AUDIO_ENABLE - play_sound = true; -#endif - break; - } - case 1: - if (active) { - muse_mode = true; - } else { - muse_mode = false; - } - } - return true; -} - -void matrix_scan_user(void) { -#ifdef AUDIO_ENABLE - if (muse_mode) { - if (muse_counter == 0) { - uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()]; - if (muse_note != last_muse_note) { - stop_note(compute_freq_for_midi_note(last_muse_note)); - play_note(compute_freq_for_midi_note(muse_note), 0xF); - last_muse_note = muse_note; - } - } - muse_counter = (muse_counter + 1) % muse_tempo; - } else { - if (muse_counter) { - stop_all_notes(); - muse_counter = 0; - } - } -#endif -} - -bool music_mask_user(uint16_t keycode) { - switch (keycode) { - case RAISE: - case LOWER: - return false; - default: - return true; - } -} diff --git a/keyboards/planck/keymaps/jweickm/rules_before_break.mk b/keyboards/planck/keymaps/jweickm/rules_before_break.mk deleted file mode 100644 index 96e89a0dccc5..000000000000 --- a/keyboards/planck/keymaps/jweickm/rules_before_break.mk +++ /dev/null @@ -1,39 +0,0 @@ -# MCU name -MCU = STM32F303 -BOARD = QMK_PROTON_C - -# Bootloader selection -BOOTLOADER = stm32-dfu - -# Build Options -# change to "no" to disable the options, or define them in the Makefile in -# the appropriate keymap folder that will get included automatically -# -BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration -MOUSEKEY_ENABLE = yes # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = no # Console for debug -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 -UNICODE_ENABLE = yes # Unicode -BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID -RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. -WS2812_DRIVER = pwm -API_SYSEX_ENABLE = no -TAP_DANCE_ENABLE = yes # enable tap dance functionality - -# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE -SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend - -RGB_MATRIX_ENABLE = no -RGB_MATRIX_DRIVER = WS2812 -ENCODER_ENABLE = yes -DIP_SWITCH_ENABLE = yes - -LAYOUTS = ortho_4x12 planck_mit -LAYOUTS_HAS_RGB = no - -SRC += muse.c diff --git a/keyboards/planck/keymaps/jweickm/rules_default.mk b/keyboards/planck/keymaps/jweickm/rules_default.mk deleted file mode 100644 index acf0896a321b..000000000000 --- a/keyboards/planck/keymaps/jweickm/rules_default.mk +++ /dev/null @@ -1 +0,0 @@ -SRC += muse.c \ No newline at end of file From 51ec6f2612c0f1695d7adcabd4f98e0f4172c28d Mon Sep 17 00:00:00 2001 From: Jakob Weickmann Date: Wed, 8 Sep 2021 22:40:04 +0200 Subject: [PATCH 04/31] Update keymap.c --- keyboards/planck/keymaps/jweickm/keymap.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/keyboards/planck/keymaps/jweickm/keymap.c b/keyboards/planck/keymaps/jweickm/keymap.c index e9c011a608b8..2a09bb138709 100644 --- a/keyboards/planck/keymaps/jweickm/keymap.c +++ b/keyboards/planck/keymaps/jweickm/keymap.c @@ -780,7 +780,7 @@ const rgblight_segment_t PROGMEM my_layer4_layer[] = RGBLIGHT_LAYER_SEGMENTS( {7, 3, HSV_PURPLE} ); // Light LEDs 1 to 9 in darkorange when de_layout_active is true -const rgblight_segment_t PROGMEM my_de_layer[] = RGBLIGHT_LAYER_SEGMENTS( +const rgblight_segment_t PROGMEM my_layer5_layer[] = RGBLIGHT_LAYER_SEGMENTS( {3, 4, HSV_DARKORANGE}, {0, 3, HSV_CYAN}, {8, 3, HSV_CYAN} @@ -799,11 +799,11 @@ const rgblight_segment_t PROGMEM my_nav_layer[] = RGBLIGHT_LAYER_SEGMENTS( const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST( my_layer0_layer, // hrcolemak my_layer1_layer, // hrwidecolemak - my_layer2_layer, // gaming - my_layer3_layer, // widecolemak - my_layer4_layer, // adjust + my_layer2_layer, // de_layout + my_layer3_layer, // gaming + my_layer4_layer, // widecolemak + my_layer5_layer, // adjust my_nav_layer, // nav - my_de_layer, // de_layout my_capslock_layer // capslock ); @@ -818,8 +818,8 @@ bool led_update_user(led_t led_state) { } layer_state_t layer_state_set_user(layer_state_t state) { - rgblight_set_layer_state(2, layer_state_cmp(state, _GAMING)); - rgblight_set_layer_state(3, layer_state_cmp(state, _WIDECOLEMAK)); + rgblight_set_layer_state(3, layer_state_cmp(state, _GAMING)); + rgblight_set_layer_state(4, layer_state_cmp(state, _WIDECOLEMAK)); if ( ( layer_state_cmp(state, _LOWER) && layer_state_cmp(state, _RAISE ) ) || ( layer_state_cmp(state, _LOWER_DE) && layer_state_cmp(state, _RAISE_DE ) ) ) { @@ -828,14 +828,14 @@ layer_state_t layer_state_set_user(layer_state_t state) { return state & ~(1UL<<_ADJUST); } // state = update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); - rgblight_set_layer_state(4, layer_state_cmp(state, _ADJUST)); + rgblight_set_layer_state(5, layer_state_cmp(state, _ADJUST)); //return state; } layer_state_t default_layer_state_set_user(layer_state_t state) { - rgblight_set_layer_state(3, layer_state_cmp(state, _WIDECOLEMAK)); + rgblight_set_layer_state(4, layer_state_cmp(state, _WIDECOLEMAK)); rgblight_set_layer_state(1, layer_state_cmp(state, _HRWIDECOLEMAK)); - rgblight_set_layer_state(6, layer_state_cmp(state, _HRWIDECOLEMAK_DE)); + rgblight_set_layer_state(2, layer_state_cmp(state, _HRWIDECOLEMAK_DE)); return state; } From ed2e92b349d40622abc4f6b6795186b399cfaeec Mon Sep 17 00:00:00 2001 From: Jakob Weickmann Date: Wed, 8 Sep 2021 22:48:47 +0200 Subject: [PATCH 05/31] Update keymap.c --- keyboards/planck/keymaps/jweickm/keymap.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/keyboards/planck/keymaps/jweickm/keymap.c b/keyboards/planck/keymaps/jweickm/keymap.c index 2a09bb138709..66e2103bb9b6 100644 --- a/keyboards/planck/keymaps/jweickm/keymap.c +++ b/keyboards/planck/keymaps/jweickm/keymap.c @@ -766,25 +766,25 @@ const rgblight_segment_t PROGMEM my_layer0_layer[] = RGBLIGHT_LAYER_SEGMENTS( const rgblight_segment_t PROGMEM my_layer1_layer[] = RGBLIGHT_LAYER_SEGMENTS( {0, 10, HSV_CYAN} ); -// Light LEDs 1 to 9 in red when GAMING layer is active +// Light LEDs 1 to 9 in darkorange when de_layout_active is true const rgblight_segment_t PROGMEM my_layer2_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {3, 4, HSV_DARKORANGE}, + {0, 3, HSV_CYAN}, + {8, 3, HSV_CYAN} +); +// Light LEDs 1 to 9 in red when GAMING layer is active +const rgblight_segment_t PROGMEM my_layer3_layer[] = RGBLIGHT_LAYER_SEGMENTS( {0, 10, HSV_RED} ); // Light LEDs 1 to 9 in white when WIDECOLEMAK is active -const rgblight_segment_t PROGMEM my_layer3_layer[] = RGBLIGHT_LAYER_SEGMENTS( +const rgblight_segment_t PROGMEM my_layer4_layer[] = RGBLIGHT_LAYER_SEGMENTS( {0, 10, HSV_WHITE} ); // Light bottom LEDs in purple when ADJUST layer is active -const rgblight_segment_t PROGMEM my_layer4_layer[] = RGBLIGHT_LAYER_SEGMENTS( +const rgblight_segment_t PROGMEM my_layer5_layer[] = RGBLIGHT_LAYER_SEGMENTS( {0, 2, HSV_PURPLE}, {7, 3, HSV_PURPLE} ); -// Light LEDs 1 to 9 in darkorange when de_layout_active is true -const rgblight_segment_t PROGMEM my_layer5_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {3, 4, HSV_DARKORANGE}, - {0, 3, HSV_CYAN}, - {8, 3, HSV_CYAN} -); // Light bottom LEDs in red when caps lock is active. Hard to ignore! const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS( {0, 3, HSV_MAGENTA}, From d64800a8d2835e5ca5891a88a32339988dfa01d5 Mon Sep 17 00:00:00 2001 From: Jakob Weickmann Date: Thu, 9 Sep 2021 12:46:40 +0200 Subject: [PATCH 06/31] Update keymap.c - change layout of the thumb row - include variables to control tapping term grouped by finger - cleaned tapping term area - removed alt codes from German overlay --- keyboards/planck/keymaps/jweickm/keymap.c | 133 +++++++++++++--------- 1 file changed, 77 insertions(+), 56 deletions(-) diff --git a/keyboards/planck/keymaps/jweickm/keymap.c b/keyboards/planck/keymaps/jweickm/keymap.c index 66e2103bb9b6..0e11ce5ef1bc 100644 --- a/keyboards/planck/keymaps/jweickm/keymap.c +++ b/keyboards/planck/keymaps/jweickm/keymap.c @@ -74,7 +74,8 @@ enum tap_dance_codes{ TD_QUO_BRC, // double function on quotes to enable typing ü in german layout TD_COMM_SLSH, // comma that doubles as a slash TD_MPLY, // play/pause, double for next, triple for previous song - TD_Q_TAB // double tap q to register tab + TD_Q_TAB, // double tap q to register tab + TD_VIM_GG // single tap to scroll down, double tap to scroll up }; #define LOWER MO(_LOWER) @@ -88,21 +89,21 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM,KC_B), KC_SVU_BU, LT(_NUM,KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Y), RGUI_T(KC_SCLN), DE_UE, KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, LT(_MOUSE,KC_Z), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, LT(_MOUSE,KC_MINS), KC_SLSH, - LCTL_T(KC_CAPS), LT(_NUM,KC_TAB), LGUI_T(KC_ESC), LT(_LOWER, KC_BSPC), OSM(MOD_LSFT), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE, KC_DEL), RCTL_T(KC_ENT), KC_LALT, LT(_NAV,KC_LEFT), LT(_NAV,KC_RIGHT) + LCTL_T(KC_CAPS), LGUI_T(KC_TAB), LALT_T(KC_ESC), LT(_LOWER, KC_BSPC), OSM(MOD_LSFT), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE, KC_ENT), RSFT_T(KC_DEL), RCTL_T(KC_TAB), LT(_NAV,KC_LEFT), LT(_NAV,KC_RIGHT) ), [_HRWIDECOLEMAK_DE] = LAYOUT_planck_grid( LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM,KC_B), KC_SVU_BU, LT(_NUM,KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Z), DE_SCLN, RGUI_T(KC_LBRC), KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB, KC_M, KC_N, KC_E, KC_I, KC_O, DE_QUOT, LT(_MOUSE,KC_Y), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, LT(_MOUSE,KC_SLSH), DE_SLSH_QUST, - LCTL_T(KC_CAPS), LT(_NUM,KC_TAB), LGUI_T(KC_ESC), LT(_LOWER_DE, KC_BSPC), OSM(MOD_LSFT), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE_DE, KC_DEL), RCTL_T(KC_ENT), KC_LALT, LT(_NAV,KC_LEFT), LT(_NAV,KC_RIGHT) + LCTL_T(KC_CAPS), LGUI_T(KC_TAB), LALT_T(KC_ESC), LT(_LOWER_DE, KC_BSPC), OSM(MOD_LSFT), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE_DE, KC_ENT), RSFT_T(KC_DEL), RCTL_T(KC_TAB), LT(_NAV,KC_LEFT), LT(_NAV,KC_RIGHT) ), [_GAMING] = LAYOUT_planck_grid( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_F5, KC_F8, KC_F9, KC_VOLU, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_VOLD, KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_Z, KC_M, KC_SCLN, KC_ENT, - KC_LCTL, KC_LALT, KC_B, KC_X, KC_C, KC_SPC, KC_SPC, KC_LALT, TG_COLEMAK, KC_TRNS, KC_TRNS, GAMING + KC_LCTL, KC_LALT, KC_B, KC_X, KC_C, KC_SPC, KC_SPC, TG_COLEMAK, KC_LALT, KC_TRNS, KC_TRNS, GAMING ), /* WIDECOLEMAK @@ -132,7 +133,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_LOWER_DE] = LAYOUT_planck_grid( KC_EXLM, RALT(KC_Q), KC_BSLS, KC_DLR, KC_PERC, RALT(KC_RBRC), KC_GRV, KC_CIRC, KC_RCBR, KC_ASTR, KC_LPRN, KC_QUOT, - KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, DE_SZ, LSFT(KC_SLSH), KC_RBRC, RALT(KC_7), RALT(KC_0), RALT(KC_NUBS), + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, LSFT(KC_SLSH), KC_RBRC, RALT(KC_7), RALT(KC_0), RALT(KC_NUBS), KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, LSFT(KC_7), KC_NUBS, LSFT(KC_NUBS), KC_CURRENCY, KC_PLUS, TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_DOWN, KC_UP ), @@ -146,7 +147,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_RAISE_DE] = LAYOUT_planck_grid( KC_1, KC_2, KC_3, KC_4, KC_5, LSFT(KC_GRV), KC_6, KC_7, KC_8, KC_9, KC_0, KC_SCLN, - KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, DE_SZ, KC_SLSH, LSFT(KC_0), RALT(KC_8), RALT(KC_9), RALT(KC_MINS), + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_SLSH, LSFT(KC_0), RALT(KC_8), RALT(KC_9), RALT(KC_MINS), KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, RALT(KC_MINS), KC_COMM, KC_DOT, KC_SLSH, KC_EQL, TG(_MOUSE), KC_TRNS, KC_BSPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_DOWN, KC_UP ), @@ -160,7 +161,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_NAV] = LAYOUT_planck_grid( ALT_TAB, LCTL(KC_RGHT), LANG_SWITCH, LALT(KC_GRV), LCTL(KC_LEFT), KC_MNXT, KC_DOWN, KC_RIGHT, KC_PGUP, LCTL(KC_C), KC_RGUI, KC_DE_SWITCH, - CTL_TAB, KC_TAB, KC_ESC, LT(_NUM,KC_ENT), KC_TAB, KC_MPLY, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_END, VIM_O, + CTL_TAB, KC_TAB, KC_ESC, LT(_NUM,KC_ENT), TD_VIM_GG, KC_MPLY, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_END, VIM_O, KC_LSFT, KC_NO, LCTL(KC_X), KC_CAPS, VIM_V, KC_MUTE, KC_HOME, KC_PGDN, KC_LSFT, KC_RSFT, LCTL(KC_F), LCTL(KC_F), KC_NO, KC_NO, KC_NO, KC_TRNS, KC_TRNS, LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), KC_NO, KC_NO, KC_TRNS, KC_DOWN, KC_UP ), @@ -219,69 +220,88 @@ qk_tap_dance_action_t tap_dance_actions[] = { [TD_ESC_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_ESC, KC_CAPS), [TD_QUO_BRC] = ACTION_TAP_DANCE_DOUBLE(KC_QUOT, KC_LBRC), [TD_COMM_SLSH] = ACTION_TAP_DANCE_DOUBLE(KC_COMMA, KC_SLSH), - [TD_Q_TAB] = ACTION_TAP_DANCE_DOUBLE(KC_Q, KC_TAB) + [TD_Q_TAB] = ACTION_TAP_DANCE_DOUBLE(KC_Q, KC_TAB), + [TD_VIM_GG] = ACTION_TAP_DANCE_DOUBLE(KC_PGDN, KC_PGUP) }; -// TD(TD_ESC_CAPS), LGUI_T(KC_A), LALT_T(KC_R), LSFT_T(KC_S), LCTL_T(KC_T), KC_G, KC_M, RCTL_T(KC_N), RSFT_T(KC_E), LALT_T(KC_I), RGUI_T(KC_O), KC_TRNS, +float thumb_factor = 0.95; +float index_factor = 1.1; +float middle_factor = 1.2; +float ring_factor = 1.25; +float pinky_factor = 1.15; +float td_factor = 1.4; + // define the per_key_tapping_term uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { switch (keycode) { - case TD(TD_ESC_CAPS): - return TAPPING_TERM * 1.5; - case LGUI_T(KC_A): - return TAPPING_TERM * 1.4; - case LGUI_T(KC_Q): - return TAPPING_TERM * 1.1; - case RGUI_T(KC_O): - return TAPPING_TERM * 1.45; - case RGUI_T(KC_SCLN): - return TAPPING_TERM * 1.1; - case RGUI_T(KC_LBRC): - return TAPPING_TERM * 1.1; - case LALT_T(KC_R): - return TAPPING_TERM * 1.3; - case LALT_T(KC_W): - return TAPPING_TERM * 1.25; - case LALT_T(KC_I): - return TAPPING_TERM * 1.35; - case LALT_T(KC_Y): - return TAPPING_TERM * 1.25; - case LCTL_T(KC_T): - return TAPPING_TERM * 1.1; + // thumb keys + case RSFT_T(KC_DEL): + return TAPPING_TERM * thumb_factor; + case RCTL_T(KC_TAB): + return TAPPING_TERM * thumb_factor; + case LT(_NAV,KC_LEFT): + return TAPPING_TERM * thumb_factor; + case LT(_NAV,KC_RIGHT): + return TAPPING_TERM * thumb_factor; + case LT(_LOWER,KC_BSPC): + return TAPPING_TERM * thumb_factor; + case LT(_LOWER_DE,KC_BSPC): + return TAPPING_TERM * thumb_factor; + case LT(_RAISE,KC_ENT): + return TAPPING_TERM * thumb_factor; + case LT(_RAISE_DE,KC_ENT): + return TAPPING_TERM * thumb_factor; + case LT(_NAV,KC_SPC): + return TAPPING_TERM * thumb_factor; + case LALT_T(KC_ESC): + return TAPPING_TERM * thumb_factor; + + // index finger keys case LCTL_T(KC_P): - return TAPPING_TERM * 1.1; - case RCTL_T(KC_N): - return TAPPING_TERM * 1.1; + return TAPPING_TERM * index_factor; case RCTL_T(KC_L): - return TAPPING_TERM * 1.1; - case LSFT_T(KC_S): - return TAPPING_TERM * 1.1; - case LSFT_T(KC_F): - return TAPPING_TERM * 1.2; - case RSFT_T(KC_E): - return TAPPING_TERM * 1.1; - case RSFT_T(KC_U): - return TAPPING_TERM * 1.2; - case LT(_NUM, KC_F): - return TAPPING_TERM * 1.2; + return TAPPING_TERM * index_factor; case LT(_NUM, KC_B): - return TAPPING_TERM * 1.1; + return TAPPING_TERM * index_factor; case LT(_NUM, KC_J): - return TAPPING_TERM * 1.1; + return TAPPING_TERM * index_factor; + + // middle finger keys + case LSFT_T(KC_F): + return TAPPING_TERM * middle_factor; + case RSFT_T(KC_U): + return TAPPING_TERM * middle_factor; + + // ring finger keys + case LALT_T(KC_W): + return TAPPING_TERM * ring_factor; + case LALT_T(KC_Y): + return TAPPING_TERM * ring_factor; + case LGUI_T(KC_TAB): + return TAPPING_TERM * ring_factor; + + // pinky keys + case LGUI_T(KC_Q): + return TAPPING_TERM * pinky_factor; + case RGUI_T(KC_SCLN): + return TAPPING_TERM * pinky_factor; + case RGUI_T(KC_LBRC): + return TAPPING_TERM * pinky_factor; case LT(_MOUSE, KC_Z): - return TAPPING_TERM * 1.15; + return TAPPING_TERM * pinky_factor; case LT(_MOUSE, KC_SLSH): - return TAPPING_TERM * 1.15; - case TD(TD_QUO_BRC): - return TAPPING_TERM * 1.1; - case TD(TD_Q_TAB): - return TAPPING_TERM * 1.1; + return TAPPING_TERM * pinky_factor; + case LCTL_T(KC_CAPS): + return TAPPING_TERM * pinky_factor; + + // tap-dance actions case TD(TD_PRN): - return TAPPING_TERM * 1.4; + return TAPPING_TERM * td_factor; case TD(TD_BRC): - return TAPPING_TERM * 1.4; + return TAPPING_TERM * td_factor; case TD(TD_CBR): - return TAPPING_TERM * 1.4; + return TAPPING_TERM * td_factor; + default: return TAPPING_TERM; } @@ -839,3 +859,4 @@ layer_state_t default_layer_state_set_user(layer_state_t state) { return state; } + From 5802fe2b950a6c16bc21713eb33e759a4e0d8fdd Mon Sep 17 00:00:00 2001 From: Jakob Weickmann Date: Thu, 9 Sep 2021 13:19:32 +0200 Subject: [PATCH 07/31] Update keymap.c added transparency to thumb keys on nav layer fixed wrong keymap for kana romaji switch on adjust layer --- keyboards/planck/keymaps/jweickm/keymap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/keyboards/planck/keymaps/jweickm/keymap.c b/keyboards/planck/keymaps/jweickm/keymap.c index 0e11ce5ef1bc..216cf1327053 100644 --- a/keyboards/planck/keymaps/jweickm/keymap.c +++ b/keyboards/planck/keymaps/jweickm/keymap.c @@ -154,7 +154,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_ADJUST] = LAYOUT_planck_grid( LALT(KC_LSFT), RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DE_SWITCH, - LALT(KC_GRV), EEP_RST, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, HRWIDECOLEMAK, WIDECOLEMAK, LCTL(KC_RGHT), LANG_SWITCH, GAMING, + LALT(KC_GRV), EEP_RST, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, HRWIDECOLEMAK, WIDECOLEMAK, LALT(KC_GRV), LANG_SWITCH, GAMING, KC_TRNS, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, KC_SVD_BD, KC_MPLY, KC_SVU_BU, KC_TRNS, , KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS ), @@ -163,7 +163,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ALT_TAB, LCTL(KC_RGHT), LANG_SWITCH, LALT(KC_GRV), LCTL(KC_LEFT), KC_MNXT, KC_DOWN, KC_RIGHT, KC_PGUP, LCTL(KC_C), KC_RGUI, KC_DE_SWITCH, CTL_TAB, KC_TAB, KC_ESC, LT(_NUM,KC_ENT), TD_VIM_GG, KC_MPLY, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_END, VIM_O, KC_LSFT, KC_NO, LCTL(KC_X), KC_CAPS, VIM_V, KC_MUTE, KC_HOME, KC_PGDN, KC_LSFT, KC_RSFT, LCTL(KC_F), LCTL(KC_F), - KC_NO, KC_NO, KC_NO, KC_TRNS, KC_TRNS, LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), KC_NO, KC_NO, KC_TRNS, KC_DOWN, KC_UP + KC_NO, KC_NO, KC_NO, KC_TRNS, KC_TRNS, LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), KC_TRNS, KC_TRNS, KC_TRNS, KC_DOWN, KC_UP ), [_NUM] = LAYOUT_planck_grid( From a3fd373dd71f831561206de2612a1f35fab07d80 Mon Sep 17 00:00:00 2001 From: Jakob Weickmann Date: Mon, 13 Sep 2021 15:23:58 +0200 Subject: [PATCH 08/31] updated keymap.c and config.h - rgb light now turns off, when the host goes to sleep (config.h) - swapped / and - on both main keymaps - changed gaming layer to work better with colemak - updated _nav layer, fixed tap dance error - added brightness switch to _mouse layer - changed tapping term just for space - added lower and raise buttons to get_tapping_force_hold --- keyboards/planck/keymaps/jweickm/config.h | 2 ++ keyboards/planck/keymaps/jweickm/keymap.c | 34 ++++++++++++++--------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/keyboards/planck/keymaps/jweickm/config.h b/keyboards/planck/keymaps/jweickm/config.h index 010c4bd17334..af59e4532b1e 100644 --- a/keyboards/planck/keymaps/jweickm/config.h +++ b/keyboards/planck/keymaps/jweickm/config.h @@ -199,3 +199,5 @@ #define IGNORE_MOD_TAP_INTERRUPT #define TAPPING_FORCE_HOLD_PER_KEY + +#define RGBLIGHT_SLEEP // RGB lighting will switch off when the host goes to sleep diff --git a/keyboards/planck/keymaps/jweickm/keymap.c b/keyboards/planck/keymaps/jweickm/keymap.c index 216cf1327053..bc2ecde163f8 100644 --- a/keyboards/planck/keymaps/jweickm/keymap.c +++ b/keyboards/planck/keymaps/jweickm/keymap.c @@ -88,22 +88,22 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_HRWIDECOLEMAK] = LAYOUT_planck_grid( LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM,KC_B), KC_SVU_BU, LT(_NUM,KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Y), RGUI_T(KC_SCLN), DE_UE, KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, - LT(_MOUSE,KC_Z), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, LT(_MOUSE,KC_MINS), KC_SLSH, - LCTL_T(KC_CAPS), LGUI_T(KC_TAB), LALT_T(KC_ESC), LT(_LOWER, KC_BSPC), OSM(MOD_LSFT), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE, KC_ENT), RSFT_T(KC_DEL), RCTL_T(KC_TAB), LT(_NAV,KC_LEFT), LT(_NAV,KC_RIGHT) + LT(_MOUSE,KC_Z), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, LT(_MOUSE,KC_SLSH), KC_MINS, + LCTL_T(KC_CAPS), LGUI_T(KC_TAB), LALT_T(KC_ESC), LT(_LOWER,KC_BSPC), OSM(MOD_LSFT), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE, KC_ENT), RSFT_T(KC_DEL), RCTL_T(KC_TAB), LT(_NAV,KC_LEFT), LT(_NAV,KC_RIGHT) ), [_HRWIDECOLEMAK_DE] = LAYOUT_planck_grid( LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM,KC_B), KC_SVU_BU, LT(_NUM,KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Z), DE_SCLN, RGUI_T(KC_LBRC), KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB, KC_M, KC_N, KC_E, KC_I, KC_O, DE_QUOT, - LT(_MOUSE,KC_Y), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, LT(_MOUSE,KC_SLSH), DE_SLSH_QUST, - LCTL_T(KC_CAPS), LGUI_T(KC_TAB), LALT_T(KC_ESC), LT(_LOWER_DE, KC_BSPC), OSM(MOD_LSFT), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE_DE, KC_ENT), RSFT_T(KC_DEL), RCTL_T(KC_TAB), LT(_NAV,KC_LEFT), LT(_NAV,KC_RIGHT) + LT(_MOUSE,KC_Y), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, DE_SLSH_QUST, KC_SLSH, + LCTL_T(KC_CAPS), LGUI_T(KC_TAB), LALT_T(KC_ESC), LT(_LOWER_DE,KC_BSPC), OSM(MOD_LSFT), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE_DE, KC_ENT), RSFT_T(KC_DEL), RCTL_T(KC_TAB), LT(_NAV,KC_LEFT), LT(_NAV,KC_RIGHT) ), [_GAMING] = LAYOUT_planck_grid( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_F5, KC_F8, KC_F9, KC_VOLU, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_VOLD, - KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_Z, KC_M, KC_SCLN, KC_ENT, - KC_LCTL, KC_LALT, KC_B, KC_X, KC_C, KC_SPC, KC_SPC, TG_COLEMAK, KC_LALT, KC_TRNS, KC_TRNS, GAMING + KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_Z, KC_M, KC_SCLN, TG_COLEMAK, + KC_LCTL, KC_C, KC_B, KC_X, KC_LALT, KC_SPC, KC_SPC, KC_LALT, KC_ENT, KC_TRNS, KC_TRNS, GAMING ), /* WIDECOLEMAK @@ -120,8 +120,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_WIDECOLEMAK] = LAYOUT_planck_grid( KC_Q, KC_W, KC_F, KC_P, KC_B, KC_SVU_BU, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, DE_UE, KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB_MPLY, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, - KC_Z, KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, LSFT_T(KC_ENT), - KC_CAPS, LT(_NUM,KC_TAB), LGUI_T(KC_ESC), LT(_LOWER, KC_BSPC), OSM(MOD_LSFT), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE, KC_DEL), TG_COLEMAK, KC_LALT, KC_LEFT, KC_RIGHT + KC_Z, KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, TG_COLEMAK, + KC_CAPS, LT(_NUM,KC_TAB), LGUI_T(KC_ESC), LT(_LOWER,KC_BSPC), OSM(MOD_LSFT), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE, KC_ENT), RSFT_T(KC_DEL), KC_LALT, LT(_NAV,KC_LEFT), LT(_NAV,KC_RIGHT) ), [_LOWER] = LAYOUT_planck_grid( @@ -161,7 +161,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_NAV] = LAYOUT_planck_grid( ALT_TAB, LCTL(KC_RGHT), LANG_SWITCH, LALT(KC_GRV), LCTL(KC_LEFT), KC_MNXT, KC_DOWN, KC_RIGHT, KC_PGUP, LCTL(KC_C), KC_RGUI, KC_DE_SWITCH, - CTL_TAB, KC_TAB, KC_ESC, LT(_NUM,KC_ENT), TD_VIM_GG, KC_MPLY, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_END, VIM_O, + CTL_TAB, KC_TAB, KC_ESC, KC_ENT, TD(TD_VIM_GG), KC_MPLY, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_END, VIM_O, KC_LSFT, KC_NO, LCTL(KC_X), KC_CAPS, VIM_V, KC_MUTE, KC_HOME, KC_PGDN, KC_LSFT, KC_RSFT, LCTL(KC_F), LCTL(KC_F), KC_NO, KC_NO, KC_NO, KC_TRNS, KC_TRNS, LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), KC_TRNS, KC_TRNS, KC_TRNS, KC_DOWN, KC_UP ), @@ -174,9 +174,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), [_MOUSE] = LAYOUT_planck_grid( - KC_NO, KC_NO, KC_BTN4, KC_BTN5, KC_NO, KC_NO, KC_NO, KC_WH_U, KC_MS_U, KC_WH_U, KC_NO, KC_NO, - KC_NO, KC_BTN3, KC_BTN2, KC_BTN1, KC_NO, KC_NO, KC_NO, KC_MS_L, KC_MS_D, KC_MS_R, KC_NO, KC_NO, - KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_WH_D, KC_NO, KC_NO, KC_TRNS, KC_NO, + KC_NO, KC_NO, KC_BTN4, KC_BTN5, KC_NO, KC_BRIU, KC_NO, KC_WH_U, KC_MS_U, KC_WH_U, KC_NO, KC_NO, + KC_NO, KC_BTN3, KC_BTN2, KC_BTN1, KC_NO, KC_MPLY, KC_NO, KC_MS_L, KC_MS_D, KC_MS_R, KC_NO, KC_NO, + KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_BRID, KC_NO, KC_WH_D, KC_NO, KC_NO, KC_TRNS, KC_NO, TG(_MOUSE), KC_NO, KC_NO, KC_TRNS, KC_NO, KC_ACL2, KC_ACL2, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO ) @@ -252,7 +252,7 @@ uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { case LT(_RAISE_DE,KC_ENT): return TAPPING_TERM * thumb_factor; case LT(_NAV,KC_SPC): - return TAPPING_TERM * thumb_factor; + return TAPPING_TERM * 1.0; case LALT_T(KC_ESC): return TAPPING_TERM * thumb_factor; @@ -769,6 +769,14 @@ bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) { return true; case RSFT_T(KC_U): return true; + case LT(_RAISE,KC_ENT): + return true; + case LT(_RAISE_DE,KC_ENT): + return true; + case LT(_LOWER,KC_BSPC): + return true; + case LT(_LOWER_DE,KC_BSPC): + return true; default: return false; } From a5aeb30bc77721cf3a73430a3c85d611d797e8fe Mon Sep 17 00:00:00 2001 From: Jakob Weickmann Date: Wed, 15 Sep 2021 20:34:46 +0200 Subject: [PATCH 09/31] Update to special characters and layout - added eeprom reset button - enabled bootmagic lite - removed excess keycodes and layers - improved macros for german overlay and alt codes - added double tap function to german overlay - used already implementd mod_mask_shift - added multiplication sign to num pad as well as dot and comma to the right pinkey - new esc/context menu button - removed plover --- .../planck/keymaps/jweickm/.keymap.c.swo | Bin 0 -> 57344 bytes keyboards/planck/keymaps/jweickm/keymap.c | 329 +++++++++--------- keyboards/planck/keymaps/jweickm/rules.mk | 2 +- 3 files changed, 174 insertions(+), 157 deletions(-) create mode 100644 keyboards/planck/keymaps/jweickm/.keymap.c.swo diff --git a/keyboards/planck/keymaps/jweickm/.keymap.c.swo b/keyboards/planck/keymaps/jweickm/.keymap.c.swo new file mode 100644 index 0000000000000000000000000000000000000000..5dce69e963ce019c02ea92b638a1cf05415be148 GIT binary patch literal 57344 zcmeI534CN#mGBEU48q8`p$y;y6cR{xIt>jp&0-~~EOce*s-zd7r>G>Ar0Aq7T~+C( z?QRrMJ{&=vPlfSw#T6B|@l#QB7-^SrU&d`5oN++LeZ!xF%b@c=_uTv5t1YSSq(_*k zbpPvBy?5VT&%5uPd(S;@e9h*8LGQfPoe}+1%-S|jY(IkzJGnK?C;a< zcA(<;4hF8H2 za5a=*8ZL!l=!1)49h?cRa5@|d4=@<<1NaVn75)J}4DWzj;Z<-WTn%~1z@@MW`r%?Y z2hM<#;EC`@%Kr=aE_@w62Y16=@OSWLcnOSy)Kwe&fkA^6%j;cq`ll zH^LxnglEA%21DB5Lkw#Cl!1vK!4KgsI1WC^V8S+d5n}|`!wVq;PlCG{SJ(khfXBm; z@EZmZ+;~N!Leg=Dw`HIw);%1L4MsPTpY}*g%f{|hyn8g>?(wDDe0G`7t>!ZxjgOiy z$q_y1wy`1IpKt+26GKT8Qor;?2M31wZ2ZYy4II^|%x91J>@}Z#=Cj{?USd8kHJ^j# zGua&OD_?tv4H@B(=z8DXoI--i2N~x@~xDG^NHa zsp&#?veneS$DdSwYP3~qKRS|ZYxm-PV*|Q_0`hw>MaHO!_-Jb?KD;HCNcF_p3Eo9h zaCkU5*g81elZsQxayFrcqMIdv9 znN(t+uYa_SYLrle!(&O4!)-)E{3=OWx7zBP&Hm)(o>Uh*B+N#$M?@G|(NLGI$bRE--D=%X!B4AqIhfBJolBntBNmrS?iezb|^j(OPb_>gw zF>+~T>`yObEg>=E`fLfLOQcQZZY)+MWc4JhB{GrE6-(YiHdpFACsp!B62pCiu|dyT z^j)_7vcc$RVqj}3F}x+||DY#NN|bvsN}9|}Wpf$NbV=UeaBIqZYx577KF=I5-`XOP z{Tm|EbB^|;uwzX1^?4l~UNM`Sp3Qir^t@Nfd&P-Des^dc}Nh+QlMWoaxp~R1^8RxwKcBNtbLEie8%kUU4>EoIwaFDDsoy>Nmk{ zHm4SH6QyiE=kb5%LcWwKN}e;hv?=VKc`C#^@KGXwi+;74W zO5I70C$PlyX7dv}G-!8Mf?kwAvN4hvlDkF=a zrr73+N${n^W^xO2(r&3qOhGfLiTq@yxHm!yqvWSY_IZ<;iP>}^Eu}5m=GVJoq{VfU zB|~FhI|>8 zFJ+HCUikSLb^t z1?;1e3P4<+47_z+i1@va(kAq{-cHb@Sj)wBPNX5ZN7!> zWAwM2;Y!p}b(5n?%lDZG`V;P{u&fx!dZtj6LPSo@<|bwrCNthCI~UTq(!$*8nNvbL z=eUB)_G}v5nA#ZI)-@bW^rZSD-WeU>rDwT(z1`W;3>Rv)$Yq_ME~MvHd)~m5m&Kj8=?QoPIz&Rh)5)!`T@*EJeM!XbyG@b zXNxA?!C0cZKRSdQ4j>%cJTCO!fzhE@GU@dWC%mXP5>1Q_bdSZO32$U9F*2NtQMe?9 zB0G}c_(BQs8|~*w){72p^R`42$j|7u4W?G;S-i}yOwMFJJ2yX@rAQci7pQV6l*BL^ zsyL52oTPUxWQmucbW>97nf$yYNKcq85ifoCc*diJrWR&tZd3494$_eoy!^a$2yI?E zw}-w>`srP?IlD}GCAQuI*-z%DN@8{H^-7OrI+1oSLqi59cxzp?+d6KidL+kWf^*~! zKy0KiS9AdvsebzId1)}tlCh%A*!fZ%dfgnd5LAhzoz6{m&`xvt$?TNG zBT;oDB!%qsOvzijW^Jc;iP-CVTa4L!I+u%}Kkh`djGxZ-l>wm%>Y66rKuSLGQl?*1|oq-X^OwkzqF$pkGu`rL$mPw%~meskdU>!=Z!wyuqjYL|kx*fgKysKL~$Kn@U z;D?i@Zul=kq+VvWnDO>De9oc)iLhMKynWtsGAKhR^4D6olHG_*n|Io2bpyFE9Iws% z+Z!>FE*0z2QJUEH?TfTzr-*FD{v!3ot??_NejLmJ))QGBt*X9|!r`U2Sn>k$rJz(; zSgN~W?r}CVseR9C8LUmoU@aH(cs@UC4%ur)Qzd9AI6*F1(f^rNjy#!pWYPbf{rbP7 z=YIm;12@9ea1~5L1}32wI^hKPJ!1iX3)jH~@N32cJ_C2c`(O{u!U(K|r@&G07tVjr*L312WhDbod=( z9ruCE?Y|Rlgat^#1+WHAgyZ4qa2))cdHv79ZSXeO0Vl!{@CWAeWzK&AQgAu^1$=?| z{rADE;d;0ZHo`;9`Tqd!huh&Vp$~eX1@2`2|4r}`crnD_*VqDl1O5)~gzMluI2lfY z6X82F;!SWR^uWn*1l&WreiYsa*TB`VAGX2?{MLV)0myULM8Bu6%Yhtzz&SW0DcSu6c=(A+P~9gt{6az$`8 zZcpYE+%9gB1jwa#>9O_}{y5AIJz{dV&K{I*goEkHD;J6~yTO^}_}S&hcW0SJ$j@fx z(lW2%0-aSJXgWQ|v`Ogr+VbO*8TqZVC@zXl7sTXorcgVfH7=CqcBbI+qVs2=CxYoY z=223mGZ+q*nKd_|Msh(zTqcueiN3D5%)6&BFNh_QsrW#0v{fcfhVr}RRxYz@GHxk@ zux4CY8+El8H-n}6ibAv;pNt4UC8N@_VVDqbF4YRQF`tX@AC?mSGr+y3;>@;S}Kiu59Ul+SopcOfCk4OM94SD5Y54=taS z_32Mzh9uaxfN*U-GBC8!>s)6tE`7tgbyY!BEKJAEVGY9_A(<)3?LvB#1C)Hp4}HzPWz6A$_1$ z#EjQ!C;jE|%;*r)s4Q4yhzUswix8|bX7aO>t-g_u4c{&gdptSh3!-A2q2K&50qx9c z$Vr7PmCKq)mWq*>I%-2|6Nt&8{H~X2Ci1frskwA}-lz|4gyfJ}$`-(Q3ozN{X`IjTx99vLhUb z1jz} z%`*p|Vp4jiGrUC%?_{Jgnx=BK96wW+^kcQhWm%p9LE8piwr{a9<;_8?t9O~09GXP1(Hkcsz< z>})wTJB8GG(XpO^VS1QoS3IWL&Rm*-sjE^&X75$%d^Jbg$_jU&)i2eACfAZKrLx_x zE4XZ{M9CctpBJR&j!KF2MlHn={r@!dzT?pWMgMo}1_P}MZ9z^dy z5x$15|2~+2DEtzA{%ddmZiQRm2AF~#I0cS}$H86b@1o<2z5iNxHarG?ho1gp_zc_* zZwArnpAT0+7n}-@1+m-z9()V#gb%{)@c-bsa5-EE&xB`y*z7+5UxzQlr{H>+g#kDp zo&mo>hyNyg5Z(oEfS17>#Ng3zANu^~;5HbAKInj>;bZ9X?}wK`5yoLVBq0W;!0*uQ z?|{F7=fierf&WCG{~mlCcEU9D!0GTb_;WZC9z?(Y8r%+|_g?~Q;fZi3?fGuF8H(^M zkT!k>H1_A@#XbgzRi0RbiFNwOnzjwbOwZr3wsOb1${iAdr;h_4jkt*AcA!R;DTKVJ zmg`u`m30Xdvzau#kQ`^f+-+-!{XyofDzj1?$=hp|leeH)n&*5jgKZamu+6(WF4teH z+*S1eqrCE?JT$|nSh@C~&?YyglKlhN*xUPu#Nv8Axg(fZ=pTXzUB@Qr=xun_MPiLr zT8(C3EN0Bei$r5?r5H7iaVw=>#|xSC4pYUZ#j9_{a*hmOntc0dhgxePw`7B=FnQ&| zv$QmwT`5iH*cSU>L~^BnOD0Z{4}&yyR_0AIE7Ejx#O3S|Bt1Cw5g<+W$rxE0{%@D1 zmgQdj=h^0Z^KzQ&kUFL+$yr}1N>0pQu$;U-qC`nD>pG^WdB&GLwr`TJ^4t?KTh!y! zL}?c7WZaEBR6HjUAk7qJ{Qxz4EX=n3POWBu@I9*HZq!((Yt{$_3$vVxN~a-Xw6bhK z>j2Fnzq^Rdt0?O{zGHc8O54J~1tS1e zw`r{-IlZM;EBG3-ncX|NDu{WI=G2C6QPzyU)=la#mr@(rm9k2ds!LfOq>)nEuG20M zaFS5#=Bu~Py3MMW1P=$nP1rT4tTpf@+HZSzLRbq~Ocv~9w;S=WB2hC9)#HLk68kjM zHDJ~@%6hprZ=XK**oPo}+_3>+qN{F2?P_`W!nP zUn`+R@hPp9Y7vhE<#z=TmQTz6ze-s`|5h zsHdvRWx=sc+CQ<5IA}IR|36*yR`glX|DAumFQePP3-&__&V#>zAEV>{2)+O^-+wJk zLkBzwzKvf0F}MkCgd8M6^!_8^8|e36hY!Q+AP=J;y1&fl{}Vd>x8QDg8|;Sduoh(g z{-@~hUxe4eK8V9=5WW5(xCaiv&9EOv;9NKgenuHT4sU_0K<4VD+}FbkVJBP!qTBx` zb@F@oH~2W*3fDjyu7DWyKsOu#KS7`W28hmo70kosFbwPAY4A_z_FsXI!F%9!uoo_e zQFsoV1t-Dp(eM8aJ_a9vTj3ROJxsv}oDb{ZS#UfY4L?EmzYAUu{})P-gDh-?A$Tm@ z%Q(O*pa3VqiBSFL%ba%p{|y~RAozc>4ntOJn+}7;Vh7n_aH$1qbouQ>x?LT=sJMfg zJD|U6-;Qy#sAZW34RsN<0!ypZ@5i;@#M+9X%O#$;?6Zhjcv$hYRi`Xr-Ag80H239u zmH5Hlz_IuIt5eLnxp554;Bv^X6?Ce=P zG1tF0mcE`;o_32Z|KfEcBR0AqIyEm#;#kCtNr|0zQR9Zza?@15(iY8{6_&D@)$;tU zT=r_U=%SgErZrk*=uF96z4;CV0Au_|sogvw0R$ z&d=t#fKpg^$?|ko>#yA|`AiNE^|k84-&CJu-Thg)8;y=I8Qqr}jU@(IlUSNeO)SM-*)ZViC6<%dZ^@6^cd171Hyo z%$j;*JcTit)O;kO^{=0`TY-7s9eZlGXyEt6c&lk7*NesGdy6qXQ^ftoipF>;(QzB% zuYrQLn4qQy37ldWmn+MS#CXt!p*#eIr9g zjpTNbxXjRo%o=T5v6!}mVxriRxQB@&zAYLqJoDOA>SL9-G1y&Zl zp}5Gjo^-I;&awjis@l1Bj)&y(xg?a9NV#aZ0(k2SQTHVc6~9%T}mja`nB7+I%F&oRA%+CuS8L= zi5ANd9p+-jPK`w=`u~&B2gRmb^nd4{eI{eLWj@9Mo(Alqq zEL;NLM@PRFWPbkR=;h9Tp3KdE1pWrLf!Ny1ocxpE*XZV=w|^4uf{($~kcM7Z4<~{6 z*ZT#!`H$cS@OBX2dU+TJnU`;er^27Z6G80o-wQ7XvBS^82&{**pc8(MZvItxAG`{7 zK^FR94V(bKMJK-(?tyQE%-M_Xekq9Fej*$TKc^nQ2?yW}@FI92Nd3w@{YxPQT_FDa zeudtB0Nw;LPoIEO;1Brp`y#v>-Ua%nqGF$@_NG6@0Vc_9U2J_9GKP!diz>qAmVRQ2N%jFfiWkDn0)XNj`7^ket+Q9A5gK8 z$%+2Rsf%Ti#9a`VQ0F;vGio>~(PGW=#Z?y>>oe~{YDmUv%=#JY1#7&3zTUcXhg7}w zjAhOdLrc5%(F8w3^i~3t(h`FXQLkjhGCdusEU%Q78FYXDVXN4KN~n=)9WP8AhH4cB zqg)o^qKpL?sWFw`UFXRrbbciaJuer8Aete;u+*EysV==8KJEOMj~Dcda~W^!7;C=nzYLNRBU>O}?lPVjDtzP7=cXX04w&V=!sc z;!7f&2?+HY$_EW$F{Ko_A2+!?a(MhxTQJ z)h^_R^vB5LfIodz1cIOwLYR}kLcMW@v)>iYRYBq zrV^RvrC0OPt9j|w^JO~UoG}#dR*%Utv8*X*Rz@@{BkGD;-PjVTRy&@9aoo6MV}%-+ zQ|+&chO4kXxC#cHs1R zzYgU&)tnG2hWTyO6OC#JSyL~bYHDJweS$nC#AP-=L#|1UZ(hk`A7&dtNb7H#{eE-% zB@a>@=^Gmf&Jow(oFF5anp5B3sb}o}$5Ad5qGO`}yZ86K4c&huJb=!B3tR;Eqw~w0 z{#o#CbbXo2e;;gvBj8Qw{QrtR|5|tr?1y9FcJy|!tN%Ru_-EiBKz!q$0e_4BeKC9m z9s7&$1$Z}H0S}>1-vVuL8ax{w4evsimi6ynM1Q^lw!`Ic0elMGxd*;Wd5SO(d64pL zhr{^C6&2mQ-Lsqep5DvvCyQJdD{x3JD2-@vjOC(SBeEUf5*Zvz4ckpGzV`>_Ng8*|QT*{89Z3rO6R2eKNAjieIdp`8?%*luU7jEPz{5_PnXo+L47z9hFq zk<_wT#P%}Jww2dG_!7}s(Xt%KMUS{AV#yd8=!tcW;s2fGj;YaM`^Dr)_Vml;pkK(N zd`U*_o@CVS+3fagmOT_28)xe)Sls&Sg6PG2(Tc|tzfom0#6;=uY2=IF?faL1sNb>o zrLsE_cR|Uw+y-@P?XX`Y~*yllV1ptq;8$YHes; zs84;G(G87vj71vDtSsO`soPOIKk~d?7C9Wr)Fgr%@FCBz3 zy0qEvTDp6{3W)23_ z_6I6Iev4Z%FfAa`H88@nLAaIK8P!MI{;0fWh2P~3%#P6kt4H}w8s!dU!m7ff$;q&T z*(n1M=6xo3$d}96H0vU5>V_K+aqAQ*)f$YVqOWF=(RnU7el@1I$jxJ{B1cm;rLI@rXFJA}iWV^REL#fdga zG^%MQbL#w64Q6u+p$>DNWl*JcG(B!Iy-5?_qMMj*61o}H z%{JYP=|-f7JPzw-L^fSJiu0Q3_LZ0ARjZBuFFJ7vomupM_kR1Iqx=5|z5}0w+h7Mo z!GkBm&lnT<0elm_3ZH@x!pmVZw8K&G&@qe)fUFC6E!+av!!@uQPK2XD-XHL3koN;# z0}~+c5D?!0r@={Z6#Ry9hOfg1;FYiku7qAV6Xab2$H0#nd-ybnpFbIocm+HkiXiXt zyBJP|BjJ9=C%yr9!W-ZPkcDnI4Nd^DIgqi7SHexO2WH_?I2Xk4-+wTc@qG}#00-bb z@J4tYycBMN8=(YS;X*hSTHx_;FXJ9xg7<>hB3ujNKS0(JjDq+I6q|%+z)|ok#zTG# z_k-9ad=hSh{{v#5a0Mix7i1jeDEI?oC-;H)6#O!L9>lNUhv5#m8nUnjy5TrD7XE|r zm3!f>AnObE!89b{DR2z@5IOp1_%z%Gx57){1z=N9+N!vG(7- zk!oJWXxj9WK>QIf4_)7tQE?wHe1xNUQJvH86+`pQ`H+f;5?1CPPT-3N)6D0fo1yCY)cm`UBwV{joE znXW0(6)WIvm^v#GLp__C?fc^6c@*o(*T~7vo zV!5g8wCfizKblL=i;FTgc%zYHs|)Gfp#qj4%k3!Ssb62ZJu#UoKbOOPGOYHR6dNZ= zBot>L$xQkrmm}lGJ5wfjwlrPlC4S=F*SZ^% zc9K8e*s5kZ8oN3*@=@0;i+3$_@)47={RrPHWe6o`h^pIxo)JEQbwi;OB)4YGR4Oxz zx7^I6T;{rps?EE|3$HQ?E~l!d^3UP2*4X5l4zAM1>O@~C>8hlo!#=mn@je83m*-Vx zy#am&GWdF%&+xjxnS4Q(Sm`@6-CpySK=nglUZt5wX~we$E}a(`W(zG8H8y(X6)*Nk zYPuI*Lhc(Y%5ZL|?#drpWa@?|KP+hMVijLZD$h5mR6mV|8;R*3jSHJi*Yc*ReBV=t z?y1VF<@(Br(4s9BI2@9(q0m~@7PE4vZiTuM1Qn(RO)~hY#q2m;+QxZE*z1=$I71#E ztuwRBPkA_1iWJT~Z!=ORV{m2FQmHRfARnK26z!n zK`%TGKFx_Af#-wR2b>3|!zu7|kchv7UjI=LUw~J`U&6_7FM7QA0eCft{Xh~fhI8Qz zI36BEhyN1X1amM3;s@Yg(AU2LABLNu3(kY5!f(*izYq7qx8M_SE9?RB18^Mt5k37L zxB>RU1Uv_Rf&TsPAbR^-;g#?*xDMuF5S|V9p?4pEcft*DHk=MmgrA^azZPB&^B}r+ z7hDKy;COftUHVIK6U@OFtc9PWKZ}0-S$G>HpdX$MkB0}*p&x+z;fwH2$br~9oDAZ} z{};5QwB--0Y#oeP*N|tu0%X|UUIC3<0A@zk^f4DdTrU9`>gGB~Hg+Az#Up>qcW|fi z$Y;18t#+AM<^4-Km9kT;XR>>*y*&~{TB9>(#=PuiaPVI4s`9d~GA~%P%N^zJw=5?s zK`9;qPVFSKraPs-ck{3fb*ZkD%NHfNWPNLLGi<@yhH@FH5}LCrL&y$V?!en4E@Pnw z$KZ)z`9idG-l{@~+)3VEw4A&J#d;)3l}zl48O9?~r0nC*f!l(<|KTH3B4i>{H~jCE zDPt@U5-Pcy*LWUw7tQiJDHqdH_q(c|s%nSpsb0UFmXj{CN-bO}Z&mj{x!slBi>)Wl zyWhKSe@Lf+(|<1qntm$~*_wyCa9C zu|oY{;*oGsOR@L2c>di{^# zc6bL|2mg#7FYoYs8pP4v2cRELf?eqA&w@M9$z^W+e)t}I0>l^J$?#e7btO#06qtN! z7Mq{V8fex)vj&6JCKmDP+P8(uYoRjXb#2$BtscCLA-*w&VfcdTl!D{lW3n?_4ZgJ%zYk7z}ydcD_MA20|c2Scq$-s6$xXh*WjRwmMnD=%X!B4DN_4x4mIB`sUJ%H&lfOC!~lfh#3r57IjA*&~0E%tS!zM-0X8?+iM6>-=)7#&RvY)vJGwfDH=F@mL@>39l z3VBaTJNCa~lHth?Y%O+W^SmuZjGA05Vhv%Jy$}`eH=Il3JqvfYnpfT?&3~_mo!$&W zD484^PMJlFqVa1sozoF7pYwJu$g3VD&uZS~mG+2hEnaLUZ+ylDr3^&rh?U02y)LEe zkAeuLf{aawdoQ#GWi6K6Da`B77Yeg`c<&9bD#(>kF7TFvvU870tD0mD!3XXt(ME`#;?1zo; z47d;d|J|?$HozYl1GpQmg8`5^{^LN#2IQT8{|cXg+u+484|$MrgBEyzv4VR*dYQ!|e&NnV)72G;5$)1I-#})jTsM)cRbyvv!`9XE4u?hjV2l18TCl#%=mI5OMqrj3nXlvjPxhB<{gcyv z;!Jn#I_GG&%nQ99bBDqX)U6L*cPQM{a%j!!^~9)p-(|kqw_T*=LND4qIxswh5;v0S zi4JwgQoTd1yRvhs>FKtJ=Sgs*;hE62g7*xM@wRj^WYd8}GwNo~^z}4RR;v;U&XjO= zaMO$-L|RO`syGsv0AmMGDg30|h7!wlswHJQm2GLbSz$zqw2&*3Rq>?gD~br<6$l!;Lh zHDYn5EN)w2F%(`dDvCRAIVgEqB3QG5%>`bkY|lK?*>qGGAk~XBv<$R?NX2}hzOQJ# z4iDPTs_6gsp#MJwU0L-1K6@wr9y~V*=s};QjCxcm?c)1ju^^&Ve>~ z3jC6>fp5b5;hk^`{1xnj%R&4CtO4;2a6B9fkAiy{H~0X&5^jJiVG>d>1U>M3>P6NO z{1wcAsi&2FT4~1Ctbt|?G;5$)1I-#}*1*G{22di*pM8px=dQ#2n(XFVZ;jc0^R2hc z+GWx^+#2X|yLu~>5#2g>LCv?`7BjBC0zK=HO#QWD<#Mm<)TH^=+lhQ(Qq)}BlKroF z>+SGxPuDh#gog2@YF65oy)ZZQwp=8r{Dryhlv=)1Dn=eu`f3cwI_Z|RFjHxKP@Er$ SXyCf1EcqT@`znL;BmV_f)t=)3 literal 0 HcmV?d00001 diff --git a/keyboards/planck/keymaps/jweickm/keymap.c b/keyboards/planck/keymaps/jweickm/keymap.c index bc2ecde163f8..ea8bce6c3ef2 100644 --- a/keyboards/planck/keymaps/jweickm/keymap.c +++ b/keyboards/planck/keymaps/jweickm/keymap.c @@ -20,7 +20,6 @@ enum planck_layers { - _HRCOLEMAK, _HRWIDECOLEMAK, _HRWIDECOLEMAK_DE, _GAMING, @@ -33,14 +32,10 @@ enum planck_layers { _NAV, _NUM, _MOUSE, - _PLOVER }; enum planck_keycodes { HRWIDECOLEMAK = SAFE_RANGE, - PLOVER, - BACKLIT, - EXT_PLV, GAMING, WIDECOLEMAK, TG_COLEMAK, @@ -62,48 +57,45 @@ enum planck_keycodes { LANG_SWITCH, DE_SLSH_QUST, DE_QUOT, - DE_SCLN + DE_SCLN, + M_ESCM }; // Tap Dance declarations enum tap_dance_codes{ TD_PRN, // round brackets (parentheses) + TD_PRN_DE, // round brackets (parentheses) TD_BRC, // square brackets + TD_BRC_DE, // square brackets TD_CBR, // curly brackets - TD_ESC_CAPS, // double tap for caps lock - TD_QUO_BRC, // double function on quotes to enable typing ü in german layout - TD_COMM_SLSH, // comma that doubles as a slash - TD_MPLY, // play/pause, double for next, triple for previous song - TD_Q_TAB, // double tap q to register tab + TD_CBR_DE, // curly brackets TD_VIM_GG // single tap to scroll down, double tap to scroll up }; #define LOWER MO(_LOWER) #define RAISE MO(_RAISE) -#define MODS_SHIFT_MASK (MOD_BIT(KC_LSFT)|MOD_BIT(KC_RSFT)) - const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_HRWIDECOLEMAK] = LAYOUT_planck_grid( LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM,KC_B), KC_SVU_BU, LT(_NUM,KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Y), RGUI_T(KC_SCLN), DE_UE, KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, LT(_MOUSE,KC_Z), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, LT(_MOUSE,KC_SLSH), KC_MINS, - LCTL_T(KC_CAPS), LGUI_T(KC_TAB), LALT_T(KC_ESC), LT(_LOWER,KC_BSPC), OSM(MOD_LSFT), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE, KC_ENT), RSFT_T(KC_DEL), RCTL_T(KC_TAB), LT(_NAV,KC_LEFT), LT(_NAV,KC_RIGHT) + LCTL_T(KC_CAPS), LGUI_T(KC_TAB), M_ESCM, LT(_LOWER,KC_BSPC), OSM(MOD_LSFT), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE, KC_ENT), RSFT_T(KC_DEL), RCTL_T(KC_TAB), LT(_NAV,KC_LEFT), LT(_NAV,KC_RIGHT) ), [_HRWIDECOLEMAK_DE] = LAYOUT_planck_grid( LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM,KC_B), KC_SVU_BU, LT(_NUM,KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Z), DE_SCLN, RGUI_T(KC_LBRC), KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB, KC_M, KC_N, KC_E, KC_I, KC_O, DE_QUOT, LT(_MOUSE,KC_Y), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, DE_SLSH_QUST, KC_SLSH, - LCTL_T(KC_CAPS), LGUI_T(KC_TAB), LALT_T(KC_ESC), LT(_LOWER_DE,KC_BSPC), OSM(MOD_LSFT), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE_DE, KC_ENT), RSFT_T(KC_DEL), RCTL_T(KC_TAB), LT(_NAV,KC_LEFT), LT(_NAV,KC_RIGHT) + LCTL_T(KC_CAPS), LGUI_T(KC_TAB), M_ESCM, LT(_LOWER_DE,KC_BSPC), OSM(MOD_LSFT), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE_DE, KC_ENT), RSFT_T(KC_DEL), RCTL_T(KC_TAB), LT(_NAV,KC_LEFT), LT(_NAV,KC_RIGHT) ), [_GAMING] = LAYOUT_planck_grid( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_F5, KC_F8, KC_F9, KC_VOLU, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_VOLD, KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_Z, KC_M, KC_SCLN, TG_COLEMAK, - KC_LCTL, KC_C, KC_B, KC_X, KC_LALT, KC_SPC, KC_SPC, KC_LALT, KC_ENT, KC_TRNS, KC_TRNS, GAMING + KC_LCTL, KC_C, KC_B, KC_X, KC_LALT, KC_SPC, KC_SPC, KC_ENT, KC_RALT, KC_TRNS, KC_TRNS, GAMING ), /* WIDECOLEMAK @@ -132,8 +124,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), [_LOWER_DE] = LAYOUT_planck_grid( - KC_EXLM, RALT(KC_Q), KC_BSLS, KC_DLR, KC_PERC, RALT(KC_RBRC), KC_GRV, KC_CIRC, KC_RCBR, KC_ASTR, KC_LPRN, KC_QUOT, - KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, LSFT(KC_SLSH), KC_RBRC, RALT(KC_7), RALT(KC_0), RALT(KC_NUBS), + KC_EXLM, RALT(KC_Q), KC_BSLS, KC_DLR, KC_PERC, RALT(KC_RBRC), KC_GRV, KC_CIRC, KC_RCBR, TD(TD_PRN_DE), KC_LPRN, KC_QUOT, + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, LSFT(KC_SLSH), KC_RBRC, TD(TD_CBR_DE), RALT(KC_0), RALT(KC_NUBS), KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, LSFT(KC_7), KC_NUBS, LSFT(KC_NUBS), KC_CURRENCY, KC_PLUS, TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_DOWN, KC_UP ), @@ -147,7 +139,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_RAISE_DE] = LAYOUT_planck_grid( KC_1, KC_2, KC_3, KC_4, KC_5, LSFT(KC_GRV), KC_6, KC_7, KC_8, KC_9, KC_0, KC_SCLN, - KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_SLSH, LSFT(KC_0), RALT(KC_8), RALT(KC_9), RALT(KC_MINS), + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_SLSH, LSFT(KC_0), TD(TD_BRC_DE), RALT(KC_9), RALT(KC_MINS), KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, RALT(KC_MINS), KC_COMM, KC_DOT, KC_SLSH, KC_EQL, TG(_MOUSE), KC_TRNS, KC_BSPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_DOWN, KC_UP ), @@ -156,20 +148,20 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { LALT(KC_LSFT), RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DE_SWITCH, LALT(KC_GRV), EEP_RST, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, HRWIDECOLEMAK, WIDECOLEMAK, LALT(KC_GRV), LANG_SWITCH, GAMING, KC_TRNS, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, KC_SVD_BD, KC_MPLY, KC_SVU_BU, KC_TRNS, , - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, EEPROM_RESET ), [_NAV] = LAYOUT_planck_grid( - ALT_TAB, LCTL(KC_RGHT), LANG_SWITCH, LALT(KC_GRV), LCTL(KC_LEFT), KC_MNXT, KC_DOWN, KC_RIGHT, KC_PGUP, LCTL(KC_C), KC_RGUI, KC_DE_SWITCH, + ALT_TAB, LCTL(KC_RGHT), LANG_SWITCH, LALT(KC_GRV), LCTL(KC_LEFT), KC_MNXT, KC_HOME, KC_RIGHT, KC_PGUP, LCTL(KC_C), KC_RGUI, KC_DE_SWITCH, CTL_TAB, KC_TAB, KC_ESC, KC_ENT, TD(TD_VIM_GG), KC_MPLY, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_END, VIM_O, KC_LSFT, KC_NO, LCTL(KC_X), KC_CAPS, VIM_V, KC_MUTE, KC_HOME, KC_PGDN, KC_LSFT, KC_RSFT, LCTL(KC_F), LCTL(KC_F), KC_NO, KC_NO, KC_NO, KC_TRNS, KC_TRNS, LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), KC_TRNS, KC_TRNS, KC_TRNS, KC_DOWN, KC_UP ), [_NUM] = LAYOUT_planck_grid( - KC_F1, KC_F2, KC_F3, KC_F4, KC_MPRV, KC_NLCK, KC_MNXT, KC_P7, KC_P8, KC_P9, KC_PMNS, KC_TRNS, - KC_F5, KC_F6, KC_F7, KC_F8, KC_VOLU, KC_MPLY, KC_BRIU, KC_P4, KC_P5, KC_P6, KC_PPLS, KC_TRNS, - KC_F9,KC_F10,KC_F11,KC_F12, KC_VOLD, KC_MUTE, KC_BRID, KC_P1, KC_P2, KC_P3, KC_PSLS, KC_TRNS, + KC_F1, KC_F2, KC_F3, KC_F4, KC_MPRV, KC_NLCK, KC_MNXT, KC_P7, KC_P8, KC_P9, KC_MINS, KC_TRNS, + KC_F5, KC_F6, KC_F7, KC_F8, KC_VOLU, KC_MPLY, KC_ASTR, KC_P4, KC_P5, KC_P6, KC_PLUS, KC_DOT, + KC_F9,KC_F10,KC_F11,KC_F12, KC_VOLD, KC_MUTE, KC_EQL, KC_P1, KC_P2, KC_P3, KC_SLSH, KC_COMM, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P0, KC_DOT, KC_COMM, KC_EQL, KC_TRNS ), @@ -210,18 +202,62 @@ void dance_cbr(qk_tap_dance_state_t *state, void *user_data) { tap_code(KC_LEFT); } } +void dance_prn_de(qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + tap_code16(KC_ASTR); + } else { + tap_code16(KC_ASTR); + tap_code16(KC_LPRN); + tap_code(KC_LEFT); + } +} +void dance_brc_de(qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + register_mods(MOD_RALT); + tap_code(KC_8); + unregister_mods(MOD_RALT); + } else { + register_mods(MOD_RALT); + tap_code(KC_8); + tap_code(KC_9); + unregister_mods(MOD_RALT); + tap_code(KC_LEFT); + } +} +void dance_cbr_de(qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + register_mods(MOD_RALT); + tap_code16(KC_7); + unregister_mods(MOD_RALT); + } else { + register_mods(MOD_RALT); + tap_code(KC_7); + tap_code(KC_0); + unregister_mods(MOD_RALT); + tap_code(KC_LEFT); + } +} +void vim_gg(qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + for (int i = 0; i < 10; i++) { + tap_code(KC_PGDN); + } + } else { + for (int i = 0; i < 10; i++) { + tap_code(KC_PGUP); + } + } +} qk_tap_dance_action_t tap_dance_actions[] = { // declare tap dance actions here - [TD_PRN] = ACTION_TAP_DANCE_FN(dance_prn), - [TD_BRC] = ACTION_TAP_DANCE_FN(dance_brc), - [TD_CBR] = ACTION_TAP_DANCE_FN(dance_cbr), - [TD_MPLY] = ACTION_TAP_DANCE_DOUBLE(KC_MPLY, KC_MNXT), - [TD_ESC_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_ESC, KC_CAPS), - [TD_QUO_BRC] = ACTION_TAP_DANCE_DOUBLE(KC_QUOT, KC_LBRC), - [TD_COMM_SLSH] = ACTION_TAP_DANCE_DOUBLE(KC_COMMA, KC_SLSH), - [TD_Q_TAB] = ACTION_TAP_DANCE_DOUBLE(KC_Q, KC_TAB), - [TD_VIM_GG] = ACTION_TAP_DANCE_DOUBLE(KC_PGDN, KC_PGUP) + [TD_PRN] = ACTION_TAP_DANCE_FN(dance_prn), + [TD_BRC] = ACTION_TAP_DANCE_FN(dance_brc), + [TD_CBR] = ACTION_TAP_DANCE_FN(dance_cbr), + [TD_PRN_DE] = ACTION_TAP_DANCE_FN(dance_prn_de), + [TD_BRC_DE] = ACTION_TAP_DANCE_FN(dance_brc_de), + [TD_CBR_DE] = ACTION_TAP_DANCE_FN(dance_cbr_de), + [TD_VIM_GG] = ACTION_TAP_DANCE_FN(vim_gg) }; float thumb_factor = 0.95; @@ -260,9 +296,9 @@ uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { case LCTL_T(KC_P): return TAPPING_TERM * index_factor; case RCTL_T(KC_L): - return TAPPING_TERM * index_factor; + return TAPPING_TERM * (index_factor + 0.1); case LT(_NUM, KC_B): - return TAPPING_TERM * index_factor; + return TAPPING_TERM * (index_factor + 0.1); case LT(_NUM, KC_J): return TAPPING_TERM * index_factor; @@ -301,21 +337,27 @@ uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { return TAPPING_TERM * td_factor; case TD(TD_CBR): return TAPPING_TERM * td_factor; + case TD(TD_PRN_DE): + return TAPPING_TERM * td_factor; + case TD(TD_BRC_DE): + return TAPPING_TERM * td_factor; + case TD(TD_CBR_DE): + return TAPPING_TERM * td_factor; + case TD(TD_VIM_GG): + return TAPPING_TERM * td_factor; default: return TAPPING_TERM; } } -#ifdef AUDIO_ENABLE - float plover_song[][2] = SONG(PLOVER_SOUND); - float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND); -#endif - // alt tab function setup bool is_alt_tab_active = false; bool is_ctl_tab_active = false; -bool de_layout_active = false; +bool de_layout_active = false; + +static uint16_t key_timer; + bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { @@ -353,7 +395,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { break; case VIM_V: if (record->event.pressed) { - if (get_mods() & MOD_BIT(KC_LSFT)) { + if ((get_mods() & MOD_BIT(KC_LSFT)) ) { unregister_mods(MOD_LSFT); } else { register_mods(MOD_LSFT); @@ -437,52 +479,55 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { break; case DE_AE: if (record->event.pressed) { - uint8_t temp_mod = get_mods(); - if (temp_mod & MODS_SHIFT_MASK) { - clear_mods(); - register_mods(MOD_LALT); - tap_code(KC_P0); tap_code(KC_P1); tap_code(KC_P9); tap_code(KC_P6); // Ä - unregister_mods(MOD_LALT); + uint8_t temp_mods = get_mods(); + if ((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) { + clear_oneshot_mods(); + clear_mods(); + register_mods(MOD_LALT); + tap_code(KC_P0); tap_code(KC_P1); tap_code(KC_P9); tap_code(KC_P6); // Ä } else { - clear_mods(); - register_mods(MOD_LALT); - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P2); tap_code(KC_P8); // ä - unregister_mods(MOD_LALT); + clear_mods(); + register_mods(MOD_LALT); + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P2); tap_code(KC_P8); // ä } + unregister_mods(MOD_LALT); + set_mods(temp_mods); return false; } break; case DE_OE: if (record->event.pressed) { - uint8_t temp_mod = get_mods(); - if (temp_mod & MODS_SHIFT_MASK) { - clear_mods(); - register_mods(MOD_LALT); - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P1); tap_code(KC_P4); // Ö - unregister_mods(MOD_LALT); + uint8_t temp_mods = get_mods(); + if ((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) { + clear_oneshot_mods(); + clear_mods(); + register_mods(MOD_LALT); + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P1); tap_code(KC_P4); // Ö } else { - clear_mods(); - register_mods(MOD_LALT); - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P4); tap_code(KC_P6); // ö - unregister_mods(MOD_LALT); - } + clear_mods(); + register_mods(MOD_LALT); + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P4); tap_code(KC_P6); // ö + } + unregister_mods(MOD_LALT); + set_mods(temp_mods); return false; } break; case DE_UE: if (record->event.pressed) { - uint8_t temp_mod = get_mods(); - if (temp_mod & MODS_SHIFT_MASK) { - clear_mods(); - register_mods(MOD_LALT); - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P2); tap_code(KC_P0); // Ü - unregister_mods(MOD_LALT); + uint8_t temp_mods = get_mods(); + if ((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) { + clear_oneshot_mods(); + clear_mods(); + register_mods(MOD_LALT); + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P2); tap_code(KC_P0); // Ü } else { - clear_mods(); - register_mods(MOD_LALT); - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P5); tap_code(KC_P2); // ü - unregister_mods(MOD_LALT); + clear_mods(); + register_mods(MOD_LALT); + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P5); tap_code(KC_P2); // ü } + unregister_mods(MOD_LALT); + set_mods(temp_mods); return false; } break; @@ -515,64 +560,80 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { break; case DE_SZ: if (record->event.pressed) { - uint8_t temp_mod = get_mods(); - clear_mods(); - register_mods(MOD_LALT); - if (temp_mod & MODS_SHIFT_MASK) { + uint8_t temp_mods = get_mods(); + if ((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) { + clear_oneshot_mods(); + clear_mods(); + register_mods(MOD_LALT); tap_code(KC_P0); tap_code(KC_P1); tap_code(KC_P7); tap_code(KC_P6); // ° } else { - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P2); tap_code(KC_P3); // ß - } - unregister_mods(MOD_LALT); + clear_mods(); + register_mods(MOD_LALT); + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P2); tap_code(KC_P3); // ß + } + unregister_mods(MOD_LALT); + set_mods(temp_mods); return false; } break; case DE_EGRAVE: if (record->event.pressed) { - uint8_t temp_mod = get_mods(); - clear_mods(); - register_mods(MOD_LALT); - if (temp_mod & MODS_SHIFT_MASK) { + uint8_t temp_mods = get_mods(); + if ((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) { + clear_oneshot_mods(); + clear_mods(); + register_mods(MOD_LALT); tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P0); tap_code(KC_P0); // È } else { + clear_mods(); + register_mods(MOD_LALT); tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P3); tap_code(KC_P2); // è - } - unregister_mods(MOD_LALT); + } + unregister_mods(MOD_LALT); + set_mods(temp_mods); return false; } break; case DE_EAIGU: if (record->event.pressed) { - uint8_t temp_mod = get_mods(); - clear_mods(); - register_mods(MOD_LALT); - if (temp_mod & MODS_SHIFT_MASK) { + uint8_t temp_mods = get_mods(); + if ((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) { + clear_oneshot_mods(); + clear_mods(); + register_mods(MOD_LALT); tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P0); tap_code(KC_P1); // É } else { + clear_mods(); + register_mods(MOD_LALT); tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P3); tap_code(KC_P3); // é - } - unregister_mods(MOD_LALT); + } + unregister_mods(MOD_LALT); + set_mods(temp_mods); return false; } break; case KC_CURRENCY: if (record->event.pressed) { - uint8_t temp_mod = get_mods(); - clear_mods(); - register_mods(MOD_LALT); - if (temp_mod & MODS_SHIFT_MASK) { + uint8_t temp_mods = get_mods(); + if ((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) { + clear_oneshot_mods(); + clear_mods(); + register_mods(MOD_LALT); tap_code(KC_P1); tap_code(KC_P5); tap_code(KC_P7); // ¥ } else { + clear_mods(); + register_mods(MOD_LALT); tap_code(KC_P0); tap_code(KC_P1); tap_code(KC_P2); tap_code(KC_P8); // € - } - unregister_mods(MOD_LALT); + } + unregister_mods(MOD_LALT); + set_mods(temp_mods); return false; } break; case DE_SLSH_QUST: if (record->event.pressed) { - uint8_t temp_mod = get_mods(); - if (temp_mod & MODS_SHIFT_MASK) { + uint8_t temp_mods = get_mods() | get_oneshot_mods(); + if (temp_mods & MOD_MASK_SHIFT) { tap_code(KC_MINS); // ? } else { tap_code16(KC_AMPR); // / @@ -582,8 +643,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { break; case DE_QUOT: if (record->event.pressed) { - uint8_t temp_mod = get_mods(); - if (temp_mod & MODS_SHIFT_MASK) { + uint8_t temp_mods = get_mods() | get_oneshot_mods(); + if (temp_mods & MOD_MASK_SHIFT) { tap_code(KC_2); // \" } else { tap_code16(KC_PIPE); // /' @@ -593,8 +654,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { break; case DE_SCLN: if (record->event.pressed) { - uint8_t temp_mod = get_mods(); - if (temp_mod & MODS_SHIFT_MASK) { + uint8_t temp_mods = get_mods() | get_oneshot_mods(); + if (temp_mods & MOD_MASK_SHIFT) { tap_code(KC_DOT); // ; } else { register_mods(MOD_LSFT); @@ -604,48 +665,16 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return false; } break; - case BACKLIT: + //switch multiplexing for escape, short tap for escape, long press for context menu + case M_ESCM: if (record->event.pressed) { - register_code(KC_RSFT); - #ifdef BACKLIGHT_ENABLE - backlight_step(); - #endif - #ifdef KEYBOARD_planck_rev5 - writePinLow(E6); - #endif + key_timer = timer_read(); } else { - unregister_code(KC_RSFT); - #ifdef KEYBOARD_planck_rev5 - writePinHigh(E6); - #endif - } - 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(); - keymap_config.nkro = 1; - eeconfig_update_keymap(keymap_config.raw); - } - return false; - break; - case EXT_PLV: - if (record->event.pressed) { - #ifdef AUDIO_ENABLE - PLAY_SONG(plover_gb_song); - #endif - layer_off(_PLOVER); + if (timer_elapsed(key_timer) > TAPPING_TERM) { + tap_code(KC_APP); + } else { + tap_code(KC_ESC); + } } return false; break; @@ -695,23 +724,11 @@ bool encoder_update(bool clockwise) { bool dip_switch_update_user(uint8_t index, bool active) { switch (index) { case 0: { -#ifdef AUDIO_ENABLE - static bool play_sound = false; -#endif if (active) { -#ifdef AUDIO_ENABLE - if (play_sound) { PLAY_SONG(plover_song); } -#endif layer_on(_ADJUST); } else { -#ifdef AUDIO_ENABLE - if (play_sound) { PLAY_SONG(plover_gb_song); } -#endif layer_off(_ADJUST); } -#ifdef AUDIO_ENABLE - play_sound = true; -#endif break; } case 1: diff --git a/keyboards/planck/keymaps/jweickm/rules.mk b/keyboards/planck/keymaps/jweickm/rules.mk index 4b3192f614c8..48f1defc2e03 100644 --- a/keyboards/planck/keymaps/jweickm/rules.mk +++ b/keyboards/planck/keymaps/jweickm/rules.mk @@ -9,7 +9,7 @@ BOOTLOADER = stm32-dfu # change to "no" to disable the options, or define them in the Makefile in # the appropriate keymap folder that will get included automatically # -BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite +BOOTMAGIC_ENABLE = lite # Enable Bootmagic Lite MOUSEKEY_ENABLE = yes # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control CONSOLE_ENABLE = no # Console for debug From 106298c3f7fb96e2b523a0d36cc984609d596537 Mon Sep 17 00:00:00 2001 From: Jakob Weickmann Date: Wed, 15 Sep 2021 22:52:41 +0200 Subject: [PATCH 10/31] Update keymap.c custom layer and mod tap for the german layout pinky --- keyboards/planck/keymaps/jweickm/keymap.c | 48 ++++++++++++++++++----- 1 file changed, 39 insertions(+), 9 deletions(-) diff --git a/keyboards/planck/keymaps/jweickm/keymap.c b/keyboards/planck/keymaps/jweickm/keymap.c index ea8bce6c3ef2..964ccacc119a 100644 --- a/keyboards/planck/keymaps/jweickm/keymap.c +++ b/keyboards/planck/keymaps/jweickm/keymap.c @@ -58,7 +58,8 @@ enum planck_keycodes { DE_SLSH_QUST, DE_QUOT, DE_SCLN, - M_ESCM + M_ESCM, + M_RGUI_SCLN }; // Tap Dance declarations @@ -85,7 +86,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), [_HRWIDECOLEMAK_DE] = LAYOUT_planck_grid( - LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM,KC_B), KC_SVU_BU, LT(_NUM,KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Z), DE_SCLN, RGUI_T(KC_LBRC), + LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM,KC_B), KC_SVU_BU, LT(_NUM,KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Z), M_RGUI_SCLN, KC_LBRC, KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB, KC_M, KC_N, KC_E, KC_I, KC_O, DE_QUOT, LT(_MOUSE,KC_Y), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, DE_SLSH_QUST, KC_SLSH, LCTL_T(KC_CAPS), LGUI_T(KC_TAB), M_ESCM, LT(_LOWER_DE,KC_BSPC), OSM(MOD_LSFT), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE_DE, KC_ENT), RSFT_T(KC_DEL), RCTL_T(KC_TAB), LT(_NAV,KC_LEFT), LT(_NAV,KC_RIGHT) @@ -632,14 +633,22 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { break; case DE_SLSH_QUST: if (record->event.pressed) { - uint8_t temp_mods = get_mods() | get_oneshot_mods(); - if (temp_mods & MOD_MASK_SHIFT) { - tap_code(KC_MINS); // ? - } else { - tap_code16(KC_AMPR); // / - } + key_timer = timer_read(); + layer_on(_MOUSE); + } else { + if (timer_elapsed(key_timer) < (TAPPING_TERM * pinky_factor)) { + layer_off(_MOUSE); + uint8_t temp_mods = get_mods() | get_oneshot_mods(); + if (temp_mods & MOD_MASK_SHIFT) { + tap_code(KC_MINS); // ? + } else { + tap_code16(KC_AMPR); // / + } + } else { + layer_off(_MOUSE); + } + } return false; - } break; case DE_QUOT: if (record->event.pressed) { @@ -678,6 +687,27 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return false; break; + case M_RGUI_SCLN: + if (record->event.pressed) { + key_timer = timer_read(); + add_mods(MOD_BIT(KC_RGUI)); + } else { + del_mods(MOD_BIT(KC_RGUI)); + if (timer_elapsed(key_timer) < (TAPPING_TERM * pinky_factor)) { + uint8_t temp_mods = get_mods() | get_oneshot_mods(); + if (temp_mods & MOD_MASK_SHIFT) { + tap_code(KC_DOT); // ; + } else { + register_mods(MOD_LSFT); + tap_code(KC_COMM); // : + unregister_mods(MOD_LSFT); + } + } else { + tap_code(KC_RGUI); + } + } + return false; + break; } return true; } From 13e9a24686d8ffcd65b128a2a55b580de4bddca3 Mon Sep 17 00:00:00 2001 From: Jakob Weickmann Date: Thu, 16 Sep 2021 01:38:56 +0200 Subject: [PATCH 11/31] macro selfrepeating further updates to the custom key macros. managed to make a key repeat itself when held (`return true;`). next step will be to do the same for the alt + numcode macros. --- keyboards/planck/keymaps/jweickm/keymap.c | 174 ++++++++++++++-------- keyboards/planck/keymaps/jweickm/rules.mk | 2 +- 2 files changed, 110 insertions(+), 66 deletions(-) diff --git a/keyboards/planck/keymaps/jweickm/keymap.c b/keyboards/planck/keymaps/jweickm/keymap.c index 964ccacc119a..8f56e4afc846 100644 --- a/keyboards/planck/keymaps/jweickm/keymap.c +++ b/keyboards/planck/keymaps/jweickm/keymap.c @@ -46,9 +46,11 @@ enum planck_keycodes { KC_TAB_MPLY, ALT_TAB, CTL_TAB, + DE_ae, + DE_oe, + DE_ue, DE_AE, DE_OE, - DE_UE, DE_SZ, DE_EGRAVE, DE_EAIGU, @@ -58,6 +60,7 @@ enum planck_keycodes { DE_SLSH_QUST, DE_QUOT, DE_SCLN, + DE_BSLS, M_ESCM, M_RGUI_SCLN }; @@ -79,16 +82,16 @@ enum tap_dance_codes{ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_HRWIDECOLEMAK] = LAYOUT_planck_grid( - LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM,KC_B), KC_SVU_BU, LT(_NUM,KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Y), RGUI_T(KC_SCLN), DE_UE, + LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM,KC_B), KC_SVU_BU, LT(_NUM,KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Y), RGUI_T(KC_SCLN), DE_ue, KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, - LT(_MOUSE,KC_Z), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, LT(_MOUSE,KC_SLSH), KC_MINS, + LT(_MOUSE,KC_Z), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, LT(_MOUSE,KC_SLSH), KC_BSLS, LCTL_T(KC_CAPS), LGUI_T(KC_TAB), M_ESCM, LT(_LOWER,KC_BSPC), OSM(MOD_LSFT), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE, KC_ENT), RSFT_T(KC_DEL), RCTL_T(KC_TAB), LT(_NAV,KC_LEFT), LT(_NAV,KC_RIGHT) ), [_HRWIDECOLEMAK_DE] = LAYOUT_planck_grid( LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM,KC_B), KC_SVU_BU, LT(_NUM,KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Z), M_RGUI_SCLN, KC_LBRC, KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB, KC_M, KC_N, KC_E, KC_I, KC_O, DE_QUOT, - LT(_MOUSE,KC_Y), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, DE_SLSH_QUST, KC_SLSH, + LT(_MOUSE,KC_Y), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, DE_SLSH_QUST, DE_BSLS, LCTL_T(KC_CAPS), LGUI_T(KC_TAB), M_ESCM, LT(_LOWER_DE,KC_BSPC), OSM(MOD_LSFT), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE_DE, KC_ENT), RSFT_T(KC_DEL), RCTL_T(KC_TAB), LT(_NAV,KC_LEFT), LT(_NAV,KC_RIGHT) ), @@ -111,36 +114,36 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `-----------------------------------------------------------------------------------' */ [_WIDECOLEMAK] = LAYOUT_planck_grid( - KC_Q, KC_W, KC_F, KC_P, KC_B, KC_SVU_BU, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, DE_UE, + KC_Q, KC_W, KC_F, KC_P, KC_B, KC_SVU_BU, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, DE_ue, KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB_MPLY, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, KC_Z, KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, TG_COLEMAK, KC_CAPS, LT(_NUM,KC_TAB), LGUI_T(KC_ESC), LT(_LOWER,KC_BSPC), OSM(MOD_LSFT), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE, KC_ENT), RSFT_T(KC_DEL), KC_LALT, LT(_NAV,KC_LEFT), LT(_NAV,KC_RIGHT) ), [_LOWER] = LAYOUT_planck_grid( - KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_TILD, KC_CIRC, KC_AMPR, KC_ASTR, TD(TD_PRN), KC_RPRN, DE_AE, - KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, DE_SZ, KC_UNDS, KC_PLUS, TD(TD_CBR), KC_RCBR, KC_PIPE, + KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_TILD, KC_CIRC, KC_AMPR, KC_ASTR, TD(TD_PRN), KC_RPRN, DE_OE, + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, DE_SZ, KC_UNDS, KC_PLUS, TD(TD_CBR), KC_RCBR, DE_AE, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, KC_SLSH, KC_NUBS, LSFT(KC_NUBS), KC_CURRENCY, DE_EGRAVE, TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_DOWN, KC_UP ), [_LOWER_DE] = LAYOUT_planck_grid( - KC_EXLM, RALT(KC_Q), KC_BSLS, KC_DLR, KC_PERC, RALT(KC_RBRC), KC_GRV, KC_CIRC, KC_RCBR, TD(TD_PRN_DE), KC_LPRN, KC_QUOT, - KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, LSFT(KC_SLSH), KC_RBRC, TD(TD_CBR_DE), RALT(KC_0), RALT(KC_NUBS), + KC_EXLM, RALT(KC_Q), KC_BSLS, KC_DLR, KC_PERC, RALT(KC_RBRC), KC_GRV, KC_CIRC, KC_RCBR, TD(TD_PRN_DE), KC_LPRN, LSFT(KC_SCLN), + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, LSFT(KC_SLSH), KC_RBRC, TD(TD_CBR_DE), RALT(KC_0), LSFT(KC_QUOT), KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, LSFT(KC_7), KC_NUBS, LSFT(KC_NUBS), KC_CURRENCY, KC_PLUS, TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_DOWN, KC_UP ), [_RAISE] = LAYOUT_planck_grid( - KC_1, KC_2, KC_3, KC_4, KC_5, KC_GRV, KC_6, KC_7, KC_8, KC_9, KC_0, DE_OE, - KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, DE_SZ, KC_MINS, KC_EQL, TD(TD_BRC), KC_RBRC, KC_BSLS, + KC_1, KC_2, KC_3, KC_4, KC_5, KC_GRV, KC_6, KC_7, KC_8, KC_9, KC_0, DE_oe, + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, DE_SZ, KC_MINS, KC_EQL, TD(TD_BRC), KC_RBRC, DE_ae, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, KC_BSLS, KC_COMM, KC_DOT, KC_SLSH, DE_EAIGU, TG(_MOUSE), KC_TRNS, KC_BSPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_DOWN, KC_UP ), [_RAISE_DE] = LAYOUT_planck_grid( KC_1, KC_2, KC_3, KC_4, KC_5, LSFT(KC_GRV), KC_6, KC_7, KC_8, KC_9, KC_0, KC_SCLN, - KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_SLSH, LSFT(KC_0), TD(TD_BRC_DE), RALT(KC_9), RALT(KC_MINS), + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_SLSH, LSFT(KC_0), TD(TD_BRC_DE), RALT(KC_9), KC_QUOT, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, RALT(KC_MINS), KC_COMM, KC_DOT, KC_SLSH, KC_EQL, TG(_MOUSE), KC_TRNS, KC_BSPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_DOWN, KC_UP ), @@ -214,27 +217,27 @@ void dance_prn_de(qk_tap_dance_state_t *state, void *user_data) { } void dance_brc_de(qk_tap_dance_state_t *state, void *user_data) { if (state->count == 1) { - register_mods(MOD_RALT); + add_mods(MOD_BIT(KC_RALT)); tap_code(KC_8); - unregister_mods(MOD_RALT); + unregister_mods(MOD_BIT(KC_RALT)); } else { - register_mods(MOD_RALT); + add_mods(MOD_BIT(KC_RALT)); tap_code(KC_8); tap_code(KC_9); - unregister_mods(MOD_RALT); + unregister_mods(MOD_BIT(KC_RALT)); tap_code(KC_LEFT); } } void dance_cbr_de(qk_tap_dance_state_t *state, void *user_data) { if (state->count == 1) { - register_mods(MOD_RALT); + add_mods(MOD_BIT(KC_RALT)); tap_code16(KC_7); - unregister_mods(MOD_RALT); + unregister_mods(MOD_BIT(KC_RALT)); } else { - register_mods(MOD_RALT); + add_mods(MOD_BIT(KC_RALT)); tap_code(KC_7); tap_code(KC_0); - unregister_mods(MOD_RALT); + unregister_mods(MOD_BIT(KC_RALT)); tap_code(KC_LEFT); } } @@ -359,7 +362,6 @@ bool de_layout_active = false; static uint16_t key_timer; - bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case WIDECOLEMAK: @@ -396,8 +398,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { break; case VIM_V: if (record->event.pressed) { - if ((get_mods() & MOD_BIT(KC_LSFT)) ) { - unregister_mods(MOD_LSFT); + if (get_mods() & MOD_MASK_SHIFT) { + clear_mods(); } else { register_mods(MOD_LSFT); } @@ -406,9 +408,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { break; case KC_SVU_BU: // increase backlight when pressing shift and vol up if (record->event.pressed) { - if (get_mods() & MOD_BIT(KC_LSFT) || get_mods() & MOD_BIT(KC_RSFT)) { + if (get_mods() & MOD_MASK_SHIFT) { register_code(KC_BRIU); - } else if (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTL)){ + } else if (get_mods() & MOD_MASK_SHIFT){ register_code(KC_MNXT); } else { register_code(KC_VOLU); @@ -421,9 +423,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return false; case KC_SVD_BD: // decrease backlight when pressing shift and vol up if (record->event.pressed) { - if (get_mods() & MOD_BIT(KC_LSFT) || get_mods() & MOD_BIT(KC_RSFT)) { + if (get_mods() & MOD_MASK_SHIFT) { register_code(KC_BRID); - } else if (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTL)){ + } else if (get_mods() & MOD_MASK_SHIFT){ register_code(KC_MPRV); } else { register_code(KC_VOLD); @@ -436,7 +438,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return false; case KC_TAB_MPLY: // press tab or play/pause when ctrl is pressed if (record->event.pressed) { - if (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTL)){ + if (get_mods() & MOD_MASK_CTRL){ register_code(KC_MPLY); } else { register_code(KC_TAB); @@ -450,7 +452,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { if (!is_alt_tab_active) { is_alt_tab_active = true; - register_mods(MOD_LALT); + add_mods(MOD_LALT); } register_code(KC_TAB); } else { @@ -461,7 +463,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { if (!is_ctl_tab_active) { is_ctl_tab_active = true; - register_mods(MOD_LCTL); + add_mods(MOD_LCTL); } register_code(KC_TAB); } else { @@ -478,59 +480,83 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { is_ctl_tab_active = false; } break; - case DE_AE: + case DE_ae: if (record->event.pressed) { uint8_t temp_mods = get_mods(); if ((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) { clear_oneshot_mods(); clear_mods(); - register_mods(MOD_LALT); + add_mods(MOD_LALT); tap_code(KC_P0); tap_code(KC_P1); tap_code(KC_P9); tap_code(KC_P6); // Ä } else { clear_mods(); - register_mods(MOD_LALT); + add_mods(MOD_LALT); tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P2); tap_code(KC_P8); // ä } unregister_mods(MOD_LALT); set_mods(temp_mods); + } return false; + break; + case DE_AE: + if (record->event.pressed) { + uint8_t temp_mods = get_mods() | get_oneshot_mods(); + clear_oneshot_mods(); + clear_mods(); + add_mods(MOD_LALT); + tap_code(KC_P0); tap_code(KC_P1); tap_code(KC_P9); tap_code(KC_P6); // Ä + unregister_mods(MOD_LALT); + set_mods(temp_mods); } + return false; break; - case DE_OE: + case DE_oe: if (record->event.pressed) { uint8_t temp_mods = get_mods(); if ((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) { clear_oneshot_mods(); clear_mods(); - register_mods(MOD_LALT); + add_mods(MOD_LALT); tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P1); tap_code(KC_P4); // Ö } else { clear_mods(); - register_mods(MOD_LALT); + add_mods(MOD_LALT); tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P4); tap_code(KC_P6); // ö } unregister_mods(MOD_LALT); set_mods(temp_mods); + } return false; + break; + case DE_OE: + if (record->event.pressed) { + uint8_t temp_mods = get_mods() | get_oneshot_mods(); + clear_oneshot_mods(); + clear_mods(); + add_mods(MOD_LALT); + tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P1); tap_code(KC_P4); // Ö + unregister_mods(MOD_LALT); + set_mods(temp_mods); } + return false; break; - case DE_UE: + case DE_ue: if (record->event.pressed) { uint8_t temp_mods = get_mods(); if ((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) { clear_oneshot_mods(); clear_mods(); - register_mods(MOD_LALT); + add_mods(MOD_LALT); tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P2); tap_code(KC_P0); // Ü } else { clear_mods(); - register_mods(MOD_LALT); + add_mods(MOD_LALT); tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P5); tap_code(KC_P2); // ü } unregister_mods(MOD_LALT); set_mods(temp_mods); - return false; } + return false; break; case KC_DE_SWITCH: if (record->event.pressed) { @@ -546,7 +572,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { break; case LANG_SWITCH: if (record->event.pressed) { - register_mods(MOD_LALT); + add_mods(MOD_LALT); tap_code(KC_LSFT); unregister_mods(MOD_LALT); if (de_layout_active) { @@ -565,17 +591,17 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if ((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) { clear_oneshot_mods(); clear_mods(); - register_mods(MOD_LALT); + add_mods(MOD_LALT); tap_code(KC_P0); tap_code(KC_P1); tap_code(KC_P7); tap_code(KC_P6); // ° } else { clear_mods(); - register_mods(MOD_LALT); + add_mods(MOD_LALT); tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P2); tap_code(KC_P3); // ß } unregister_mods(MOD_LALT); set_mods(temp_mods); - return false; } + return false; break; case DE_EGRAVE: if (record->event.pressed) { @@ -583,17 +609,17 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if ((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) { clear_oneshot_mods(); clear_mods(); - register_mods(MOD_LALT); + add_mods(MOD_LALT); tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P0); tap_code(KC_P0); // È } else { clear_mods(); - register_mods(MOD_LALT); + add_mods(MOD_LALT); tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P3); tap_code(KC_P2); // è } unregister_mods(MOD_LALT); set_mods(temp_mods); - return false; } + return false; break; case DE_EAIGU: if (record->event.pressed) { @@ -601,17 +627,17 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if ((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) { clear_oneshot_mods(); clear_mods(); - register_mods(MOD_LALT); + add_mods(MOD_LALT); tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P0); tap_code(KC_P1); // É } else { clear_mods(); - register_mods(MOD_LALT); + add_mods(MOD_LALT); tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P3); tap_code(KC_P3); // é } unregister_mods(MOD_LALT); set_mods(temp_mods); - return false; } + return false; break; case KC_CURRENCY: if (record->event.pressed) { @@ -619,17 +645,17 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if ((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) { clear_oneshot_mods(); clear_mods(); - register_mods(MOD_LALT); + add_mods(MOD_LALT); tap_code(KC_P1); tap_code(KC_P5); tap_code(KC_P7); // ¥ } else { clear_mods(); - register_mods(MOD_LALT); + add_mods(MOD_LALT); tap_code(KC_P0); tap_code(KC_P1); tap_code(KC_P2); tap_code(KC_P8); // € } unregister_mods(MOD_LALT); set_mods(temp_mods); - return false; } + return false; break; case DE_SLSH_QUST: if (record->event.pressed) { @@ -654,26 +680,45 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { uint8_t temp_mods = get_mods() | get_oneshot_mods(); if (temp_mods & MOD_MASK_SHIFT) { - tap_code(KC_2); // \" + register_code(KC_2); // \" } else { - tap_code16(KC_PIPE); // /' + register_code16(KC_PIPE); // /' } - return false; - } - break; + } else { + unregister_code(KC_2); + unregister_code16(KC_PIPE); + } + return true; case DE_SCLN: if (record->event.pressed) { uint8_t temp_mods = get_mods() | get_oneshot_mods(); if (temp_mods & MOD_MASK_SHIFT) { tap_code(KC_DOT); // ; } else { - register_mods(MOD_LSFT); + add_mods(MOD_LSFT); tap_code(KC_COMM); // : - unregister_mods(MOD_LSFT); + del_mods(MOD_LSFT); } return false; } break; + case DE_BSLS: + if (record->event.pressed) { + uint8_t temp_mods = get_mods() | get_oneshot_mods(); + clear_mods(); + clear_oneshot_mods(); + add_mods(MOD_BIT(KC_RALT)); + if (temp_mods & MOD_MASK_SHIFT) { + register_code(KC_NUBS); // | Pipe + } else { + register_code(KC_MINS); // Backslash + } + set_mods(temp_mods); + } else { + unregister_code(KC_NUBS); + unregister_code(KC_MINS); + } + return true; //switch multiplexing for escape, short tap for escape, long press for context menu case M_ESCM: if (record->event.pressed) { @@ -686,21 +731,20 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } } return false; - break; case M_RGUI_SCLN: if (record->event.pressed) { key_timer = timer_read(); - add_mods(MOD_BIT(KC_RGUI)); + add_mods(MOD_RGUI); } else { - del_mods(MOD_BIT(KC_RGUI)); + del_mods(MOD_RGUI); if (timer_elapsed(key_timer) < (TAPPING_TERM * pinky_factor)) { uint8_t temp_mods = get_mods() | get_oneshot_mods(); if (temp_mods & MOD_MASK_SHIFT) { tap_code(KC_DOT); // ; } else { - register_mods(MOD_LSFT); + add_mods(MOD_LSFT); tap_code(KC_COMM); // : - unregister_mods(MOD_LSFT); + del_mods(MOD_LSFT); } } else { tap_code(KC_RGUI); diff --git a/keyboards/planck/keymaps/jweickm/rules.mk b/keyboards/planck/keymaps/jweickm/rules.mk index 48f1defc2e03..bab7b817c451 100644 --- a/keyboards/planck/keymaps/jweickm/rules.mk +++ b/keyboards/planck/keymaps/jweickm/rules.mk @@ -18,7 +18,7 @@ NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: h BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality MIDI_ENABLE = no # MIDI controls AUDIO_ENABLE = yes # Audio output -UNICODE_ENABLE = yes # Unicode +UNICODE_ENABLE = no # Unicode BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. WS2812_DRIVER = pwm From e4163c2d96c45e702be640c857ab36d0c5674404 Mon Sep 17 00:00:00 2001 From: Jakob Weickmann Date: Thu, 16 Sep 2021 22:28:11 +0200 Subject: [PATCH 12/31] Update keymap.c added 'normal' del key to nav layer improved lang_switch to also work on android changed color scheme to be similar to gruvbox --- keyboards/planck/keymaps/jweickm/keymap.c | 29 +++++++++++++---------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/keyboards/planck/keymaps/jweickm/keymap.c b/keyboards/planck/keymaps/jweickm/keymap.c index 8f56e4afc846..ede7f94912dd 100644 --- a/keyboards/planck/keymaps/jweickm/keymap.c +++ b/keyboards/planck/keymaps/jweickm/keymap.c @@ -159,7 +159,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ALT_TAB, LCTL(KC_RGHT), LANG_SWITCH, LALT(KC_GRV), LCTL(KC_LEFT), KC_MNXT, KC_HOME, KC_RIGHT, KC_PGUP, LCTL(KC_C), KC_RGUI, KC_DE_SWITCH, CTL_TAB, KC_TAB, KC_ESC, KC_ENT, TD(TD_VIM_GG), KC_MPLY, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_END, VIM_O, KC_LSFT, KC_NO, LCTL(KC_X), KC_CAPS, VIM_V, KC_MUTE, KC_HOME, KC_PGDN, KC_LSFT, KC_RSFT, LCTL(KC_F), LCTL(KC_F), - KC_NO, KC_NO, KC_NO, KC_TRNS, KC_TRNS, LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), KC_TRNS, KC_TRNS, KC_TRNS, KC_DOWN, KC_UP + KC_NO, KC_NO, KC_NO, KC_BSPC, KC_TRNS, LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), KC_ENT, KC_DEL, KC_TRNS, KC_DOWN, KC_UP ), [_NUM] = LAYOUT_planck_grid( @@ -572,9 +572,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { break; case LANG_SWITCH: if (record->event.pressed) { - add_mods(MOD_LALT); - tap_code(KC_LSFT); - unregister_mods(MOD_LALT); + register_mods(MOD_LALT); + register_code(KC_LSFT); if (de_layout_active) { de_layout_active = false; // deactivate German overlay set_single_persistent_default_layer(_HRWIDECOLEMAK); @@ -582,9 +581,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { de_layout_active = true; // activate German overlay set_single_persistent_default_layer(_HRWIDECOLEMAK_DE); } - return false; + } else { + unregister_code(KC_LSFT); + unregister_mods(MOD_LALT); } - break; + return false; case DE_SZ: if (record->event.pressed) { uint8_t temp_mods = get_mods(); @@ -876,6 +877,8 @@ bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) { // Set RGB to change with layer changes #define HSV_DARKORANGE 10, 255, 255 #define HSV_DARKPINK 150, 100, 255 +#define HSV_GRASS 57, 255, 255 +#define HSV_OCEAN 148, 255, 255 // Light LEDs 1 to 9 in darkorange when HRCOLEMAK is active const rgblight_segment_t PROGMEM my_layer0_layer[] = RGBLIGHT_LAYER_SEGMENTS( @@ -883,13 +886,13 @@ const rgblight_segment_t PROGMEM my_layer0_layer[] = RGBLIGHT_LAYER_SEGMENTS( ); // Light LEDs 1 to 9 in green when HRWIDECOLEMAK is active const rgblight_segment_t PROGMEM my_layer1_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {0, 10, HSV_CYAN} + {0, 10, HSV_OCEAN} ); // Light LEDs 1 to 9 in darkorange when de_layout_active is true const rgblight_segment_t PROGMEM my_layer2_layer[] = RGBLIGHT_LAYER_SEGMENTS( {3, 4, HSV_DARKORANGE}, - {0, 3, HSV_CYAN}, - {8, 3, HSV_CYAN} + {0, 3, HSV_OCEAN}, + {8, 3, HSV_OCEAN} ); // Light LEDs 1 to 9 in red when GAMING layer is active const rgblight_segment_t PROGMEM my_layer3_layer[] = RGBLIGHT_LAYER_SEGMENTS( @@ -901,13 +904,13 @@ const rgblight_segment_t PROGMEM my_layer4_layer[] = RGBLIGHT_LAYER_SEGMENTS( ); // Light bottom LEDs in purple when ADJUST layer is active const rgblight_segment_t PROGMEM my_layer5_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {0, 2, HSV_PURPLE}, - {7, 3, HSV_PURPLE} + {0, 2, HSV_MAGENTA}, + {7, 3, HSV_MAGENTA} ); // Light bottom LEDs in red when caps lock is active. Hard to ignore! const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {0, 3, HSV_MAGENTA}, - {7, 3, HSV_MAGENTA} + {0, 3, HSV_GRASS}, + {7, 3, HSV_GRASS} ); // Light LEDs 1 to 9 in white when NAVIGATION is active const rgblight_segment_t PROGMEM my_nav_layer[] = RGBLIGHT_LAYER_SEGMENTS( From 76bdcef22364f69b1b3f1be8a3fba79b5bd99617 Mon Sep 17 00:00:00 2001 From: Jakob Weickmann Date: Fri, 17 Sep 2021 18:05:02 +0200 Subject: [PATCH 13/31] Update keymap.c Added ctl ins and ctl sft to the _nav layer changed vim_gg tap dance code to a more sensible code (ctl+home, and ctl+end) --- keyboards/planck/keymaps/jweickm/keymap.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/keyboards/planck/keymaps/jweickm/keymap.c b/keyboards/planck/keymaps/jweickm/keymap.c index ede7f94912dd..e18a03da0ea5 100644 --- a/keyboards/planck/keymaps/jweickm/keymap.c +++ b/keyboards/planck/keymaps/jweickm/keymap.c @@ -30,6 +30,7 @@ enum planck_layers { _RAISE_DE, _ADJUST, _NAV, + _VIM, _NUM, _MOUSE, }; @@ -156,10 +157,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), [_NAV] = LAYOUT_planck_grid( + ALT_TAB, LCTL(KC_RGHT), LANG_SWITCH, LALT(KC_GRV), LCTL(KC_LEFT), KC_MNXT, KC_HOME, KC_RIGHT, KC_PGUP, LCTL(KC_INS), LSFT(KC_INS), KC_DE_SWITCH, + CTL_TAB, KC_TAB, KC_ESC, KC_ENT, TD(TD_VIM_GG), KC_MPLY, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_END, VIM_O, + KC_LSFT, KC_NO, LCTL(KC_X), KC_CAPS, VIM_V, KC_MUTE, KC_HOME, KC_PGDN, KC_LSFT, KC_RSFT, LCTL(KC_F), LCTL(KC_F), + KC_NO, KC_NO, KC_TRNS, KC_BSPC, KC_TRNS, LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), KC_ENT, KC_DEL, KC_TRNS, KC_DOWN, KC_UP +), + +[_VIM] = LAYOUT_planck_grid( ALT_TAB, LCTL(KC_RGHT), LANG_SWITCH, LALT(KC_GRV), LCTL(KC_LEFT), KC_MNXT, KC_HOME, KC_RIGHT, KC_PGUP, LCTL(KC_C), KC_RGUI, KC_DE_SWITCH, CTL_TAB, KC_TAB, KC_ESC, KC_ENT, TD(TD_VIM_GG), KC_MPLY, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_END, VIM_O, KC_LSFT, KC_NO, LCTL(KC_X), KC_CAPS, VIM_V, KC_MUTE, KC_HOME, KC_PGDN, KC_LSFT, KC_RSFT, LCTL(KC_F), LCTL(KC_F), - KC_NO, KC_NO, KC_NO, KC_BSPC, KC_TRNS, LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), KC_ENT, KC_DEL, KC_TRNS, KC_DOWN, KC_UP + KC_NO, KC_NO, TG(_VIM), KC_BSPC, KC_TRNS, LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), KC_ENT, KC_DEL, KC_TRNS, KC_DOWN, KC_UP ), [_NUM] = LAYOUT_planck_grid( @@ -243,13 +251,13 @@ void dance_cbr_de(qk_tap_dance_state_t *state, void *user_data) { } void vim_gg(qk_tap_dance_state_t *state, void *user_data) { if (state->count == 1) { - for (int i = 0; i < 10; i++) { - tap_code(KC_PGDN); - } + register_mods(MOD_LCTL); + tap_code(KC_END); + unregister_mods(MOD_LCTL); } else { - for (int i = 0; i < 10; i++) { - tap_code(KC_PGUP); - } + register_mods(MOD_LCTL); + tap_code(KC_HOME); + unregister_mods(MOD_LCTL); } } From ec67c89afa28d8b5e29766110d79adc94ace9ce7 Mon Sep 17 00:00:00 2001 From: Jakob Weickmann Date: Fri, 17 Sep 2021 18:18:34 +0200 Subject: [PATCH 14/31] cleaned up the directory for commit to the master branch --- .../planck/keymaps/jweickm/.keymap.c.swo | Bin 57344 -> 0 bytes .../planck/keymaps/jweickm/config.h_qwerty | 199 ---- .../planck/keymaps/jweickm/config_kopie.h | 44 - ... - \343\202\263\343\203\224\343\203\274.c" | 862 ------------------ .../planck/keymaps/jweickm/keymap_backup.c | 839 ----------------- .../planck/keymaps/jweickm/keymap_halfwide.c | 583 ------------ .../planck/keymaps/jweickm/keymap_narrow.c | 572 ------------ .../planck/keymaps/jweickm/keymap_qwerty.c | 479 ---------- .../keymaps/jweickm/keymap_triple_tap.c | 731 --------------- .../planck/keymaps/jweickm/keymap_unicode.c | 425 --------- keyboards/planck/keymaps/jweickm/readme.md | 8 +- .../planck/keymaps/jweickm/rules_kopie.mk | 1 - 12 files changed, 7 insertions(+), 4736 deletions(-) delete mode 100644 keyboards/planck/keymaps/jweickm/.keymap.c.swo delete mode 100644 keyboards/planck/keymaps/jweickm/config.h_qwerty delete mode 100644 keyboards/planck/keymaps/jweickm/config_kopie.h delete mode 100644 "keyboards/planck/keymaps/jweickm/keymap - \343\202\263\343\203\224\343\203\274.c" delete mode 100644 keyboards/planck/keymaps/jweickm/keymap_backup.c delete mode 100644 keyboards/planck/keymaps/jweickm/keymap_halfwide.c delete mode 100644 keyboards/planck/keymaps/jweickm/keymap_narrow.c delete mode 100644 keyboards/planck/keymaps/jweickm/keymap_qwerty.c delete mode 100644 keyboards/planck/keymaps/jweickm/keymap_triple_tap.c delete mode 100644 keyboards/planck/keymaps/jweickm/keymap_unicode.c delete mode 100644 keyboards/planck/keymaps/jweickm/rules_kopie.mk diff --git a/keyboards/planck/keymaps/jweickm/.keymap.c.swo b/keyboards/planck/keymaps/jweickm/.keymap.c.swo deleted file mode 100644 index 5dce69e963ce019c02ea92b638a1cf05415be148..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 57344 zcmeI534CN#mGBEU48q8`p$y;y6cR{xIt>jp&0-~~EOce*s-zd7r>G>Ar0Aq7T~+C( z?QRrMJ{&=vPlfSw#T6B|@l#QB7-^SrU&d`5oN++LeZ!xF%b@c=_uTv5t1YSSq(_*k zbpPvBy?5VT&%5uPd(S;@e9h*8LGQfPoe}+1%-S|jY(IkzJGnK?C;a< zcA(<;4hF8H2 za5a=*8ZL!l=!1)49h?cRa5@|d4=@<<1NaVn75)J}4DWzj;Z<-WTn%~1z@@MW`r%?Y z2hM<#;EC`@%Kr=aE_@w62Y16=@OSWLcnOSy)Kwe&fkA^6%j;cq`ll zH^LxnglEA%21DB5Lkw#Cl!1vK!4KgsI1WC^V8S+d5n}|`!wVq;PlCG{SJ(khfXBm; z@EZmZ+;~N!Leg=Dw`HIw);%1L4MsPTpY}*g%f{|hyn8g>?(wDDe0G`7t>!ZxjgOiy z$q_y1wy`1IpKt+26GKT8Qor;?2M31wZ2ZYy4II^|%x91J>@}Z#=Cj{?USd8kHJ^j# zGua&OD_?tv4H@B(=z8DXoI--i2N~x@~xDG^NHa zsp&#?veneS$DdSwYP3~qKRS|ZYxm-PV*|Q_0`hw>MaHO!_-Jb?KD;HCNcF_p3Eo9h zaCkU5*g81elZsQxayFrcqMIdv9 znN(t+uYa_SYLrle!(&O4!)-)E{3=OWx7zBP&Hm)(o>Uh*B+N#$M?@G|(NLGI$bRE--D=%X!B4AqIhfBJolBntBNmrS?iezb|^j(OPb_>gw zF>+~T>`yObEg>=E`fLfLOQcQZZY)+MWc4JhB{GrE6-(YiHdpFACsp!B62pCiu|dyT z^j)_7vcc$RVqj}3F}x+||DY#NN|bvsN}9|}Wpf$NbV=UeaBIqZYx577KF=I5-`XOP z{Tm|EbB^|;uwzX1^?4l~UNM`Sp3Qir^t@Nfd&P-Des^dc}Nh+QlMWoaxp~R1^8RxwKcBNtbLEie8%kUU4>EoIwaFDDsoy>Nmk{ zHm4SH6QyiE=kb5%LcWwKN}e;hv?=VKc`C#^@KGXwi+;74W zO5I70C$PlyX7dv}G-!8Mf?kwAvN4hvlDkF=a zrr73+N${n^W^xO2(r&3qOhGfLiTq@yxHm!yqvWSY_IZ<;iP>}^Eu}5m=GVJoq{VfU zB|~FhI|>8 zFJ+HCUikSLb^t z1?;1e3P4<+47_z+i1@va(kAq{-cHb@Sj)wBPNX5ZN7!> zWAwM2;Y!p}b(5n?%lDZG`V;P{u&fx!dZtj6LPSo@<|bwrCNthCI~UTq(!$*8nNvbL z=eUB)_G}v5nA#ZI)-@bW^rZSD-WeU>rDwT(z1`W;3>Rv)$Yq_ME~MvHd)~m5m&Kj8=?QoPIz&Rh)5)!`T@*EJeM!XbyG@b zXNxA?!C0cZKRSdQ4j>%cJTCO!fzhE@GU@dWC%mXP5>1Q_bdSZO32$U9F*2NtQMe?9 zB0G}c_(BQs8|~*w){72p^R`42$j|7u4W?G;S-i}yOwMFJJ2yX@rAQci7pQV6l*BL^ zsyL52oTPUxWQmucbW>97nf$yYNKcq85ifoCc*diJrWR&tZd3494$_eoy!^a$2yI?E zw}-w>`srP?IlD}GCAQuI*-z%DN@8{H^-7OrI+1oSLqi59cxzp?+d6KidL+kWf^*~! zKy0KiS9AdvsebzId1)}tlCh%A*!fZ%dfgnd5LAhzoz6{m&`xvt$?TNG zBT;oDB!%qsOvzijW^Jc;iP-CVTa4L!I+u%}Kkh`djGxZ-l>wm%>Y66rKuSLGQl?*1|oq-X^OwkzqF$pkGu`rL$mPw%~meskdU>!=Z!wyuqjYL|kx*fgKysKL~$Kn@U z;D?i@Zul=kq+VvWnDO>De9oc)iLhMKynWtsGAKhR^4D6olHG_*n|Io2bpyFE9Iws% z+Z!>FE*0z2QJUEH?TfTzr-*FD{v!3ot??_NejLmJ))QGBt*X9|!r`U2Sn>k$rJz(; zSgN~W?r}CVseR9C8LUmoU@aH(cs@UC4%ur)Qzd9AI6*F1(f^rNjy#!pWYPbf{rbP7 z=YIm;12@9ea1~5L1}32wI^hKPJ!1iX3)jH~@N32cJ_C2c`(O{u!U(K|r@&G07tVjr*L312WhDbod=( z9ruCE?Y|Rlgat^#1+WHAgyZ4qa2))cdHv79ZSXeO0Vl!{@CWAeWzK&AQgAu^1$=?| z{rADE;d;0ZHo`;9`Tqd!huh&Vp$~eX1@2`2|4r}`crnD_*VqDl1O5)~gzMluI2lfY z6X82F;!SWR^uWn*1l&WreiYsa*TB`VAGX2?{MLV)0myULM8Bu6%Yhtzz&SW0DcSu6c=(A+P~9gt{6az$`8 zZcpYE+%9gB1jwa#>9O_}{y5AIJz{dV&K{I*goEkHD;J6~yTO^}_}S&hcW0SJ$j@fx z(lW2%0-aSJXgWQ|v`Ogr+VbO*8TqZVC@zXl7sTXorcgVfH7=CqcBbI+qVs2=CxYoY z=223mGZ+q*nKd_|Msh(zTqcueiN3D5%)6&BFNh_QsrW#0v{fcfhVr}RRxYz@GHxk@ zux4CY8+El8H-n}6ibAv;pNt4UC8N@_VVDqbF4YRQF`tX@AC?mSGr+y3;>@;S}Kiu59Ul+SopcOfCk4OM94SD5Y54=taS z_32Mzh9uaxfN*U-GBC8!>s)6tE`7tgbyY!BEKJAEVGY9_A(<)3?LvB#1C)Hp4}HzPWz6A$_1$ z#EjQ!C;jE|%;*r)s4Q4yhzUswix8|bX7aO>t-g_u4c{&gdptSh3!-A2q2K&50qx9c z$Vr7PmCKq)mWq*>I%-2|6Nt&8{H~X2Ci1frskwA}-lz|4gyfJ}$`-(Q3ozN{X`IjTx99vLhUb z1jz} z%`*p|Vp4jiGrUC%?_{Jgnx=BK96wW+^kcQhWm%p9LE8piwr{a9<;_8?t9O~09GXP1(Hkcsz< z>})wTJB8GG(XpO^VS1QoS3IWL&Rm*-sjE^&X75$%d^Jbg$_jU&)i2eACfAZKrLx_x zE4XZ{M9CctpBJR&j!KF2MlHn={r@!dzT?pWMgMo}1_P}MZ9z^dy z5x$15|2~+2DEtzA{%ddmZiQRm2AF~#I0cS}$H86b@1o<2z5iNxHarG?ho1gp_zc_* zZwArnpAT0+7n}-@1+m-z9()V#gb%{)@c-bsa5-EE&xB`y*z7+5UxzQlr{H>+g#kDp zo&mo>hyNyg5Z(oEfS17>#Ng3zANu^~;5HbAKInj>;bZ9X?}wK`5yoLVBq0W;!0*uQ z?|{F7=fierf&WCG{~mlCcEU9D!0GTb_;WZC9z?(Y8r%+|_g?~Q;fZi3?fGuF8H(^M zkT!k>H1_A@#XbgzRi0RbiFNwOnzjwbOwZr3wsOb1${iAdr;h_4jkt*AcA!R;DTKVJ zmg`u`m30Xdvzau#kQ`^f+-+-!{XyofDzj1?$=hp|leeH)n&*5jgKZamu+6(WF4teH z+*S1eqrCE?JT$|nSh@C~&?YyglKlhN*xUPu#Nv8Axg(fZ=pTXzUB@Qr=xun_MPiLr zT8(C3EN0Bei$r5?r5H7iaVw=>#|xSC4pYUZ#j9_{a*hmOntc0dhgxePw`7B=FnQ&| zv$QmwT`5iH*cSU>L~^BnOD0Z{4}&yyR_0AIE7Ejx#O3S|Bt1Cw5g<+W$rxE0{%@D1 zmgQdj=h^0Z^KzQ&kUFL+$yr}1N>0pQu$;U-qC`nD>pG^WdB&GLwr`TJ^4t?KTh!y! zL}?c7WZaEBR6HjUAk7qJ{Qxz4EX=n3POWBu@I9*HZq!((Yt{$_3$vVxN~a-Xw6bhK z>j2Fnzq^Rdt0?O{zGHc8O54J~1tS1e zw`r{-IlZM;EBG3-ncX|NDu{WI=G2C6QPzyU)=la#mr@(rm9k2ds!LfOq>)nEuG20M zaFS5#=Bu~Py3MMW1P=$nP1rT4tTpf@+HZSzLRbq~Ocv~9w;S=WB2hC9)#HLk68kjM zHDJ~@%6hprZ=XK**oPo}+_3>+qN{F2?P_`W!nP zUn`+R@hPp9Y7vhE<#z=TmQTz6ze-s`|5h zsHdvRWx=sc+CQ<5IA}IR|36*yR`glX|DAumFQePP3-&__&V#>zAEV>{2)+O^-+wJk zLkBzwzKvf0F}MkCgd8M6^!_8^8|e36hY!Q+AP=J;y1&fl{}Vd>x8QDg8|;Sduoh(g z{-@~hUxe4eK8V9=5WW5(xCaiv&9EOv;9NKgenuHT4sU_0K<4VD+}FbkVJBP!qTBx` zb@F@oH~2W*3fDjyu7DWyKsOu#KS7`W28hmo70kosFbwPAY4A_z_FsXI!F%9!uoo_e zQFsoV1t-Dp(eM8aJ_a9vTj3ROJxsv}oDb{ZS#UfY4L?EmzYAUu{})P-gDh-?A$Tm@ z%Q(O*pa3VqiBSFL%ba%p{|y~RAozc>4ntOJn+}7;Vh7n_aH$1qbouQ>x?LT=sJMfg zJD|U6-;Qy#sAZW34RsN<0!ypZ@5i;@#M+9X%O#$;?6Zhjcv$hYRi`Xr-Ag80H239u zmH5Hlz_IuIt5eLnxp554;Bv^X6?Ce=P zG1tF0mcE`;o_32Z|KfEcBR0AqIyEm#;#kCtNr|0zQR9Zza?@15(iY8{6_&D@)$;tU zT=r_U=%SgErZrk*=uF96z4;CV0Au_|sogvw0R$ z&d=t#fKpg^$?|ko>#yA|`AiNE^|k84-&CJu-Thg)8;y=I8Qqr}jU@(IlUSNeO)SM-*)ZViC6<%dZ^@6^cd171Hyo z%$j;*JcTit)O;kO^{=0`TY-7s9eZlGXyEt6c&lk7*NesGdy6qXQ^ftoipF>;(QzB% zuYrQLn4qQy37ldWmn+MS#CXt!p*#eIr9g zjpTNbxXjRo%o=T5v6!}mVxriRxQB@&zAYLqJoDOA>SL9-G1y&Zl zp}5Gjo^-I;&awjis@l1Bj)&y(xg?a9NV#aZ0(k2SQTHVc6~9%T}mja`nB7+I%F&oRA%+CuS8L= zi5ANd9p+-jPK`w=`u~&B2gRmb^nd4{eI{eLWj@9Mo(Alqq zEL;NLM@PRFWPbkR=;h9Tp3KdE1pWrLf!Ny1ocxpE*XZV=w|^4uf{($~kcM7Z4<~{6 z*ZT#!`H$cS@OBX2dU+TJnU`;er^27Z6G80o-wQ7XvBS^82&{**pc8(MZvItxAG`{7 zK^FR94V(bKMJK-(?tyQE%-M_Xekq9Fej*$TKc^nQ2?yW}@FI92Nd3w@{YxPQT_FDa zeudtB0Nw;LPoIEO;1Brp`y#v>-Ua%nqGF$@_NG6@0Vc_9U2J_9GKP!diz>qAmVRQ2N%jFfiWkDn0)XNj`7^ket+Q9A5gK8 z$%+2Rsf%Ti#9a`VQ0F;vGio>~(PGW=#Z?y>>oe~{YDmUv%=#JY1#7&3zTUcXhg7}w zjAhOdLrc5%(F8w3^i~3t(h`FXQLkjhGCdusEU%Q78FYXDVXN4KN~n=)9WP8AhH4cB zqg)o^qKpL?sWFw`UFXRrbbciaJuer8Aete;u+*EysV==8KJEOMj~Dcda~W^!7;C=nzYLNRBU>O}?lPVjDtzP7=cXX04w&V=!sc z;!7f&2?+HY$_EW$F{Ko_A2+!?a(MhxTQJ z)h^_R^vB5LfIodz1cIOwLYR}kLcMW@v)>iYRYBq zrV^RvrC0OPt9j|w^JO~UoG}#dR*%Utv8*X*Rz@@{BkGD;-PjVTRy&@9aoo6MV}%-+ zQ|+&chO4kXxC#cHs1R zzYgU&)tnG2hWTyO6OC#JSyL~bYHDJweS$nC#AP-=L#|1UZ(hk`A7&dtNb7H#{eE-% zB@a>@=^Gmf&Jow(oFF5anp5B3sb}o}$5Ad5qGO`}yZ86K4c&huJb=!B3tR;Eqw~w0 z{#o#CbbXo2e;;gvBj8Qw{QrtR|5|tr?1y9FcJy|!tN%Ru_-EiBKz!q$0e_4BeKC9m z9s7&$1$Z}H0S}>1-vVuL8ax{w4evsimi6ynM1Q^lw!`Ic0elMGxd*;Wd5SO(d64pL zhr{^C6&2mQ-Lsqep5DvvCyQJdD{x3JD2-@vjOC(SBeEUf5*Zvz4ckpGzV`>_Ng8*|QT*{89Z3rO6R2eKNAjieIdp`8?%*luU7jEPz{5_PnXo+L47z9hFq zk<_wT#P%}Jww2dG_!7}s(Xt%KMUS{AV#yd8=!tcW;s2fGj;YaM`^Dr)_Vml;pkK(N zd`U*_o@CVS+3fagmOT_28)xe)Sls&Sg6PG2(Tc|tzfom0#6;=uY2=IF?faL1sNb>o zrLsE_cR|Uw+y-@P?XX`Y~*yllV1ptq;8$YHes; zs84;G(G87vj71vDtSsO`soPOIKk~d?7C9Wr)Fgr%@FCBz3 zy0qEvTDp6{3W)23_ z_6I6Iev4Z%FfAa`H88@nLAaIK8P!MI{;0fWh2P~3%#P6kt4H}w8s!dU!m7ff$;q&T z*(n1M=6xo3$d}96H0vU5>V_K+aqAQ*)f$YVqOWF=(RnU7el@1I$jxJ{B1cm;rLI@rXFJA}iWV^REL#fdga zG^%MQbL#w64Q6u+p$>DNWl*JcG(B!Iy-5?_qMMj*61o}H z%{JYP=|-f7JPzw-L^fSJiu0Q3_LZ0ARjZBuFFJ7vomupM_kR1Iqx=5|z5}0w+h7Mo z!GkBm&lnT<0elm_3ZH@x!pmVZw8K&G&@qe)fUFC6E!+av!!@uQPK2XD-XHL3koN;# z0}~+c5D?!0r@={Z6#Ry9hOfg1;FYiku7qAV6Xab2$H0#nd-ybnpFbIocm+HkiXiXt zyBJP|BjJ9=C%yr9!W-ZPkcDnI4Nd^DIgqi7SHexO2WH_?I2Xk4-+wTc@qG}#00-bb z@J4tYycBMN8=(YS;X*hSTHx_;FXJ9xg7<>hB3ujNKS0(JjDq+I6q|%+z)|ok#zTG# z_k-9ad=hSh{{v#5a0Mix7i1jeDEI?oC-;H)6#O!L9>lNUhv5#m8nUnjy5TrD7XE|r zm3!f>AnObE!89b{DR2z@5IOp1_%z%Gx57){1z=N9+N!vG(7- zk!oJWXxj9WK>QIf4_)7tQE?wHe1xNUQJvH86+`pQ`H+f;5?1CPPT-3N)6D0fo1yCY)cm`UBwV{joE znXW0(6)WIvm^v#GLp__C?fc^6c@*o(*T~7vo zV!5g8wCfizKblL=i;FTgc%zYHs|)Gfp#qj4%k3!Ssb62ZJu#UoKbOOPGOYHR6dNZ= zBot>L$xQkrmm}lGJ5wfjwlrPlC4S=F*SZ^% zc9K8e*s5kZ8oN3*@=@0;i+3$_@)47={RrPHWe6o`h^pIxo)JEQbwi;OB)4YGR4Oxz zx7^I6T;{rps?EE|3$HQ?E~l!d^3UP2*4X5l4zAM1>O@~C>8hlo!#=mn@je83m*-Vx zy#am&GWdF%&+xjxnS4Q(Sm`@6-CpySK=nglUZt5wX~we$E}a(`W(zG8H8y(X6)*Nk zYPuI*Lhc(Y%5ZL|?#drpWa@?|KP+hMVijLZD$h5mR6mV|8;R*3jSHJi*Yc*ReBV=t z?y1VF<@(Br(4s9BI2@9(q0m~@7PE4vZiTuM1Qn(RO)~hY#q2m;+QxZE*z1=$I71#E ztuwRBPkA_1iWJT~Z!=ORV{m2FQmHRfARnK26z!n zK`%TGKFx_Af#-wR2b>3|!zu7|kchv7UjI=LUw~J`U&6_7FM7QA0eCft{Xh~fhI8Qz zI36BEhyN1X1amM3;s@Yg(AU2LABLNu3(kY5!f(*izYq7qx8M_SE9?RB18^Mt5k37L zxB>RU1Uv_Rf&TsPAbR^-;g#?*xDMuF5S|V9p?4pEcft*DHk=MmgrA^azZPB&^B}r+ z7hDKy;COftUHVIK6U@OFtc9PWKZ}0-S$G>HpdX$MkB0}*p&x+z;fwH2$br~9oDAZ} z{};5QwB--0Y#oeP*N|tu0%X|UUIC3<0A@zk^f4DdTrU9`>gGB~Hg+Az#Up>qcW|fi z$Y;18t#+AM<^4-Km9kT;XR>>*y*&~{TB9>(#=PuiaPVI4s`9d~GA~%P%N^zJw=5?s zK`9;qPVFSKraPs-ck{3fb*ZkD%NHfNWPNLLGi<@yhH@FH5}LCrL&y$V?!en4E@Pnw z$KZ)z`9idG-l{@~+)3VEw4A&J#d;)3l}zl48O9?~r0nC*f!l(<|KTH3B4i>{H~jCE zDPt@U5-Pcy*LWUw7tQiJDHqdH_q(c|s%nSpsb0UFmXj{CN-bO}Z&mj{x!slBi>)Wl zyWhKSe@Lf+(|<1qntm$~*_wyCa9C zu|oY{;*oGsOR@L2c>di{^# zc6bL|2mg#7FYoYs8pP4v2cRELf?eqA&w@M9$z^W+e)t}I0>l^J$?#e7btO#06qtN! z7Mq{V8fex)vj&6JCKmDP+P8(uYoRjXb#2$BtscCLA-*w&VfcdTl!D{lW3n?_4ZgJ%zYk7z}ydcD_MA20|c2Scq$-s6$xXh*WjRwmMnD=%X!B4DN_4x4mIB`sUJ%H&lfOC!~lfh#3r57IjA*&~0E%tS!zM-0X8?+iM6>-=)7#&RvY)vJGwfDH=F@mL@>39l z3VBaTJNCa~lHth?Y%O+W^SmuZjGA05Vhv%Jy$}`eH=Il3JqvfYnpfT?&3~_mo!$&W zD484^PMJlFqVa1sozoF7pYwJu$g3VD&uZS~mG+2hEnaLUZ+ylDr3^&rh?U02y)LEe zkAeuLf{aawdoQ#GWi6K6Da`B77Yeg`c<&9bD#(>kF7TFvvU870tD0mD!3XXt(ME`#;?1zo; z47d;d|J|?$HozYl1GpQmg8`5^{^LN#2IQT8{|cXg+u+484|$MrgBEyzv4VR*dYQ!|e&NnV)72G;5$)1I-#})jTsM)cRbyvv!`9XE4u?hjV2l18TCl#%=mI5OMqrj3nXlvjPxhB<{gcyv z;!Jn#I_GG&%nQ99bBDqX)U6L*cPQM{a%j!!^~9)p-(|kqw_T*=LND4qIxswh5;v0S zi4JwgQoTd1yRvhs>FKtJ=Sgs*;hE62g7*xM@wRj^WYd8}GwNo~^z}4RR;v;U&XjO= zaMO$-L|RO`syGsv0AmMGDg30|h7!wlswHJQm2GLbSz$zqw2&*3Rq>?gD~br<6$l!;Lh zHDYn5EN)w2F%(`dDvCRAIVgEqB3QG5%>`bkY|lK?*>qGGAk~XBv<$R?NX2}hzOQJ# z4iDPTs_6gsp#MJwU0L-1K6@wr9y~V*=s};QjCxcm?c)1ju^^&Ve>~ z3jC6>fp5b5;hk^`{1xnj%R&4CtO4;2a6B9fkAiy{H~0X&5^jJiVG>d>1U>M3>P6NO z{1wcAsi&2FT4~1Ctbt|?G;5$)1I-#}*1*G{22di*pM8px=dQ#2n(XFVZ;jc0^R2hc z+GWx^+#2X|yLu~>5#2g>LCv?`7BjBC0zK=HO#QWD<#Mm<)TH^=+lhQ(Qq)}BlKroF z>+SGxPuDh#gog2@YF65oy)ZZQwp=8r{Dryhlv=)1Dn=eu`f3cwI_Z|RFjHxKP@Er$ SXyCf1EcqT@`znL;BmV_f)t=)3 diff --git a/keyboards/planck/keymaps/jweickm/config.h_qwerty b/keyboards/planck/keymaps/jweickm/config.h_qwerty deleted file mode 100644 index 3facfcafbea9..000000000000 --- a/keyboards/planck/keymaps/jweickm/config.h_qwerty +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Copyright 2018 Jack Humbert - * - * 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 . - */ - -#ifndef REV6_CONFIG_H -#define REV6_CONFIG_H - -/* USB Device descriptor parameter */ -#define PRODUCT_ID 0xA4F9 -#define DEVICE_VER 0x0006 - -#undef MATRIX_ROWS -#undef MATRIX_COLS -/* key matrix size */ -#define MATRIX_ROWS 8 -#define MATRIX_COLS 6 - -/* - * Keyboard Matrix Assignments - * - * Change this to how you wired your keyboard - * COLS: AVR pins used for columns, left to right - * ROWS: AVR pins used for rows, top to bottom - * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) - * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) - * -*/ -/* Note: These are not used for arm boards. They're here purely as documentation. */ -#undef MATRIX_ROW_PINS -#undef MATRIX_COL_PINS - -#define MATRIX_ROW_PINS { A10, A9, A8, B15, C13, C14, C15, A2 } -#define MATRIX_COL_PINS { B11, B10, B2, B1, A7, B0 } - -#define UNUSED_PINS - -#define ENCODERS_PAD_A { B12 } -#define ENCODERS_PAD_B { B13 } - -#define DIP_SWITCH_PINS { B14, A15, A0, B9 } - -#define MUSIC_MAP -#undef AUDIO_VOICES -#undef AUDIO_PIN -#define AUDIO_PIN A5 -#define AUDIO_PIN_ALT A4 -#define AUDIO_PIN_ALT_AS_NEGATIVE - -/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ -// #define DEBOUNCE 6 - -/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ -//#define LOCKING_SUPPORT_ENABLE -/* Locking resynchronize hack */ -//#define LOCKING_RESYNC_ENABLE - -/* - * Force NKRO - * - * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved - * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the - * makefile for this to work.) - * - * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) - * until the next keyboard reset. - * - * NKRO may prevent your keystrokes from being detected in the BIOS, but it is - * fully operational during normal computer usage. - * - * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) - * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by - * bootmagic, NKRO mode will always be enabled until it is toggled again during a - * power-up. - * - */ -//#define FORCE_NKRO - -/* - * Feature disable options - * These options are also useful to firmware size reduction. - */ - -/* disable debug print */ -//#define NO_DEBUG - -/* disable print */ -//#define NO_PRINT - -/* disable action features */ -//#define NO_ACTION_LAYER -//#define NO_ACTION_TAPPING -//#define NO_ACTION_ONESHOT -//#define NO_ACTION_MACRO -//#define NO_ACTION_FUNCTION - -/* - * 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 - -/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ -//#define MIDI_TONE_KEYCODE_OCTAVES 1 - - -/* - * WS2812 Underglow Matrix options - */ -#define RGB_DI_PIN A1 -#define RGBLED_NUM 9 -#define DRIVER_LED_TOTAL RGBLED_NUM - -#define WS2812_PWM_DRIVER PWMD2 -#define WS2812_PWM_CHANNEL 2 -#define WS2812_PWM_PAL_MODE 1 -#define WS2812_DMA_STREAM STM32_DMA1_STREAM2 -#define WS2812_DMA_CHANNEL 2 - -#ifndef RGB_DISABLE_WHEN_USB_SUSPENDED -# define RGB_DISABLE_WHEN_USB_SUSPENDED true -#endif - -#endif - -#define RGBLIGHT_LAYERS - -#pragma once - -#ifdef AUDIO_ENABLE - #define STARTUP_SONG SONG(PLANCK_SOUND) - // #define STARTUP_SONG SONG(NO_SOUND) - - #define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \ - SONG(COLEMAK_SOUND), \ - SONG(DVORAK_SOUND), \ - SONG(WORKMAN_SOUND), \ - SONG(PLOVER_SOUND), \ - SONG(STARTUP_SOUND), \ - SONG(PREONIC_SOUND), \ - SONG(GOODBYE_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 - -/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ -//#define MIDI_TONE_KEYCODE_OCTAVES 2 - -// Most tactile encoders have detents every 4 stages -#define ENCODER_RESOLUTION 4 - -//settings for home row mods -#define TAPPING_TERM 200 // 200 ms is the default value - -#define PERMISSIVE_HOLD - -#define IGNORE_MOD_TAP_INTERRUPT - -#define TAPPING_FORCE_HOLD_PER_KEY diff --git a/keyboards/planck/keymaps/jweickm/config_kopie.h b/keyboards/planck/keymaps/jweickm/config_kopie.h deleted file mode 100644 index 2ab74b82daa8..000000000000 --- a/keyboards/planck/keymaps/jweickm/config_kopie.h +++ /dev/null @@ -1,44 +0,0 @@ -#pragma once - -#ifdef AUDIO_ENABLE - #define STARTUP_SONG SONG(PLANCK_SOUND) - // #define STARTUP_SONG SONG(NO_SOUND) - - #define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \ - SONG(COLEMAK_SOUND), \ - SONG(DVORAK_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 - -/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ -//#define MIDI_TONE_KEYCODE_OCTAVES 2 - -// Most tactile encoders have detents every 4 stages -#define ENCODER_RESOLUTION 4 - -//settings for home row mods -#define TAPPING_TERM 200 // 200 ms is the default value - -#define PERMISSIVE_HOLD - -#define IGNORE_MOD_TAP_INTERRUPT - -#define TAPPING_FORCE_HOLD_PER_KEY diff --git "a/keyboards/planck/keymaps/jweickm/keymap - \343\202\263\343\203\224\343\203\274.c" "b/keyboards/planck/keymaps/jweickm/keymap - \343\202\263\343\203\224\343\203\274.c" deleted file mode 100644 index 36cf513fe9b9..000000000000 --- "a/keyboards/planck/keymaps/jweickm/keymap - \343\202\263\343\203\224\343\203\274.c" +++ /dev/null @@ -1,862 +0,0 @@ -/* Copyright 2015-2017 Jack Humbert - * Copyright 2021 Jakob Weickmann - * - * 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 . - */ -#include QMK_KEYBOARD_H -#include "muse.h" -#include "quantum.h" - - -enum planck_layers { - _COLEMAK, - _HRCOLEMAK, - _HRWIDECOLEMAK, - _GAMING, - _WIDECOLEMAK, - _LOWER, - _RAISE, - _LOWER2, - _RAISE2, - _ADJUST, - _NAV, - _NAV2, - _NUM, - _NUM2, - _MOUSE, - _PLOVER -}; - -enum planck_keycodes { - COLEMAK = SAFE_RANGE, - HRCOLEMAK, - HRWIDECOLEMAK, - PLOVER, - BACKLIT, - EXT_PLV, - GAMING, - WIDECOLEMAK, - TG_COLEMAK, - VIM_O, - VIM_V, - KC_SVD_BD, - KC_SVU_BU, - KC_TAB_MPLY, - ALT_TAB, - CTL_TAB, - DE_AE, - DE_OE, - DE_UE, - DE_SZ, - DE_EGRAVE, - DE_EAIGU, - KC_CURRENCY, - KC_UE_SWITCH, - LANG_SWITCH -}; - -// Tap Dance declarations -enum tap_dance_codes{ - TD_PRN, // round brackets (parentheses) - TD_BRC, // square brackets - TD_CBR, // curly brackets - TD_ESC_CAPS, // double tap for caps lock - TD_QUO_BRC, // double function on quotes to enable typing ü in german layout - TD_COMM_SLSH, // comma that doubles as a slash - TD_MPLY, // play/pause, double for next, triple for previous song - TD_Q_TAB // double tap q to register tab -}; - -#define LOWER MO(_LOWER) -#define RAISE MO(_RAISE) - -#define MODS_SHIFT_MASK (MOD_BIT(KC_LSFT)|MOD_BIT(KC_RSFT)) - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - -[_COLEMAK] = LAYOUT_planck_grid( - LT(_NUM,KC_TAB), KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, - LCTL_T(KC_ESC), KC_A, KC_R, KC_S, KC_T, KC_G, KC_M, KC_N, KC_E, KC_I, KC_O, TD(TD_QUO_BRC), - OSM(MOD_LSFT), KC_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, RSFT_T(KC_ENT), - LCTL_T(KC_CAPS), RALT_T(KC_APP), LGUI_T(KC_TAB), LT(_MOUSE, KC_ESC), LT(_LOWER,KC_BSPC), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE,KC_DEL), RCTL_T(KC_ENT), TG(_NAV), RALT_T(KC_UP), CTL_T(KC_CAPS) -), - -[_HRCOLEMAK] = LAYOUT_planck_grid( - LT(_NUM,KC_TAB), LGUI_T(KC_Q), LALT_T(KC_W), LT(_NUM, KC_F), KC_P, KC_B, KC_J, KC_L, LT(_NUM,KC_U), LALT_T(KC_Y), RGUI_T(KC_SCLN), KC_LBRC, - TD(TD_ESC_CAPS), KC_A, KC_R, LSFT_T(KC_S), LCTL_T(KC_T), KC_G, KC_M, RCTL_T(KC_N), RSFT_T(KC_E), KC_I, KC_O, KC_QUOT, - OSM(MOD_LSFT), KC_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, RSFT_T(KC_ENT), - LCTL_T(KC_CAPS), RALT_T(KC_APP), LGUI_T(KC_TAB), LT(_MOUSE, KC_ESC), LT(_LOWER,KC_BSPC), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE,KC_DEL), RCTL_T(KC_ENT), TG(_NAV), RALT_T(KC_UP), CTL_T(KC_CAPS) -), - -[_HRWIDECOLEMAK] = LAYOUT_planck_grid( - LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM2,KC_B), KC_SVU_BU, LT(_NUM2,KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Y), RGUI_T(KC_SCLN), DE_UE, - KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB_MPLY, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, - LT(_MOUSE,KC_Z), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, LT(_MOUSE,KC_SLSH), KC_MINS, - KC_CAPS, LT(_NUM,KC_TAB), LGUI_T(KC_ESC), LT(_LOWER2, KC_BSPC), OSM(MOD_LSFT), LT(_NAV2,KC_SPC), LT(_NAV2,KC_SPC), LT(_RAISE2, KC_DEL), RCTL_T(KC_ENT), KC_LALT, KC_LEFT, KC_RIGHT -), - -[_GAMING] = LAYOUT_planck_grid( - KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_F5, KC_F8, KC_F9, KC_VOLU, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_VOLD, - KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_Z, KC_M, KC_SCLN, TG_COLEMAK, - KC_LCTL, KC_NUBS, KC_B, KC_X, KC_C, KC_SPC, KC_SPC, KC_LALT, KC_TRNS, KC_TRNS, ALT_TAB, GAMING -), - -/* WIDECOLEMAK - * ,-----------------------------------------------------------------------------------. - * |_NUM(Tab)| Q | W | E | R | T | Y | U | I | O | P | Bksp | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * |CTL(Esc)| A | S | D | F | G | H | J | K | L | ; | " | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | - * `-----------------------------------------------------------------------------------' - */ -[_WIDECOLEMAK] = LAYOUT_planck_grid( - TD(TD_Q_TAB), KC_W, KC_F, KC_P, KC_B, KC_SVU_BU, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, DE_UE, - KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB_MPLY, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, - KC_Z, KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, TG_COLEMAK, - KC_CAPS, LT(_NUM,KC_TAB), LGUI_T(KC_ESC), LT(_LOWER2, KC_BSPC), OSM(MOD_LSFT), LT(_NAV2,KC_SPC), LT(_NAV2,KC_SPC), LT(_RAISE2, KC_DEL), RCTL_T(KC_ENT), KC_LALT, KC_LEFT, KC_RIGHT -), - -[_LOWER] = LAYOUT_planck_grid( - KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, TD(TD_PRN), KC_RPRN, KC_DEL, - KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, TD(TD_CBR), KC_RCBR, KC_PIPE, - KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, LSFT(KC_NUHS), LSFT(KC_BSLS), KC_JYEN, KC_EQL, KC_TRNS, - TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_DEL, KC_VOLD, KC_VOLU, KC_MPLY -), - -[_RAISE] = LAYOUT_planck_grid( - 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, TD(TD_BRC), KC_RBRC,KC_BSLS, - KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_COMM, KC_DOT, KC_SLSH, KC_TRNS, - TG(_MOUSE), KC_TRNS, KC_BSPC, KC_DEL, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY -), - -[_LOWER2] = LAYOUT_planck_grid( - KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_TILD, KC_CIRC, KC_AMPR, KC_ASTR, TD(TD_PRN), KC_RPRN, DE_AE, - KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, DE_SZ, KC_UNDS, KC_PLUS, TD(TD_CBR), KC_RCBR, KC_PIPE, - KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, LSFT(KC_NUHS), LSFT(KC_BSLS), KC_NUBS, KC_CURRENCY, DE_EGRAVE, - TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_DEL, KC_VOLD, KC_VOLU, KC_MPLY -), - -[_RAISE2] = LAYOUT_planck_grid( - KC_1, KC_2, KC_3, KC_4, KC_5, KC_GRV, KC_6, KC_7, KC_8, KC_9, KC_0, DE_OE, - KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, DE_SZ, KC_MINS, KC_EQL, TD(TD_BRC), KC_RBRC,KC_BSLS, - KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, KC_NUHS, KC_COMM, KC_DOT, KC_SLSH, DE_EAIGU, - TG(_MOUSE), KC_TRNS, KC_BSPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY -), - -[_ADJUST] = LAYOUT_planck_grid( - LALT(KC_LSFT), RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_INS, - LALT(KC_GRV), EEP_RST, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, COLEMAK, HRCOLEMAK, WIDECOLEMAK, HRWIDECOLEMAK, GAMING, - KC_TRNS, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, KC_SVD_BD, KC_MPLY, KC_SVU_BU, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS -), - -[_NAV] = LAYOUT_planck_grid( - LALT(KC_LSFT), KC_NO, LCTL(KC_RGHT), KC_MS_U, LCTL(KC_V), LCTL(KC_LEFT), LCTL(KC_V), KC_RIGHT, KC_PGUP, LCTL(KC_C), KC_NO, KC_NO, - LALT(KC_GRV), KC_HOME, KC_MS_L, KC_MS_D, KC_MS_R, KC_BTN1, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_END, VIM_O, - KC_TRNS, KC_NO, LCTL(KC_X), LCTL(KC_X), KC_BTN2, VIM_V, KC_NO, KC_PGDN, TG(_NAV), KC_NO, LCTL(KC_F), KC_TRNS, - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRNS, KC_TRNS, KC_NO, KC_NO, KC_TRNS, KC_NO, KC_NO -), - -[_NAV2] = LAYOUT_planck_grid( - ALT_TAB, LCTL(KC_RGHT), LANG_SWITCH, LALT(KC_GRV), LCTL(KC_LEFT), KC_BRIU, KC_DOWN, KC_RIGHT, KC_PGUP, LCTL(KC_C), KC_NO, KC_UE_SWITCH, - CTL_TAB, KC_TAB, KC_ESC, LT(_NUM2,KC_ENT), KC_TAB, KC_MUTE, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_END, VIM_O, - KC_LSFT, KC_NO, LCTL(KC_X), TD(TD_ESC_CAPS), VIM_V, KC_BRID, KC_HOME, KC_PGDN, KC_NO, KC_NO, LCTL(KC_F), KC_TRNS, - KC_NO, KC_NO, KC_NO, KC_TRNS, KC_TRNS, LT(_NAV2,KC_SPC), LT(_NAV2,KC_SPC), KC_NO, KC_NO, KC_TRNS, KC_NO, KC_NO -), - -[_NUM] = LAYOUT_planck_grid( - KC_TAB, KC_F1, KC_F2, LT(_NUM,KC_F3), KC_F4, KC_SVU_BU, KC_NLCK, KC_P7, LT(_NUM,KC_P8), KC_P9, KC_PMNS, KC_TRNS, - KC_TRNS, KC_F5, KC_F6, KC_F7, KC_F8, KC_MPLY, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, KC_TRNS, - KC_TRNS, KC_F9,KC_F10,KC_F11,KC_F12, KC_SVD_BD, KC_TRNS, KC_P1, KC_P2, KC_P3, KC_PSLS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P0, KC_DOT, KC_COMM, KC_EQL, KC_TRNS -), - -[_NUM2] = LAYOUT_planck_grid( - KC_F1, KC_F2, KC_F3, KC_F4, KC_MPRV, KC_NLCK, KC_MNXT, KC_P7, KC_P8, KC_P9, KC_PMNS, KC_TRNS, - KC_F5, KC_F6, KC_F7, KC_F8, KC_VOLU, KC_MPLY, KC_BRIU, KC_P4, KC_P5, KC_P6, KC_PPLS, KC_TRNS, - KC_F9,KC_F10,KC_F11,KC_F12, KC_VOLD, KC_MUTE, KC_BRID, KC_P1, KC_P2, KC_P3, KC_PSLS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P0, KC_DOT, KC_COMM, KC_EQL, KC_TRNS -), - -[_MOUSE] = LAYOUT_planck_grid( - KC_NO, KC_NO, KC_BTN4, KC_BTN5, KC_NO, KC_NO, KC_NO, KC_WH_U, KC_MS_U, KC_WH_U, KC_NO, KC_NO, - KC_NO, KC_BTN3, KC_BTN2, KC_BTN1, KC_NO, KC_NO, KC_NO, KC_MS_L, KC_MS_D, KC_MS_R, KC_NO, KC_NO, - KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_WH_D, KC_NO, KC_NO, KC_TRNS, KC_NO, - TG(_MOUSE), KC_NO, KC_NO, KC_TRNS, KC_NO, KC_ACL2, KC_ACL2, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO -) - -}; - -// define the tap dance functions -void dance_prn(qk_tap_dance_state_t *state, void *user_data) { - if (state->count == 1) { - tap_code16(KC_LPRN); - } else { - tap_code16(KC_LPRN); - tap_code16(KC_RPRN); - tap_code(KC_LEFT); - } -} -void dance_brc(qk_tap_dance_state_t *state, void *user_data) { - if (state->count == 1) { - tap_code(KC_LBRC); - } else { - tap_code(KC_LBRC); - tap_code(KC_RBRC); - tap_code(KC_LEFT); - } -} -void dance_cbr(qk_tap_dance_state_t *state, void *user_data) { - if (state->count == 1) { - tap_code16(KC_LCBR); - } else { - tap_code16(KC_LCBR); - tap_code16(KC_RCBR); - tap_code(KC_LEFT); - } -} - -qk_tap_dance_action_t tap_dance_actions[] = { - // declare tap dance actions here - [TD_PRN] = ACTION_TAP_DANCE_FN(dance_prn), - [TD_BRC] = ACTION_TAP_DANCE_FN(dance_brc), - [TD_CBR] = ACTION_TAP_DANCE_FN(dance_cbr), - [TD_MPLY] = ACTION_TAP_DANCE_DOUBLE(KC_MPLY, KC_MNXT), - [TD_ESC_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_ESC, KC_CAPS), - [TD_QUO_BRC] = ACTION_TAP_DANCE_DOUBLE(KC_QUOT, KC_LBRC), - [TD_COMM_SLSH] = ACTION_TAP_DANCE_DOUBLE(KC_COMMA, KC_SLSH), - [TD_Q_TAB] = ACTION_TAP_DANCE_DOUBLE(KC_Q, KC_TAB) -}; - -// TD(TD_ESC_CAPS), LGUI_T(KC_A), LALT_T(KC_R), LSFT_T(KC_S), LCTL_T(KC_T), KC_G, KC_M, RCTL_T(KC_N), RSFT_T(KC_E), LALT_T(KC_I), RGUI_T(KC_O), KC_TRNS, -// define the per_key_tapping_term -uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case TD(TD_ESC_CAPS): - return TAPPING_TERM * 1.5; - case LGUI_T(KC_A): - return TAPPING_TERM * 1.4; - case LGUI_T(KC_Q): - return TAPPING_TERM * 1.1; - case RGUI_T(KC_O): - return TAPPING_TERM * 1.45; - case RGUI_T(KC_SCLN): - return TAPPING_TERM * 1.1; - case LALT_T(KC_R): - return TAPPING_TERM * 1.3; - case LALT_T(KC_W): - return TAPPING_TERM * 1.25; - case LALT_T(KC_I): - return TAPPING_TERM * 1.35; - case LALT_T(KC_Y): - return TAPPING_TERM * 1.25; - case LCTL_T(KC_T): - return TAPPING_TERM * 1.1; - case LCTL_T(KC_P): - return TAPPING_TERM * 1.1; - case RCTL_T(KC_N): - return TAPPING_TERM * 1.1; - case RCTL_T(KC_L): - return TAPPING_TERM * 1.1; - case LSFT_T(KC_S): - return TAPPING_TERM * 1.1; - case LSFT_T(KC_F): - return TAPPING_TERM * 1.2; - case RSFT_T(KC_E): - return TAPPING_TERM * 1.1; - case RSFT_T(KC_U): - return TAPPING_TERM * 1.2; - case LT(_NUM, KC_F): - return TAPPING_TERM * 1.2; - case LT(_NUM2, KC_B): - return TAPPING_TERM * 1.1; - case LT(_NUM2, KC_J): - return TAPPING_TERM * 1.1; - case LT(_MOUSE, KC_Z): - return TAPPING_TERM * 1.15; - case LT(_MOUSE, KC_SLSH): - return TAPPING_TERM * 1.15; - case TD(TD_QUO_BRC): - return TAPPING_TERM * 1.1; - case TD(TD_Q_TAB): - return TAPPING_TERM * 1.1; - default: - return TAPPING_TERM; - } -} - -#ifdef AUDIO_ENABLE - float plover_song[][2] = SONG(PLOVER_SOUND); - float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND); -#endif - -// alt tab function setup -bool is_alt_tab_active = false; -uint16_t alt_tab_timer = 0; -bool is_ctl_tab_active = false; -uint16_t ctl_tab_timer = 0; -bool de_layout_active = false; - -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case COLEMAK: - if (record->event.pressed) { - set_single_persistent_default_layer(_COLEMAK); - } - return false; - break; - case WIDECOLEMAK: - if (record->event.pressed) { - set_single_persistent_default_layer(_WIDECOLEMAK); - } - return false; - break; - case HRCOLEMAK: - if (record->event.pressed) { - set_single_persistent_default_layer(_HRCOLEMAK); - } - return false; - break; - case HRWIDECOLEMAK: - if (record->event.pressed) { - set_single_persistent_default_layer(_HRWIDECOLEMAK); - } - return false; - break; - case GAMING: - if (record->event.pressed) { - layer_invert(_GAMING); - } - return false; - break; - case TG_COLEMAK: - if (record->event.pressed) { - tap_code(KC_ENT); - layer_invert(_WIDECOLEMAK); - } - return false; - break; - case VIM_O: - if (record->event.pressed) { - tap_code(KC_END); - tap_code(KC_ENT); - } - return false; - break; - case VIM_V: - if (record->event.pressed) { - if (get_mods() & MOD_BIT(KC_LSFT)) { - unregister_code(KC_LSFT); - } else { - register_code(KC_LSFT); - } - } - return false; - break; - case KC_SVU_BU: // increase backlight when pressing shift and vol up - if (record->event.pressed) { - if (get_mods() & MOD_BIT(KC_LSFT) || get_mods() & MOD_BIT(KC_RSFT)) { - register_code(KC_BRIU); - } else if (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTL)){ - register_code(KC_MNXT); - } else { - register_code(KC_VOLU); - } - } else { - unregister_code(KC_BRIU); - unregister_code(KC_MNXT); - unregister_code(KC_VOLU); - } - return false; - case KC_SVD_BD: // decrease backlight when pressing shift and vol up - if (record->event.pressed) { - if (get_mods() & MOD_BIT(KC_LSFT) || get_mods() & MOD_BIT(KC_RSFT)) { - register_code(KC_BRID); - } else if (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTL)){ - register_code(KC_MPRV); - } else { - register_code(KC_VOLD); - } - } else { - unregister_code(KC_BRID); - unregister_code(KC_MPRV); - unregister_code(KC_VOLD); - } - return false; - case KC_TAB_MPLY: // press tab or play/pause when ctrl is pressed - if (record->event.pressed) { - if (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTL)){ - register_code(KC_MPLY); - } else { - register_code(KC_TAB); - } - } else { - unregister_code(KC_MPLY); - unregister_code(KC_TAB); - } - return false; - case ALT_TAB: - if (record->event.pressed) { - if (!is_alt_tab_active) { - is_alt_tab_active = true; - register_code(KC_LALT); - } - alt_tab_timer = timer_read(); - register_code(KC_TAB); - } else { - unregister_code(KC_TAB); - } - break; - case CTL_TAB: - if (record->event.pressed) { - if (!is_ctl_tab_active) { - is_ctl_tab_active = true; - register_code(KC_LCTL); - } - ctl_tab_timer = timer_read(); - register_code(KC_TAB); - } else { - unregister_code(KC_TAB); - } - break; - case DE_AE: - if (record->event.pressed) { - uint8_t temp_mod = get_mods(); - if (temp_mod & MODS_SHIFT_MASK) { - if (!de_layout_active) { - clear_mods(); - register_code(KC_LALT); - tap_code(KC_P0); tap_code(KC_P1); tap_code(KC_P9); tap_code(KC_P6); // Ä - unregister_code(KC_LALT); - } else { - register_code(KC_QUOT); - } - } else { - if (!de_layout_active) { - clear_mods(); - register_code(KC_LALT); - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P2); tap_code(KC_P8); // ä - unregister_code(KC_LALT); - } else { - register_code(KC_QUOT); - } - } - unregister_code(KC_QUOT); - return false; - } - break; - case DE_OE: - if (record->event.pressed) { - uint8_t temp_mod = get_mods(); - if (temp_mod & MODS_SHIFT_MASK) { - if (!de_layout_active) { - clear_mods(); - register_code(KC_LALT); - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P1); tap_code(KC_P4); // Ö - unregister_code(KC_LALT); - } else { - register_code(KC_SCLN); - } - } else { - if (!de_layout_active) { - clear_mods(); - register_code(KC_LALT); - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P4); tap_code(KC_P6); // ö - unregister_code(KC_LALT); - } else { - register_code(KC_SCLN); - } - } - unregister_code(KC_SCLN); - return false; - } - break; - case DE_UE: - if (record->event.pressed) { - uint8_t temp_mod = get_mods(); - if (temp_mod & MODS_SHIFT_MASK) { - if (!de_layout_active) { - clear_mods(); - register_code(KC_LALT); - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P2); tap_code(KC_P0); // Ü - unregister_code(KC_LALT); - } else { - register_code(KC_LBRC); - } - } else { - if (!de_layout_active) { - clear_mods(); - register_code(KC_LALT); - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P5); tap_code(KC_P2); // ü - unregister_code(KC_LALT); - } else { - register_code(KC_LBRC); - } - } - unregister_code(KC_LBRC); - return false; - } - break; - case KC_UE_SWITCH: - if (record->event.pressed) { - if (de_layout_active) { - de_layout_active = false;// deactivate ü if it was active - } else { - de_layout_active = true; // activate ü if it was deactivated - } - return false; - } - break; - case LANG_SWITCH: - if (record->event.pressed) { - register_code(KC_LALT); - tap_code(KC_LSFT); - unregister_code(KC_LALT); - if (de_layout_active) { - de_layout_active = false;// deactivate ü if it was active - } else { - de_layout_active = true; // activate ü if it was deactivated - } - return false; - } - break; - case DE_SZ: - if (record->event.pressed) { - uint8_t temp_mod = get_mods(); - clear_mods(); - register_code(KC_LALT); - if (temp_mod & MODS_SHIFT_MASK) { - tap_code(KC_P0); tap_code(KC_P1); tap_code(KC_P7); tap_code(KC_P6); // ° - } else { - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P2); tap_code(KC_P3); // ß - } - unregister_code(KC_LALT); - return false; - } - break; - case DE_EGRAVE: - if (record->event.pressed) { - uint8_t temp_mod = get_mods(); - clear_mods(); - register_code(KC_LALT); - if (temp_mod & MODS_SHIFT_MASK) { - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P0); tap_code(KC_P0); // È - } else { - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P3); tap_code(KC_P2); // è - } - unregister_code(KC_LALT); - return false; - } - break; - case DE_EAIGU: - if (record->event.pressed) { - uint8_t temp_mod = get_mods(); - clear_mods(); - register_code(KC_LALT); - if (temp_mod & MODS_SHIFT_MASK) { - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P0); tap_code(KC_P1); // É - } else { - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P3); tap_code(KC_P3); // é - } - unregister_code(KC_LALT); - return false; - } - break; - case KC_CURRENCY: - if (record->event.pressed) { - uint8_t temp_mod = get_mods(); - clear_mods(); - register_code(KC_LALT); - if (temp_mod & MODS_SHIFT_MASK) { - tap_code(KC_P1); tap_code(KC_P5); tap_code(KC_P7); // ¥ - } else { - tap_code(KC_P0); tap_code(KC_P1); tap_code(KC_P2); tap_code(KC_P8); // € - } - unregister_code(KC_LALT); - return false; - } - break; - case BACKLIT: - if (record->event.pressed) { - register_code(KC_RSFT); - #ifdef BACKLIGHT_ENABLE - backlight_step(); - #endif - #ifdef KEYBOARD_planck_rev5 - writePinLow(E6); - #endif - } else { - unregister_code(KC_RSFT); - #ifdef KEYBOARD_planck_rev5 - writePinHigh(E6); - #endif - } - 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(); - keymap_config.nkro = 1; - eeconfig_update_keymap(keymap_config.raw); - } - return false; - break; - case EXT_PLV: - if (record->event.pressed) { - #ifdef AUDIO_ENABLE - PLAY_SONG(plover_gb_song); - #endif - layer_off(_PLOVER); - } - return false; - break; - } - return true; -} - -bool muse_mode = false; -uint8_t last_muse_note = 0; -uint16_t muse_counter = 0; -uint8_t muse_offset = 70; -uint16_t muse_tempo = 50; - -bool encoder_update(bool clockwise) { - 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 (clockwise) { - #ifdef MOUSEKEY_ENABLE - tap_code(KC_MS_WH_DOWN); - #else - tap_code(KC_PGDN); - #endif - } else { - #ifdef MOUSEKEY_ENABLE - tap_code(KC_MS_WH_UP); - #else - tap_code(KC_PGUP); - #endif - } - } - return true; -} - -void dip_switch_update_user(uint8_t index, bool active) { - switch (index) { - case 0: { -#ifdef AUDIO_ENABLE - static bool play_sound = false; -#endif - if (active) { -#ifdef AUDIO_ENABLE - if (play_sound) { PLAY_SONG(plover_song); } -#endif - layer_on(_ADJUST); - } else { -#ifdef AUDIO_ENABLE - if (play_sound) { PLAY_SONG(plover_gb_song); } -#endif - layer_off(_ADJUST); - } -#ifdef AUDIO_ENABLE - play_sound = true; -#endif - break; - } - case 1: - if (active) { - muse_mode = true; - } else { - muse_mode = false; - } - } -} - -void matrix_scan_user(void) { - // set the timeout for the alt-tab function - if (is_alt_tab_active) { - if (timer_elapsed(alt_tab_timer) > 700) { - unregister_code(KC_LALT); - is_alt_tab_active = false; - } - } - if (is_ctl_tab_active) { - if (timer_elapsed(ctl_tab_timer) > 700) { - unregister_code(KC_LCTL); - is_ctl_tab_active = false; - } - } - #ifdef AUDIO_ENABLE - if (muse_mode) { - if (muse_counter == 0) { - uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()]; - if (muse_note != last_muse_note) { - stop_note(compute_freq_for_midi_note(last_muse_note)); - play_note(compute_freq_for_midi_note(muse_note), 0xF); - last_muse_note = muse_note; - } - } - muse_counter = (muse_counter + 1) % muse_tempo; - } else { - if (muse_counter) { - stop_all_notes(); - muse_counter = 0; - } - } -#endif -} - -bool music_mask_user(uint16_t keycode) { - switch (keycode) { - case RAISE: - case LOWER: - return false; - default: - return true; - } -} - -bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case LSFT_T(KC_S): - return true; - case RSFT_T(KC_E): - return true; - case LSFT_T(KC_D): - return true; - case RSFT_T(KC_K): - return true; - case LSFT_T(KC_F): - return true; - case RSFT_T(KC_U): - return true; - default: - return false; - } -} - -// Set RGB to change with layer changes -#define HSV_DARKORANGE 10, 255, 255 -#define HSV_DARKPINK 150, 100, 255 - -// Light LEDs 1 to 9 in darkorange when HRCOLEMAK is active -const rgblight_segment_t PROGMEM my_layer0_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {1, 10, HSV_DARKORANGE} -); -// Light LEDs 1 to 9 in green when HRWIDECOLEMAK is active -const rgblight_segment_t PROGMEM my_layer1_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {0, 10, HSV_CYAN} -); -// Light LEDs 1 to 9 in red when GAMING layer is active -const rgblight_segment_t PROGMEM my_layer2_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {1, 10, HSV_RED} -); -// Light LEDs 1 to 9 in white when WIDECOLEMAK is active -const rgblight_segment_t PROGMEM my_layer3_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {1, 10, HSV_WHITE} -); -// Light bottom LEDs in purple when ADJUST layer is active -const rgblight_segment_t PROGMEM my_layer4_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {1, 2, HSV_PURPLE}, - {7, 3, HSV_PURPLE} -); -// Light LEDs 1 to 9 in darkorange when de_layout_active is true -const rgblight_segment_t PROGMEM my_de_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {3, 4, HSV_DARKORANGE} -); -// Light bottom LEDs in red when caps lock is active. Hard to ignore! -const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {1, 2, HSV_RED}, - {7, 3, HSV_RED} -); -// Light LEDs 1 to 9 in white when NAVIGATION is active -const rgblight_segment_t PROGMEM my_nav_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {1, 10, HSV_WHITE} -); - -// Now define the array of layers. Later layers take precedence -const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST( - my_layer0_layer, // hrcolemak - my_layer1_layer, // hrwidecolemak - my_layer2_layer, // gaming - my_layer3_layer, // widecolemak - my_layer4_layer, // adjust - my_nav_layer, // nav - my_de_layer, // de_layout - my_capslock_layer // capslock -); - -void keyboard_post_init_user(void) { - // Enable the LED layers - rgblight_layers = my_rgb_layers; -} - -bool led_update_user(led_t led_state) { - rgblight_set_layer_state(7, led_state.caps_lock); - return true; -} - -layer_state_t layer_state_set_user(layer_state_t state) { - rgblight_set_layer_state(4, layer_state_cmp(state, _ADJUST)); - rgblight_set_layer_state(2, layer_state_cmp(state, _GAMING)); - rgblight_set_layer_state(5, layer_state_cmp(state, _NAV)); - rgblight_set_layer_state(3, layer_state_cmp(state, _WIDECOLEMAK)); - rgblight_set_layer_state(6, de_layout_active); - if ( - ( layer_state_cmp(state, _LOWER) && layer_state_cmp(state, _RAISE ) ) || - ( layer_state_cmp(state, _LOWER2) && layer_state_cmp(state, _RAISE2 ) ) ) { - return state | (1UL<<_ADJUST); - } else { - return state & ~(1UL<<_ADJUST); - } - - //state = update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); - //return state; -} - -layer_state_t default_layer_state_set_user(layer_state_t state) { - rgblight_set_layer_state(3, layer_state_cmp(state, _WIDECOLEMAK)); - rgblight_set_layer_state(0, layer_state_cmp(state, _HRCOLEMAK)); - rgblight_set_layer_state(1, layer_state_cmp(state, _HRWIDECOLEMAK)); - return state; -} - diff --git a/keyboards/planck/keymaps/jweickm/keymap_backup.c b/keyboards/planck/keymaps/jweickm/keymap_backup.c deleted file mode 100644 index 4df199968664..000000000000 --- a/keyboards/planck/keymaps/jweickm/keymap_backup.c +++ /dev/null @@ -1,839 +0,0 @@ -/* Copyright 2015-2017 Jack Humbert - * Copyright 2021 Jakob Weickmann - * - * 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 . - */ -#include QMK_KEYBOARD_H -#include "muse.h" -#include "quantum.h" - - -enum planck_layers { - _COLEMAK, - _HRCOLEMAK, - _HRWIDECOLEMAK, - _HRWIDECOLEMAK_DE, - _GAMING, - _WIDECOLEMAK, - _LOWER, - _RAISE, - _LOWER_DE, - _RAISE_DE, - _ADJUST, - _NAV, - _NUM, - _MOUSE, - _PLOVER -}; - -enum planck_keycodes { - COLEMAK = SAFE_RANGE, - HRCOLEMAK, - HRWIDECOLEMAK, - PLOVER, - BACKLIT, - EXT_PLV, - GAMING, - WIDECOLEMAK, - TG_COLEMAK, - VIM_O, - VIM_V, - KC_SVD_BD, - KC_SVU_BU, - KC_TAB_MPLY, - ALT_TAB, - CTL_TAB, - DE_AE, - DE_OE, - DE_UE, - DE_SZ, - DE_EGRAVE, - DE_EAIGU, - KC_CURRENCY, - KC_DE_SWITCH, - LANG_SWITCH, - DE_SLSH_QUST, - DE_QUOT -}; - -// Tap Dance declarations -enum tap_dance_codes{ - TD_PRN, // round brackets (parentheses) - TD_BRC, // square brackets - TD_CBR, // curly brackets - TD_ESC_CAPS, // double tap for caps lock - TD_QUO_BRC, // double function on quotes to enable typing ü in german layout - TD_COMM_SLSH, // comma that doubles as a slash - TD_MPLY, // play/pause, double for next, triple for previous song - TD_Q_TAB // double tap q to register tab -}; - -#define LOWER MO(_LOWER) -#define RAISE MO(_RAISE) - -#define MODS_SHIFT_MASK (MOD_BIT(KC_LSFT)|MOD_BIT(KC_RSFT)) - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - -[_HRWIDECOLEMAK] = LAYOUT_planck_grid( - LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM,KC_B), KC_SVU_BU, LT(_NUM,KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Y), RGUI_T(KC_SCLN), DE_UE, - KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, - LT(_MOUSE,KC_Z), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, LT(_MOUSE,KC_MINS), KC_SLSH, - KC_CAPS, LT(_NUM,KC_TAB), LGUI_T(KC_ESC), LT(_LOWER, KC_BSPC), OSM(MOD_LSFT), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE, KC_DEL), RCTL_T(KC_ENT), KC_LALT, KC_LEFT, KC_RIGHT -), - -[_HRWIDECOLEMAK_DE] = LAYOUT_planck_grid( - LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM,KC_B), KC_SVU_BU, LT(_NUM,KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Z), RGUI_T(KC_SCLN), KC_LBRC, - KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB, KC_M, KC_N, KC_E, KC_I, KC_O, DE_QUOT, - LT(_MOUSE,KC_Y), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, LT(_MOUSE,KC_SLSH), DE_SLSH_QUST, - KC_CAPS, LT(_NUM,KC_TAB), LGUI_T(KC_ESC), LT(_LOWER_DE, KC_BSPC), OSM(MOD_LSFT), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE_DE, KC_DEL), RCTL_T(KC_ENT), KC_LALT, KC_LEFT, KC_RIGHT -), - -[_GAMING] = LAYOUT_planck_grid( - KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_F5, KC_F8, KC_F9, KC_VOLU, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_VOLD, - KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_Z, KC_M, KC_SCLN, KC_ENT, - KC_LCTL, KC_LALT, KC_B, KC_X, KC_C, KC_SPC, KC_SPC, KC_LALT, TG_COLEMAK, KC_TRNS, KC_TRNS, GAMING -), - -/* WIDECOLEMAK - * ,-----------------------------------------------------------------------------------. - * |_NUM(Tab)| Q | W | E | R | T | Y | U | I | O | P | Bksp | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * |CTL(Esc)| A | S | D | F | G | H | J | K | L | ; | " | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | - * `-----------------------------------------------------------------------------------' - */ -[_WIDECOLEMAK] = LAYOUT_planck_grid( - KC_Q, KC_W, KC_F, KC_P, KC_B, KC_SVU_BU, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, DE_UE, - KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB_MPLY, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, - KC_Z, KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, LSFT_T(KC_ENT), - KC_CAPS, LT(_NUM,KC_TAB), LGUI_T(KC_ESC), LT(_LOWER, KC_BSPC), OSM(MOD_LSFT), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE, KC_DEL), TG_COLEMAK, KC_LALT, KC_LEFT, KC_RIGHT -), - -[_LOWER] = LAYOUT_planck_grid( - KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_TILD, KC_CIRC, KC_AMPR, KC_ASTR, TD(TD_PRN), KC_RPRN, DE_AE, - KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, DE_SZ, KC_UNDS, KC_PLUS, TD(TD_CBR), KC_RCBR, KC_PIPE, - KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, KC_SLSH, KC_NUBS, LSFT(KC_NUBS), KC_CURRENCY, DE_EGRAVE, - TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_DOWN, KC_UP -), - -[_LOWER_DE] = LAYOUT_planck_grid( - KC_EXLM, RALT(KC_Q), KC_BSLS, KC_DLR, KC_PERC, RALT(KC_RBRC), KC_GRV, KC_CIRC, KC_RCBR, KC_ASTR, KC_LPRN, KC_QUOT, - KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, DE_SZ, LSFT(KC_SLSH), KC_RBRC, RALT(KC_7), RALT(KC_0), RALT(KC_NUBS), - KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, LSFT(KC_7), KC_NUBS, LSFT(KC_NUBS), KC_CURRENCY, DE_EGRAVE, - TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_DOWN, KC_UP -), - -[_RAISE] = LAYOUT_planck_grid( - KC_1, KC_2, KC_3, KC_4, KC_5, KC_GRV, KC_6, KC_7, KC_8, KC_9, KC_0, DE_OE, - KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, DE_SZ, KC_MINS, KC_EQL, TD(TD_BRC), KC_RBRC, KC_BSLS, - KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, KC_BSLS, KC_COMM, KC_DOT, KC_SLSH, DE_EAIGU, - TG(_MOUSE), KC_TRNS, KC_BSPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_DOWN, KC_UP -), - -[_RAISE_DE] = LAYOUT_planck_grid( - KC_1, KC_2, KC_3, KC_4, KC_5, KC_GRV, KC_6, KC_7, KC_8, KC_9, KC_0, KC_SCLN, - KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, DE_SZ, KC_SLSH, LSFT(KC_0), RALT(KC_8), RALT(KC_9), RALT(KC_MINS), - KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, RALT(KC_MINS), KC_COMM, KC_DOT, KC_SLSH, DE_EAIGU, - TG(_MOUSE), KC_TRNS, KC_BSPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_DOWN, KC_UP -), - -[_ADJUST] = LAYOUT_planck_grid( - LALT(KC_LSFT), RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DE_SWITCH, - LALT(KC_GRV), EEP_RST, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, HRWIDECOLEMAK, WIDECOLEMAK, LCTL(KC_RGHT), LANG_SWITCH, GAMING, - KC_TRNS, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, KC_SVD_BD, KC_MPLY, KC_SVU_BU, KC_TRNS, , - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS -), - -[_NAV] = LAYOUT_planck_grid( - ALT_TAB, LCTL(KC_RGHT), LANG_SWITCH, LALT(KC_GRV), LCTL(KC_LEFT), KC_MNXT, KC_DOWN, KC_RIGHT, KC_PGUP, LCTL(KC_C), KC_NO, KC_DE_SWITCH, - CTL_TAB, KC_TAB, KC_ESC, LT(_NUM,KC_ENT), KC_TAB, KC_MPLY, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_END, VIM_O, - KC_LSFT, KC_NO, LCTL(KC_X), TD(TD_ESC_CAPS), VIM_V, KC_MUTE, KC_HOME, KC_PGDN, KC_NO, KC_NO, LCTL(KC_F), LCTL(KC_F), - KC_NO, KC_NO, KC_NO, KC_TRNS, KC_TRNS, LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), KC_NO, KC_NO, KC_TRNS, KC_NO, KC_NO -), - -[_NUM] = LAYOUT_planck_grid( - KC_F1, KC_F2, KC_F3, KC_F4, KC_MPRV, KC_NLCK, KC_MNXT, KC_P7, KC_P8, KC_P9, KC_PMNS, KC_TRNS, - KC_F5, KC_F6, KC_F7, KC_F8, KC_VOLU, KC_MPLY, KC_BRIU, KC_P4, KC_P5, KC_P6, KC_PPLS, KC_TRNS, - KC_F9,KC_F10,KC_F11,KC_F12, KC_VOLD, KC_MUTE, KC_BRID, KC_P1, KC_P2, KC_P3, KC_PSLS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P0, KC_DOT, KC_COMM, KC_EQL, KC_TRNS -), - -[_MOUSE] = LAYOUT_planck_grid( - KC_NO, KC_NO, KC_BTN4, KC_BTN5, KC_NO, KC_NO, KC_NO, KC_WH_U, KC_MS_U, KC_WH_U, KC_NO, KC_NO, - KC_NO, KC_BTN3, KC_BTN2, KC_BTN1, KC_NO, KC_NO, KC_NO, KC_MS_L, KC_MS_D, KC_MS_R, KC_NO, KC_NO, - KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_WH_D, KC_NO, KC_NO, KC_TRNS, KC_NO, - TG(_MOUSE), KC_NO, KC_NO, KC_TRNS, KC_NO, KC_ACL2, KC_ACL2, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO -) - -}; - -// define the tap dance functions -void dance_prn(qk_tap_dance_state_t *state, void *user_data) { - if (state->count == 1) { - tap_code16(KC_LPRN); - } else { - tap_code16(KC_LPRN); - tap_code16(KC_RPRN); - tap_code(KC_LEFT); - } -} -void dance_brc(qk_tap_dance_state_t *state, void *user_data) { - if (state->count == 1) { - tap_code(KC_LBRC); - } else { - tap_code(KC_LBRC); - tap_code(KC_RBRC); - tap_code(KC_LEFT); - } -} -void dance_cbr(qk_tap_dance_state_t *state, void *user_data) { - if (state->count == 1) { - tap_code16(KC_LCBR); - } else { - tap_code16(KC_LCBR); - tap_code16(KC_RCBR); - tap_code(KC_LEFT); - } -} - -qk_tap_dance_action_t tap_dance_actions[] = { - // declare tap dance actions here - [TD_PRN] = ACTION_TAP_DANCE_FN(dance_prn), - [TD_BRC] = ACTION_TAP_DANCE_FN(dance_brc), - [TD_CBR] = ACTION_TAP_DANCE_FN(dance_cbr), - [TD_MPLY] = ACTION_TAP_DANCE_DOUBLE(KC_MPLY, KC_MNXT), - [TD_ESC_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_ESC, KC_CAPS), - [TD_QUO_BRC] = ACTION_TAP_DANCE_DOUBLE(KC_QUOT, KC_LBRC), - [TD_COMM_SLSH] = ACTION_TAP_DANCE_DOUBLE(KC_COMMA, KC_SLSH), - [TD_Q_TAB] = ACTION_TAP_DANCE_DOUBLE(KC_Q, KC_TAB) -}; - -// TD(TD_ESC_CAPS), LGUI_T(KC_A), LALT_T(KC_R), LSFT_T(KC_S), LCTL_T(KC_T), KC_G, KC_M, RCTL_T(KC_N), RSFT_T(KC_E), LALT_T(KC_I), RGUI_T(KC_O), KC_TRNS, -// define the per_key_tapping_term -uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case TD(TD_ESC_CAPS): - return TAPPING_TERM * 1.5; - case LGUI_T(KC_A): - return TAPPING_TERM * 1.4; - case LGUI_T(KC_Q): - return TAPPING_TERM * 1.1; - case RGUI_T(KC_O): - return TAPPING_TERM * 1.45; - case RGUI_T(KC_SCLN): - return TAPPING_TERM * 1.1; - case LALT_T(KC_R): - return TAPPING_TERM * 1.3; - case LALT_T(KC_W): - return TAPPING_TERM * 1.25; - case LALT_T(KC_I): - return TAPPING_TERM * 1.35; - case LALT_T(KC_Y): - return TAPPING_TERM * 1.25; - case LCTL_T(KC_T): - return TAPPING_TERM * 1.1; - case LCTL_T(KC_P): - return TAPPING_TERM * 1.1; - case RCTL_T(KC_N): - return TAPPING_TERM * 1.1; - case RCTL_T(KC_L): - return TAPPING_TERM * 1.1; - case LSFT_T(KC_S): - return TAPPING_TERM * 1.1; - case LSFT_T(KC_F): - return TAPPING_TERM * 1.2; - case RSFT_T(KC_E): - return TAPPING_TERM * 1.1; - case RSFT_T(KC_U): - return TAPPING_TERM * 1.2; - case LT(_NUM, KC_F): - return TAPPING_TERM * 1.2; - case LT(_NUM, KC_B): - return TAPPING_TERM * 1.1; - case LT(_NUM, KC_J): - return TAPPING_TERM * 1.1; - case LT(_MOUSE, KC_Z): - return TAPPING_TERM * 1.15; - case LT(_MOUSE, KC_SLSH): - return TAPPING_TERM * 1.15; - case TD(TD_QUO_BRC): - return TAPPING_TERM * 1.1; - case TD(TD_Q_TAB): - return TAPPING_TERM * 1.1; - case TD(TD_PRN): - return TAPPING_TERM * 1.4; - case TD(TD_BRC): - return TAPPING_TERM * 1.4; - case TD(TD_CBR): - return TAPPING_TERM * 1.4; - default: - return TAPPING_TERM; - } -} - -#ifdef AUDIO_ENABLE - float plover_song[][2] = SONG(PLOVER_SOUND); - float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND); -#endif - -// alt tab function setup -bool is_alt_tab_active = false; -bool is_ctl_tab_active = false; -bool de_layout_active = false; - -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case COLEMAK: - if (record->event.pressed) { - set_single_persistent_default_layer(_COLEMAK); - } - return false; - break; - case WIDECOLEMAK: - if (record->event.pressed) { - set_single_persistent_default_layer(_WIDECOLEMAK); - } - return false; - break; - case HRCOLEMAK: - if (record->event.pressed) { - set_single_persistent_default_layer(_HRCOLEMAK); - } - return false; - break; - case HRWIDECOLEMAK: - if (record->event.pressed) { - set_single_persistent_default_layer(_HRWIDECOLEMAK); - } - return false; - break; - case GAMING: - if (record->event.pressed) { - layer_invert(_GAMING); - } - return false; - break; - case TG_COLEMAK: - if (record->event.pressed) { - tap_code(KC_ENT); - layer_invert(_WIDECOLEMAK); - } - return false; - break; - case VIM_O: - if (record->event.pressed) { - tap_code(KC_END); - tap_code(KC_ENT); - } - return false; - break; - case VIM_V: - if (record->event.pressed) { - if (get_mods() & MOD_BIT(KC_LSFT)) { - unregister_mods(MOD_LSFT); - } else { - register_mods(MOD_LSFT); - } - } - return false; - break; - case KC_SVU_BU: // increase backlight when pressing shift and vol up - if (record->event.pressed) { - if (get_mods() & MOD_BIT(KC_LSFT) || get_mods() & MOD_BIT(KC_RSFT)) { - register_code(KC_BRIU); - } else if (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTL)){ - register_code(KC_MNXT); - } else { - register_code(KC_VOLU); - } - } else { - unregister_code(KC_BRIU); - unregister_code(KC_MNXT); - unregister_code(KC_VOLU); - } - return false; - case KC_SVD_BD: // decrease backlight when pressing shift and vol up - if (record->event.pressed) { - if (get_mods() & MOD_BIT(KC_LSFT) || get_mods() & MOD_BIT(KC_RSFT)) { - register_code(KC_BRID); - } else if (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTL)){ - register_code(KC_MPRV); - } else { - register_code(KC_VOLD); - } - } else { - unregister_code(KC_BRID); - unregister_code(KC_MPRV); - unregister_code(KC_VOLD); - } - return false; - case KC_TAB_MPLY: // press tab or play/pause when ctrl is pressed - if (record->event.pressed) { - if (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTL)){ - register_code(KC_MPLY); - } else { - register_code(KC_TAB); - } - } else { - unregister_code(KC_MPLY); - unregister_code(KC_TAB); - } - return false; - case ALT_TAB: - if (record->event.pressed) { - if (!is_alt_tab_active) { - is_alt_tab_active = true; - register_mods(MOD_LALT); - } - register_code(KC_TAB); - } else { - unregister_code(KC_TAB); - } - break; - case CTL_TAB: - if (record->event.pressed) { - if (!is_ctl_tab_active) { - is_ctl_tab_active = true; - register_mods(MOD_LCTL); - } - register_code(KC_TAB); - } else { - unregister_code(KC_TAB); - } - break; - // the next case allows us to use alt_tab without a timer - case LT(_NAV,KC_SPC): - if (record->event.pressed) { - } else { - unregister_mods(MOD_LALT); - unregister_mods(MOD_LCTL); - is_alt_tab_active = false; - is_ctl_tab_active = false; - } - break; - case DE_AE: - if (record->event.pressed) { - uint8_t temp_mod = get_mods(); - if (temp_mod & MODS_SHIFT_MASK) { - clear_mods(); - register_mods(MOD_LALT); - tap_code(KC_P0); tap_code(KC_P1); tap_code(KC_P9); tap_code(KC_P6); // Ä - unregister_mods(MOD_LALT); - } else { - clear_mods(); - register_mods(MOD_LALT); - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P2); tap_code(KC_P8); // ä - unregister_mods(MOD_LALT); - } - return false; - } - break; - case DE_OE: - if (record->event.pressed) { - uint8_t temp_mod = get_mods(); - if (temp_mod & MODS_SHIFT_MASK) { - clear_mods(); - register_mods(MOD_LALT); - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P1); tap_code(KC_P4); // Ö - unregister_mods(MOD_LALT); - } else { - clear_mods(); - register_mods(MOD_LALT); - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P4); tap_code(KC_P6); // ö - unregister_mods(MOD_LALT); - } - return false; - } - break; - case DE_UE: - if (record->event.pressed) { - uint8_t temp_mod = get_mods(); - if (temp_mod & MODS_SHIFT_MASK) { - clear_mods(); - register_mods(MOD_LALT); - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P2); tap_code(KC_P0); // Ü - unregister_mods(MOD_LALT); - } else { - clear_mods(); - register_mods(MOD_LALT); - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P5); tap_code(KC_P2); // ü - unregister_mods(MOD_LALT); - } - return false; - } - break; - case KC_DE_SWITCH: - if (record->event.pressed) { - if (de_layout_active) { - de_layout_active = false;// deactivate German overlay - set_single_persistent_default_layer(_HRWIDECOLEMAK); - } else { - de_layout_active = true; // activate German overlay - set_single_persistent_default_layer(_HRWIDECOLEMAK_DE); - } - return false; - } - break; - case LANG_SWITCH: - if (record->event.pressed) { - register_mods(MOD_LALT); - tap_code(KC_LSFT); - unregister_mods(MOD_LALT); - if (de_layout_active) { - de_layout_active = false; // deactivate German overlay - set_single_persistent_default_layer(_HRWIDECOLEMAK); - } else { - de_layout_active = true; // activate German overlay - set_single_persistent_default_layer(_HRWIDECOLEMAK_DE); - } - return false; - } - break; - case DE_SZ: - if (record->event.pressed) { - uint8_t temp_mod = get_mods(); - clear_mods(); - register_mods(MOD_LALT); - if (temp_mod & MODS_SHIFT_MASK) { - tap_code(KC_P0); tap_code(KC_P1); tap_code(KC_P7); tap_code(KC_P6); // ° - } else { - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P2); tap_code(KC_P3); // ß - } - unregister_mods(MOD_LALT); - return false; - } - break; - case DE_EGRAVE: - if (record->event.pressed) { - uint8_t temp_mod = get_mods(); - clear_mods(); - register_mods(MOD_LALT); - if (temp_mod & MODS_SHIFT_MASK) { - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P0); tap_code(KC_P0); // È - } else { - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P3); tap_code(KC_P2); // è - } - unregister_mods(MOD_LALT); - return false; - } - break; - case DE_EAIGU: - if (record->event.pressed) { - uint8_t temp_mod = get_mods(); - clear_mods(); - register_mods(MOD_LALT); - if (temp_mod & MODS_SHIFT_MASK) { - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P0); tap_code(KC_P1); // É - } else { - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P3); tap_code(KC_P3); // é - } - unregister_mods(MOD_LALT); - return false; - } - break; - case KC_CURRENCY: - if (record->event.pressed) { - uint8_t temp_mod = get_mods(); - clear_mods(); - register_mods(MOD_LALT); - if (temp_mod & MODS_SHIFT_MASK) { - tap_code(KC_P1); tap_code(KC_P5); tap_code(KC_P7); // ¥ - } else { - tap_code(KC_P0); tap_code(KC_P1); tap_code(KC_P2); tap_code(KC_P8); // € - } - unregister_mods(MOD_LALT); - return false; - } - break; - case DE_SLSH_QUST: - if (record->event.pressed) { - uint8_t temp_mod = get_mods(); - if (temp_mod & MODS_SHIFT_MASK) { - tap_code(KC_MINS); // ? - } else { - tap_code16(KC_AMPR); // / - } - return false; - } - break; - case DE_QUOT: - if (record->event.pressed) { - uint8_t temp_mod = get_mods(); - if (temp_mod & MODS_SHIFT_MASK) { - tap_code(KC_2); // \" - } else { - tap_code16(KC_PIPE); // /' - } - return false; - } - break; - case BACKLIT: - if (record->event.pressed) { - register_code(KC_RSFT); - #ifdef BACKLIGHT_ENABLE - backlight_step(); - #endif - #ifdef KEYBOARD_planck_rev5 - writePinLow(E6); - #endif - } else { - unregister_code(KC_RSFT); - #ifdef KEYBOARD_planck_rev5 - writePinHigh(E6); - #endif - } - 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(); - keymap_config.nkro = 1; - eeconfig_update_keymap(keymap_config.raw); - } - return false; - break; - case EXT_PLV: - if (record->event.pressed) { - #ifdef AUDIO_ENABLE - PLAY_SONG(plover_gb_song); - #endif - layer_off(_PLOVER); - } - return false; - break; - } - return true; -} - -bool muse_mode = false; -uint8_t last_muse_note = 0; -uint16_t muse_counter = 0; -uint8_t muse_offset = 70; -uint16_t muse_tempo = 50; - -bool encoder_update(bool clockwise) { - 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 (clockwise) { - #ifdef MOUSEKEY_ENABLE - tap_code(KC_MS_WH_DOWN); - #else - tap_code(KC_PGDN); - #endif - } else { - #ifdef MOUSEKEY_ENABLE - tap_code(KC_MS_WH_UP); - #else - tap_code(KC_PGUP); - #endif - } - } - return true; -} - -// bool dip_switch_update_user(uint8_t index, bool active) { -// switch (index) { -// case 0: { -// #ifdef AUDIO_ENABLE -// static bool play_sound = false; -// #endif -// if (active) { -// #ifdef AUDIO_ENABLE -// if (play_sound) { PLAY_SONG(plover_song); } -// #endif -// layer_on(_ADJUST); -// } else { -// #ifdef AUDIO_ENABLE -// if (play_sound) { PLAY_SONG(plover_gb_song); } -// #endif -// layer_off(_ADJUST); -// } -// #ifdef AUDIO_ENABLE -// play_sound = true; -// #endif -// break; -// } -// case 1: -// if (active) { -// muse_mode = true; -// } else { -// muse_mode = false; -// } -// } -// } - -void matrix_scan_user(void) { - #ifdef AUDIO_ENABLE - if (muse_mode) { - if (muse_counter == 0) { - uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()]; - if (muse_note != last_muse_note) { - stop_note(compute_freq_for_midi_note(last_muse_note)); - play_note(compute_freq_for_midi_note(muse_note), 0xF); - last_muse_note = muse_note; - } - } - muse_counter = (muse_counter + 1) % muse_tempo; - } else { - if (muse_counter) { - stop_all_notes(); - muse_counter = 0; - } - } -#endif -} - -bool music_mask_user(uint16_t keycode) { - switch (keycode) { - case RAISE: - case LOWER: - return false; - default: - return true; - } -} - -bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case LSFT_T(KC_S): - return true; - case RSFT_T(KC_E): - return true; - case LSFT_T(KC_D): - return true; - case RSFT_T(KC_K): - return true; - case LSFT_T(KC_F): - return true; - case RSFT_T(KC_U): - return true; - default: - return false; - } -} - -// Set RGB to change with layer changes -#define HSV_DARKORANGE 10, 255, 255 -#define HSV_DARKPINK 150, 100, 255 - -// Light LEDs 1 to 9 in darkorange when HRCOLEMAK is active -const rgblight_segment_t PROGMEM my_layer0_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {0, 10, HSV_DARKORANGE} -); -// Light LEDs 1 to 9 in green when HRWIDECOLEMAK is active -const rgblight_segment_t PROGMEM my_layer1_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {0, 10, HSV_CYAN} -); -// Light LEDs 1 to 9 in red when GAMING layer is active -const rgblight_segment_t PROGMEM my_layer2_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {0, 10, HSV_RED} -); -// Light LEDs 1 to 9 in white when WIDECOLEMAK is active -const rgblight_segment_t PROGMEM my_layer3_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {0, 10, HSV_WHITE} -); -// Light bottom LEDs in purple when ADJUST layer is active -const rgblight_segment_t PROGMEM my_layer4_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {0, 2, HSV_PURPLE}, - {7, 3, HSV_PURPLE} -); -// Light LEDs 1 to 9 in darkorange when de_layout_active is true -const rgblight_segment_t PROGMEM my_de_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {3, 4, HSV_DARKORANGE}, - {0, 3, HSV_CYAN}, - {8, 3, HSV_CYAN} -); -// Light bottom LEDs in red when caps lock is active. Hard to ignore! -const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {0, 3, HSV_MAGENTA}, - {7, 3, HSV_MAGENTA} -); -// Light LEDs 1 to 9 in white when NAVIGATION is active -const rgblight_segment_t PROGMEM my_nav_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {0, 10, HSV_WHITE} -); - -// Now define the array of layers. Later layers take precedence -const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST( - my_layer0_layer, // hrcolemak - my_layer1_layer, // hrwidecolemak - my_layer2_layer, // gaming - my_layer3_layer, // widecolemak - my_layer4_layer, // adjust - my_nav_layer, // nav - my_de_layer, // de_layout - my_capslock_layer // capslock -); - -void keyboard_post_init_user(void) { - // Enable the LED layers - rgblight_layers = my_rgb_layers; -} - -bool led_update_user(led_t led_state) { - rgblight_set_layer_state(7, led_state.caps_lock); - return true; -} - -layer_state_t layer_state_set_user(layer_state_t state) { - rgblight_set_layer_state(2, layer_state_cmp(state, _GAMING)); - rgblight_set_layer_state(3, layer_state_cmp(state, _WIDECOLEMAK)); - if ( - ( layer_state_cmp(state, _LOWER) && layer_state_cmp(state, _RAISE ) ) || - ( layer_state_cmp(state, _LOWER_DE) && layer_state_cmp(state, _RAISE_DE ) ) ) { - return state | (1UL<<_ADJUST); - } else { - return state & ~(1UL<<_ADJUST); - } - // state = update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); - rgblight_set_layer_state(4, layer_state_cmp(state, _ADJUST)); - //return state; -} - -layer_state_t default_layer_state_set_user(layer_state_t state) { - rgblight_set_layer_state(3, layer_state_cmp(state, _WIDECOLEMAK)); - rgblight_set_layer_state(1, layer_state_cmp(state, _HRWIDECOLEMAK)); - rgblight_set_layer_state(6, layer_state_cmp(state, _HRWIDECOLEMAK_DE)); - return state; -} - diff --git a/keyboards/planck/keymaps/jweickm/keymap_halfwide.c b/keyboards/planck/keymaps/jweickm/keymap_halfwide.c deleted file mode 100644 index 545794222789..000000000000 --- a/keyboards/planck/keymaps/jweickm/keymap_halfwide.c +++ /dev/null @@ -1,583 +0,0 @@ -/* Copyright 2015-2017 Jack Humbert - * Copyright 2021 Jakob Weickmann - * - * 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 . - */ -#include QMK_KEYBOARD_H -#include "muse.h" -#include "quantum.h" - -enum planck_layers { - _COLEMAK, - _WIDECOLEMAK, - _HRCOLEMAK, - _HRWIDECOLEMAK, - _GAMING, - _LOWER, - _RAISE, - _ADJUST, - _NAV, - _NAV2, - _NUM, - _FN, - _MEDIA, - _MOUSE, - _PLOVER -}; - -enum planck_keycodes { - COLEMAK = SAFE_RANGE, - PLOVER, - BACKLIT, - EXT_PLV, - WIDECOLEMAK, - HRCOLEMAK, - HRWIDECOLEMAK, - GAMING, - VIM_O, - VIM_V, - KC_SVD_BD, - KC_SVU_BU -}; - -// Tap Dance declarations -enum { - TD_PRN, // round brackets (parentheses) - TD_BRC, // square brackets - TD_CBR, // curly brackets - TD_ESC_CAPS, // double tap for caps lock - TD_QUO_BRC, // double function on quotes to enable typing ü in german layout - TD_COMM_SLSH, // comma that doubles as a slash - TD_MPLY_MNXT_MPRV -}; - -#define LOWER MO(_LOWER) -#define RAISE MO(_RAISE) - - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - -[_COLEMAK] = LAYOUT_planck_grid( - LT(_NUM,KC_TAB), KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, - LCTL_T(KC_ESC), KC_A, KC_R, KC_S, KC_T, KC_G, KC_M, KC_N, KC_E, KC_I, KC_O, TD(TD_QUO_BRC), - OSM(MOD_LSFT), KC_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, RSFT_T(KC_ENT), - LCTL_T(KC_CAPS), RALT_T(KC_APP), LGUI_T(KC_TAB), LT(_MOUSE, KC_ESC), LT(_LOWER,KC_BSPC), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE,KC_DEL), LT(_MEDIA, KC_ENT), TG(_NAV), RALT_T(KC_UP), CTL_T(KC_CAPS) -), - -/* WIDECOLEMAK - * ,-----------------------------------------------------------------------------------. - * |_NUM(Tab)| Q | W | E | R | T | Y | U | I | O | P | Bksp | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * |CTL(Esc)| A | S | D | F | G | H | J | K | L | ; | " | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | - * `-----------------------------------------------------------------------------------' - */ -[_WIDECOLEMAK] = LAYOUT_planck_grid( - KC_Q, KC_W, KC_F, KC_P, KC_B, KC_SVU_BU, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_LBRC, - KC_A, KC_R, KC_S, KC_T, KC_G, TD(TD_MPLY_MNXT_MPRV), KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, - KC_Z, KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, KC_MINS, - TG(_MOUSE), LT(_NUM,KC_TAB), LCTL_T(KC_ESC), OSM(MOD_LSFT), LT(_LOWER, KC_BSPC), LT(_NAV2,KC_ENT), LT(_NAV2,KC_ENT), LT(_RAISE, KC_SPC), RCTL_T(KC_TAB), RGUI_T(KC_LALT), KC_LEFT, KC_RIGHT -), - -[_HRCOLEMAK] = LAYOUT_planck_grid( - KC_TRNS, KC_Q, KC_W, LT(_NUM, KC_F), KC_P, KC_B, KC_J, KC_L, LT(_FN, KC_U), KC_Y, KC_SCLN, KC_LBRC, - TD(TD_ESC_CAPS), LGUI_T(KC_A), LALT_T(KC_R), LSFT_T(KC_S), LCTL_T(KC_T), KC_G, KC_M, RCTL_T(KC_N), RSFT_T(KC_E), LALT_T(KC_I), RGUI_T(KC_O), KC_QUOT, - KC_TRNS, KC_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, KC_MINS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS -), - -[_HRWIDECOLEMAK] = LAYOUT_planck_grid( - KC_Q, KC_W, LT(_NUM,KC_F), KC_P, KC_B, KC_SVU_BU, KC_J, KC_L, LT(_FN,KC_U), KC_Y, KC_SCLN, KC_LBRC, - LGUI_T(KC_A), LALT_T(KC_R), LSFT_T(KC_S), LCTL_T(KC_T), KC_G, TD(TD_MPLY_MNXT_MPRV), KC_M, RCTL_T(KC_N), RSFT_T(KC_E), LALT_T(KC_I), RGUI_T(KC_O), KC_QUOT, - KC_Z, KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, KC_MINS, - TG(_MOUSE), LT(_NUM,KC_TAB), LCTL_T(KC_ESC), OSM(MOD_LSFT), LT(_LOWER, KC_BSPC), LT(_NAV2,KC_ENT), LT(_NAV2,KC_ENT), LT(_RAISE, KC_SPC), RCTL_T(KC_TAB), RGUI_T(KC_LALT), KC_LEFT, KC_RIGHT -), - -[_GAMING] = LAYOUT_planck_grid( - KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, GAMING, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_QUOT, - KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_Z, KC_M, KC_SCLN, KC_SFTENT, - KC_LCTL, KC_NUBS, KC_B, KC_X, KC_C, KC_SPC, KC_SPC, KC_LALT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS -), - -[_LOWER] = LAYOUT_planck_grid( - KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_TILD, KC_CIRC, KC_AMPR, KC_ASTR, TD(TD_PRN), KC_RPRN, KC_DEL, - KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_DEL, KC_UNDS, KC_PLUS, TD(TD_CBR), KC_RCBR, KC_PIPE, - KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, LSFT(KC_NUHS), LSFT(KC_BSLS), KC_JYEN, KC_EQL, KC_TRNS, - TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_DEL, KC_VOLD, KC_VOLU, KC_MPLY -), - -[_RAISE] = LAYOUT_planck_grid( - KC_1, KC_2, KC_3, KC_4, KC_5, KC_GRV, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, - KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_DEL, KC_MINS, KC_EQL, TD(TD_BRC), KC_RBRC,KC_BSLS, - KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, KC_NUHS, KC_COMM, KC_DOT, KC_SLSH, KC_TRNS, - TG(_MOUSE), KC_TRNS, KC_BSPC, KC_DEL, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY -), - -[_ADJUST] = LAYOUT_planck_grid( - LALT(KC_LSFT), RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_INS, - LALT(KC_GRV), EEP_RST, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, COLEMAK, HRCOLEMAK, WIDECOLEMAK, HRWIDECOLEMAK, GAMING, - KC_TRNS, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, KC_NO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS -), - -[_NAV] = LAYOUT_planck_grid( - LALT(KC_LSFT), KC_NO, LCTL(KC_RGHT), KC_MS_U, LCTL(KC_V), LCTL(KC_LEFT), LCTL(KC_V), KC_RIGHT, KC_PGUP, LCTL(KC_C), KC_NO, KC_NO, - LALT(KC_GRV), KC_HOME, KC_MS_L, KC_MS_D, KC_MS_R, KC_BTN1, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_END, VIM_O, - KC_TRNS, KC_NO, LCTL(KC_X), LCTL(KC_X), KC_BTN2, VIM_V, KC_NO, KC_PGDN, TG(_NAV), KC_NO, LCTL(KC_F), KC_TRNS, - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRNS, KC_TRNS, KC_NO, KC_NO, KC_TRNS, KC_NO, KC_NO -), - -[_NAV2] = LAYOUT_planck_grid( - KC_TAB, LCTL(KC_RGHT), LALT(KC_LSFT), LALT(KC_GRV), LCTL(KC_LEFT), KC_BRIU, KC_CAPS, KC_RIGHT, KC_PGUP, LCTL(KC_C), KC_NO, KC_BSPC, - OSM(MOD_LGUI), OSM(MOD_LALT), OSM(MOD_LSFT), OSM(MOD_LCTL), KC_TAB, KC_MUTE, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_END, VIM_O, - KC_TRNS, KC_NO, LALT(KC_LSFT), TD(TD_ESC_CAPS), VIM_V, KC_BRID, KC_HOME, KC_PGDN, KC_NO, KC_NO, LCTL(KC_F), KC_TRNS, - KC_NO, KC_NO, KC_NO, KC_TRNS, KC_DEL, LT(_NAV2,KC_ENT), LT(_NAV2,KC_ENT), KC_NO, KC_NO, KC_TRNS, KC_NO, KC_NO -), - -[_NUM] = LAYOUT_planck_grid( - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NLCK, KC_P7, KC_P8, KC_P9, KC_PMNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PAST, KC_P4, KC_P5, KC_P6, KC_PPLS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P1, KC_P2, KC_P3, KC_PSLS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P0, KC_PDOT, KC_PCMM, KC_PEQL, KC_TRNS -), - -[_MEDIA] = LAYOUT_planck_grid( - LALT(KC_LSFT), KC_NO, KC_NO, KC_NO, KC_NO, KC_BRID, KC_BRIU, KC_MUTE, KC_MPLY, KC_NO, KC_NO, KC_NO, - LALT(KC_GRV), KC_NO, KC_NO, KC_BRID, KC_BRIU, KC_NO, KC_MPRV, KC_VOLD, KC_VOLU, KC_MNXT, KC_NO, 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 -), - -[_MOUSE] = LAYOUT_planck_grid( - KC_NO, KC_NO, KC_BTN4, KC_BTN5, KC_NO, KC_NO, KC_NO, KC_WH_U, KC_MS_U, KC_WH_U, KC_NO, KC_NO, - KC_NO, KC_NO, KC_BTN3, KC_BTN2, KC_BTN1, 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_WH_D, KC_NO, KC_NO, KC_NO, KC_NO, - TG(_MOUSE), KC_NO, KC_NO, KC_TRNS, KC_NO, KC_ACL2, KC_ACL2, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO -), - -[_FN] = LAYOUT_planck_grid( - KC_NO, KC_F1, KC_F2, KC_F3, KC_F4, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_NO, KC_F5, KC_F6, KC_F7, KC_F8, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_NO, KC_F9,KC_F10,KC_F11,KC_F12, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_NO, KC_NO, KC_TRNS, KC_NO, KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO -) -}; - - -// define the tap dance functions -void dance_prn(qk_tap_dance_state_t *state, void *user_data) { - if (state->count == 1) { - tap_code16(KC_LPRN); - } else { - tap_code16(KC_LPRN); - tap_code16(KC_RPRN); - tap_code(KC_LEFT); - } -} -void dance_brc(qk_tap_dance_state_t *state, void *user_data) { - if (state->count == 1) { - tap_code(KC_LBRC); - } else { - tap_code(KC_LBRC); - tap_code(KC_RBRC); - tap_code(KC_LEFT); - } -} -void dance_cbr(qk_tap_dance_state_t *state, void *user_data) { - if (state->count == 1) { - tap_code16(KC_LCBR); - } else { - tap_code16(KC_LCBR); - tap_code16(KC_RCBR); - tap_code(KC_LEFT); - } -} -void dance_mply_mnxt_mprv(qk_tap_dance_state_t *state, void *user_data) { - if (state->count == 1) { - tap_code(KC_MPLY); - } if (state->count == 2) { - tap_code(KC_MNXT); - } else { - tap_code(KC_MPRV); - } -} - -qk_tap_dance_action_t tap_dance_actions[] = { - // declare tap dance actions here - [TD_PRN] = ACTION_TAP_DANCE_FN(dance_prn), - [TD_BRC] = ACTION_TAP_DANCE_FN(dance_brc), - [TD_CBR] = ACTION_TAP_DANCE_FN(dance_cbr), - [TD_ESC_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_ESC, KC_CAPS), - [TD_QUO_BRC] = ACTION_TAP_DANCE_DOUBLE(KC_QUOT, KC_LBRC), - [TD_COMM_SLSH] = ACTION_TAP_DANCE_DOUBLE(KC_COMMA, KC_SLSH), - [TD_MPLY_MNXT_MPRV] = ACTION_TAP_DANCE_FN(dance_mply_mnxt_mprv) -}; - -// TD(TD_ESC_CAPS), LGUI_T(KC_A), LALT_T(KC_R), LSFT_T(KC_S), LCTL_T(KC_T), KC_G, KC_M, RCTL_T(KC_N), RSFT_T(KC_E), LALT_T(KC_I), RGUI_T(KC_O), KC_TRNS, -// define the per_key_tapping_term -uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case TD(TD_ESC_CAPS): - return TAPPING_TERM * 1.5; - case LGUI_T(KC_A): - return TAPPING_TERM * 1.4; - case RGUI(KC_O): - return TAPPING_TERM * 1.45; - case LALT_T(KC_R): - return TAPPING_TERM * 1.3; - case LALT_T(KC_I): - return TAPPING_TERM * 1.35; - case LCTL_T(KC_T): - return TAPPING_TERM * 1.1; - case LCTL_T(KC_N): - return TAPPING_TERM * 1.1; - case LSFT_T(KC_S): - return TAPPING_TERM * 1.0; - case RSFT_T(KC_E): - return TAPPING_TERM * 1.0; - case LT(_NUM, KC_F): - return TAPPING_TERM * 1.2; - case LT(_FN, KC_U): - return TAPPING_TERM * 1.2; - case TD(TD_QUO_BRC): - return TAPPING_TERM * 1.2; - default: - return TAPPING_TERM; - } -} - -#ifdef AUDIO_ENABLE - float plover_song[][2] = SONG(PLOVER_SOUND); - float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND); -#endif - - -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case COLEMAK: - if (record->event.pressed) { - set_single_persistent_default_layer(_COLEMAK); - } - return false; - break; - case WIDECOLEMAK: - if (record->event.pressed) { - set_single_persistent_default_layer(_WIDECOLEMAK); - } - return false; - break; - case HRCOLEMAK: - if (record->event.pressed) { - set_single_persistent_default_layer(_HRCOLEMAK); - } - return false; - break; - case HRWIDECOLEMAK: - if (record->event.pressed) { - set_single_persistent_default_layer(_HRWIDECOLEMAK); - } - return false; - break; - case GAMING: - if (record->event.pressed) { - layer_invert(_GAMING); - } - return false; - break; - case VIM_O: - if (record->event.pressed) { - tap_code(KC_END); - tap_code(KC_ENT); - } - return false; - break; - case VIM_V: - if (record->event.pressed) { - if (get_mods() & MOD_BIT(KC_LSFT)) { - unregister_code(KC_LSFT); - } else { - register_code(KC_LSFT); - } - } - return false; - break; - case KC_SVU_BU: // increase backlight when pressing shift and vol up - if (record->event.pressed) { - if (get_mods() & MOD_BIT(KC_LSFT) || get_mods() & MOD_BIT(KC_RSFT)) { - register_code(KC_BRIU); - } else { - register_code(KC_VOLU); - } - } else { - unregister_code(KC_BRIU); - unregister_code(KC_VOLU); - } - return false; - case KC_SVD_BD: // increase backlight when pressing shift and vol up - if (record->event.pressed) { - if (get_mods() & MOD_BIT(KC_LSFT) || get_mods() & MOD_BIT(KC_RSFT)) { - register_code(KC_BRID); - } else { - register_code(KC_VOLD); - } - } else { - unregister_code(KC_BRID); - unregister_code(KC_VOLD); - } - return false; - case BACKLIT: - if (record->event.pressed) { - register_code(KC_RSFT); - #ifdef BACKLIGHT_ENABLE - backlight_step(); - #endif - #ifdef KEYBOARD_planck_rev5 - writePinLow(E6); - #endif - } else { - unregister_code(KC_RSFT); - #ifdef KEYBOARD_planck_rev5 - writePinHigh(E6); - #endif - } - 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(); - keymap_config.nkro = 1; - eeconfig_update_keymap(keymap_config.raw); - } - return false; - break; - case EXT_PLV: - if (record->event.pressed) { - #ifdef AUDIO_ENABLE - PLAY_SONG(plover_gb_song); - #endif - layer_off(_PLOVER); - } - return false; - break; - } - return true; -} - -bool muse_mode = false; -uint8_t last_muse_note = 0; -uint16_t muse_counter = 0; -uint8_t muse_offset = 70; -uint16_t muse_tempo = 50; - -bool encoder_update(bool clockwise) { - 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 (clockwise) { - #ifdef MOUSEKEY_ENABLE - tap_code(KC_MS_WH_DOWN); - #else - tap_code(KC_PGDN); - #endif - } else { - #ifdef MOUSEKEY_ENABLE - tap_code(KC_MS_WH_UP); - #else - tap_code(KC_PGUP); - #endif - } - } - return true; -} - -void dip_switch_update_user(uint8_t index, bool active) { - switch (index) { - case 0: { -#ifdef AUDIO_ENABLE - static bool play_sound = false; -#endif - if (active) { -#ifdef AUDIO_ENABLE - if (play_sound) { PLAY_SONG(plover_song); } -#endif - layer_on(_ADJUST); - } else { -#ifdef AUDIO_ENABLE - if (play_sound) { PLAY_SONG(plover_gb_song); } -#endif - layer_off(_ADJUST); - } -#ifdef AUDIO_ENABLE - play_sound = true; -#endif - break; - } - case 1: - if (active) { - muse_mode = true; - } else { - muse_mode = false; - } - } -} - -void matrix_scan_user(void) { -#ifdef AUDIO_ENABLE - if (muse_mode) { - if (muse_counter == 0) { - uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()]; - if (muse_note != last_muse_note) { - stop_note(compute_freq_for_midi_note(last_muse_note)); - play_note(compute_freq_for_midi_note(muse_note), 0xF); - last_muse_note = muse_note; - } - } - muse_counter = (muse_counter + 1) % muse_tempo; - } else { - if (muse_counter) { - stop_all_notes(); - muse_counter = 0; - } - } -#endif -} - -bool music_mask_user(uint16_t keycode) { - switch (keycode) { - case RAISE: - case LOWER: - return false; - default: - return true; - } -} - -bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case LSFT_T(KC_S): - return true; - case RSFT_T(KC_E): - return true; - case LSFT_T(KC_D): - return true; - case RSFT_T(KC_K): - return true; - default: - return false; - } -} - -// Set RGB to change with layer changes -#define HSV_DARKORANGE 10, 255, 255 -#define HSV_DARKPINK 150, 100, 255 - -// Light LEDs 1 to 9 in goldenrod when COLEMAK is active -const rgblight_segment_t PROGMEM my_layer0_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {1, 10, HSV_GOLDENROD} -); -// Light LEDs 1 to 9 in white when WIDECOLEMAK is active -const rgblight_segment_t PROGMEM my_layer1_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {1, 10, HSV_WHITE} -); -// Light LEDs 1 to 9 in darkorange when HRCOLEMAK is active -const rgblight_segment_t PROGMEM my_layer2_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {1, 10, HSV_DARKORANGE} -); -// Light LEDs 1 to 9 in green when HRWIDECOLEMAK is active -const rgblight_segment_t PROGMEM my_layer3_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {1, 10, HSV_GREEN} -); -// Light LEDs 1 to 9 in green when HRWIDECOLEMAK is active -const rgblight_segment_t PROGMEM my_nav_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {1, 10, HSV_GREEN} -); -// Light LEDs 1 to 9 in red when GAMING layer is active -const rgblight_segment_t PROGMEM my_layer4_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {1, 10, HSV_RED} -); -// Light bottom LEDs in purple when ADJUST layer is active -const rgblight_segment_t PROGMEM my_layer5_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {1, 2, HSV_PURPLE}, - {7, 2, HSV_PURPLE} -); -// Light bottom LEDs in red when caps lock is active. Hard to ignore! -const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {1, 2, HSV_DARKPINK}, - {7, 2, HSV_DARKPINK} -); - -// Now define the array of layers. Later layers take precedence -const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST( - my_layer0_layer, // colemak - my_layer1_layer, // widecolemak - my_layer2_layer, // hrcolemak - my_layer3_layer, // hrwidecolemak - my_layer4_layer, // gaming - my_layer5_layer, // adjust - my_capslock_layer, // capslock - my_nav_layer // nav -); - -void keyboard_post_init_user(void) { - // Enable the LED layers - rgblight_layers = my_rgb_layers; -} - -bool led_update_user(led_t led_state) { - rgblight_set_layer_state(6, led_state.caps_lock); - return true; -} - -layer_state_t layer_state_set_user(layer_state_t state) { - state = update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); - rgblight_set_layer_state(5, layer_state_cmp(state, _ADJUST)); - rgblight_set_layer_state(4, layer_state_cmp(state, _GAMING)); - rgblight_set_layer_state(7, layer_state_cmp(state, _NAV)); - return state; -} - -layer_state_t default_layer_state_set_user(layer_state_t state) { - rgblight_set_layer_state(0, layer_state_cmp(state, _COLEMAK)); - rgblight_set_layer_state(1, layer_state_cmp(state, _WIDECOLEMAK)); - rgblight_set_layer_state(2, layer_state_cmp(state, _HRCOLEMAK)); - rgblight_set_layer_state(3, layer_state_cmp(state, _HRWIDECOLEMAK)); - return state; -} diff --git a/keyboards/planck/keymaps/jweickm/keymap_narrow.c b/keyboards/planck/keymaps/jweickm/keymap_narrow.c deleted file mode 100644 index 0d686c6a5414..000000000000 --- a/keyboards/planck/keymaps/jweickm/keymap_narrow.c +++ /dev/null @@ -1,572 +0,0 @@ -/* Copyright 2015-2017 Jack Humbert - * Copyright 2021 Jakob Weickmann - * - * 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 . - */ -#include QMK_KEYBOARD_H -#include "muse.h" -#include "quantum.h" - -enum planck_layers { - _QWERTY, - _COLEMAK, - _WIDECOLEMAK, - _HRCOLEMAK, - _HRWIDECOLEMAK, - _GAMING, - _LOWER, - _RAISE, - _ADJUST, - _NAV, - _NAV2, - _NUM, - _FN, - _MEDIA, - _MOUSE, - _PLOVER -}; - -enum planck_keycodes { - QWERTY = SAFE_RANGE, - COLEMAK, - PLOVER, - BACKLIT, - EXT_PLV, - WIDECOLEMAK, - HRCOLEMAK, - HRWIDECOLEMAK, - GAMING, - VIM_O, - VIM_V -}; - -// Tap Dance declarations -enum { - TD_PRN, // round brackets (parentheses) - TD_BRC, // square brackets - TD_CBR, // curly brackets - TD_ESC_CAPS, // double tap for caps lock - TD_QUO_BRC, // double function on quotes to enable typing ü in german layout - TD_COMM_SLSH // comma that doubles as a slash -}; - -#define LOWER MO(_LOWER) -#define RAISE MO(_RAISE) - - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - -/* Qwerty - * ,-----------------------------------------------------------------------------------. - * |_NUM(Tab)| Q | W | E | R | T | Y | U | I | O | P | Bksp | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * |CTL(Esc)| A | S | D | F | G | H | J | K | L | ; | " | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | - * `-----------------------------------------------------------------------------------' - */ -[_QWERTY] = LAYOUT_planck_grid( - LT(_NUM,KC_TAB), KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, - LCTL_T(KC_ESC), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, TD(TD_QUO_BRC), - OSM(MOD_LSFT), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, RSFT_T(KC_ENT), - LCTL_T(KC_CAPS), RALT_T(KC_APP), LGUI_T(KC_TAB), LT(_MOUSE, KC_ESC), LT(_LOWER,KC_BSPC), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE,KC_DEL), LT(_MEDIA, KC_ENT), TG(_NAV), RALT_T(KC_UP), CTL_T(KC_CAPS) -), - -[_COLEMAK] = LAYOUT_planck_grid( - KC_TRNS, KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_TRNS, - KC_TRNS, KC_A, KC_R, KC_S, KC_T, KC_G, KC_M, KC_N, KC_E, KC_I, KC_O, KC_TRNS, - KC_TRNS, KC_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS -), - -/* WIDECOLEMAK - * ,-----------------------------------------------------------------------------------. - * |_NUM(Tab)| Q | W | E | R | T | Y | U | I | O | P | Bksp | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * |CTL(Esc)| A | S | D | F | G | H | J | K | L | ; | " | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | - * `-----------------------------------------------------------------------------------' - */ -[_WIDECOLEMAK] = LAYOUT_planck_grid( - KC_Q, KC_W, KC_F, KC_P, KC_B, KC_LBRC, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_LBRC, - KC_A, KC_R, KC_S, KC_T, KC_G, KC_GRV, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, - KC_Z, KC_X, KC_C, KC_D, KC_V, KC_LPRN, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, KC_MINS, - KC_TRNS, KC_TRNS, LCTL_T(KC_ESC), OSM(MOD_LSFT), LT(_LOWER, KC_BSPC), KC_TRNS, KC_TRNS, LT(_RAISE, KC_TAB), RCTL_T(KC_SPC), RSFT_T(KC_ENT), KC_LEFT, KC_RIGHT -), - -[_HRCOLEMAK] = LAYOUT_planck_grid( - KC_TRNS, KC_Q, KC_W, LT(_NUM, KC_F), KC_P, KC_B, KC_J, KC_L, LT(_FN, KC_U), KC_Y, KC_SCLN, KC_LBRC, - TD(TD_ESC_CAPS), LGUI_T(KC_A), LALT_T(KC_R), LSFT_T(KC_S), LCTL_T(KC_T), KC_G, KC_M, RCTL_T(KC_N), RSFT_T(KC_E), LALT_T(KC_I), RGUI_T(KC_O), KC_QUOT, - KC_TRNS, KC_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, KC_MINS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS -), - -[_HRWIDECOLEMAK] = LAYOUT_planck_grid( - KC_Q, KC_W, KC_F, KC_P, KC_B, KC_LBRC, KC_RBRC, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, - LGUI_T(KC_A), LALT_T(KC_R), LSFT_T(KC_S), LCTL_T(KC_T), KC_G, KC_GRV, KC_QUOT, KC_M, RCTL_T(KC_N), RSFT_T(KC_E), RALT_T(KC_I), RGUI_T(KC_O), - KC_Z, KC_X, KC_C, KC_D, KC_V, KC_LPRN, KC_RPRN, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, - KC_TRNS, KC_TRNS, LCTL_T(KC_ESC), OSM(MOD_LSFT), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, LSFT_T(KC_SPC), LCTL_T(KC_TAB), KC_TRNS, HRCOLEMAK -), - -[_GAMING] = LAYOUT_planck_grid( - KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, GAMING, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_QUOT, - KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_Z, KC_M, KC_SCLN, KC_SFTENT, - KC_LCTL, KC_NUBS, KC_B, KC_X, KC_C, KC_SPC, KC_SPC, KC_LALT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS -), - -[_LOWER] = LAYOUT_planck_grid( - KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, TD(TD_PRN), KC_RPRN, KC_DEL, - KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, TD(TD_CBR), KC_RCBR, KC_PIPE, - KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, LSFT(KC_NUHS), LSFT(KC_BSLS), KC_JYEN, KC_EQL, KC_TRNS, - TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY -), - -[_RAISE] = LAYOUT_planck_grid( - 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, TD(TD_BRC), KC_RBRC,KC_BSLS, - KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_COMM, KC_DOT, KC_SLSH, KC_TRNS, - TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY -), - -[_ADJUST] = LAYOUT_planck_grid( - LALT(KC_LSFT), RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_INS, - LALT(KC_GRV), EEP_RST, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, WIDECOLEMAK, HRWIDECOLEMAK, GAMING, - KC_TRNS, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, KC_NO, HRCOLEMAK, KC_TRNS, TERM_OFF, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS -), - -[_NAV] = LAYOUT_planck_grid( - LALT(KC_LSFT), KC_NO, LCTL(KC_RGHT), KC_MS_U, LCTL(KC_V), LCTL(KC_LEFT), LCTL(KC_V), KC_RIGHT, KC_PGUP, LCTL(KC_C), KC_NO, KC_NO, - LALT(KC_GRV), KC_HOME, KC_MS_L, KC_MS_D, KC_MS_R, KC_BTN1, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_END, VIM_O, - MO(_NAV2), KC_NO, LCTL(KC_X), LCTL(KC_X), KC_BTN2, VIM_V, KC_NO, KC_PGDN, TG(_NAV), KC_NO, LCTL(KC_F), KC_TRNS, - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRNS, KC_TRNS, KC_NO, KC_NO, KC_TRNS, KC_NO, KC_NO -), - -[_NAV2] = LAYOUT_planck_grid( - 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_HOME, KC_PGDN, KC_PGUP, KC_END, KC_NO, KC_NO, - 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 -), - -[_NUM] = LAYOUT_planck_grid( - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NLCK, KC_P7, KC_P8, KC_P9, KC_PMNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PAST, KC_P4, KC_P5, KC_P6, KC_PPLS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P1, KC_P2, KC_P3, KC_PSLS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P0, KC_PDOT, KC_PCMM, KC_PEQL, KC_TRNS -), - -[_MEDIA] = LAYOUT_planck_grid( - LALT(KC_LSFT), KC_NO, KC_NO, KC_NO, KC_NO, KC_BRID, KC_BRIU, KC_MUTE, KC_MPLY, KC_NO, KC_NO, KC_NO, - LALT(KC_GRV), KC_NO, KC_NO, KC_BRID, KC_BRIU, KC_NO, KC_MPRV, KC_VOLD, KC_VOLU, KC_MNXT, KC_NO, 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 -), - -[_MOUSE] = LAYOUT_planck_grid( - KC_NO, KC_NO, KC_BTN4, KC_BTN5, KC_NO, KC_NO, KC_NO, KC_WH_U, KC_MS_U, KC_WH_U, KC_NO, KC_NO, - KC_NO, KC_NO, KC_BTN3, KC_BTN2, KC_BTN1, 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_WH_D, KC_NO, KC_NO, KC_NO, KC_NO, - KC_TRNS, KC_NO, KC_NO, KC_TRNS, KC_NO, KC_ACL2, KC_ACL2, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO -), - -[_FN] = LAYOUT_planck_grid( - KC_NO, KC_F1, KC_F2, KC_F3, KC_F4, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_NO, KC_F5, KC_F6, KC_F7, KC_F8, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_NO, KC_F9,KC_F10,KC_F11,KC_F12, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_NO, KC_NO, KC_TRNS, KC_NO, KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO -) -}; - - -// define the tap dance functions -void dance_prn(qk_tap_dance_state_t *state, void *user_data) { - if (state->count == 1) { - tap_code16(KC_LPRN); - } else { - tap_code16(KC_LPRN); - tap_code16(KC_RPRN); - tap_code(KC_LEFT); - } -} -void dance_brc(qk_tap_dance_state_t *state, void *user_data) { - if (state->count == 1) { - tap_code(KC_LBRC); - } else { - tap_code(KC_LBRC); - tap_code(KC_RBRC); - tap_code(KC_LEFT); - } -} -void dance_cbr(qk_tap_dance_state_t *state, void *user_data) { - if (state->count == 1) { - tap_code16(KC_LCBR); - } else { - tap_code16(KC_LCBR); - tap_code16(KC_RCBR); - tap_code(KC_LEFT); - } -} - -qk_tap_dance_action_t tap_dance_actions[] = { - // declare tap dance actions here - [TD_PRN] = ACTION_TAP_DANCE_FN(dance_prn), - [TD_BRC] = ACTION_TAP_DANCE_FN(dance_brc), - [TD_CBR] = ACTION_TAP_DANCE_FN(dance_cbr), - [TD_ESC_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_ESC, KC_CAPS), - [TD_QUO_BRC] = ACTION_TAP_DANCE_DOUBLE(KC_QUOT, KC_LBRC), - [TD_COMM_SLSH] = ACTION_TAP_DANCE_DOUBLE(KC_COMMA, KC_SLSH) -}; - -// TD(TD_ESC_CAPS), LGUI_T(KC_A), LALT_T(KC_R), LSFT_T(KC_S), LCTL_T(KC_T), KC_G, KC_M, RCTL_T(KC_N), RSFT_T(KC_E), LALT_T(KC_I), RGUI_T(KC_O), KC_TRNS, -// define the per_key_tapping_term -uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case TD(TD_ESC_CAPS): - return TAPPING_TERM * 1.5; - case LGUI_T(KC_A): - return TAPPING_TERM * 1.4; - case RGUI(KC_O): - return TAPPING_TERM * 1.45; - case LALT_T(KC_R): - return TAPPING_TERM * 1.3; - case LALT_T(KC_I): - return TAPPING_TERM * 1.35; - case LCTL_T(KC_T): - return TAPPING_TERM * 1.1; - case LCTL_T(KC_N): - return TAPPING_TERM * 1.1; - case LSFT_T(KC_S): - return TAPPING_TERM * 1.0; - case RSFT_T(KC_E): - return TAPPING_TERM * 1.0; - case LT(_NUM, KC_F): - return TAPPING_TERM * 1.2; - case LT(_FN, KC_U): - return TAPPING_TERM * 1.2; - case TD(TD_QUO_BRC): - return TAPPING_TERM * 1.2; - default: - return TAPPING_TERM; - } -} - -#ifdef AUDIO_ENABLE - float plover_song[][2] = SONG(PLOVER_SOUND); - float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND); -#endif - - -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case QWERTY: - if (record->event.pressed) { - set_single_persistent_default_layer(_QWERTY); - } - return false; - break; - case COLEMAK: - if (record->event.pressed) { - set_single_persistent_default_layer(_COLEMAK); - } - return false; - break; - case WIDECOLEMAK: - if (record->event.pressed) { - set_single_persistent_default_layer(_WIDECOLEMAK); - } - return false; - break; - case HRCOLEMAK: - if (record->event.pressed) { - set_single_persistent_default_layer(_HRCOLEMAK); - } - return false; - break; - case HRWIDECOLEMAK: - if (record->event.pressed) { - set_single_persistent_default_layer(_HRWIDECOLEMAK); - } - return false; - break; - case GAMING: - if (record->event.pressed) { - layer_invert(_GAMING); - } - return false; - break; - case VIM_O: - if (record->event.pressed) { - tap_code(KC_END); - tap_code(KC_ENT); - } - return false; - break; - case VIM_V: - if (record->event.pressed) { - if (get_mods() & MOD_BIT(KC_LSFT)) { - unregister_code(KC_LSFT); - } else { - register_code(KC_LSFT); - } - } - return false; - break; - case BACKLIT: - if (record->event.pressed) { - register_code(KC_RSFT); - #ifdef BACKLIGHT_ENABLE - backlight_step(); - #endif - #ifdef KEYBOARD_planck_rev5 - writePinLow(E6); - #endif - } else { - unregister_code(KC_RSFT); - #ifdef KEYBOARD_planck_rev5 - writePinHigh(E6); - #endif - } - 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(); - keymap_config.nkro = 1; - eeconfig_update_keymap(keymap_config.raw); - } - return false; - break; - case EXT_PLV: - if (record->event.pressed) { - #ifdef AUDIO_ENABLE - PLAY_SONG(plover_gb_song); - #endif - layer_off(_PLOVER); - } - return false; - break; - } - return true; -} - -bool muse_mode = false; -uint8_t last_muse_note = 0; -uint16_t muse_counter = 0; -uint8_t muse_offset = 70; -uint16_t muse_tempo = 50; - -bool encoder_update(bool clockwise) { - 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 (clockwise) { - #ifdef MOUSEKEY_ENABLE - tap_code(KC_MS_WH_DOWN); - #else - tap_code(KC_PGDN); - #endif - } else { - #ifdef MOUSEKEY_ENABLE - tap_code(KC_MS_WH_UP); - #else - tap_code(KC_PGUP); - #endif - } - } - return true; -} - -void dip_switch_update_user(uint8_t index, bool active) { - switch (index) { - case 0: { -#ifdef AUDIO_ENABLE - static bool play_sound = false; -#endif - if (active) { -#ifdef AUDIO_ENABLE - if (play_sound) { PLAY_SONG(plover_song); } -#endif - layer_on(_ADJUST); - } else { -#ifdef AUDIO_ENABLE - if (play_sound) { PLAY_SONG(plover_gb_song); } -#endif - layer_off(_ADJUST); - } -#ifdef AUDIO_ENABLE - play_sound = true; -#endif - break; - } - case 1: - if (active) { - muse_mode = true; - } else { - muse_mode = false; - } - } -} - -void matrix_scan_user(void) { -#ifdef AUDIO_ENABLE - if (muse_mode) { - if (muse_counter == 0) { - uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()]; - if (muse_note != last_muse_note) { - stop_note(compute_freq_for_midi_note(last_muse_note)); - play_note(compute_freq_for_midi_note(muse_note), 0xF); - last_muse_note = muse_note; - } - } - muse_counter = (muse_counter + 1) % muse_tempo; - } else { - if (muse_counter) { - stop_all_notes(); - muse_counter = 0; - } - } -#endif -} - -bool music_mask_user(uint16_t keycode) { - switch (keycode) { - case RAISE: - case LOWER: - return false; - default: - return true; - } -} - -bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case LSFT_T(KC_S): - return true; - case RSFT_T(KC_E): - return true; - case LSFT_T(KC_D): - return true; - case RSFT_T(KC_K): - return true; - default: - return false; - } -} - -// Set RGB to change with layer changes -#define HSV_DARKORANGE 10, 255, 255 -#define HSV_DARKPINK 150, 100, 255 - -// Light LEDs 1 to 9 in goldenrod when COLEMAK is active -const rgblight_segment_t PROGMEM my_layer0_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {1, 10, HSV_GOLDENROD} -); -// Light LEDs 1 to 9 in white when WIDECOLEMAK is active -const rgblight_segment_t PROGMEM my_layer1_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {1, 10, HSV_WHITE} -); -// Light LEDs 1 to 9 in darkorange when HRCOLEMAK is active -const rgblight_segment_t PROGMEM my_layer2_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {1, 10, HSV_DARKORANGE} -); -// Light LEDs 1 to 9 in green when HRWIDECOLEMAK is active -const rgblight_segment_t PROGMEM my_layer3_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {1, 10, HSV_GREEN} -); -// Light LEDs 1 to 9 in green when HRWIDECOLEMAK is active -const rgblight_segment_t PROGMEM my_nav_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {1, 10, HSV_GREEN} -); -// Light LEDs 1 to 9 in red when GAMING layer is active -const rgblight_segment_t PROGMEM my_layer4_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {1, 10, HSV_RED} -); -// Light bottom LEDs in purple when ADJUST layer is active -const rgblight_segment_t PROGMEM my_layer5_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {1, 2, HSV_PURPLE}, - {7, 2, HSV_PURPLE} -); -// Light bottom LEDs in red when caps lock is active. Hard to ignore! -const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {1, 2, HSV_DARKPINK}, - {7, 2, HSV_DARKPINK} -); - -// Now define the array of layers. Later layers take precedence -const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST( - my_layer0_layer, // colemak - my_layer1_layer, // widecolemak - my_layer2_layer, // hrcolemak - my_layer3_layer, // hrwidecolemak - my_layer4_layer, // gaming - my_layer5_layer, // adjust - my_capslock_layer, // capslock - my_nav_layer // nav -); - -void keyboard_post_init_user(void) { - // Enable the LED layers - rgblight_layers = my_rgb_layers; -} - -bool led_update_user(led_t led_state) { - rgblight_set_layer_state(6, led_state.caps_lock); - return true; -} - -layer_state_t layer_state_set_user(layer_state_t state) { - state = update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); - rgblight_set_layer_state(5, layer_state_cmp(state, _ADJUST)); - rgblight_set_layer_state(4, layer_state_cmp(state, _GAMING)); - rgblight_set_layer_state(7, layer_state_cmp(state, _NAV)); - return state; -} - -layer_state_t default_layer_state_set_user(layer_state_t state) { - rgblight_set_layer_state(0, layer_state_cmp(state, _COLEMAK)); - rgblight_set_layer_state(1, layer_state_cmp(state, _WIDECOLEMAK)); - rgblight_set_layer_state(2, layer_state_cmp(state, _HRCOLEMAK)); - rgblight_set_layer_state(3, layer_state_cmp(state, _HRWIDECOLEMAK)); - return state; -} diff --git a/keyboards/planck/keymaps/jweickm/keymap_qwerty.c b/keyboards/planck/keymaps/jweickm/keymap_qwerty.c deleted file mode 100644 index 608f6f27aa76..000000000000 --- a/keyboards/planck/keymaps/jweickm/keymap_qwerty.c +++ /dev/null @@ -1,479 +0,0 @@ -/* Copyright 2015-2017 Jack Humbert - * Copyright 2021 Jakob Weickmann - * - * 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 . - */ -#include QMK_KEYBOARD_H -#include "muse.h" -#include "quantum.h" - -enum planck_layers { - _QWERTY, - _COLEMAK, - _DVORAK, - _WIDEQWERTY, - _WIDECOLEMAK, - _HRQWERTY, - _HRCOLEMAK, - _GAMING, - _LOWER, - _RAISE, - _ADJUST, - _NAV, - _NAV2, - _NUM, - _MEDIA, - _MOUSE, - _PLOVER -}; - -enum planck_keycodes { - QWERTY = SAFE_RANGE, - COLEMAK, - DVORAK, - PLOVER, - BACKLIT, - EXT_PLV, - WIDECOLEMAK, - WIDEQWERTY, - HRQWERTY, - HRCOLEMAK, - GAMING -}; - -#define LOWER MO(_LOWER) -#define RAISE MO(_RAISE) - - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - -/* Qwerty - * ,-----------------------------------------------------------------------------------. - * |_NUM(Tab)| Q | W | E | R | T | Y | U | I | O | P | Bksp | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * |CTL(Esc)| A | S | D | F | G | H | J | K | L | ; | " | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | - * `-----------------------------------------------------------------------------------' - */ -[_QWERTY] = LAYOUT_planck_grid( - LT(_NUM,KC_TAB), KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, - LCTL_T(KC_ESC), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, RSFT_T(KC_QUOT), - OSM(MOD_LSFT), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, RSFT_T(KC_ENT), - LCTL_T(KC_CAPS), RALT_T(KC_APP), KC_LGUI, KC_LALT, LT(_LOWER,KC_BSPC), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE,KC_DEL), RCTL_T(KC_LEFT), LT(_MEDIA,KC_DOWN), RALT_T(KC_UP), RCTL_T(KC_RGHT) -), - -[_COLEMAK] = LAYOUT_planck_grid( - KC_TRNS, KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_TRNS, - KC_TRNS, KC_A, KC_R, KC_S, KC_T, KC_G, KC_M, KC_N, KC_E, KC_I, KC_O, KC_TRNS, - KC_TRNS, KC_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS -), - -[_WIDEQWERTY] = LAYOUT_planck_grid( - KC_Q, KC_W, KC_E, KC_R, KC_T, KC_LBRC, KC_RBRC, KC_Y, KC_U, KC_I, KC_O, KC_P, - LGUI_T(KC_A), LALT_T(KC_S), LCTL_T(KC_D), LSFT_T(KC_F), KC_G, KC_GRV, KC_QUOT, KC_H, RSFT_T(KC_J), RCTL_T(KC_K), RALT_T(KC_L), RGUI_T(KC_SCLN), - KC_Z, KC_X, KC_C, KC_V, KC_B, KC_LPRN, KC_RPRN, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, - KC_TRNS, KC_TRNS, LCTL_T(KC_ESC), OSM(MOD_LSFT), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, LSFT_T(KC_SPC), LCTL_T(KC_TAB), KC_TRNS, KC_TRNS -), - -[_WIDECOLEMAK] = LAYOUT_planck_grid( - KC_Q, KC_W, KC_F, KC_P, KC_B, KC_LBRC, KC_RBRC, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, - LGUI_T(KC_A), LALT_T(KC_R), LSFT_T(KC_S), LCTL_T(KC_T), KC_G, KC_GRV, KC_QUOT, KC_M, RCTL_T(KC_N), RSFT_T(KC_E), RALT_T(KC_I), RGUI_T(KC_O), - KC_Z, KC_X, KC_C, KC_D, KC_V, KC_LPRN, KC_RPRN, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, - KC_TRNS, KC_TRNS, LCTL_T(KC_ESC), OSM(MOD_LSFT), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, LSFT_T(KC_SPC), LCTL_T(KC_TAB), KC_TRNS, KC_TRNS -), - -[_HRQWERTY] = LAYOUT_planck_grid( - KC_TRNS, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_TRNS, - KC_TRNS, LGUI_T(KC_A), LALT_T(KC_S), LSFT_T(KC_D), LCTL_T(KC_F), KC_G, KC_H, RCTL_T(KC_J), RSFT_T(KC_K), LALT_T(KC_L), RGUI_T(KC_SCLN), KC_TRNS, - KC_TRNS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS -), - -[_HRCOLEMAK] = LAYOUT_planck_grid( - KC_TRNS, KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_TRNS, - KC_TRNS, LGUI_T(KC_A), LALT_T(KC_R), LSFT_T(KC_S), LCTL_T(KC_T), KC_G, KC_M, RCTL_T(KC_N), RSFT_T(KC_E), LALT_T(KC_I), RGUI_T(KC_O), KC_TRNS, - KC_TRNS, KC_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS -), - -[_GAMING] = LAYOUT_planck_grid( - KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, GAMING, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_QUOT, - KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_Z, KC_M, KC_SCLN, KC_SFTENT, - KC_LCTL, KC_NUBS, KC_B, KC_X, KC_C, KC_SPC, KC_SPC, KC_LALT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS -), - -[_LOWER] = LAYOUT_planck_grid( - 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_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_NUHS), LSFT(KC_BSLS), KC_JYEN, KC_EQL, KC_TRNS, - TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY -), - -[_RAISE] = LAYOUT_planck_grid( - 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_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_COMM, KC_DOT, KC_SLSH, KC_TRNS, - TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY -), - -[_ADJUST] = LAYOUT_planck_grid( - LALT(KC_LSFT), RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_INS, - LALT(KC_GRV), EEP_RST, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, WIDEQWERTY, WIDECOLEMAK, GAMING, - KC_TRNS, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, HRQWERTY, HRCOLEMAK, TERM_ON, TERM_OFF, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS -), - -[_NAV] = LAYOUT_planck_grid( - LALT(KC_LSFT), KC_NO, LCTL(KC_RGHT), LCTL(KC_RGHT), LCTL(KC_Y), KC_NO, LCTL(KC_C), LCTL(KC_Z), KC_PGUP, KC_NO, LCTL(KC_V), KC_NO, - LALT(KC_GRV), KC_NO, KC_NO, LCTL(KC_X), KC_NO, KC_NO, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_NO, KC_NO, - MO(_NAV2), KC_NO, LCTL(KC_X), LCTL(KC_X), KC_NO, LCTL(KC_LEFT), KC_NO, KC_PGDN, KC_NO, KC_NO, LCTL(KC_F), 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 -), - -[_NAV2] = LAYOUT_planck_grid( - 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_HOME, KC_PGDN, KC_PGUP, KC_END, KC_NO, KC_NO, - 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 -), - -[_NUM] = LAYOUT_planck_grid( - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NLCK, KC_P7, KC_P8, KC_P9, KC_PMNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PAST, KC_P4, KC_P5, KC_P6, KC_PPLS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P1, KC_P2, KC_P3, KC_PSLS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P0, KC_PDOT, KC_PCMM, KC_PEQL, KC_TRNS -), - -[_MEDIA] = LAYOUT_planck_grid( - LALT(KC_LSFT), KC_NO, KC_NO, KC_NO, KC_NO, KC_BRID, KC_BRIU, KC_MUTE, KC_MPLY, KC_NO, KC_NO, KC_NO, - LALT(KC_GRV), KC_NO, KC_NO, KC_BRID, KC_BRIU, KC_NO, KC_MPRV, KC_VOLD, KC_VOLU, KC_MNXT, KC_NO, 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 -), - -[_MOUSE] = LAYOUT_planck_grid( - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_WH_U, KC_NO, KC_NO, KC_NO, - KC_NO, KC_NO, KC_BTN3, KC_BTN2, KC_BTN1, KC_NO, KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R, KC_NO, KC_NO, - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_WH_D, KC_NO, KC_NO, KC_NO, - KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_ACL2, KC_ACL2, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO -) -}; - - -qk_tap_dance_action_t tap_dance_actions[] = { - // declare tap dance actions here -}; - -#ifdef AUDIO_ENABLE - float plover_song[][2] = SONG(PLOVER_SOUND); - float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND); -#endif - -layer_state_t layer_state_set_user(layer_state_t state) { - state = update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); - rgblight_set_layer_state(6, layer_state_cmp(state, _ADJUST)); - rgblight_set_layer_state(5, layer_state_cmp(state, _GAMING)); - return state; -} - -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case QWERTY: - if (record->event.pressed) { - set_single_persistent_default_layer(_QWERTY); - } - return false; - break; - case COLEMAK: - if (record->event.pressed) { - set_single_persistent_default_layer(_COLEMAK); - } - return false; - break; - case WIDEQWERTY: - if (record->event.pressed) { - set_single_persistent_default_layer(_WIDEQWERTY); - } - return false; - break; - case WIDECOLEMAK: - if (record->event.pressed) { - set_single_persistent_default_layer(_WIDECOLEMAK); - } - return false; - break; - case HRQWERTY: - if (record->event.pressed) { - set_single_persistent_default_layer(_HRQWERTY); - } - return false; - break; - case HRCOLEMAK: - if (record->event.pressed) { - set_single_persistent_default_layer(_HRCOLEMAK); - } - return false; - break; - case DVORAK: - if (record->event.pressed) { - set_single_persistent_default_layer(_DVORAK); - } - return false; - break; - case GAMING: - if (record->event.pressed) { - layer_invert(_GAMING); - } - return false; - break; - case BACKLIT: - if (record->event.pressed) { - register_code(KC_RSFT); - #ifdef BACKLIGHT_ENABLE - backlight_step(); - #endif - #ifdef KEYBOARD_planck_rev5 - writePinLow(E6); - #endif - } else { - unregister_code(KC_RSFT); - #ifdef KEYBOARD_planck_rev5 - writePinHigh(E6); - #endif - } - 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(); - keymap_config.nkro = 1; - eeconfig_update_keymap(keymap_config.raw); - } - return false; - break; - case EXT_PLV: - if (record->event.pressed) { - #ifdef AUDIO_ENABLE - PLAY_SONG(plover_gb_song); - #endif - layer_off(_PLOVER); - } - return false; - break; - } - return true; -} - -bool muse_mode = false; -uint8_t last_muse_note = 0; -uint16_t muse_counter = 0; -uint8_t muse_offset = 70; -uint16_t muse_tempo = 50; - -bool encoder_update(bool clockwise) { - 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 (clockwise) { - #ifdef MOUSEKEY_ENABLE - tap_code(KC_MS_WH_DOWN); - #else - tap_code(KC_PGDN); - #endif - } else { - #ifdef MOUSEKEY_ENABLE - tap_code(KC_MS_WH_UP); - #else - tap_code(KC_PGUP); - #endif - } - } - return true; -} - -void dip_switch_update_user(uint8_t index, bool active) { - switch (index) { - case 0: { -#ifdef AUDIO_ENABLE - static bool play_sound = false; -#endif - if (active) { -#ifdef AUDIO_ENABLE - if (play_sound) { PLAY_SONG(plover_song); } -#endif - layer_on(_ADJUST); - } else { -#ifdef AUDIO_ENABLE - if (play_sound) { PLAY_SONG(plover_gb_song); } -#endif - layer_off(_ADJUST); - } -#ifdef AUDIO_ENABLE - play_sound = true; -#endif - break; - } - case 1: - if (active) { - muse_mode = true; - } else { - muse_mode = false; - } - } -} - -void matrix_scan_user(void) { -#ifdef AUDIO_ENABLE - if (muse_mode) { - if (muse_counter == 0) { - uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()]; - if (muse_note != last_muse_note) { - stop_note(compute_freq_for_midi_note(last_muse_note)); - play_note(compute_freq_for_midi_note(muse_note), 0xF); - last_muse_note = muse_note; - } - } - muse_counter = (muse_counter + 1) % muse_tempo; - } else { - if (muse_counter) { - stop_all_notes(); - muse_counter = 0; - } - } -#endif -} - -bool music_mask_user(uint16_t keycode) { - switch (keycode) { - case RAISE: - case LOWER: - return false; - default: - return true; - } -} - -bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case LSFT_T(KC_S): - return true; - case RSFT_T(KC_E): - return true; - case LSFT_T(KC_D): - return true; - case RSFT_T(KC_K): - return true; - default: - return false; - } -} - -// Set RGB to change with layer changes -#define HSV_DARKORANGE 10, 255, 255 -#define HSV_DARKPINK 150, 100, 255 - -// Light LEDs 1 to 9 in goldenrod when COLEMAK is active -const rgblight_segment_t PROGMEM my_layer0_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {1, 9, HSV_GOLDENROD} -); -// Light LEDs 1 to 9 in orange when WIDEQWERTY is active -const rgblight_segment_t PROGMEM my_layer1_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {1, 9, HSV_CYAN} -); -// Light LEDs 1 to 9 in yellow when WIDECOLEMAK is active -const rgblight_segment_t PROGMEM my_layer2_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {1, 9, HSV_WHITE} -); -// Light LEDs 1 to 9 in red when HRQWERTY is active -const rgblight_segment_t PROGMEM my_layer3_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {1, 9, HSV_GREEN} -); -// Light LEDs 1 to 9 in red when HRCOLEMAK is active -const rgblight_segment_t PROGMEM my_layer4_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {1, 9, HSV_DARKORANGE} -); -// Light LEDs 1 to 9 in red when GAMING layer is active -const rgblight_segment_t PROGMEM my_layer5_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {1, 9, HSV_RED} -); -// Light bottom LEDs in purple when ADJUST layer is active -const rgblight_segment_t PROGMEM my_layer6_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {1, 2, HSV_PURPLE}, - {7, 2, HSV_PURPLE} -); -// Light bottom LEDs in red when caps lock is active. Hard to ignore! -const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {1, 2, HSV_DARKPINK}, - {7, 2, HSV_DARKPINK} -); - -// Now define the array of layers. Later layers take precedence -const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST( - my_layer0_layer, // colemak - my_layer1_layer, // wideqwerty - my_layer2_layer, // widecolemak - my_layer3_layer, // hrqwerty - my_layer4_layer, // hrcolemak - my_layer5_layer, // gaming - my_layer6_layer, // adjust - my_capslock_layer -); - -void keyboard_post_init_user(void) { - // Enable the LED layers - rgblight_layers = my_rgb_layers; -} - -bool led_update_user(led_t led_state) { - rgblight_set_layer_state(7, led_state.caps_lock); - return true; -} - -layer_state_t default_layer_state_set_user(layer_state_t state) { - rgblight_set_layer_state(0, layer_state_cmp(state, _COLEMAK)); - rgblight_set_layer_state(1, layer_state_cmp(state, _WIDEQWERTY)); - rgblight_set_layer_state(2, layer_state_cmp(state, _WIDECOLEMAK)); - rgblight_set_layer_state(3, layer_state_cmp(state, _HRQWERTY)); - rgblight_set_layer_state(4, layer_state_cmp(state, _HRCOLEMAK)); - return state; -} - diff --git a/keyboards/planck/keymaps/jweickm/keymap_triple_tap.c b/keyboards/planck/keymaps/jweickm/keymap_triple_tap.c deleted file mode 100644 index 94b06e30c510..000000000000 --- a/keyboards/planck/keymaps/jweickm/keymap_triple_tap.c +++ /dev/null @@ -1,731 +0,0 @@ -/* Copyright 2015-2017 Jack Humbert - * Copyright 2021 Jakob Weickmann - * - * 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 . - */ -#include QMK_KEYBOARD_H -#include "muse.h" -#include "quantum.h" - -// for advanced tap dance actions -typedef enum { - TD_NONE, - TD_UNKNOWN, - TD_SINGLE_TAP, - TD_SINGLE_HOLD, - TD_DOUBLE_TAP, - TD_DOUBLE_HOLD, - TD_DOUBLE_SINGLE_TAP, // Send two single taps - TD_TRIPLE_TAP, - TD_TRIPLE_HOLD -} td_state_t; -typedef struct { - bool is_press_action; - td_state_t state; -} td_tap_t; - -enum planck_layers { - _COLEMAK, - _WIDECOLEMAK, - _HRCOLEMAK, - _HRWIDECOLEMAK, - _GAMING, - _LOWER, - _RAISE, - _LOWER2, - _RAISE2, - _ADJUST, - _NAV, - _NAV2, - _NUM, - _MEDIA, - _MOUSE, - _PLOVER -}; - -enum planck_keycodes { - COLEMAK = SAFE_RANGE, - PLOVER, - BACKLIT, - EXT_PLV, - WIDECOLEMAK, - HRCOLEMAK, - HRWIDECOLEMAK, - GAMING, - VIM_O, - VIM_V, - KC_SVD_BD, - KC_SVU_BU, - ALT_TAB -}; - -// Tap Dance declarations -enum tap_dance_codes{ - TD_PRN, // round brackets (parentheses) - TD_BRC, // square brackets - TD_CBR, // curly brackets - TD_ESC_CAPS, // double tap for caps lock - TD_QUO_BRC, // double function on quotes to enable typing ü in german layout - TD_COMM_SLSH, // comma that doubles as a slash - TD_MPLY, // play/pause, double for next, triple for previous song - TD_Q_TAB // double tap q to register tab -}; - -#define LOWER MO(_LOWER) -#define RAISE MO(_RAISE) - -// also for tap dance -td_state_t cur_dance(qk_tap_dance_state_t *state); - -// For the mply tap dance. Put it here so it can be used in any keymap -void mply_finished(qk_tap_dance_state_t *state, void *user_data); -void mply_reset(qk_tap_dance_state_t *state, void *user_data); - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - -[_COLEMAK] = LAYOUT_planck_grid( - LT(_NUM,KC_TAB), KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, - LCTL_T(KC_ESC), KC_A, KC_R, KC_S, KC_T, KC_G, KC_M, KC_N, KC_E, KC_I, KC_O, TD(TD_QUO_BRC), - OSM(MOD_LSFT), KC_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, RSFT_T(KC_ENT), - LCTL_T(KC_CAPS), RALT_T(KC_APP), LGUI_T(KC_TAB), LT(_MOUSE, KC_ESC), LT(_LOWER,KC_BSPC), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE,KC_DEL), LT(_MEDIA, KC_ENT), TG(_NAV), RALT_T(KC_UP), CTL_T(KC_CAPS) -), - -/* WIDECOLEMAK - * ,-----------------------------------------------------------------------------------. - * |_NUM(Tab)| Q | W | E | R | T | Y | U | I | O | P | Bksp | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * |CTL(Esc)| A | S | D | F | G | H | J | K | L | ; | " | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | - * `-----------------------------------------------------------------------------------' - */ -[_WIDECOLEMAK] = LAYOUT_planck_grid( - TD(TD_Q_TAB), KC_W, KC_F, KC_P, KC_B, KC_SVU_BU, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_LBRC, - KC_A, KC_R, KC_S, KC_T, KC_G, TD(TD_MPLY), KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, - KC_Z, KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, KC_MINS, - KC_CAPS, LT(_NUM,KC_TAB), LGUI_T(KC_ESC), LT(_LOWER2, KC_BSPC), OSM(MOD_LSFT), LT(_NAV2,KC_SPC), LT(_NAV2,KC_SPC), LT(_RAISE2, KC_DEL), RCTL_T(KC_ENT), KC_LALT, KC_LEFT, KC_RIGHT -), - -[_HRCOLEMAK] = LAYOUT_planck_grid( - KC_TRNS, LGUI_T(KC_Q), LALT_T(KC_W), LT(_NUM, KC_F), KC_P, KC_B, KC_J, KC_L, LT(_NUM,KC_U), LALT_T(KC_Y), RGUI_T(KC_SCLN), KC_LBRC, - TD(TD_ESC_CAPS), KC_A, KC_R, LSFT_T(KC_S), LCTL_T(KC_T), KC_G, KC_M, RCTL_T(KC_N), RSFT_T(KC_E), KC_I, KC_O, KC_QUOT, - KC_TRNS, KC_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, KC_MINS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS -), - -[_HRWIDECOLEMAK] = LAYOUT_planck_grid( - LGUI_T(KC_Q), LALT_T(KC_W), LT(_NUM,KC_F), KC_P, KC_B, KC_SVU_BU, KC_J, KC_L, LT(_NUM,KC_U), LALT_T(KC_Y), RGUI_T(KC_SCLN), KC_LBRC, - KC_A, KC_R, LSFT_T(KC_S), LCTL_T(KC_T), KC_G, TD(TD_MPLY), KC_M, RCTL_T(KC_N), RSFT_T(KC_E), KC_I, KC_O, KC_QUOT, - KC_Z, KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, KC_MINS, - KC_CAPS, LT(_NUM,KC_TAB), LGUI_T(KC_ESC), LT(_LOWER2, KC_BSPC), OSM(MOD_LSFT), LT(_NAV2,KC_SPC), LT(_NAV2,KC_SPC), LT(_RAISE2, KC_DEL), RCTL_T(KC_ENT), KC_LALT, KC_LEFT, KC_RIGHT -), - -[_GAMING] = LAYOUT_planck_grid( - KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, GAMING, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_QUOT, - KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_Z, KC_M, KC_SCLN, KC_SFTENT, - KC_LCTL, KC_NUBS, KC_B, KC_X, KC_C, KC_SPC, KC_SPC, KC_LALT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS -), - -[_LOWER] = LAYOUT_planck_grid( - KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, TD(TD_PRN), KC_RPRN, KC_DEL, - KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, TD(TD_CBR), KC_RCBR, KC_PIPE, - KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, LSFT(KC_NUHS), LSFT(KC_BSLS), KC_JYEN, KC_EQL, KC_TRNS, - TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_DEL, KC_VOLD, KC_VOLU, KC_MPLY -), - -[_RAISE] = LAYOUT_planck_grid( - 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, TD(TD_BRC), KC_RBRC,KC_BSLS, - KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_COMM, KC_DOT, KC_SLSH, KC_TRNS, - TG(_MOUSE), KC_TRNS, KC_BSPC, KC_DEL, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY -), - -[_LOWER2] = LAYOUT_planck_grid( - KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_TILD, KC_CIRC, KC_AMPR, KC_ASTR, TD(TD_PRN), KC_RPRN, KC_DEL, - KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_DEL, KC_UNDS, KC_PLUS, TD(TD_CBR), KC_RCBR, KC_PIPE, - KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, LSFT(KC_NUHS), LSFT(KC_BSLS), KC_JYEN, KC_EQL, KC_TRNS, - TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_DEL, KC_VOLD, KC_VOLU, KC_MPLY -), - -[_RAISE2] = LAYOUT_planck_grid( - KC_1, KC_2, KC_3, KC_4, KC_5, KC_GRV, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, - KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_DEL, KC_MINS, KC_EQL, TD(TD_BRC), KC_RBRC,KC_BSLS, - KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, KC_NUHS, KC_COMM, KC_DOT, KC_SLSH, KC_TRNS, - TG(_MOUSE), KC_TRNS, KC_BSPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY -), - -[_ADJUST] = LAYOUT_planck_grid( - LALT(KC_LSFT), RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_INS, - LALT(KC_GRV), EEP_RST, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, COLEMAK, HRCOLEMAK, WIDECOLEMAK, HRWIDECOLEMAK, GAMING, - KC_TRNS, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, KC_SVD_BD, KC_MPLY, KC_SVU_BU, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS -), - -[_NAV] = LAYOUT_planck_grid( - LALT(KC_LSFT), KC_NO, LCTL(KC_RGHT), KC_MS_U, LCTL(KC_V), LCTL(KC_LEFT), LCTL(KC_V), KC_RIGHT, KC_PGUP, LCTL(KC_C), KC_NO, KC_NO, - LALT(KC_GRV), KC_HOME, KC_MS_L, KC_MS_D, KC_MS_R, KC_BTN1, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_END, VIM_O, - KC_TRNS, KC_NO, LCTL(KC_X), LCTL(KC_X), KC_BTN2, VIM_V, KC_NO, KC_PGDN, TG(_NAV), KC_NO, LCTL(KC_F), KC_TRNS, - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRNS, KC_TRNS, KC_NO, KC_NO, KC_TRNS, KC_NO, KC_NO -), - -[_NAV2] = LAYOUT_planck_grid( - ALT_TAB, LCTL(KC_RGHT), LALT(KC_LSFT), LALT(KC_GRV), LCTL(KC_LEFT), KC_BRIU, KC_CAPS, KC_RIGHT, KC_PGUP, LCTL(KC_C), KC_NO, KC_BSPC, - OSM(MOD_LGUI), OSM(MOD_LALT), OSM(MOD_LSFT), OSM(MOD_LCTL), KC_TAB, KC_MUTE, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_END, VIM_O, - KC_TRNS, KC_NO, LCTL(KC_X), TD(TD_ESC_CAPS), VIM_V, KC_BRID, KC_HOME, KC_PGDN, KC_NO, KC_NO, LCTL(KC_F), KC_TRNS, - KC_NO, KC_NO, KC_NO, KC_TRNS, KC_TAB, LT(_NAV2,KC_SPC), LT(_NAV2,KC_SPC), KC_NO, KC_NO, KC_TRNS, KC_NO, KC_NO -), - -[_NUM] = LAYOUT_planck_grid( - KC_TAB, KC_F1, LT(_NUM,KC_F2), LT(_NUM,KC_F3), KC_F4, KC_TRNS, KC_NLCK, KC_P7, LT(_NUM,KC_P8), KC_P9, KC_PMNS, KC_TRNS, - KC_TRNS, KC_F5, KC_F6, KC_F7, KC_F8, KC_TRNS, KC_PAST, KC_P4, KC_P5, KC_P6, KC_PPLS, KC_TRNS, - KC_TRNS, KC_F9,KC_F10,KC_F11,KC_F12, KC_TRNS, KC_TRNS, KC_P1, KC_P2, KC_P3, KC_PSLS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P0, KC_DOT, KC_COMM, KC_EQL, KC_TRNS -), - -[_MEDIA] = LAYOUT_planck_grid( - LALT(KC_LSFT), KC_NO, KC_NO, KC_NO, KC_NO, KC_BRID, KC_BRIU, KC_MUTE, KC_MPLY, KC_NO, KC_NO, KC_NO, - LALT(KC_GRV), KC_NO, KC_NO, KC_BRID, KC_BRIU, KC_NO, KC_MPRV, KC_VOLD, KC_VOLU, KC_MNXT, KC_NO, 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 -), - -[_MOUSE] = LAYOUT_planck_grid( - KC_NO, KC_NO, KC_BTN4, KC_BTN5, KC_NO, KC_NO, KC_NO, KC_WH_U, KC_MS_U, KC_WH_U, KC_NO, KC_NO, - KC_NO, KC_NO, KC_BTN3, KC_BTN2, KC_BTN1, 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_WH_D, KC_NO, KC_NO, KC_NO, KC_NO, - TG(_MOUSE), KC_NO, KC_NO, KC_TRNS, KC_NO, KC_ACL2, KC_ACL2, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO -) - -}; - - -// define the tap dance functions -void dance_prn(qk_tap_dance_state_t *state, void *user_data) { - if (state->count == 1) { - tap_code16(KC_LPRN); - } else { - tap_code16(KC_LPRN); - tap_code16(KC_RPRN); - tap_code(KC_LEFT); - } -} -void dance_brc(qk_tap_dance_state_t *state, void *user_data) { - if (state->count == 1) { - tap_code(KC_LBRC); - } else { - tap_code(KC_LBRC); - tap_code(KC_RBRC); - tap_code(KC_LEFT); - } -} -void dance_cbr(qk_tap_dance_state_t *state, void *user_data) { - if (state->count == 1) { - tap_code16(KC_LCBR); - } else { - tap_code16(KC_LCBR); - tap_code16(KC_RCBR); - tap_code(KC_LEFT); - } -} - -qk_tap_dance_action_t tap_dance_actions[] = { - // declare tap dance actions here - [TD_PRN] = ACTION_TAP_DANCE_FN(dance_prn), - [TD_BRC] = ACTION_TAP_DANCE_FN(dance_brc), - [TD_CBR] = ACTION_TAP_DANCE_FN(dance_cbr), - [TD_MPLY] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, mply_finished, mply_reset), - [TD_ESC_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_ESC, KC_CAPS), - [TD_QUO_BRC] = ACTION_TAP_DANCE_DOUBLE(KC_QUOT, KC_LBRC), - [TD_COMM_SLSH] = ACTION_TAP_DANCE_DOUBLE(KC_COMMA, KC_SLSH), - [TD_Q_TAB] = ACTION_TAP_DANCE_DOUBLE(KC_Q, KC_TAB) -}; - -// TD(TD_ESC_CAPS), LGUI_T(KC_A), LALT_T(KC_R), LSFT_T(KC_S), LCTL_T(KC_T), KC_G, KC_M, RCTL_T(KC_N), RSFT_T(KC_E), LALT_T(KC_I), RGUI_T(KC_O), KC_TRNS, -// define the per_key_tapping_term -uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case TD(TD_ESC_CAPS): - return TAPPING_TERM * 1.5; - case LGUI_T(KC_A): - return TAPPING_TERM * 1.4; - case LGUI_T(KC_Q): - return TAPPING_TERM * 1.3; - case RGUI_T(KC_O): - return TAPPING_TERM * 1.45; - case RGUI_T(KC_SCLN): - return TAPPING_TERM * 1.3; - case LALT_T(KC_R): - return TAPPING_TERM * 1.3; - case LALT_T(KC_W): - return TAPPING_TERM * 1.3; - case LALT_T(KC_I): - return TAPPING_TERM * 1.35; - case LALT_T(KC_Y): - return TAPPING_TERM * 1.3; - case LCTL_T(KC_T): - return TAPPING_TERM * 1.1; - case LCTL_T(KC_N): - return TAPPING_TERM * 1.1; - case LSFT_T(KC_S): - return TAPPING_TERM * 1.0; - case RSFT_T(KC_E): - return TAPPING_TERM * 1.0; - case LT(_NUM, KC_F): - return TAPPING_TERM * 1.2; - case LT(_NUM, KC_U): - return TAPPING_TERM * 1.2; - case LT(_NUM, KC_F3): - return TAPPING_TERM * 1.2; - case LT(_NUM, KC_F2): - return TAPPING_TERM * 1.2; - case LT(_NUM, KC_P8): - return TAPPING_TERM * 1.2; - case TD(TD_QUO_BRC): - return TAPPING_TERM * 1.2; - case TD(TD_Q_TAB): - return TAPPING_TERM * 1.2; - default: - return TAPPING_TERM; - } -} - -#ifdef AUDIO_ENABLE - float plover_song[][2] = SONG(PLOVER_SOUND); - float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND); -#endif - -// alt tab function setup -bool is_alt_tab_active = false; -uint16_t alt_tab_timer = 0; - -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case COLEMAK: - if (record->event.pressed) { - set_single_persistent_default_layer(_COLEMAK); - } - return false; - break; - case WIDECOLEMAK: - if (record->event.pressed) { - set_single_persistent_default_layer(_WIDECOLEMAK); - } - return false; - break; - case HRCOLEMAK: - if (record->event.pressed) { - set_single_persistent_default_layer(_HRCOLEMAK); - } - return false; - break; - case HRWIDECOLEMAK: - if (record->event.pressed) { - set_single_persistent_default_layer(_HRWIDECOLEMAK); - } - return false; - break; - case GAMING: - if (record->event.pressed) { - layer_invert(_GAMING); - } - return false; - break; - case VIM_O: - if (record->event.pressed) { - tap_code(KC_END); - tap_code(KC_ENT); - } - return false; - break; - case VIM_V: - if (record->event.pressed) { - if (get_mods() & MOD_BIT(KC_LSFT)) { - unregister_code(KC_LSFT); - } else { - register_code(KC_LSFT); - } - } - return false; - break; - case KC_SVU_BU: // increase backlight when pressing shift and vol up - if (record->event.pressed) { - if (get_mods() & MOD_BIT(KC_LSFT) || get_mods() & MOD_BIT(KC_RSFT)) { - register_code(KC_BRIU); - } else { - register_code(KC_VOLU); - } - } else { - unregister_code(KC_BRIU); - unregister_code(KC_VOLU); - } - return false; - case KC_SVD_BD: // increase backlight when pressing shift and vol up - if (record->event.pressed) { - if (get_mods() & MOD_BIT(KC_LSFT) || get_mods() & MOD_BIT(KC_RSFT)) { - register_code(KC_BRID); - } else { - register_code(KC_VOLD); - } - } else { - unregister_code(KC_BRID); - unregister_code(KC_VOLD); - } - return false; - case ALT_TAB: - if (record->event.pressed) { - if (!is_alt_tab_active) { - is_alt_tab_active = true; - register_code(KC_LALT); - } - alt_tab_timer = timer_read(); - register_code(KC_TAB); - } else { - unregister_code(KC_TAB); - } - break; - case BACKLIT: - if (record->event.pressed) { - register_code(KC_RSFT); - #ifdef BACKLIGHT_ENABLE - backlight_step(); - #endif - #ifdef KEYBOARD_planck_rev5 - writePinLow(E6); - #endif - } else { - unregister_code(KC_RSFT); - #ifdef KEYBOARD_planck_rev5 - writePinHigh(E6); - #endif - } - 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(); - keymap_config.nkro = 1; - eeconfig_update_keymap(keymap_config.raw); - } - return false; - break; - case EXT_PLV: - if (record->event.pressed) { - #ifdef AUDIO_ENABLE - PLAY_SONG(plover_gb_song); - #endif - layer_off(_PLOVER); - } - return false; - break; - } - return true; -} - -bool muse_mode = false; -uint8_t last_muse_note = 0; -uint16_t muse_counter = 0; -uint8_t muse_offset = 70; -uint16_t muse_tempo = 50; - -bool encoder_update(bool clockwise) { - 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 (clockwise) { - #ifdef MOUSEKEY_ENABLE - tap_code(KC_MS_WH_DOWN); - #else - tap_code(KC_PGDN); - #endif - } else { - #ifdef MOUSEKEY_ENABLE - tap_code(KC_MS_WH_UP); - #else - tap_code(KC_PGUP); - #endif - } - } - return true; -} - -void dip_switch_update_user(uint8_t index, bool active) { - switch (index) { - case 0: { -#ifdef AUDIO_ENABLE - static bool play_sound = false; -#endif - if (active) { -#ifdef AUDIO_ENABLE - if (play_sound) { PLAY_SONG(plover_song); } -#endif - layer_on(_ADJUST); - } else { -#ifdef AUDIO_ENABLE - if (play_sound) { PLAY_SONG(plover_gb_song); } -#endif - layer_off(_ADJUST); - } -#ifdef AUDIO_ENABLE - play_sound = true; -#endif - break; - } - case 1: - if (active) { - muse_mode = true; - } else { - muse_mode = false; - } - } -} - -void matrix_scan_user(void) { - if (is_alt_tab_active) { - if (timer_elapsed(alt_tab_timer) > 600) { - unregister_code(KC_LALT); - is_alt_tab_active = false; - } - } - #ifdef AUDIO_ENABLE - if (muse_mode) { - if (muse_counter == 0) { - uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()]; - if (muse_note != last_muse_note) { - stop_note(compute_freq_for_midi_note(last_muse_note)); - play_note(compute_freq_for_midi_note(muse_note), 0xF); - last_muse_note = muse_note; - } - } - muse_counter = (muse_counter + 1) % muse_tempo; - } else { - if (muse_counter) { - stop_all_notes(); - muse_counter = 0; - } - } -#endif -} - -bool music_mask_user(uint16_t keycode) { - switch (keycode) { - case RAISE: - case LOWER: - return false; - default: - return true; - } -} - -bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case LSFT_T(KC_S): - return true; - case RSFT_T(KC_E): - return true; - case LSFT_T(KC_D): - return true; - case RSFT_T(KC_K): - return true; - default: - return false; - } -} - -// Set RGB to change with layer changes -#define HSV_DARKORANGE 10, 255, 255 -#define HSV_DARKPINK 150, 100, 255 - -// Light LEDs 1 to 9 in goldenrod when COLEMAK is active -const rgblight_segment_t PROGMEM my_layer0_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {1, 10, HSV_GOLDENROD} -); -// Light LEDs 1 to 9 in white when WIDECOLEMAK is active -const rgblight_segment_t PROGMEM my_layer1_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {1, 10, HSV_WHITE} -); -// Light LEDs 1 to 9 in darkorange when HRCOLEMAK is active -const rgblight_segment_t PROGMEM my_layer2_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {1, 10, HSV_DARKORANGE} -); -// Light LEDs 1 to 9 in green when HRWIDECOLEMAK is active -const rgblight_segment_t PROGMEM my_layer3_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {1, 10, HSV_GREEN} -); -// Light LEDs 1 to 9 in green when HRWIDECOLEMAK is active -const rgblight_segment_t PROGMEM my_nav_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {1, 10, HSV_GREEN} -); -// Light LEDs 1 to 9 in red when GAMING layer is active -const rgblight_segment_t PROGMEM my_layer4_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {1, 10, HSV_RED} -); -// Light bottom LEDs in purple when ADJUST layer is active -const rgblight_segment_t PROGMEM my_layer5_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {1, 2, HSV_PURPLE}, - {7, 2, HSV_PURPLE} -); -// Light bottom LEDs in red when caps lock is active. Hard to ignore! -const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {1, 2, HSV_DARKPINK}, - {7, 2, HSV_DARKPINK} -); - -// Now define the array of layers. Later layers take precedence -const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST( - my_layer0_layer, // colemak - my_layer1_layer, // widecolemak - my_layer2_layer, // hrcolemak - my_layer3_layer, // hrwidecolemak - my_layer4_layer, // gaming - my_layer5_layer, // adjust - my_capslock_layer, // capslock - my_nav_layer // nav -); - -void keyboard_post_init_user(void) { - // Enable the LED layers - rgblight_layers = my_rgb_layers; -} - -bool led_update_user(led_t led_state) { - rgblight_set_layer_state(6, led_state.caps_lock); - return true; -} - -layer_state_t layer_state_set_user(layer_state_t state) { - if ( - ( layer_state_cmp(state, _LOWER) && layer_state_cmp(state, _RAISE ) ) || - ( layer_state_cmp(state, _LOWER2) && layer_state_cmp(state, _RAISE2 ) ) ) { - return state | (1UL<<_ADJUST); - } else { - return state & ~(1UL<<_ADJUST); - } - //state = update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); - rgblight_set_layer_state(5, layer_state_cmp(state, _ADJUST)); - rgblight_set_layer_state(4, layer_state_cmp(state, _GAMING)); - rgblight_set_layer_state(7, layer_state_cmp(state, _NAV)); - return state; -} - -layer_state_t default_layer_state_set_user(layer_state_t state) { - rgblight_set_layer_state(0, layer_state_cmp(state, _COLEMAK)); - rgblight_set_layer_state(1, layer_state_cmp(state, _WIDECOLEMAK)); - rgblight_set_layer_state(2, layer_state_cmp(state, _HRCOLEMAK)); - rgblight_set_layer_state(3, layer_state_cmp(state, _HRWIDECOLEMAK)); - return state; -} - -/* Return an integer that corresponds to what kind of tap dance should be executed. - * - * How to figure out tap dance state: interrupted and pressed. - * - * Interrupted: If the state of a dance dance is "interrupted", that means that another key has been hit - * under the tapping term. This is typically indicitive that you are trying to "tap" the key. - * - * Pressed: Whether or not the key is still being pressed. If this value is true, that means the tapping term - * has ended, but the key is still being pressed down. This generally means the key is being "held". - * - * One thing that is currenlty not possible with qmk software in regards to tap dance is to mimic the "permissive hold" - * feature. In general, advanced tap dances do not work well if they are used with commonly typed letters. - * For example "A". Tap dances are best used on non-letter keys that are not hit while typing letters. - * - * Good places to put an advanced tap dance: - * z,q,x,j,k,v,b, any function key, home/end, comma, semi-colon - * - * Criteria for "good placement" of a tap dance key: - * Not a key that is hit frequently in a sentence - * Not a key that is used frequently to double tap, for example 'tab' is often double tapped in a terminal, or - * in a web form. So 'tab' would be a poor choice for a tap dance. - * Letters used in common words as a double. For example 'p' in 'pepper'. If a tap dance function existed on the - * letter 'p', the word 'pepper' would be quite frustating to type. - * - * For the third point, there does exist the 'TD_DOUBLE_SINGLE_TAP', however this is not fully tested - * - */ -td_state_t cur_dance(qk_tap_dance_state_t *state) { - if (state->count == 1) { - if (state->interrupted || !state->pressed) return TD_SINGLE_TAP; - // Key has not been interrupted, but the key is still held. Means you want to send a 'HOLD'. - else return TD_SINGLE_HOLD; - } else if (state->count == 2) { - // TD_DOUBLE_SINGLE_TAP is to distinguish between typing "pepper", and actually wanting a double tap - // action when hitting 'pp'. Suggested use case for this return value is when you want to send two - // keystrokes of the key, and not the 'double tap' action/macro. - if (state->interrupted) return TD_DOUBLE_SINGLE_TAP; - else if (state->pressed) return TD_DOUBLE_HOLD; - else return TD_DOUBLE_TAP; - } - - // Assumes no one is trying to type the same letter three times (at least not quickly). - // If your tap dance key is 'KC_W', and you want to type "www." quickly - then you will need to add - // an exception here to return a 'TD_TRIPLE_SINGLE_TAP', and define that enum just like 'TD_DOUBLE_SINGLE_TAP' - if (state->count == 3) { - if (state->interrupted || !state->pressed) return TD_TRIPLE_TAP; - else return TD_TRIPLE_HOLD; - } else return TD_UNKNOWN; -} - -// Create an instance of 'td_tap_t' for the 'mply' tap dance. -static td_tap_t mplytap_state = { - .is_press_action = true, - .state = TD_NONE -}; - -void mply_finished(qk_tap_dance_state_t *state, void *user_data) { - mplytap_state.state = cur_dance(state); - switch (mplytap_state.state) { - case TD_SINGLE_TAP: register_code16(KC_MPLY); break; - case TD_SINGLE_HOLD: register_code16(KC_MUTE); break; - case TD_DOUBLE_TAP: register_code16(KC_MNXT); break; - case TD_TRIPLE_TAP: register_code16(KC_MPRV); break; - default: break; - } -} - -void mply_reset(qk_tap_dance_state_t *state, void *user_data) { - switch (mplytap_state.state) { - case TD_SINGLE_TAP: unregister_code16(KC_MPLY); break; - case TD_SINGLE_HOLD: unregister_code16(KC_MUTE); break; - case TD_DOUBLE_TAP: unregister_code16(KC_MNXT); break; - case TD_TRIPLE_TAP: unregister_code16(KC_MPRV); break; - default: break; - } - mplytap_state.state = TD_NONE; -} diff --git a/keyboards/planck/keymaps/jweickm/keymap_unicode.c b/keyboards/planck/keymaps/jweickm/keymap_unicode.c deleted file mode 100644 index 3c95cf4fb397..000000000000 --- a/keyboards/planck/keymaps/jweickm/keymap_unicode.c +++ /dev/null @@ -1,425 +0,0 @@ -/* Copyright 2015-2017 Jack Humbert - * Copyright 2021 Jakob Weickmann - * - * 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 . - */ -#include QMK_KEYBOARD_H -#include "muse.h" - -enum planck_layers { - _QWERTY, - _COLEMAK, - _DVORAK, - _WIDEQWERTY, - _WIDECOLEMAK, - _HRQWERTY, - _HRCOLEMAK, - _GAMING, - _LOWER, - _RAISE, - _ADJUST, - _NAV, - _NAV2, - _NUM, - _MEDIA, - _MOUSE, - _PLOVER -}; - -enum planck_keycodes { - QWERTY = SAFE_RANGE, - COLEMAK, - DVORAK, - PLOVER, - BACKLIT, - EXT_PLV, - WIDECOLEMAK, - WIDEQWERTY -}; - -enum unicode_names { - KC_DE_EUR, - KC_DE_AE, - KC_DE_ae, - KC_DE_OE, - KC_DE_oe, - KC_DE_UE, - KC_DE_ue, - KC_DE_SZ -}; - -const uint32_t PROGMEM unicode_map[] = { - [KC_DE_EUR] = 0x20AC, // € - [KC_DE_AE] = 0x00C4, // Ä - [KC_DE_ae] = 0x00E4, // ä - [KC_DE_OE] = 0x00D6, // Ö - [KC_DE_oe] = 0x00F6, // ö - [KC_DE_UE] = 0x00DC, // Ü - [KC_DE_ue] = 0x00FC, // ü - [KC_DE_SZ] = 0x00DF, // ß -}; - -#define LOWER MO(_LOWER) -#define RAISE MO(_RAISE) - - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - -/* Qwerty - * ,-----------------------------------------------------------------------------------. - * |_NUM(Tab)| Q | W | E | R | T | Y | U | I | O | P | Bksp | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * |CTL(Esc)| A | S | D | F | G | H | J | K | L | ; | " | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | - * `-----------------------------------------------------------------------------------' - */ -[_QWERTY] = LAYOUT_planck_grid( - LT(_NUM,KC_TAB), KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, - LCTL_T(KC_ESC), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, RSFT_T(KC_QUOT), - OSM(MOD_LSFT), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_SFTENT, - LCTL_T(KC_CAPS), RALT_T(KC_APP), KC_LGUI, KC_LALT, LT(_LOWER,KC_BSPC), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE,KC_DEL), RCTL_T(KC_LEFT), LT(_MEDIA,KC_DOWN), RALT_T(KC_UP), RCTL_T(KC_RGHT) -), - - -[_COLEMAK] = LAYOUT_planck_grid( - KC_TRNS, KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_TRNS, - KC_TRNS, KC_A, KC_R, KC_S, KC_T, KC_G, KC_M, KC_N, KC_E, KC_I, KC_O, KC_TRNS, - KC_TRNS, KC_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS -), - -[_WIDEQWERTY] = LAYOUT_planck_grid( - KC_Q, KC_W, KC_E, KC_R, KC_T, KC_LBRC, KC_RBRC, KC_Y, KC_U, KC_I, KC_O, KC_P, - LGUI_T(KC_A), LALT_T(KC_S), LCTL_T(KC_D), LSFT_T(KC_F), KC_G, KC_GRV, KC_QUOT, KC_H, RSFT_T(KC_J), RCTL_T(KC_K), RALT_T(KC_L), RGUI_T(KC_SCLN), - KC_Z, KC_X, KC_C, KC_V, KC_B, KC_LPRN, KC_RPRN, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, - KC_TRNS, KC_TRNS, LCTL_T(KC_ESC), OSM(MOD_LSFT), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, LSFT_T(KC_SPC), LCTL_T(KC_TAB), KC_TRNS, KC_TRNS -), - -[_WIDECOLEMAK] = LAYOUT_planck_grid( - KC_Q, KC_W, KC_F, KC_P, KC_B, KC_LBRC, KC_RBRC, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, - LGUI_T(KC_A), LALT_T(KC_R), LSFT_T(KC_S), LCTL_T(KC_T), KC_G, KC_GRV, KC_QUOT, KC_M, RCTL_T(KC_N), RSFT_T(KC_E), RALT_T(KC_I), RGUI_T(KC_O), - KC_Z, KC_X, KC_C, KC_D, KC_V, KC_LPRN, KC_RPRN, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, - KC_TRNS, KC_TRNS, LCTL_T(KC_ESC), OSM(MOD_LSFT), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, LSFT_T(KC_SPC), LCTL_T(KC_TAB), KC_TRNS, KC_TRNS -), - -[_HRQWERTY] = LAYOUT_planck_grid( - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, LGUI_T(KC_A), LALT_T(KC_S), LSFT_T(KC_D), LCTL_T(KC_F), KC_TRNS, KC_TRNS, RCTL_T(KC_J), RSFT_T(KC_K), LALT_T(KC_L), RGUI_T(KC_SCLN), KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS -), - -[_HRCOLEMAK] = LAYOUT_planck_grid( - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, LGUI_T(KC_A), LALT_T(KC_R), LSFT_T(KC_S), LCTL_T(KC_T), KC_TRNS, KC_TRNS, RCTL_T(KC_N), RSFT_T(KC_E), LALT_T(KC_I), RGUI_T(KC_O), KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS -), - -[_GAMING] = LAYOUT_planck_grid( - KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, TG(_GAMING), - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_TRNS, - KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_Z, KC_M, KC_SCLN, KC_QUOT, - KC_LCTL, KC_NUBS, KC_B, KC_X, KC_C, KC_SPC, KC_SPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS -), - -[_LOWER] = LAYOUT_planck_grid( - 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_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_NUHS), LSFT(KC_BSLS), KC_JYEN, KC_EQL, KC_TRNS, - TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY -), - -[_RAISE] = LAYOUT_planck_grid( - 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_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_COMM, KC_DOT, KC_SLSH, KC_TRNS, - TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY -), - -[_ADJUST] = LAYOUT_planck_grid( - LALT(KC_LSFT), RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_INS, - LALT(KC_GRV), EEP_RST, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, WIDEQWERTY, WIDECOLEMAK, TG(_GAMING), - KC_TRNS, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, TG(_HRQWERTY), TG(_HRCOLEMAK), TERM_ON, TERM_OFF, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS -), - -[_NAV] = LAYOUT_planck_grid( - LALT(KC_LSFT), KC_NO, LCTL(KC_RGHT), LCTL(KC_RGHT), LCTL(KC_Y), KC_NO, LCTL(KC_C), LCTL(KC_Z), KC_PGUP, XP(KC_DE_ue,KC_DE_UE), LCTL(KC_V), XP(KC_DE_ue,KC_DE_UE), - LALT(KC_GRV), XP(KC_DE_ae,KC_DE_AE), X(KC_DE_SZ), X(KC_DE_SZ), KC_NO, KC_NO, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, XP(KC_DE_oe, KC_DE_OE), XP(KC_DE_ae, KC_DE_AE), - MO(_NAV2), KC_NO, KC_DEL, LCTL(KC_X), KC_NO, LCTL(KC_LEFT), KC_NO, KC_PGDN, KC_NO, KC_NO, LCTL(KC_F), 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 -), - -[_NAV2] = LAYOUT_planck_grid( - 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_HOME, KC_PGDN, KC_PGUP, KC_END, KC_NO, KC_NO, - 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 -), - -[_NUM] = LAYOUT_planck_grid( - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NLCK, KC_P7, KC_P8, KC_P9, KC_PMNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PAST, KC_P4, KC_P5, KC_P6, KC_PPLS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P1, KC_P2, KC_P3, KC_PSLS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P0, KC_PDOT, KC_PCMM, KC_PEQL, KC_TRNS -), - -[_MEDIA] = LAYOUT_planck_grid( - LALT(KC_LSFT), KC_NO, KC_NO, KC_NO, KC_NO, KC_BRID, KC_BRIU, KC_MUTE, KC_MPLY, KC_NO, KC_NO, KC_NO, - LALT(KC_GRV), KC_NO, KC_NO, KC_BRID, KC_BRIU, KC_NO, KC_MPRV, KC_VOLD, KC_VOLU, KC_MNXT, KC_NO, 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 -), - -[_MOUSE] = LAYOUT_planck_grid( - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_WH_U, KC_NO, KC_NO, KC_NO, - KC_NO, KC_NO, KC_BTN3, KC_BTN2, KC_BTN1, KC_NO, KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R, KC_NO, KC_NO, - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_WH_D, KC_NO, KC_NO, KC_NO, - KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_ACL2, KC_ACL2, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO -) -}; - -#ifdef AUDIO_ENABLE - float plover_song[][2] = SONG(PLOVER_SOUND); - float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND); -#endif - -layer_state_t layer_state_set_user(layer_state_t state) { - return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); -} - -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case QWERTY: - if (record->event.pressed) { - set_single_persistent_default_layer(_QWERTY); - } - return false; - break; - case COLEMAK: - if (record->event.pressed) { - set_single_persistent_default_layer(_COLEMAK); - } - return false; - break; - case WIDEQWERTY: - if (record->event.pressed) { - set_single_persistent_default_layer(_WIDEQWERTY); - } - return false; - break; - case WIDECOLEMAK: - if (record->event.pressed) { - set_single_persistent_default_layer(_WIDECOLEMAK); - } - return false; - break; - case DVORAK: - if (record->event.pressed) { - set_single_persistent_default_layer(_DVORAK); - } - return false; - break; - case BACKLIT: - if (record->event.pressed) { - register_code(KC_RSFT); - #ifdef BACKLIGHT_ENABLE - backlight_step(); - #endif - #ifdef KEYBOARD_planck_rev5 - writePinLow(E6); - #endif - } else { - unregister_code(KC_RSFT); - #ifdef KEYBOARD_planck_rev5 - writePinHigh(E6); - #endif - } - 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(); - keymap_config.nkro = 1; - eeconfig_update_keymap(keymap_config.raw); - } - return false; - break; - case EXT_PLV: - if (record->event.pressed) { - #ifdef AUDIO_ENABLE - PLAY_SONG(plover_gb_song); - #endif - layer_off(_PLOVER); - } - return false; - break; - } - return true; -} - -bool muse_mode = false; -uint8_t last_muse_note = 0; -uint16_t muse_counter = 0; -uint8_t muse_offset = 70; -uint16_t muse_tempo = 50; - -bool encoder_update(bool clockwise) { - 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 (clockwise) { - #ifdef MOUSEKEY_ENABLE - tap_code(KC_MS_WH_DOWN); - #else - tap_code(KC_PGDN); - #endif - } else { - #ifdef MOUSEKEY_ENABLE - tap_code(KC_MS_WH_UP); - #else - tap_code(KC_PGUP); - #endif - } - } - return true; -} - -void dip_switch_update_user(uint8_t index, bool active) { - switch (index) { - case 0: { -#ifdef AUDIO_ENABLE - static bool play_sound = false; -#endif - if (active) { -#ifdef AUDIO_ENABLE - if (play_sound) { PLAY_SONG(plover_song); } -#endif - layer_on(_ADJUST); - } else { -#ifdef AUDIO_ENABLE - if (play_sound) { PLAY_SONG(plover_gb_song); } -#endif - layer_off(_ADJUST); - } -#ifdef AUDIO_ENABLE - play_sound = true; -#endif - break; - } - case 1: - if (active) { - muse_mode = true; - } else { - muse_mode = false; - } - } -} - -void matrix_scan_user(void) { -#ifdef AUDIO_ENABLE - if (muse_mode) { - if (muse_counter == 0) { - uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()]; - if (muse_note != last_muse_note) { - stop_note(compute_freq_for_midi_note(last_muse_note)); - play_note(compute_freq_for_midi_note(muse_note), 0xF); - last_muse_note = muse_note; - } - } - muse_counter = (muse_counter + 1) % muse_tempo; - } else { - if (muse_counter) { - stop_all_notes(); - muse_counter = 0; - } - } -#endif -} - -bool music_mask_user(uint16_t keycode) { - switch (keycode) { - case RAISE: - case LOWER: - return false; - default: - return true; - } -} - -bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case LT(_HRQWERTY, LGUI_T(KC_A)): - return true; - case LT(_HRQWERTY, LALT_T(KC_S)): - return true; - case LT(_HRQWERTY, LSFT_T(KC_D)): - return true; - case LT(_HRQWERTY, LCTL_T(KC_F)): - return true; - case LT(_HRQWERTY, RCTL_T(KC_J)): - return true; - case LT(_HRQWERTY, RSFT_T(KC_K)): - return true; - case LT(_HRQWERTY, LALT_T(KC_L)): - return true; - case LT(_HRQWERTY, RGUI_T(KC_SCOLON)): - return true; - case LT(_HRCOLEMAK, LGUI_T(KC_A)): - return true; - case LT(_HRCOLEMAK, LALT_T(KC_R)): - return true; - case LT(_HRCOLEMAK, LSFT_T(KC_S)): - return true; - case LT(_HRCOLEMAK, LCTL_T(KC_T)): - return true; - case LT(_HRCOLEMAK, RCTL_T(KC_N)): - return true; - case LT(_HRCOLEMAK, RSFT_T(KC_E)): - return true; - case LT(_HRCOLEMAK, LALT_T(KC_I)): - return true; - case LT(_HRCOLEMAK, RGUI_T(KC_O)): - return true; - default: - return false; - } -} diff --git a/keyboards/planck/keymaps/jweickm/readme.md b/keyboards/planck/keymaps/jweickm/readme.md index de9680b49851..98f78c2f3185 100644 --- a/keyboards/planck/keymaps/jweickm/readme.md +++ b/keyboards/planck/keymaps/jweickm/readme.md @@ -1,2 +1,8 @@ -# The Default Planck Layout +# Semi-wide German/English MIT Planck Layout +Added keymap for my planck MIT. +It has a German and an English switching mode, so that it works the exact same with both OS languages. +It is a semi-wide layout, with the left hand all the way to the edge, and with one extra column in the middle used for media controls. +Home row mods implemented in the top row with individual tapping_terms for different fingers. +Mouse layer accessible through the pinkies. +Navigation layer on space. diff --git a/keyboards/planck/keymaps/jweickm/rules_kopie.mk b/keyboards/planck/keymaps/jweickm/rules_kopie.mk deleted file mode 100644 index acf0896a321b..000000000000 --- a/keyboards/planck/keymaps/jweickm/rules_kopie.mk +++ /dev/null @@ -1 +0,0 @@ -SRC += muse.c \ No newline at end of file From 64adc11be447df1d9b62386b6beb6bbf69996b9f Mon Sep 17 00:00:00 2001 From: Jakob Weickmann Date: Fri, 17 Sep 2021 19:34:54 +0200 Subject: [PATCH 15/31] Update keymap.c adjusted layout with clang-format to fit with community guidelines --- keyboards/planck/keymaps/jweickm/keymap.c | 1330 ++++++++++----------- 1 file changed, 625 insertions(+), 705 deletions(-) diff --git a/keyboards/planck/keymaps/jweickm/keymap.c b/keyboards/planck/keymaps/jweickm/keymap.c index e18a03da0ea5..b9b47d3fa4ae 100644 --- a/keyboards/planck/keymaps/jweickm/keymap.c +++ b/keyboards/planck/keymaps/jweickm/keymap.c @@ -18,171 +18,76 @@ #include "muse.h" #include "quantum.h" - enum planck_layers { - _HRWIDECOLEMAK, - _HRWIDECOLEMAK_DE, - _GAMING, - _WIDECOLEMAK, - _LOWER, - _RAISE, - _LOWER_DE, - _RAISE_DE, - _ADJUST, - _NAV, - _VIM, - _NUM, - _MOUSE, + _HRWIDECOLEMAK, + _HRWIDECOLEMAK_DE, + _GAMING, + _WIDECOLEMAK, + _LOWER, + _RAISE, + _LOWER_DE, + _RAISE_DE, + _ADJUST, + _NAV, + _VIM, + _NUM, + _MOUSE, }; -enum planck_keycodes { - HRWIDECOLEMAK = SAFE_RANGE, - GAMING, - WIDECOLEMAK, - TG_COLEMAK, - VIM_O, - VIM_V, - KC_SVD_BD, - KC_SVU_BU, - KC_TAB_MPLY, - ALT_TAB, - CTL_TAB, - DE_ae, - DE_oe, - DE_ue, - DE_AE, - DE_OE, - DE_SZ, - DE_EGRAVE, - DE_EAIGU, - KC_CURRENCY, - KC_DE_SWITCH, - LANG_SWITCH, - DE_SLSH_QUST, - DE_QUOT, - DE_SCLN, - DE_BSLS, - M_ESCM, - M_RGUI_SCLN -}; +enum planck_keycodes { HRWIDECOLEMAK = SAFE_RANGE, GAMING, WIDECOLEMAK, TG_COLEMAK, VIM_O, VIM_V, KC_SVD_BD, KC_SVU_BU, KC_TAB_MPLY, ALT_TAB, CTL_TAB, DE_ae, DE_oe, DE_ue, DE_AE, DE_OE, DE_SZ, DE_EGRAVE, DE_EAIGU, KC_CURRENCY, KC_DE_SWITCH, LANG_SWITCH, DE_SLSH_QUST, DE_QUOT, DE_SCLN, DE_BSLS, M_ESCM, M_RGUI_SCLN }; // Tap Dance declarations -enum tap_dance_codes{ - TD_PRN, // round brackets (parentheses) - TD_PRN_DE, // round brackets (parentheses) - TD_BRC, // square brackets - TD_BRC_DE, // square brackets - TD_CBR, // curly brackets - TD_CBR_DE, // curly brackets - TD_VIM_GG // single tap to scroll down, double tap to scroll up +enum tap_dance_codes { + TD_PRN, // round brackets (parentheses) + TD_PRN_DE, // round brackets (parentheses) + TD_BRC, // square brackets + TD_BRC_DE, // square brackets + TD_CBR, // curly brackets + TD_CBR_DE, // curly brackets + TD_VIM_GG // single tap to scroll down, double tap to scroll up }; #define LOWER MO(_LOWER) #define RAISE MO(_RAISE) const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - -[_HRWIDECOLEMAK] = LAYOUT_planck_grid( - LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM,KC_B), KC_SVU_BU, LT(_NUM,KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Y), RGUI_T(KC_SCLN), DE_ue, - KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, - LT(_MOUSE,KC_Z), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, LT(_MOUSE,KC_SLSH), KC_BSLS, - LCTL_T(KC_CAPS), LGUI_T(KC_TAB), M_ESCM, LT(_LOWER,KC_BSPC), OSM(MOD_LSFT), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE, KC_ENT), RSFT_T(KC_DEL), RCTL_T(KC_TAB), LT(_NAV,KC_LEFT), LT(_NAV,KC_RIGHT) -), - -[_HRWIDECOLEMAK_DE] = LAYOUT_planck_grid( - LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM,KC_B), KC_SVU_BU, LT(_NUM,KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Z), M_RGUI_SCLN, KC_LBRC, - KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB, KC_M, KC_N, KC_E, KC_I, KC_O, DE_QUOT, - LT(_MOUSE,KC_Y), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, DE_SLSH_QUST, DE_BSLS, - LCTL_T(KC_CAPS), LGUI_T(KC_TAB), M_ESCM, LT(_LOWER_DE,KC_BSPC), OSM(MOD_LSFT), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE_DE, KC_ENT), RSFT_T(KC_DEL), RCTL_T(KC_TAB), LT(_NAV,KC_LEFT), LT(_NAV,KC_RIGHT) -), - -[_GAMING] = LAYOUT_planck_grid( - KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_F5, KC_F8, KC_F9, KC_VOLU, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_VOLD, - KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_Z, KC_M, KC_SCLN, TG_COLEMAK, - KC_LCTL, KC_C, KC_B, KC_X, KC_LALT, KC_SPC, KC_SPC, KC_ENT, KC_RALT, KC_TRNS, KC_TRNS, GAMING -), - -/* WIDECOLEMAK - * ,-----------------------------------------------------------------------------------. - * |_NUM(Tab)| Q | W | E | R | T | Y | U | I | O | P | Bksp | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * |CTL(Esc)| A | S | D | F | G | H | J | K | L | ; | " | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | - * `-----------------------------------------------------------------------------------' - */ -[_WIDECOLEMAK] = LAYOUT_planck_grid( - KC_Q, KC_W, KC_F, KC_P, KC_B, KC_SVU_BU, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, DE_ue, - KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB_MPLY, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, - KC_Z, KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, TG_COLEMAK, - KC_CAPS, LT(_NUM,KC_TAB), LGUI_T(KC_ESC), LT(_LOWER,KC_BSPC), OSM(MOD_LSFT), LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), LT(_RAISE, KC_ENT), RSFT_T(KC_DEL), KC_LALT, LT(_NAV,KC_LEFT), LT(_NAV,KC_RIGHT) -), - -[_LOWER] = LAYOUT_planck_grid( - KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_TILD, KC_CIRC, KC_AMPR, KC_ASTR, TD(TD_PRN), KC_RPRN, DE_OE, - KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, DE_SZ, KC_UNDS, KC_PLUS, TD(TD_CBR), KC_RCBR, DE_AE, - KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, KC_SLSH, KC_NUBS, LSFT(KC_NUBS), KC_CURRENCY, DE_EGRAVE, - TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_DOWN, KC_UP -), - -[_LOWER_DE] = LAYOUT_planck_grid( - KC_EXLM, RALT(KC_Q), KC_BSLS, KC_DLR, KC_PERC, RALT(KC_RBRC), KC_GRV, KC_CIRC, KC_RCBR, TD(TD_PRN_DE), KC_LPRN, LSFT(KC_SCLN), - KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, LSFT(KC_SLSH), KC_RBRC, TD(TD_CBR_DE), RALT(KC_0), LSFT(KC_QUOT), - KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, LSFT(KC_7), KC_NUBS, LSFT(KC_NUBS), KC_CURRENCY, KC_PLUS, - TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_DOWN, KC_UP -), - -[_RAISE] = LAYOUT_planck_grid( - KC_1, KC_2, KC_3, KC_4, KC_5, KC_GRV, KC_6, KC_7, KC_8, KC_9, KC_0, DE_oe, - KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, DE_SZ, KC_MINS, KC_EQL, TD(TD_BRC), KC_RBRC, DE_ae, - KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, KC_BSLS, KC_COMM, KC_DOT, KC_SLSH, DE_EAIGU, - TG(_MOUSE), KC_TRNS, KC_BSPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_DOWN, KC_UP -), - -[_RAISE_DE] = LAYOUT_planck_grid( - KC_1, KC_2, KC_3, KC_4, KC_5, LSFT(KC_GRV), KC_6, KC_7, KC_8, KC_9, KC_0, KC_SCLN, - KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_SLSH, LSFT(KC_0), TD(TD_BRC_DE), RALT(KC_9), KC_QUOT, - KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, RALT(KC_MINS), KC_COMM, KC_DOT, KC_SLSH, KC_EQL, - TG(_MOUSE), KC_TRNS, KC_BSPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_DOWN, KC_UP -), - -[_ADJUST] = LAYOUT_planck_grid( - LALT(KC_LSFT), RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DE_SWITCH, - LALT(KC_GRV), EEP_RST, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, HRWIDECOLEMAK, WIDECOLEMAK, LALT(KC_GRV), LANG_SWITCH, GAMING, - KC_TRNS, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, KC_SVD_BD, KC_MPLY, KC_SVU_BU, KC_TRNS, , - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, EEPROM_RESET -), - -[_NAV] = LAYOUT_planck_grid( - ALT_TAB, LCTL(KC_RGHT), LANG_SWITCH, LALT(KC_GRV), LCTL(KC_LEFT), KC_MNXT, KC_HOME, KC_RIGHT, KC_PGUP, LCTL(KC_INS), LSFT(KC_INS), KC_DE_SWITCH, - CTL_TAB, KC_TAB, KC_ESC, KC_ENT, TD(TD_VIM_GG), KC_MPLY, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_END, VIM_O, - KC_LSFT, KC_NO, LCTL(KC_X), KC_CAPS, VIM_V, KC_MUTE, KC_HOME, KC_PGDN, KC_LSFT, KC_RSFT, LCTL(KC_F), LCTL(KC_F), - KC_NO, KC_NO, KC_TRNS, KC_BSPC, KC_TRNS, LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), KC_ENT, KC_DEL, KC_TRNS, KC_DOWN, KC_UP -), - -[_VIM] = LAYOUT_planck_grid( - ALT_TAB, LCTL(KC_RGHT), LANG_SWITCH, LALT(KC_GRV), LCTL(KC_LEFT), KC_MNXT, KC_HOME, KC_RIGHT, KC_PGUP, LCTL(KC_C), KC_RGUI, KC_DE_SWITCH, - CTL_TAB, KC_TAB, KC_ESC, KC_ENT, TD(TD_VIM_GG), KC_MPLY, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_END, VIM_O, - KC_LSFT, KC_NO, LCTL(KC_X), KC_CAPS, VIM_V, KC_MUTE, KC_HOME, KC_PGDN, KC_LSFT, KC_RSFT, LCTL(KC_F), LCTL(KC_F), - KC_NO, KC_NO, TG(_VIM), KC_BSPC, KC_TRNS, LT(_NAV,KC_SPC), LT(_NAV,KC_SPC), KC_ENT, KC_DEL, KC_TRNS, KC_DOWN, KC_UP -), - -[_NUM] = LAYOUT_planck_grid( - KC_F1, KC_F2, KC_F3, KC_F4, KC_MPRV, KC_NLCK, KC_MNXT, KC_P7, KC_P8, KC_P9, KC_MINS, KC_TRNS, - KC_F5, KC_F6, KC_F7, KC_F8, KC_VOLU, KC_MPLY, KC_ASTR, KC_P4, KC_P5, KC_P6, KC_PLUS, KC_DOT, - KC_F9,KC_F10,KC_F11,KC_F12, KC_VOLD, KC_MUTE, KC_EQL, KC_P1, KC_P2, KC_P3, KC_SLSH, KC_COMM, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P0, KC_DOT, KC_COMM, KC_EQL, KC_TRNS -), - -[_MOUSE] = LAYOUT_planck_grid( - KC_NO, KC_NO, KC_BTN4, KC_BTN5, KC_NO, KC_BRIU, KC_NO, KC_WH_U, KC_MS_U, KC_WH_U, KC_NO, KC_NO, - KC_NO, KC_BTN3, KC_BTN2, KC_BTN1, KC_NO, KC_MPLY, KC_NO, KC_MS_L, KC_MS_D, KC_MS_R, KC_NO, KC_NO, - KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_BRID, KC_NO, KC_WH_D, KC_NO, KC_NO, KC_TRNS, KC_NO, - TG(_MOUSE), KC_NO, KC_NO, KC_TRNS, KC_NO, KC_ACL2, KC_ACL2, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO -) + + [_HRWIDECOLEMAK] = LAYOUT_planck_grid(LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM, KC_B), KC_SVU_BU, LT(_NUM, KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Y), RGUI_T(KC_SCLN), DE_ue, KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, LT(_MOUSE, KC_Z), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, LT(_MOUSE, KC_SLSH), KC_BSLS, LCTL_T(KC_CAPS), LGUI_T(KC_TAB), M_ESCM, LT(_LOWER, KC_BSPC), OSM(MOD_LSFT), LT(_NAV, KC_SPC), LT(_NAV, KC_SPC), LT(_RAISE, KC_ENT), RSFT_T(KC_DEL), RCTL_T(KC_TAB), LT(_NAV, KC_LEFT), LT(_NAV, KC_RIGHT)), + + [_HRWIDECOLEMAK_DE] = LAYOUT_planck_grid(LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM, KC_B), KC_SVU_BU, LT(_NUM, KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Z), M_RGUI_SCLN, KC_LBRC, KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB, KC_M, KC_N, KC_E, KC_I, KC_O, DE_QUOT, LT(_MOUSE, KC_Y), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, DE_SLSH_QUST, DE_BSLS, LCTL_T(KC_CAPS), LGUI_T(KC_TAB), M_ESCM, LT(_LOWER_DE, KC_BSPC), OSM(MOD_LSFT), LT(_NAV, KC_SPC), LT(_NAV, KC_SPC), LT(_RAISE_DE, KC_ENT), RSFT_T(KC_DEL), RCTL_T(KC_TAB), LT(_NAV, KC_LEFT), LT(_NAV, KC_RIGHT)), + + [_GAMING] = LAYOUT_planck_grid(KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_F5, KC_F8, KC_F9, KC_VOLU, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_VOLD, KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_Z, KC_M, KC_SCLN, TG_COLEMAK, KC_LCTL, KC_C, KC_B, KC_X, KC_LALT, KC_SPC, KC_SPC, KC_ENT, KC_RALT, KC_TRNS, KC_TRNS, GAMING), + + /* WIDECOLEMAK + * ,-----------------------------------------------------------------------------------. + * |_NUM(Tab)| Q | W | E | R | T | Y | U | I | O | P | Bksp | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |CTL(Esc)| A | S | D | F | G | H | J | K | L | ; | " | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ + [_WIDECOLEMAK] = LAYOUT_planck_grid(KC_Q, KC_W, KC_F, KC_P, KC_B, KC_SVU_BU, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, DE_ue, KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB_MPLY, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, KC_Z, KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, TG_COLEMAK, KC_CAPS, LT(_NUM, KC_TAB), LGUI_T(KC_ESC), LT(_LOWER, KC_BSPC), OSM(MOD_LSFT), LT(_NAV, KC_SPC), LT(_NAV, KC_SPC), LT(_RAISE, KC_ENT), RSFT_T(KC_DEL), KC_LALT, LT(_NAV, KC_LEFT), LT(_NAV, KC_RIGHT)), + + [_LOWER] = LAYOUT_planck_grid(KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_TILD, KC_CIRC, KC_AMPR, KC_ASTR, TD(TD_PRN), KC_RPRN, DE_OE, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, DE_SZ, KC_UNDS, KC_PLUS, TD(TD_CBR), KC_RCBR, DE_AE, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, KC_SLSH, KC_NUBS, LSFT(KC_NUBS), KC_CURRENCY, DE_EGRAVE, TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_DOWN, KC_UP), + + [_LOWER_DE] = LAYOUT_planck_grid(KC_EXLM, RALT(KC_Q), KC_BSLS, KC_DLR, KC_PERC, RALT(KC_RBRC), KC_GRV, KC_CIRC, KC_RCBR, TD(TD_PRN_DE), KC_LPRN, LSFT(KC_SCLN), KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, LSFT(KC_SLSH), KC_RBRC, TD(TD_CBR_DE), RALT(KC_0), LSFT(KC_QUOT), KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, LSFT(KC_7), KC_NUBS, LSFT(KC_NUBS), KC_CURRENCY, KC_PLUS, TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_DOWN, KC_UP), + + [_RAISE] = LAYOUT_planck_grid(KC_1, KC_2, KC_3, KC_4, KC_5, KC_GRV, KC_6, KC_7, KC_8, KC_9, KC_0, DE_oe, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, DE_SZ, KC_MINS, KC_EQL, TD(TD_BRC), KC_RBRC, DE_ae, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, KC_BSLS, KC_COMM, KC_DOT, KC_SLSH, DE_EAIGU, TG(_MOUSE), KC_TRNS, KC_BSPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_DOWN, KC_UP), + + [_RAISE_DE] = LAYOUT_planck_grid(KC_1, KC_2, KC_3, KC_4, KC_5, LSFT(KC_GRV), KC_6, KC_7, KC_8, KC_9, KC_0, KC_SCLN, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_SLSH, LSFT(KC_0), TD(TD_BRC_DE), RALT(KC_9), KC_QUOT, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, RALT(KC_MINS), KC_COMM, KC_DOT, KC_SLSH, KC_EQL, TG(_MOUSE), KC_TRNS, KC_BSPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_DOWN, KC_UP), + + [_ADJUST] = LAYOUT_planck_grid(LALT(KC_LSFT), RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DE_SWITCH, LALT(KC_GRV), EEP_RST, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, HRWIDECOLEMAK, WIDECOLEMAK, LALT(KC_GRV), LANG_SWITCH, GAMING, KC_TRNS, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, KC_SVD_BD, KC_MPLY, KC_SVU_BU, KC_TRNS, , KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, EEPROM_RESET), + + [_NAV] = LAYOUT_planck_grid(ALT_TAB, LCTL(KC_RGHT), LANG_SWITCH, LALT(KC_GRV), LCTL(KC_LEFT), KC_MNXT, KC_HOME, KC_RIGHT, KC_PGUP, LCTL(KC_INS), LSFT(KC_INS), KC_DE_SWITCH, CTL_TAB, KC_TAB, KC_ESC, KC_ENT, TD(TD_VIM_GG), KC_MPLY, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_END, VIM_O, KC_LSFT, KC_NO, LCTL(KC_X), KC_CAPS, VIM_V, KC_MUTE, KC_HOME, KC_PGDN, KC_LSFT, KC_RSFT, LCTL(KC_F), LCTL(KC_F), KC_NO, KC_NO, KC_TRNS, KC_BSPC, KC_TRNS, LT(_NAV, KC_SPC), LT(_NAV, KC_SPC), KC_ENT, KC_DEL, KC_TRNS, KC_DOWN, KC_UP), + + [_VIM] = LAYOUT_planck_grid(ALT_TAB, LCTL(KC_RGHT), LANG_SWITCH, LALT(KC_GRV), LCTL(KC_LEFT), KC_MNXT, KC_HOME, KC_RIGHT, KC_PGUP, LCTL(KC_C), KC_RGUI, KC_DE_SWITCH, CTL_TAB, KC_TAB, KC_ESC, KC_ENT, TD(TD_VIM_GG), KC_MPLY, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_END, VIM_O, KC_LSFT, KC_NO, LCTL(KC_X), KC_CAPS, VIM_V, KC_MUTE, KC_HOME, KC_PGDN, KC_LSFT, KC_RSFT, LCTL(KC_F), LCTL(KC_F), KC_NO, KC_NO, TG(_VIM), KC_BSPC, KC_TRNS, LT(_NAV, KC_SPC), LT(_NAV, KC_SPC), KC_ENT, KC_DEL, KC_TRNS, KC_DOWN, KC_UP), + + [_NUM] = LAYOUT_planck_grid(KC_F1, KC_F2, KC_F3, KC_F4, KC_MPRV, KC_NLCK, KC_MNXT, KC_P7, KC_P8, KC_P9, KC_MINS, KC_TRNS, KC_F5, KC_F6, KC_F7, KC_F8, KC_VOLU, KC_MPLY, KC_ASTR, KC_P4, KC_P5, KC_P6, KC_PLUS, KC_DOT, KC_F9, KC_F10, KC_F11, KC_F12, KC_VOLD, KC_MUTE, KC_EQL, KC_P1, KC_P2, KC_P3, KC_SLSH, KC_COMM, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P0, KC_DOT, KC_COMM, KC_EQL, KC_TRNS), + + [_MOUSE] = LAYOUT_planck_grid(KC_NO, KC_NO, KC_BTN4, KC_BTN5, KC_NO, KC_BRIU, KC_NO, KC_WH_U, KC_MS_U, KC_WH_U, KC_NO, KC_NO, KC_NO, KC_BTN3, KC_BTN2, KC_BTN1, KC_NO, KC_MPLY, KC_NO, KC_MS_L, KC_MS_D, KC_MS_R, KC_NO, KC_NO, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_BRID, KC_NO, KC_WH_D, KC_NO, KC_NO, KC_TRNS, KC_NO, TG(_MOUSE), KC_NO, KC_NO, KC_TRNS, KC_NO, KC_ACL2, KC_ACL2, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO) }; @@ -192,8 +97,8 @@ void dance_prn(qk_tap_dance_state_t *state, void *user_data) { tap_code16(KC_LPRN); } else { tap_code16(KC_LPRN); - tap_code16(KC_RPRN); - tap_code(KC_LEFT); + tap_code16(KC_RPRN); + tap_code(KC_LEFT); } } void dance_brc(qk_tap_dance_state_t *state, void *user_data) { @@ -201,8 +106,8 @@ void dance_brc(qk_tap_dance_state_t *state, void *user_data) { tap_code(KC_LBRC); } else { tap_code(KC_LBRC); - tap_code(KC_RBRC); - tap_code(KC_LEFT); + tap_code(KC_RBRC); + tap_code(KC_LEFT); } } void dance_cbr(qk_tap_dance_state_t *state, void *user_data) { @@ -210,17 +115,17 @@ void dance_cbr(qk_tap_dance_state_t *state, void *user_data) { tap_code16(KC_LCBR); } else { tap_code16(KC_LCBR); - tap_code16(KC_RCBR); - tap_code(KC_LEFT); - } + tap_code16(KC_RCBR); + tap_code(KC_LEFT); + } } void dance_prn_de(qk_tap_dance_state_t *state, void *user_data) { if (state->count == 1) { tap_code16(KC_ASTR); } else { tap_code16(KC_ASTR); - tap_code16(KC_LPRN); - tap_code(KC_LEFT); + tap_code16(KC_LPRN); + tap_code(KC_LEFT); } } void dance_brc_de(qk_tap_dance_state_t *state, void *user_data) { @@ -231,9 +136,9 @@ void dance_brc_de(qk_tap_dance_state_t *state, void *user_data) { } else { add_mods(MOD_BIT(KC_RALT)); tap_code(KC_8); - tap_code(KC_9); + tap_code(KC_9); unregister_mods(MOD_BIT(KC_RALT)); - tap_code(KC_LEFT); + tap_code(KC_LEFT); } } void dance_cbr_de(qk_tap_dance_state_t *state, void *user_data) { @@ -244,39 +149,32 @@ void dance_cbr_de(qk_tap_dance_state_t *state, void *user_data) { } else { add_mods(MOD_BIT(KC_RALT)); tap_code(KC_7); - tap_code(KC_0); + tap_code(KC_0); unregister_mods(MOD_BIT(KC_RALT)); - tap_code(KC_LEFT); - } + tap_code(KC_LEFT); + } } void vim_gg(qk_tap_dance_state_t *state, void *user_data) { if (state->count == 1) { - register_mods(MOD_LCTL); - tap_code(KC_END); - unregister_mods(MOD_LCTL); + register_mods(MOD_LCTL); + tap_code(KC_END); + unregister_mods(MOD_LCTL); } else { - register_mods(MOD_LCTL); - tap_code(KC_HOME); - unregister_mods(MOD_LCTL); + register_mods(MOD_LCTL); + tap_code(KC_HOME); + unregister_mods(MOD_LCTL); } } qk_tap_dance_action_t tap_dance_actions[] = { - // declare tap dance actions here - [TD_PRN] = ACTION_TAP_DANCE_FN(dance_prn), - [TD_BRC] = ACTION_TAP_DANCE_FN(dance_brc), - [TD_CBR] = ACTION_TAP_DANCE_FN(dance_cbr), - [TD_PRN_DE] = ACTION_TAP_DANCE_FN(dance_prn_de), - [TD_BRC_DE] = ACTION_TAP_DANCE_FN(dance_brc_de), - [TD_CBR_DE] = ACTION_TAP_DANCE_FN(dance_cbr_de), - [TD_VIM_GG] = ACTION_TAP_DANCE_FN(vim_gg) -}; + // declare tap dance actions here + [TD_PRN] = ACTION_TAP_DANCE_FN(dance_prn), [TD_BRC] = ACTION_TAP_DANCE_FN(dance_brc), [TD_CBR] = ACTION_TAP_DANCE_FN(dance_cbr), [TD_PRN_DE] = ACTION_TAP_DANCE_FN(dance_prn_de), [TD_BRC_DE] = ACTION_TAP_DANCE_FN(dance_brc_de), [TD_CBR_DE] = ACTION_TAP_DANCE_FN(dance_cbr_de), [TD_VIM_GG] = ACTION_TAP_DANCE_FN(vim_gg)}; float thumb_factor = 0.95; float index_factor = 1.1; float middle_factor = 1.2; float ring_factor = 1.25; -float pinky_factor = 1.15; +float pinky_factor = 1.15; float td_factor = 1.4; // define the per_key_tapping_term @@ -287,19 +185,19 @@ uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { return TAPPING_TERM * thumb_factor; case RCTL_T(KC_TAB): return TAPPING_TERM * thumb_factor; - case LT(_NAV,KC_LEFT): + case LT(_NAV, KC_LEFT): return TAPPING_TERM * thumb_factor; - case LT(_NAV,KC_RIGHT): + case LT(_NAV, KC_RIGHT): return TAPPING_TERM * thumb_factor; - case LT(_LOWER,KC_BSPC): + case LT(_LOWER, KC_BSPC): return TAPPING_TERM * thumb_factor; - case LT(_LOWER_DE,KC_BSPC): + case LT(_LOWER_DE, KC_BSPC): return TAPPING_TERM * thumb_factor; - case LT(_RAISE,KC_ENT): + case LT(_RAISE, KC_ENT): return TAPPING_TERM * thumb_factor; - case LT(_RAISE_DE,KC_ENT): + case LT(_RAISE_DE, KC_ENT): return TAPPING_TERM * thumb_factor; - case LT(_NAV,KC_SPC): + case LT(_NAV, KC_SPC): return TAPPING_TERM * 1.0; case LALT_T(KC_ESC): return TAPPING_TERM * thumb_factor; @@ -331,10 +229,10 @@ uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { // pinky keys case LGUI_T(KC_Q): return TAPPING_TERM * pinky_factor; - case RGUI_T(KC_SCLN): - return TAPPING_TERM * pinky_factor; - case RGUI_T(KC_LBRC): - return TAPPING_TERM * pinky_factor; + case RGUI_T(KC_SCLN): + return TAPPING_TERM * pinky_factor; + case RGUI_T(KC_LBRC): + return TAPPING_TERM * pinky_factor; case LT(_MOUSE, KC_Z): return TAPPING_TERM * pinky_factor; case LT(_MOUSE, KC_SLSH): @@ -342,7 +240,7 @@ uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { case LCTL_T(KC_CAPS): return TAPPING_TERM * pinky_factor; - // tap-dance actions + // tap-dance actions case TD(TD_PRN): return TAPPING_TERM * td_factor; case TD(TD_BRC): @@ -371,436 +269,483 @@ bool de_layout_active = false; static uint16_t key_timer; bool process_record_user(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case WIDECOLEMAK: - if (record->event.pressed) { - set_single_persistent_default_layer(_WIDECOLEMAK); - } - return false; - break; - case HRWIDECOLEMAK: - if (record->event.pressed) { - set_single_persistent_default_layer(_HRWIDECOLEMAK); - } - return false; - break; - case GAMING: - if (record->event.pressed) { - layer_invert(_GAMING); - } - return false; - break; - case TG_COLEMAK: - if (record->event.pressed) { - tap_code(KC_ENT); - layer_invert(_WIDECOLEMAK); - } - return false; - break; - case VIM_O: - if (record->event.pressed) { - tap_code(KC_END); - tap_code(KC_ENT); - } - return false; - break; - case VIM_V: - if (record->event.pressed) { - if (get_mods() & MOD_MASK_SHIFT) { - clear_mods(); - } else { - register_mods(MOD_LSFT); - } - } - return false; - break; - case KC_SVU_BU: // increase backlight when pressing shift and vol up - if (record->event.pressed) { - if (get_mods() & MOD_MASK_SHIFT) { - register_code(KC_BRIU); - } else if (get_mods() & MOD_MASK_SHIFT){ - register_code(KC_MNXT); - } else { - register_code(KC_VOLU); - } - } else { - unregister_code(KC_BRIU); - unregister_code(KC_MNXT); - unregister_code(KC_VOLU); - } - return false; - case KC_SVD_BD: // decrease backlight when pressing shift and vol up - if (record->event.pressed) { - if (get_mods() & MOD_MASK_SHIFT) { - register_code(KC_BRID); - } else if (get_mods() & MOD_MASK_SHIFT){ - register_code(KC_MPRV); - } else { - register_code(KC_VOLD); - } - } else { - unregister_code(KC_BRID); - unregister_code(KC_MPRV); - unregister_code(KC_VOLD); - } - return false; - case KC_TAB_MPLY: // press tab or play/pause when ctrl is pressed - if (record->event.pressed) { - if (get_mods() & MOD_MASK_CTRL){ - register_code(KC_MPLY); - } else { - register_code(KC_TAB); - } - } else { - unregister_code(KC_MPLY); - unregister_code(KC_TAB); - } - return false; - case ALT_TAB: - if (record->event.pressed) { - if (!is_alt_tab_active) { - is_alt_tab_active = true; - add_mods(MOD_LALT); - } - register_code(KC_TAB); - } else { - unregister_code(KC_TAB); - } - break; - case CTL_TAB: - if (record->event.pressed) { - if (!is_ctl_tab_active) { - is_ctl_tab_active = true; - add_mods(MOD_LCTL); - } - register_code(KC_TAB); - } else { - unregister_code(KC_TAB); - } - break; - // the next case allows us to use alt_tab without a timer - case LT(_NAV,KC_SPC): - if (record->event.pressed) { - } else { - unregister_mods(MOD_LALT); - unregister_mods(MOD_LCTL); - is_alt_tab_active = false; - is_ctl_tab_active = false; - } - break; - case DE_ae: - if (record->event.pressed) { - uint8_t temp_mods = get_mods(); - if ((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) { - clear_oneshot_mods(); - clear_mods(); - add_mods(MOD_LALT); - tap_code(KC_P0); tap_code(KC_P1); tap_code(KC_P9); tap_code(KC_P6); // Ä - } else { - clear_mods(); - add_mods(MOD_LALT); - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P2); tap_code(KC_P8); // ä - } - unregister_mods(MOD_LALT); - set_mods(temp_mods); - } - return false; - break; - case DE_AE: - if (record->event.pressed) { - uint8_t temp_mods = get_mods() | get_oneshot_mods(); - clear_oneshot_mods(); - clear_mods(); - add_mods(MOD_LALT); - tap_code(KC_P0); tap_code(KC_P1); tap_code(KC_P9); tap_code(KC_P6); // Ä - unregister_mods(MOD_LALT); - set_mods(temp_mods); - } - return false; - break; - case DE_oe: - if (record->event.pressed) { - uint8_t temp_mods = get_mods(); - if ((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) { - clear_oneshot_mods(); - clear_mods(); - add_mods(MOD_LALT); - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P1); tap_code(KC_P4); // Ö - } else { - clear_mods(); - add_mods(MOD_LALT); - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P4); tap_code(KC_P6); // ö - } - unregister_mods(MOD_LALT); - set_mods(temp_mods); - } - return false; - break; - case DE_OE: - if (record->event.pressed) { - uint8_t temp_mods = get_mods() | get_oneshot_mods(); - clear_oneshot_mods(); - clear_mods(); - add_mods(MOD_LALT); - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P1); tap_code(KC_P4); // Ö - unregister_mods(MOD_LALT); - set_mods(temp_mods); - } - return false; - break; - case DE_ue: - if (record->event.pressed) { - uint8_t temp_mods = get_mods(); - if ((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) { - clear_oneshot_mods(); - clear_mods(); - add_mods(MOD_LALT); - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P2); tap_code(KC_P0); // Ü - } else { - clear_mods(); - add_mods(MOD_LALT); - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P5); tap_code(KC_P2); // ü - } - unregister_mods(MOD_LALT); - set_mods(temp_mods); - } - return false; - break; - case KC_DE_SWITCH: - if (record->event.pressed) { - if (de_layout_active) { - de_layout_active = false;// deactivate German overlay - set_single_persistent_default_layer(_HRWIDECOLEMAK); - } else { - de_layout_active = true; // activate German overlay - set_single_persistent_default_layer(_HRWIDECOLEMAK_DE); - } - return false; - } - break; - case LANG_SWITCH: - if (record->event.pressed) { - register_mods(MOD_LALT); - register_code(KC_LSFT); - if (de_layout_active) { - de_layout_active = false; // deactivate German overlay - set_single_persistent_default_layer(_HRWIDECOLEMAK); - } else { - de_layout_active = true; // activate German overlay - set_single_persistent_default_layer(_HRWIDECOLEMAK_DE); - } - } else { - unregister_code(KC_LSFT); - unregister_mods(MOD_LALT); - } - return false; - case DE_SZ: - if (record->event.pressed) { - uint8_t temp_mods = get_mods(); - if ((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) { - clear_oneshot_mods(); - clear_mods(); - add_mods(MOD_LALT); - tap_code(KC_P0); tap_code(KC_P1); tap_code(KC_P7); tap_code(KC_P6); // ° - } else { - clear_mods(); - add_mods(MOD_LALT); - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P2); tap_code(KC_P3); // ß - } - unregister_mods(MOD_LALT); - set_mods(temp_mods); - } - return false; - break; - case DE_EGRAVE: - if (record->event.pressed) { - uint8_t temp_mods = get_mods(); - if ((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) { - clear_oneshot_mods(); - clear_mods(); - add_mods(MOD_LALT); - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P0); tap_code(KC_P0); // È - } else { - clear_mods(); - add_mods(MOD_LALT); - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P3); tap_code(KC_P2); // è - } - unregister_mods(MOD_LALT); - set_mods(temp_mods); - } - return false; - break; - case DE_EAIGU: - if (record->event.pressed) { - uint8_t temp_mods = get_mods(); - if ((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) { - clear_oneshot_mods(); - clear_mods(); - add_mods(MOD_LALT); - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P0); tap_code(KC_P1); // É - } else { - clear_mods(); - add_mods(MOD_LALT); - tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P3); tap_code(KC_P3); // é - } - unregister_mods(MOD_LALT); - set_mods(temp_mods); - } - return false; - break; - case KC_CURRENCY: - if (record->event.pressed) { - uint8_t temp_mods = get_mods(); - if ((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) { - clear_oneshot_mods(); - clear_mods(); - add_mods(MOD_LALT); - tap_code(KC_P1); tap_code(KC_P5); tap_code(KC_P7); // ¥ - } else { - clear_mods(); - add_mods(MOD_LALT); - tap_code(KC_P0); tap_code(KC_P1); tap_code(KC_P2); tap_code(KC_P8); // € - } - unregister_mods(MOD_LALT); - set_mods(temp_mods); - } - return false; - break; - case DE_SLSH_QUST: - if (record->event.pressed) { - key_timer = timer_read(); - layer_on(_MOUSE); - } else { - if (timer_elapsed(key_timer) < (TAPPING_TERM * pinky_factor)) { - layer_off(_MOUSE); - uint8_t temp_mods = get_mods() | get_oneshot_mods(); - if (temp_mods & MOD_MASK_SHIFT) { - tap_code(KC_MINS); // ? - } else { - tap_code16(KC_AMPR); // / - } - } else { - layer_off(_MOUSE); - } - } - return false; - break; - case DE_QUOT: - if (record->event.pressed) { - uint8_t temp_mods = get_mods() | get_oneshot_mods(); - if (temp_mods & MOD_MASK_SHIFT) { - register_code(KC_2); // \" - } else { - register_code16(KC_PIPE); // /' - } - } else { - unregister_code(KC_2); - unregister_code16(KC_PIPE); - } - return true; - case DE_SCLN: - if (record->event.pressed) { - uint8_t temp_mods = get_mods() | get_oneshot_mods(); - if (temp_mods & MOD_MASK_SHIFT) { - tap_code(KC_DOT); // ; - } else { - add_mods(MOD_LSFT); - tap_code(KC_COMM); // : - del_mods(MOD_LSFT); - } - return false; - } - break; - case DE_BSLS: - if (record->event.pressed) { - uint8_t temp_mods = get_mods() | get_oneshot_mods(); - clear_mods(); - clear_oneshot_mods(); - add_mods(MOD_BIT(KC_RALT)); - if (temp_mods & MOD_MASK_SHIFT) { - register_code(KC_NUBS); // | Pipe - } else { - register_code(KC_MINS); // Backslash - } - set_mods(temp_mods); - } else { - unregister_code(KC_NUBS); - unregister_code(KC_MINS); - } - return true; - //switch multiplexing for escape, short tap for escape, long press for context menu - case M_ESCM: - if (record->event.pressed) { - key_timer = timer_read(); - } else { - if (timer_elapsed(key_timer) > TAPPING_TERM) { - tap_code(KC_APP); - } else { - tap_code(KC_ESC); - } - } - return false; - case M_RGUI_SCLN: - if (record->event.pressed) { - key_timer = timer_read(); - add_mods(MOD_RGUI); - } else { - del_mods(MOD_RGUI); - if (timer_elapsed(key_timer) < (TAPPING_TERM * pinky_factor)) { - uint8_t temp_mods = get_mods() | get_oneshot_mods(); - if (temp_mods & MOD_MASK_SHIFT) { - tap_code(KC_DOT); // ; - } else { - add_mods(MOD_LSFT); - tap_code(KC_COMM); // : - del_mods(MOD_LSFT); - } - } else { - tap_code(KC_RGUI); - } - } - return false; - break; - } - return true; + switch (keycode) { + case WIDECOLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_WIDECOLEMAK); + } + return false; + break; + case HRWIDECOLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_HRWIDECOLEMAK); + } + return false; + break; + case GAMING: + if (record->event.pressed) { + layer_invert(_GAMING); + } + return false; + break; + case TG_COLEMAK: + if (record->event.pressed) { + tap_code(KC_ENT); + layer_invert(_WIDECOLEMAK); + } + return false; + break; + case VIM_O: + if (record->event.pressed) { + tap_code(KC_END); + tap_code(KC_ENT); + } + return false; + break; + case VIM_V: + if (record->event.pressed) { + if (get_mods() & MOD_MASK_SHIFT) { + clear_mods(); + } else { + register_mods(MOD_LSFT); + } + } + return false; + break; + case KC_SVU_BU: // increase backlight when pressing shift and vol up + if (record->event.pressed) { + if (get_mods() & MOD_MASK_SHIFT) { + register_code(KC_BRIU); + } else if (get_mods() & MOD_MASK_SHIFT) { + register_code(KC_MNXT); + } else { + register_code(KC_VOLU); + } + } else { + unregister_code(KC_BRIU); + unregister_code(KC_MNXT); + unregister_code(KC_VOLU); + } + return false; + case KC_SVD_BD: // decrease backlight when pressing shift and vol up + if (record->event.pressed) { + if (get_mods() & MOD_MASK_SHIFT) { + register_code(KC_BRID); + } else if (get_mods() & MOD_MASK_SHIFT) { + register_code(KC_MPRV); + } else { + register_code(KC_VOLD); + } + } else { + unregister_code(KC_BRID); + unregister_code(KC_MPRV); + unregister_code(KC_VOLD); + } + return false; + case KC_TAB_MPLY: // press tab or play/pause when ctrl is pressed + if (record->event.pressed) { + if (get_mods() & MOD_MASK_CTRL) { + register_code(KC_MPLY); + } else { + register_code(KC_TAB); + } + } else { + unregister_code(KC_MPLY); + unregister_code(KC_TAB); + } + return false; + case ALT_TAB: + if (record->event.pressed) { + if (!is_alt_tab_active) { + is_alt_tab_active = true; + add_mods(MOD_LALT); + } + register_code(KC_TAB); + } else { + unregister_code(KC_TAB); + } + break; + case CTL_TAB: + if (record->event.pressed) { + if (!is_ctl_tab_active) { + is_ctl_tab_active = true; + add_mods(MOD_LCTL); + } + register_code(KC_TAB); + } else { + unregister_code(KC_TAB); + } + break; + // the next case allows us to use alt_tab without a timer + case LT(_NAV, KC_SPC): + if (record->event.pressed) { + } else { + unregister_mods(MOD_LALT); + unregister_mods(MOD_LCTL); + is_alt_tab_active = false; + is_ctl_tab_active = false; + } + break; + case DE_ae: + if (record->event.pressed) { + uint8_t temp_mods = get_mods(); + if ((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) { + clear_oneshot_mods(); + clear_mods(); + add_mods(MOD_LALT); + tap_code(KC_P0); + tap_code(KC_P1); + tap_code(KC_P9); + tap_code(KC_P6); // Ä + } else { + clear_mods(); + add_mods(MOD_LALT); + tap_code(KC_P0); + tap_code(KC_P2); + tap_code(KC_P2); + tap_code(KC_P8); // ä + } + unregister_mods(MOD_LALT); + set_mods(temp_mods); + } + return false; + break; + case DE_AE: + if (record->event.pressed) { + uint8_t temp_mods = get_mods() | get_oneshot_mods(); + clear_oneshot_mods(); + clear_mods(); + add_mods(MOD_LALT); + tap_code(KC_P0); + tap_code(KC_P1); + tap_code(KC_P9); + tap_code(KC_P6); // Ä + unregister_mods(MOD_LALT); + set_mods(temp_mods); + } + return false; + break; + case DE_oe: + if (record->event.pressed) { + uint8_t temp_mods = get_mods(); + if ((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) { + clear_oneshot_mods(); + clear_mods(); + add_mods(MOD_LALT); + tap_code(KC_P0); + tap_code(KC_P2); + tap_code(KC_P1); + tap_code(KC_P4); // Ö + } else { + clear_mods(); + add_mods(MOD_LALT); + tap_code(KC_P0); + tap_code(KC_P2); + tap_code(KC_P4); + tap_code(KC_P6); // ö + } + unregister_mods(MOD_LALT); + set_mods(temp_mods); + } + return false; + break; + case DE_OE: + if (record->event.pressed) { + uint8_t temp_mods = get_mods() | get_oneshot_mods(); + clear_oneshot_mods(); + clear_mods(); + add_mods(MOD_LALT); + tap_code(KC_P0); + tap_code(KC_P2); + tap_code(KC_P1); + tap_code(KC_P4); // Ö + unregister_mods(MOD_LALT); + set_mods(temp_mods); + } + return false; + break; + case DE_ue: + if (record->event.pressed) { + uint8_t temp_mods = get_mods(); + if ((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) { + clear_oneshot_mods(); + clear_mods(); + add_mods(MOD_LALT); + tap_code(KC_P0); + tap_code(KC_P2); + tap_code(KC_P2); + tap_code(KC_P0); // Ü + } else { + clear_mods(); + add_mods(MOD_LALT); + tap_code(KC_P0); + tap_code(KC_P2); + tap_code(KC_P5); + tap_code(KC_P2); // ü + } + unregister_mods(MOD_LALT); + set_mods(temp_mods); + } + return false; + break; + case KC_DE_SWITCH: + if (record->event.pressed) { + if (de_layout_active) { + de_layout_active = false; // deactivate German overlay + set_single_persistent_default_layer(_HRWIDECOLEMAK); + } else { + de_layout_active = true; // activate German overlay + set_single_persistent_default_layer(_HRWIDECOLEMAK_DE); + } + return false; + } + break; + case LANG_SWITCH: + if (record->event.pressed) { + register_mods(MOD_LALT); + register_code(KC_LSFT); + if (de_layout_active) { + de_layout_active = false; // deactivate German overlay + set_single_persistent_default_layer(_HRWIDECOLEMAK); + } else { + de_layout_active = true; // activate German overlay + set_single_persistent_default_layer(_HRWIDECOLEMAK_DE); + } + } else { + unregister_code(KC_LSFT); + unregister_mods(MOD_LALT); + } + return false; + case DE_SZ: + if (record->event.pressed) { + uint8_t temp_mods = get_mods(); + if ((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) { + clear_oneshot_mods(); + clear_mods(); + add_mods(MOD_LALT); + tap_code(KC_P0); + tap_code(KC_P1); + tap_code(KC_P7); + tap_code(KC_P6); // ° + } else { + clear_mods(); + add_mods(MOD_LALT); + tap_code(KC_P0); + tap_code(KC_P2); + tap_code(KC_P2); + tap_code(KC_P3); // ß + } + unregister_mods(MOD_LALT); + set_mods(temp_mods); + } + return false; + break; + case DE_EGRAVE: + if (record->event.pressed) { + uint8_t temp_mods = get_mods(); + if ((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) { + clear_oneshot_mods(); + clear_mods(); + add_mods(MOD_LALT); + tap_code(KC_P0); + tap_code(KC_P2); + tap_code(KC_P0); + tap_code(KC_P0); // È + } else { + clear_mods(); + add_mods(MOD_LALT); + tap_code(KC_P0); + tap_code(KC_P2); + tap_code(KC_P3); + tap_code(KC_P2); // è + } + unregister_mods(MOD_LALT); + set_mods(temp_mods); + } + return false; + break; + case DE_EAIGU: + if (record->event.pressed) { + uint8_t temp_mods = get_mods(); + if ((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) { + clear_oneshot_mods(); + clear_mods(); + add_mods(MOD_LALT); + tap_code(KC_P0); + tap_code(KC_P2); + tap_code(KC_P0); + tap_code(KC_P1); // É + } else { + clear_mods(); + add_mods(MOD_LALT); + tap_code(KC_P0); + tap_code(KC_P2); + tap_code(KC_P3); + tap_code(KC_P3); // é + } + unregister_mods(MOD_LALT); + set_mods(temp_mods); + } + return false; + break; + case KC_CURRENCY: + if (record->event.pressed) { + uint8_t temp_mods = get_mods(); + if ((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) { + clear_oneshot_mods(); + clear_mods(); + add_mods(MOD_LALT); + tap_code(KC_P1); + tap_code(KC_P5); + tap_code(KC_P7); // ¥ + } else { + clear_mods(); + add_mods(MOD_LALT); + tap_code(KC_P0); + tap_code(KC_P1); + tap_code(KC_P2); + tap_code(KC_P8); // € + } + unregister_mods(MOD_LALT); + set_mods(temp_mods); + } + return false; + break; + case DE_SLSH_QUST: + if (record->event.pressed) { + key_timer = timer_read(); + layer_on(_MOUSE); + } else { + if (timer_elapsed(key_timer) < (TAPPING_TERM * pinky_factor)) { + layer_off(_MOUSE); + uint8_t temp_mods = get_mods() | get_oneshot_mods(); + if (temp_mods & MOD_MASK_SHIFT) { + tap_code(KC_MINS); // ? + } else { + tap_code16(KC_AMPR); // / + } + } else { + layer_off(_MOUSE); + } + } + return false; + break; + case DE_QUOT: + if (record->event.pressed) { + uint8_t temp_mods = get_mods() | get_oneshot_mods(); + if (temp_mods & MOD_MASK_SHIFT) { + register_code(KC_2); // \" + } else { + register_code16(KC_PIPE); // /' + } + } else { + unregister_code(KC_2); + unregister_code16(KC_PIPE); + } + return true; + case DE_SCLN: + if (record->event.pressed) { + uint8_t temp_mods = get_mods() | get_oneshot_mods(); + if (temp_mods & MOD_MASK_SHIFT) { + tap_code(KC_DOT); // ; + } else { + add_mods(MOD_LSFT); + tap_code(KC_COMM); // : + del_mods(MOD_LSFT); + } + return false; + } + break; + case DE_BSLS: + if (record->event.pressed) { + uint8_t temp_mods = get_mods() | get_oneshot_mods(); + clear_mods(); + clear_oneshot_mods(); + add_mods(MOD_BIT(KC_RALT)); + if (temp_mods & MOD_MASK_SHIFT) { + register_code(KC_NUBS); // | Pipe + } else { + register_code(KC_MINS); // Backslash + } + set_mods(temp_mods); + } else { + unregister_code(KC_NUBS); + unregister_code(KC_MINS); + } + return true; + // switch multiplexing for escape, short tap for escape, long press for context menu + case M_ESCM: + if (record->event.pressed) { + key_timer = timer_read(); + } else { + if (timer_elapsed(key_timer) > TAPPING_TERM) { + tap_code(KC_APP); + } else { + tap_code(KC_ESC); + } + } + return false; + case M_RGUI_SCLN: + if (record->event.pressed) { + key_timer = timer_read(); + add_mods(MOD_RGUI); + } else { + del_mods(MOD_RGUI); + if (timer_elapsed(key_timer) < (TAPPING_TERM * pinky_factor)) { + uint8_t temp_mods = get_mods() | get_oneshot_mods(); + if (temp_mods & MOD_MASK_SHIFT) { + tap_code(KC_DOT); // ; + } else { + add_mods(MOD_LSFT); + tap_code(KC_COMM); // : + del_mods(MOD_LSFT); + } + } else { + tap_code(KC_RGUI); + } + } + return false; + break; + } + return true; } -bool muse_mode = false; -uint8_t last_muse_note = 0; -uint16_t muse_counter = 0; -uint8_t muse_offset = 70; -uint16_t muse_tempo = 50; +bool muse_mode = false; +uint8_t last_muse_note = 0; +uint16_t muse_counter = 0; +uint8_t muse_offset = 70; +uint16_t muse_tempo = 50; bool encoder_update(bool clockwise) { - 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 (clockwise) { - #ifdef MOUSEKEY_ENABLE - tap_code(KC_MS_WH_DOWN); - #else - tap_code(KC_PGDN); - #endif + 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 { - #ifdef MOUSEKEY_ENABLE - tap_code(KC_MS_WH_UP); - #else - tap_code(KC_PGUP); - #endif + if (clockwise) { +#ifdef MOUSEKEY_ENABLE + tap_code(KC_MS_WH_DOWN); +#else + tap_code(KC_PGDN); +#endif + } else { +#ifdef MOUSEKEY_ENABLE + tap_code(KC_MS_WH_UP); +#else + tap_code(KC_PGUP); +#endif + } } - } return true; } @@ -825,7 +770,7 @@ bool dip_switch_update_user(uint8_t index, bool active) { } void matrix_scan_user(void) { - #ifdef AUDIO_ENABLE +#ifdef AUDIO_ENABLE if (muse_mode) { if (muse_counter == 0) { uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()]; @@ -846,40 +791,40 @@ void matrix_scan_user(void) { } bool music_mask_user(uint16_t keycode) { - switch (keycode) { - case RAISE: - case LOWER: - return false; - default: - return true; - } + switch (keycode) { + case RAISE: + case LOWER: + return false; + default: + return true; + } } bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case LSFT_T(KC_S): - return true; - case RSFT_T(KC_E): - return true; - case LSFT_T(KC_D): - return true; - case RSFT_T(KC_K): - return true; - case LSFT_T(KC_F): - return true; - case RSFT_T(KC_U): - return true; - case LT(_RAISE,KC_ENT): - return true; - case LT(_RAISE_DE,KC_ENT): - return true; - case LT(_LOWER,KC_BSPC): - return true; - case LT(_LOWER_DE,KC_BSPC): - return true; - default: - return false; - } + switch (keycode) { + case LSFT_T(KC_S): + return true; + case RSFT_T(KC_E): + return true; + case LSFT_T(KC_D): + return true; + case RSFT_T(KC_K): + return true; + case LSFT_T(KC_F): + return true; + case RSFT_T(KC_U): + return true; + case LT(_RAISE, KC_ENT): + return true; + case LT(_RAISE_DE, KC_ENT): + return true; + case LT(_LOWER, KC_BSPC): + return true; + case LT(_LOWER_DE, KC_BSPC): + return true; + default: + return false; + } } // Set RGB to change with layer changes @@ -889,52 +834,31 @@ bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) { #define HSV_OCEAN 148, 255, 255 // Light LEDs 1 to 9 in darkorange when HRCOLEMAK is active -const rgblight_segment_t PROGMEM my_layer0_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {0, 10, HSV_DARKORANGE} -); +const rgblight_segment_t PROGMEM my_layer0_layer[] = RGBLIGHT_LAYER_SEGMENTS({0, 10, HSV_DARKORANGE}); // Light LEDs 1 to 9 in green when HRWIDECOLEMAK is active -const rgblight_segment_t PROGMEM my_layer1_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {0, 10, HSV_OCEAN} -); +const rgblight_segment_t PROGMEM my_layer1_layer[] = RGBLIGHT_LAYER_SEGMENTS({0, 10, HSV_OCEAN}); // Light LEDs 1 to 9 in darkorange when de_layout_active is true -const rgblight_segment_t PROGMEM my_layer2_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {3, 4, HSV_DARKORANGE}, - {0, 3, HSV_OCEAN}, - {8, 3, HSV_OCEAN} -); +const rgblight_segment_t PROGMEM my_layer2_layer[] = RGBLIGHT_LAYER_SEGMENTS({3, 4, HSV_DARKORANGE}, {0, 3, HSV_OCEAN}, {8, 3, HSV_OCEAN}); // Light LEDs 1 to 9 in red when GAMING layer is active -const rgblight_segment_t PROGMEM my_layer3_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {0, 10, HSV_RED} -); +const rgblight_segment_t PROGMEM my_layer3_layer[] = RGBLIGHT_LAYER_SEGMENTS({0, 10, HSV_RED}); // Light LEDs 1 to 9 in white when WIDECOLEMAK is active -const rgblight_segment_t PROGMEM my_layer4_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {0, 10, HSV_WHITE} -); +const rgblight_segment_t PROGMEM my_layer4_layer[] = RGBLIGHT_LAYER_SEGMENTS({0, 10, HSV_WHITE}); // Light bottom LEDs in purple when ADJUST layer is active -const rgblight_segment_t PROGMEM my_layer5_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {0, 2, HSV_MAGENTA}, - {7, 3, HSV_MAGENTA} -); +const rgblight_segment_t PROGMEM my_layer5_layer[] = RGBLIGHT_LAYER_SEGMENTS({0, 2, HSV_MAGENTA}, {7, 3, HSV_MAGENTA}); // Light bottom LEDs in red when caps lock is active. Hard to ignore! -const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {0, 3, HSV_GRASS}, - {7, 3, HSV_GRASS} -); +const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS({0, 3, HSV_GRASS}, {7, 3, HSV_GRASS}); // Light LEDs 1 to 9 in white when NAVIGATION is active -const rgblight_segment_t PROGMEM my_nav_layer[] = RGBLIGHT_LAYER_SEGMENTS( - {0, 10, HSV_WHITE} -); +const rgblight_segment_t PROGMEM my_nav_layer[] = RGBLIGHT_LAYER_SEGMENTS({0, 10, HSV_WHITE}); // Now define the array of layers. Later layers take precedence -const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST( - my_layer0_layer, // hrcolemak - my_layer1_layer, // hrwidecolemak - my_layer2_layer, // de_layout - my_layer3_layer, // gaming - my_layer4_layer, // widecolemak - my_layer5_layer, // adjust - my_nav_layer, // nav - my_capslock_layer // capslock +const rgblight_segment_t *const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST(my_layer0_layer, // hrcolemak + my_layer1_layer, // hrwidecolemak + my_layer2_layer, // de_layout + my_layer3_layer, // gaming + my_layer4_layer, // widecolemak + my_layer5_layer, // adjust + my_nav_layer, // nav + my_capslock_layer // capslock ); void keyboard_post_init_user(void) { @@ -948,25 +872,21 @@ bool led_update_user(led_t led_state) { } layer_state_t layer_state_set_user(layer_state_t state) { - rgblight_set_layer_state(3, layer_state_cmp(state, _GAMING)); - rgblight_set_layer_state(4, layer_state_cmp(state, _WIDECOLEMAK)); - if ( - ( layer_state_cmp(state, _LOWER) && layer_state_cmp(state, _RAISE ) ) || - ( layer_state_cmp(state, _LOWER_DE) && layer_state_cmp(state, _RAISE_DE ) ) ) { - return state | (1UL<<_ADJUST); - } else { - return state & ~(1UL<<_ADJUST); - } - // state = update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); - rgblight_set_layer_state(5, layer_state_cmp(state, _ADJUST)); - //return state; + rgblight_set_layer_state(3, layer_state_cmp(state, _GAMING)); + rgblight_set_layer_state(4, layer_state_cmp(state, _WIDECOLEMAK)); + if ((layer_state_cmp(state, _LOWER) && layer_state_cmp(state, _RAISE)) || (layer_state_cmp(state, _LOWER_DE) && layer_state_cmp(state, _RAISE_DE))) { + return state | (1UL << _ADJUST); + } else { + return state & ~(1UL << _ADJUST); + } + // state = update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); + rgblight_set_layer_state(5, layer_state_cmp(state, _ADJUST)); + // return state; } layer_state_t default_layer_state_set_user(layer_state_t state) { - rgblight_set_layer_state(4, layer_state_cmp(state, _WIDECOLEMAK)); - rgblight_set_layer_state(1, layer_state_cmp(state, _HRWIDECOLEMAK)); + rgblight_set_layer_state(4, layer_state_cmp(state, _WIDECOLEMAK)); + rgblight_set_layer_state(1, layer_state_cmp(state, _HRWIDECOLEMAK)); rgblight_set_layer_state(2, layer_state_cmp(state, _HRWIDECOLEMAK_DE)); return state; } - - From fb6bb980ccb5e912d6237b521b0101a97e25f027 Mon Sep 17 00:00:00 2001 From: Jakob Weickmann Date: Fri, 17 Sep 2021 23:48:18 +0200 Subject: [PATCH 16/31] Added ASCII keymaps and changed formatting to be in line with guidelines (clang-format) --- keyboards/planck/keymaps/jweickm/keymap.c | 241 ++++++++++++++++++++-- 1 file changed, 220 insertions(+), 21 deletions(-) diff --git a/keyboards/planck/keymaps/jweickm/keymap.c b/keyboards/planck/keymaps/jweickm/keymap.c index b9b47d3fa4ae..c6d2c466860c 100644 --- a/keyboards/planck/keymaps/jweickm/keymap.c +++ b/keyboards/planck/keymaps/jweickm/keymap.c @@ -52,42 +52,241 @@ enum tap_dance_codes { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [_HRWIDECOLEMAK] = LAYOUT_planck_grid(LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM, KC_B), KC_SVU_BU, LT(_NUM, KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Y), RGUI_T(KC_SCLN), DE_ue, KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, LT(_MOUSE, KC_Z), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, LT(_MOUSE, KC_SLSH), KC_BSLS, LCTL_T(KC_CAPS), LGUI_T(KC_TAB), M_ESCM, LT(_LOWER, KC_BSPC), OSM(MOD_LSFT), LT(_NAV, KC_SPC), LT(_NAV, KC_SPC), LT(_RAISE, KC_ENT), RSFT_T(KC_DEL), RCTL_T(KC_TAB), LT(_NAV, KC_LEFT), LT(_NAV, KC_RIGHT)), + /* _HRWIDECOLEMAK + * ,-----------------------------------------------------------------------------------. + * | G-Q | A-W | S-F | C-P |_Num-B|🔈/🔆+|_Num-J| C-L | S-U | A-Y | G-: | Ü | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | A | R | S | T | G | TAB | M | N | E | I | O | ' | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |_Mo-Z | X | C | D | V |🔈/🔆-| K | H | , | . |_Mo-/ | \ | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |C-CAPS|G-TAB |MN-ESC|_L-BSP| LSFT | _Nav-SPC |_R-ENT|S-DEL |C-TAB |_Na- ←|_Na- →| + * `-----------------------------------------------------------------------------------' + */ + [_HRWIDECOLEMAK] = LAYOUT_planck_grid( + LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM, KC_B), KC_SVU_BU, LT(_NUM, KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Y), RGUI_T(KC_SCLN), DE_ue, + KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, + LT(_MOUSE, KC_Z), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, LT(_MOUSE, KC_SLSH), KC_BSLS, + LCTL_T(KC_CAPS), LGUI_T(KC_TAB), M_ESCM, LT(_LOWER, KC_BSPC), OSM(MOD_LSFT), LT(_NAV, KC_SPC), LT(_NAV, KC_SPC), LT(_RAISE, KC_ENT), RSFT_T(KC_DEL), RCTL_T(KC_TAB), LT(_NAV, KC_LEFT), LT(_NAV, KC_RIGHT) + ), - [_HRWIDECOLEMAK_DE] = LAYOUT_planck_grid(LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM, KC_B), KC_SVU_BU, LT(_NUM, KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Z), M_RGUI_SCLN, KC_LBRC, KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB, KC_M, KC_N, KC_E, KC_I, KC_O, DE_QUOT, LT(_MOUSE, KC_Y), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, DE_SLSH_QUST, DE_BSLS, LCTL_T(KC_CAPS), LGUI_T(KC_TAB), M_ESCM, LT(_LOWER_DE, KC_BSPC), OSM(MOD_LSFT), LT(_NAV, KC_SPC), LT(_NAV, KC_SPC), LT(_RAISE_DE, KC_ENT), RSFT_T(KC_DEL), RCTL_T(KC_TAB), LT(_NAV, KC_LEFT), LT(_NAV, KC_RIGHT)), + /* _HRWIDECOLEMAK_DE + * same as above, when the PC is set to German layout + * ,-----------------------------------------------------------------------------------. + * | G-Q | A-W | S-F | C-P |_Num-B|🔈/🔆+|_Num-J| C-L | S-U | A-Y | G-: | Ü | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | A | R | S | T | G | TAB | M | N | E | I | O | ' | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |_Mo-Z | X | C | D | V |🔈/🔆-| K | H | , | . |_Mo-/ | \ | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |C-CAPS|G-TAB |MN-ESC|_L-BSP| LSFT | _Nav-SPC |_R-ENT|S-DEL |C-TAB |_Na- ←|_Na- →| + * `-----------------------------------------------------------------------------------' + */ + [_HRWIDECOLEMAK_DE] = LAYOUT_planck_grid( + LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM, KC_B), KC_SVU_BU, LT(_NUM, KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Z), M_RGUI_SCLN, KC_LBRC, + KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB, KC_M, KC_N, KC_E, KC_I, KC_O, DE_QUOT, + LT(_MOUSE, KC_Y), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, DE_SLSH_QUST, DE_BSLS, + LCTL_T(KC_CAPS), LGUI_T(KC_TAB), M_ESCM, LT(_LOWER_DE, KC_BSPC), OSM(MOD_LSFT), LT(_NAV, KC_SPC), LT(_NAV, KC_SPC), LT(_RAISE_DE, KC_ENT), RSFT_T(KC_DEL), RCTL_T(KC_TAB), LT(_NAV, KC_LEFT), LT(_NAV, KC_RIGHT) + ), - [_GAMING] = LAYOUT_planck_grid(KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_F5, KC_F8, KC_F9, KC_VOLU, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_VOLD, KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_Z, KC_M, KC_SCLN, TG_COLEMAK, KC_LCTL, KC_C, KC_B, KC_X, KC_LALT, KC_SPC, KC_SPC, KC_ENT, KC_RALT, KC_TRNS, KC_TRNS, GAMING), + /* _GAMING + * ,-----------------------------------------------------------------------------------. + * | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | F5 | F8 | F9 | 🔊 | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | TAB | Q | W | E | R | T | Y | U | I | O | P | 🔉 | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | LSFT | A | S | D | F | G | H | J | Z | M | ; |_CM-EN| + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | LCTL | C | B | X | LALT | SPACE | ENT | RALT | ____ | ____ | !GAME| + * `-----------------------------------------------------------------------------------' + */ + [_GAMING] = LAYOUT_planck_grid( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_F5, KC_F8, KC_F9, KC_VOLU, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_VOLD, + KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_Z, KC_M, KC_SCLN, TG_COLEMAK, + KC_LCTL, KC_C, KC_B, KC_X, KC_LALT, KC_SPC, KC_SPC, KC_ENT, KC_RALT, KC_TRNS, KC_TRNS, GAMING + ), /* WIDECOLEMAK + * no mod taps * ,-----------------------------------------------------------------------------------. - * |_NUM(Tab)| Q | W | E | R | T | Y | U | I | O | P | Bksp | + * | Q | W | F | P | B | 🔈+ | J | L | U | Y | : | Ü | * |------+------+------+------+------+------+------+------+------+------+------+------| - * |CTL(Esc)| A | S | D | F | G | H | J | K | L | ; | " | + * | A | R | S | T | G | TAB | M | N | E | I | O | ' | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | + * | Z | X | C | D | V | 🔈- | K | H | , | . | / |!CM-EN| * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | + * |C-CAPS|G-TAB |MN-ESC|_L-BSP| LSFT | _NAV-SPC |_R-ENT|S-DEL |C-TAB |_Na- ←|_Na- →| * `-----------------------------------------------------------------------------------' */ - [_WIDECOLEMAK] = LAYOUT_planck_grid(KC_Q, KC_W, KC_F, KC_P, KC_B, KC_SVU_BU, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, DE_ue, KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB_MPLY, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, KC_Z, KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, TG_COLEMAK, KC_CAPS, LT(_NUM, KC_TAB), LGUI_T(KC_ESC), LT(_LOWER, KC_BSPC), OSM(MOD_LSFT), LT(_NAV, KC_SPC), LT(_NAV, KC_SPC), LT(_RAISE, KC_ENT), RSFT_T(KC_DEL), KC_LALT, LT(_NAV, KC_LEFT), LT(_NAV, KC_RIGHT)), + [_WIDECOLEMAK] = LAYOUT_planck_grid( + KC_Q, KC_W, KC_F, KC_P, KC_B, KC_SVU_BU, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, DE_ue, + KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB_MPLY, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, + KC_Z, KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, TG_COLEMAK, + LCTL_T(KC_CAPS), LGUI_T(KC_TAB), M_ESCM, LT(_LOWER_DE, KC_BSPC), OSM(MOD_LSFT), LT(_NAV, KC_SPC), LT(_NAV, KC_SPC), LT(_RAISE, KC_ENT), RSFT_T(KC_DEL), KC_LALT, LT(_NAV, KC_LEFT), LT(_NAV, KC_RIGHT) + ), - [_LOWER] = LAYOUT_planck_grid(KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_TILD, KC_CIRC, KC_AMPR, KC_ASTR, TD(TD_PRN), KC_RPRN, DE_OE, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, DE_SZ, KC_UNDS, KC_PLUS, TD(TD_CBR), KC_RCBR, DE_AE, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, KC_SLSH, KC_NUBS, LSFT(KC_NUBS), KC_CURRENCY, DE_EGRAVE, TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_DOWN, KC_UP), + /* _LOWER + * ,-----------------------------------------------------------------------------------. + * | ! | @ | # | $ | % | ~ | ^ | & | * | ( | ) | Ö | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | F1 | F2 | F3 | F4 | F5 | F6 | ß | _ | + | { | } | Ä | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | F7 | F8 | F9 | F10 | F11 | F12 | ▶⏸ | / | \ | | | € | è | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |!MOUSE| ____ | ____ | ____ | ____ | ____ | ____ | 🔈- | 🔈+ | ↓ | ↑ | + * `-----------------------------------------------------------------------------------' + */ + [_LOWER] = LAYOUT_planck_grid( + KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_TILD, KC_CIRC, KC_AMPR, KC_ASTR, TD(TD_PRN), KC_RPRN, DE_OE, + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, DE_SZ, KC_UNDS, KC_PLUS, TD(TD_CBR), KC_RCBR, DE_AE, + KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, KC_SLSH, KC_NUBS, LSFT(KC_NUBS), KC_CURRENCY, DE_EGRAVE, + TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_DOWN, KC_UP + ), - [_LOWER_DE] = LAYOUT_planck_grid(KC_EXLM, RALT(KC_Q), KC_BSLS, KC_DLR, KC_PERC, RALT(KC_RBRC), KC_GRV, KC_CIRC, KC_RCBR, TD(TD_PRN_DE), KC_LPRN, LSFT(KC_SCLN), KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, LSFT(KC_SLSH), KC_RBRC, TD(TD_CBR_DE), RALT(KC_0), LSFT(KC_QUOT), KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, LSFT(KC_7), KC_NUBS, LSFT(KC_NUBS), KC_CURRENCY, KC_PLUS, TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_DOWN, KC_UP), + /* _LOWER_DE + * ,-----------------------------------------------------------------------------------. + * | ! | @ | # | $ | % | ~ | ^ | & | * | ( | ) | Ö | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | F1 | F2 | F3 | F4 | F5 | F6 | ß | _ | + | { | } | Ä | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | F7 | F8 | F9 | F10 | F11 | F12 | ▶⏸ | / | < | > | € | ` | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |!MOUSE| ____ | ____ | ____ | ____ | ____ | ____ | 🔈- | 🔈+ | ↓ | ↑ | + * `-----------------------------------------------------------------------------------' + */ + [_LOWER_DE] = LAYOUT_planck_grid( + KC_EXLM, RALT(KC_Q), KC_BSLS, KC_DLR, KC_PERC, RALT(KC_RBRC), KC_GRV, KC_CIRC, KC_RCBR, TD(TD_PRN_DE), KC_LPRN, LSFT(KC_SCLN), + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, LSFT(KC_SLSH), KC_RBRC, TD(TD_CBR_DE), RALT(KC_0), LSFT(KC_QUOT), + KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, LSFT(KC_7), KC_NUBS, LSFT(KC_NUBS), KC_CURRENCY, KC_PLUS, + TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_DOWN, KC_UP + ), - [_RAISE] = LAYOUT_planck_grid(KC_1, KC_2, KC_3, KC_4, KC_5, KC_GRV, KC_6, KC_7, KC_8, KC_9, KC_0, DE_oe, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, DE_SZ, KC_MINS, KC_EQL, TD(TD_BRC), KC_RBRC, DE_ae, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, KC_BSLS, KC_COMM, KC_DOT, KC_SLSH, DE_EAIGU, TG(_MOUSE), KC_TRNS, KC_BSPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_DOWN, KC_UP), + /* _RAISE + * ,-----------------------------------------------------------------------------------. + * | 1 | 2 | 3 | 4 | 5 | ` | 6 | 7 | 8 | 9 | 0 | ö | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | F1 | F2 | F3 | F4 | F5 | F6 | ß | - | = | [ | ] | ä | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | F7 | F8 | F9 | F10 | F11 | F12 | ▶⏸ | \ | , | . | / | é | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |!MOUSE| ____ | ____ | BSPC | ____ | ____ | ____ | ⏮️ | ⏭️ | ↓ | ↑ | + * `-----------------------------------------------------------------------------------' + */ + [_RAISE] = LAYOUT_planck_grid( + KC_1, KC_2, KC_3, KC_4, KC_5, KC_GRV, KC_6, KC_7, KC_8, KC_9, KC_0, DE_oe, + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, DE_SZ, KC_MINS, KC_EQL, TD(TD_BRC), KC_RBRC, DE_ae, + KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, KC_BSLS, KC_COMM, KC_DOT, KC_SLSH, DE_EAIGU, + TG(_MOUSE), KC_TRNS, KC_BSPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_DOWN, KC_UP + ), - [_RAISE_DE] = LAYOUT_planck_grid(KC_1, KC_2, KC_3, KC_4, KC_5, LSFT(KC_GRV), KC_6, KC_7, KC_8, KC_9, KC_0, KC_SCLN, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_SLSH, LSFT(KC_0), TD(TD_BRC_DE), RALT(KC_9), KC_QUOT, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, RALT(KC_MINS), KC_COMM, KC_DOT, KC_SLSH, KC_EQL, TG(_MOUSE), KC_TRNS, KC_BSPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_DOWN, KC_UP), + /* _RAISE_DE + * ,-----------------------------------------------------------------------------------. + * | 1 | 2 | 3 | 4 | 5 | ` | 6 | 7 | 8 | 9 | 0 | ö | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | F1 | F2 | F3 | F4 | F5 | F6 | ß | - | = | [ | ] | ä | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | F7 | F8 | F9 | F10 | F11 | F12 | ▶⏸ | \ | , | . | - | ´ | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |!MOUSE| ____ | ____ | BSPC | ____ | ____ | ____ | ⏮️ | ⏭️ | ↓ | ↑ | + * `-----------------------------------------------------------------------------------' + */ + [_RAISE_DE] = LAYOUT_planck_grid( + KC_1, KC_2, KC_3, KC_4, KC_5, LSFT(KC_GRV), KC_6, KC_7, KC_8, KC_9, KC_0, KC_SCLN, + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_SLSH, LSFT(KC_0), TD(TD_BRC_DE), RALT(KC_9), KC_QUOT, + KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, RALT(KC_MINS), KC_COMM, KC_DOT, KC_SLSH, KC_EQL, + TG(_MOUSE), KC_TRNS, KC_BSPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_DOWN, KC_UP + ), - [_ADJUST] = LAYOUT_planck_grid(LALT(KC_LSFT), RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DE_SWITCH, LALT(KC_GRV), EEP_RST, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, HRWIDECOLEMAK, WIDECOLEMAK, LALT(KC_GRV), LANG_SWITCH, GAMING, KC_TRNS, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, KC_SVD_BD, KC_MPLY, KC_SVU_BU, KC_TRNS, , KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, EEPROM_RESET), + /* _ADJUST + * ,-----------------------------------------------------------------------------------. + * | A-SFT| RESET| DEBUG|RGBTOG|RGBMOD|RGBHUI|RGBHUD|RGBSAI|RGBSAD|RGBVAI|RGBVAD| DE_SW| + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | A-GRV|EEPRST|MU_MOD| AU_ON|AU_OFF|AGNORM|AGSWAP|!HRWCM| !WCM | A-GRV| !LANG| !GAME| + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | ____ |MUV_DE|MUV_IN| MU_ON|MU_OFF| MI_ON|MI_OFF| 🔈- | ▶⏸ | 🔈+ | ____ | ____ | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ |EEPRST| + * `-----------------------------------------------------------------------------------' + */ + [_ADJUST] = LAYOUT_planck_grid( + LALT(KC_LSFT), RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DE_SWITCH, + LALT(KC_GRV), EEP_RST, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, HRWIDECOLEMAK, WIDECOLEMAK, LALT(KC_GRV), LANG_SWITCH, GAMING, + KC_TRNS, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, KC_SVD_BD, KC_MPLY, KC_SVU_BU, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, EEPROM_RESET + ), - [_NAV] = LAYOUT_planck_grid(ALT_TAB, LCTL(KC_RGHT), LANG_SWITCH, LALT(KC_GRV), LCTL(KC_LEFT), KC_MNXT, KC_HOME, KC_RIGHT, KC_PGUP, LCTL(KC_INS), LSFT(KC_INS), KC_DE_SWITCH, CTL_TAB, KC_TAB, KC_ESC, KC_ENT, TD(TD_VIM_GG), KC_MPLY, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_END, VIM_O, KC_LSFT, KC_NO, LCTL(KC_X), KC_CAPS, VIM_V, KC_MUTE, KC_HOME, KC_PGDN, KC_LSFT, KC_RSFT, LCTL(KC_F), LCTL(KC_F), KC_NO, KC_NO, KC_TRNS, KC_BSPC, KC_TRNS, LT(_NAV, KC_SPC), LT(_NAV, KC_SPC), KC_ENT, KC_DEL, KC_TRNS, KC_DOWN, KC_UP), + /* _NAV + * ,-----------------------------------------------------------------------------------. + * |A(TAB)| C(→) | !LANG|A(GRV)| C(←) | ⏭️ | HOME | → | PGUP | COPY | PASTE| DE_SW| + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |C(TAB)| TAB | ESC | ENT |VIM_GG| ▶⏸ | ← | ↓ | ↑ | → | END | VIM_O| + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | LSFT | XXXX |S(DEL)| CAPS | VIM_V| 🔇 | HOME | PGDN | LSFT | RFST | C(F) | C(F) | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | XXXX | XXXX | ____ | BSPC | ____ | ____ | ENT | DEL | ____ | ↓ | ↑ | + * `-----------------------------------------------------------------------------------' + */ + [_NAV] = LAYOUT_planck_grid( + ALT_TAB, LCTL(KC_RGHT), LANG_SWITCH, LALT(KC_GRV), LCTL(KC_LEFT), KC_MNXT, KC_HOME, KC_RIGHT, KC_PGUP, LCTL(KC_INS), LSFT(KC_INS), KC_DE_SWITCH, + CTL_TAB, KC_TAB, KC_ESC, KC_ENT, TD(TD_VIM_GG), KC_MPLY, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_END, VIM_O, + KC_LSFT, KC_NO, LSFT(KC_DEL), KC_CAPS, VIM_V, KC_MUTE, KC_HOME, KC_PGDN, KC_LSFT, KC_RSFT, LCTL(KC_F), LCTL(KC_F), + KC_NO, KC_NO, KC_TRNS, KC_BSPC, KC_TRNS, LT(_NAV, KC_SPC), LT(_NAV, KC_SPC), KC_ENT, KC_DEL, KC_TRNS, KC_DOWN, KC_UP + ), - [_VIM] = LAYOUT_planck_grid(ALT_TAB, LCTL(KC_RGHT), LANG_SWITCH, LALT(KC_GRV), LCTL(KC_LEFT), KC_MNXT, KC_HOME, KC_RIGHT, KC_PGUP, LCTL(KC_C), KC_RGUI, KC_DE_SWITCH, CTL_TAB, KC_TAB, KC_ESC, KC_ENT, TD(TD_VIM_GG), KC_MPLY, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_END, VIM_O, KC_LSFT, KC_NO, LCTL(KC_X), KC_CAPS, VIM_V, KC_MUTE, KC_HOME, KC_PGDN, KC_LSFT, KC_RSFT, LCTL(KC_F), LCTL(KC_F), KC_NO, KC_NO, TG(_VIM), KC_BSPC, KC_TRNS, LT(_NAV, KC_SPC), LT(_NAV, KC_SPC), KC_ENT, KC_DEL, KC_TRNS, KC_DOWN, KC_UP), + /* _VIM + * ,-----------------------------------------------------------------------------------. + * |A(TAB)| C(→) | !LANG|A(GRV)| C(←) | ⏭️ | HOME | → | PGUP | COPY | PASTE| DE_SW| + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |C(TAB)| TAB | ESC | ENT |VIM_GG| ▶⏸ | ← | ↓ | ↑ | → | END | VIM_O| + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | LSFT | XXXX |S(DEL)| CAPS | VIM_V| 🔇 | HOME | PGDN | LSFT | RFST | C(F) | C(F) | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | XXXX | XXXX | !VIM | BSPC | ____ | ____ | ENT | DEL | ____ | ↓ | ↑ | + * `-----------------------------------------------------------------------------------' + */ + [_VIM] = LAYOUT_planck_grid( + ALT_TAB, LCTL(KC_RGHT), LANG_SWITCH, LALT(KC_GRV), LCTL(KC_LEFT), KC_MNXT, KC_HOME, KC_RIGHT, KC_PGUP, LCTL(KC_INS), LSFT(KC_INS), KC_DE_SWITCH, + CTL_TAB, KC_TAB, KC_ESC, KC_ENT, TD(TD_VIM_GG), KC_MPLY, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_END, VIM_O, + KC_LSFT, KC_NO, LSFT(KC_DEL), KC_CAPS, VIM_V, KC_MUTE, KC_HOME, KC_PGDN, KC_LSFT, KC_RSFT, LCTL(KC_F), LCTL(KC_F), + KC_NO, KC_NO, TG(_VIM), KC_BSPC, KC_TRNS, LT(_NAV, KC_SPC), LT(_NAV, KC_SPC), KC_ENT, KC_DEL, KC_TRNS, KC_DOWN, KC_UP + ), - [_NUM] = LAYOUT_planck_grid(KC_F1, KC_F2, KC_F3, KC_F4, KC_MPRV, KC_NLCK, KC_MNXT, KC_P7, KC_P8, KC_P9, KC_MINS, KC_TRNS, KC_F5, KC_F6, KC_F7, KC_F8, KC_VOLU, KC_MPLY, KC_ASTR, KC_P4, KC_P5, KC_P6, KC_PLUS, KC_DOT, KC_F9, KC_F10, KC_F11, KC_F12, KC_VOLD, KC_MUTE, KC_EQL, KC_P1, KC_P2, KC_P3, KC_SLSH, KC_COMM, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P0, KC_DOT, KC_COMM, KC_EQL, KC_TRNS), + /* _NUM + * ,-----------------------------------------------------------------------------------. + * | F1 | F2 | F3 | F4 | ⏮️ |NUMLCK| ⏭️ | 7 | 8 | 9 | - | ____ | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | F5 | F6 | F7 | F8 | 🔊 | ▶⏸ | * | 4 | 5 | 6 | + | . | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | F9 | F10 | F11 | F12 | 🔉 | 🔇 | = | 1 | 2 | 3 | / | , | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | ____ | ____ | ____ | ____ | ____ | ____ | 0 | . | , | = | ____ | + * `-----------------------------------------------------------------------------------' + */ + [_NUM] = LAYOUT_planck_grid( + KC_F1, KC_F2, KC_F3, KC_F4, KC_MPRV, KC_NLCK, KC_MNXT, KC_P7, KC_P8, KC_P9, KC_MINS, KC_TRNS, + KC_F5, KC_F6, KC_F7, KC_F8, KC_VOLU, KC_MPLY, KC_ASTR, KC_P4, KC_P5, KC_P6, KC_PLUS, KC_DOT, + KC_F9, KC_F10, KC_F11, KC_F12, KC_VOLD, KC_MUTE, KC_EQL, KC_P1, KC_P2, KC_P3, KC_SLSH, KC_COMM, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P0, KC_DOT, KC_COMM, KC_EQL, KC_TRNS + ), - [_MOUSE] = LAYOUT_planck_grid(KC_NO, KC_NO, KC_BTN4, KC_BTN5, KC_NO, KC_BRIU, KC_NO, KC_WH_U, KC_MS_U, KC_WH_U, KC_NO, KC_NO, KC_NO, KC_BTN3, KC_BTN2, KC_BTN1, KC_NO, KC_MPLY, KC_NO, KC_MS_L, KC_MS_D, KC_MS_R, KC_NO, KC_NO, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_BRID, KC_NO, KC_WH_D, KC_NO, KC_NO, KC_TRNS, KC_NO, TG(_MOUSE), KC_NO, KC_NO, KC_TRNS, KC_NO, KC_ACL2, KC_ACL2, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO) + /* _MOUSE + * ,-----------------------------------------------------------------------------------. + * | XXXX | XXXX | MBTN4| MBTN5| XXXX | 🔆+ | XXXX | MWHL↑|MOUSE↑| MWHL↑| XXXX | XXXX | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | XXXX | MBTN3| MBTN2| MBTN1| XXXX | ▶⏸ | XXXX |MOUSE←|MOUSE↓|MOUSE→| XXXX | XXXX | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | F9 | XXXX | XXXX | XXXX | XXXX | 🔆- | XXXX | MWHL↓| XXXX | XXXX | ____ | XXXX | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |!MOUSE| XXXX | XXXX | ____ | XXXX | MOUSEACCEL 2| ____ | XXXX | XXXX | XXXX | XXXX | + * `-----------------------------------------------------------------------------------' + */ + [_MOUSE] = LAYOUT_planck_grid( + KC_NO, KC_NO, KC_BTN4, KC_BTN5, KC_NO, KC_BRIU, KC_NO, KC_WH_U, KC_MS_U, KC_WH_U, KC_NO, KC_NO, + KC_NO, KC_BTN3, KC_BTN2, KC_BTN1, KC_NO, KC_MPLY, KC_NO, KC_MS_L, KC_MS_D, KC_MS_R, KC_NO, KC_NO, + KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_BRID, KC_NO, KC_WH_D, KC_NO, KC_NO, KC_TRNS, KC_NO, + TG(_MOUSE), KC_NO, KC_NO, KC_TRNS, KC_NO, KC_ACL2, KC_ACL2, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO + ) }; @@ -316,7 +515,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { if (get_mods() & MOD_MASK_SHIFT) { register_code(KC_BRIU); - } else if (get_mods() & MOD_MASK_SHIFT) { + } else if (get_mods() & MOD_MASK_CTRL) { register_code(KC_MNXT); } else { register_code(KC_VOLU); @@ -331,7 +530,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { if (get_mods() & MOD_MASK_SHIFT) { register_code(KC_BRID); - } else if (get_mods() & MOD_MASK_SHIFT) { + } else if (get_mods() & MOD_MASK_CTRL) { register_code(KC_MPRV); } else { register_code(KC_VOLD); @@ -688,9 +887,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case M_RGUI_SCLN: if (record->event.pressed) { key_timer = timer_read(); - add_mods(MOD_RGUI); + add_mods(MOD_BIT(KC_RGUI)); } else { - del_mods(MOD_RGUI); + del_mods(MOD_BIT(KC_RGUI)); if (timer_elapsed(key_timer) < (TAPPING_TERM * pinky_factor)) { uint8_t temp_mods = get_mods() | get_oneshot_mods(); if (temp_mods & MOD_MASK_SHIFT) { From 42f708b5b7300eec6a87931b871bc6bc9ce0baa6 Mon Sep 17 00:00:00 2001 From: Jakob Weickmann Date: Sat, 18 Sep 2021 00:17:52 +0200 Subject: [PATCH 17/31] added official shorthand for key combinations in macros and replaced mod_xxx with mod_bit(kc_xxx) as they did not behave in the same way --- keyboards/planck/keymaps/jweickm/keymap.c | 72 ++++++++++------------- 1 file changed, 30 insertions(+), 42 deletions(-) diff --git a/keyboards/planck/keymaps/jweickm/keymap.c b/keyboards/planck/keymaps/jweickm/keymap.c index c6d2c466860c..fe044e09daf9 100644 --- a/keyboards/planck/keymaps/jweickm/keymap.c +++ b/keyboards/planck/keymaps/jweickm/keymap.c @@ -329,39 +329,27 @@ void dance_prn_de(qk_tap_dance_state_t *state, void *user_data) { } void dance_brc_de(qk_tap_dance_state_t *state, void *user_data) { if (state->count == 1) { - add_mods(MOD_BIT(KC_RALT)); - tap_code(KC_8); - unregister_mods(MOD_BIT(KC_RALT)); + tap_code16(RALT(KC_8)); } else { - add_mods(MOD_BIT(KC_RALT)); - tap_code(KC_8); - tap_code(KC_9); - unregister_mods(MOD_BIT(KC_RALT)); + tap_code16(RALT(KC_8)); + tap_code16(RALT(KC_9)); tap_code(KC_LEFT); } } void dance_cbr_de(qk_tap_dance_state_t *state, void *user_data) { if (state->count == 1) { - add_mods(MOD_BIT(KC_RALT)); - tap_code16(KC_7); - unregister_mods(MOD_BIT(KC_RALT)); + tap_code16(RALT(KC_7)); } else { - add_mods(MOD_BIT(KC_RALT)); - tap_code(KC_7); - tap_code(KC_0); - unregister_mods(MOD_BIT(KC_RALT)); + tap_code16(RALT(KC_7)); + tap_code16(RALT(KC_0)); tap_code(KC_LEFT); } } void vim_gg(qk_tap_dance_state_t *state, void *user_data) { if (state->count == 1) { - register_mods(MOD_LCTL); - tap_code(KC_END); - unregister_mods(MOD_LCTL); + tap_code16(LCTL(KC_END)); } else { - register_mods(MOD_LCTL); - tap_code(KC_HOME); - unregister_mods(MOD_LCTL); + tap_code16(LCTL(KC_HOME)); } } @@ -557,7 +545,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { if (!is_alt_tab_active) { is_alt_tab_active = true; - add_mods(MOD_LALT); + add_mods(MOD_BIT(KC_LALT)); } register_code(KC_TAB); } else { @@ -568,7 +556,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { if (!is_ctl_tab_active) { is_ctl_tab_active = true; - add_mods(MOD_LCTL); + add_mods(MOD_BIT(KC_LCTL)); } register_code(KC_TAB); } else { @@ -591,14 +579,14 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if ((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) { clear_oneshot_mods(); clear_mods(); - add_mods(MOD_LALT); + add_mods(MOD_BIT(KC_LALT)); tap_code(KC_P0); tap_code(KC_P1); tap_code(KC_P9); tap_code(KC_P6); // Ä } else { clear_mods(); - add_mods(MOD_LALT); + add_mods(MOD_BIT(KC_LALT)); tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P2); @@ -614,7 +602,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { uint8_t temp_mods = get_mods() | get_oneshot_mods(); clear_oneshot_mods(); clear_mods(); - add_mods(MOD_LALT); + add_mods(MOD_BIT(KC_LALT)); tap_code(KC_P0); tap_code(KC_P1); tap_code(KC_P9); @@ -630,14 +618,14 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if ((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) { clear_oneshot_mods(); clear_mods(); - add_mods(MOD_LALT); + add_mods(MOD_BIT(KC_LALT)); tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P1); tap_code(KC_P4); // Ö } else { clear_mods(); - add_mods(MOD_LALT); + add_mods(MOD_BIT(KC_LALT)); tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P4); @@ -653,7 +641,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { uint8_t temp_mods = get_mods() | get_oneshot_mods(); clear_oneshot_mods(); clear_mods(); - add_mods(MOD_LALT); + add_mods(MOD_BIT(KC_LALT)); tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P1); @@ -669,14 +657,14 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if ((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) { clear_oneshot_mods(); clear_mods(); - add_mods(MOD_LALT); + add_mods(MOD_BIT(KC_LALT)); tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P2); tap_code(KC_P0); // Ü } else { clear_mods(); - add_mods(MOD_LALT); + add_mods(MOD_BIT(KC_LALT)); tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P5); @@ -721,14 +709,14 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if ((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) { clear_oneshot_mods(); clear_mods(); - add_mods(MOD_LALT); + add_mods(MOD_BIT(KC_LALT)); tap_code(KC_P0); tap_code(KC_P1); tap_code(KC_P7); tap_code(KC_P6); // ° } else { clear_mods(); - add_mods(MOD_LALT); + add_mods(MOD_BIT(KC_LALT)); tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P2); @@ -745,14 +733,14 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if ((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) { clear_oneshot_mods(); clear_mods(); - add_mods(MOD_LALT); + add_mods(MOD_BIT(KC_LALT)); tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P0); tap_code(KC_P0); // È } else { clear_mods(); - add_mods(MOD_LALT); + add_mods(MOD_BIT(KC_LALT)); tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P3); @@ -769,14 +757,14 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if ((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) { clear_oneshot_mods(); clear_mods(); - add_mods(MOD_LALT); + add_mods(MOD_BIT(KC_LALT)); tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P0); tap_code(KC_P1); // É } else { clear_mods(); - add_mods(MOD_LALT); + add_mods(MOD_BIT(KC_LALT)); tap_code(KC_P0); tap_code(KC_P2); tap_code(KC_P3); @@ -793,13 +781,13 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if ((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) { clear_oneshot_mods(); clear_mods(); - add_mods(MOD_LALT); + add_mods(MOD_BIT(KC_LALT)); tap_code(KC_P1); tap_code(KC_P5); tap_code(KC_P7); // ¥ } else { clear_mods(); - add_mods(MOD_LALT); + add_mods(MOD_BIT(KC_LALT)); tap_code(KC_P0); tap_code(KC_P1); tap_code(KC_P2); @@ -848,9 +836,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (temp_mods & MOD_MASK_SHIFT) { tap_code(KC_DOT); // ; } else { - add_mods(MOD_LSFT); + add_mods(MOD_BIT(KC_LSFT)); tap_code(KC_COMM); // : - del_mods(MOD_LSFT); + del_mods(MOD_BIT(KC_LSFT)); } return false; } @@ -895,9 +883,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (temp_mods & MOD_MASK_SHIFT) { tap_code(KC_DOT); // ; } else { - add_mods(MOD_LSFT); + add_mods(MOD_BIT(KC_LSFT)); tap_code(KC_COMM); // : - del_mods(MOD_LSFT); + del_mods(MOD_BIT(KC_LSFT)); } } else { tap_code(KC_RGUI); From 182e9d5fd91557cd22953d156853d7a260e21857 Mon Sep 17 00:00:00 2001 From: Jakob Weickmann <57487288+jweickm@users.noreply.github.com> Date: Sat, 18 Sep 2021 09:13:33 +0200 Subject: [PATCH 18/31] Update muse section of keymap.c (Feedback by drashna) Co-authored-by: Drashna Jaelre --- keyboards/planck/keymaps/jweickm/keymap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/planck/keymaps/jweickm/keymap.c b/keyboards/planck/keymaps/jweickm/keymap.c index fe044e09daf9..ff5b21593320 100644 --- a/keyboards/planck/keymaps/jweickm/keymap.c +++ b/keyboards/planck/keymaps/jweickm/keymap.c @@ -903,7 +903,7 @@ uint16_t muse_counter = 0; uint8_t muse_offset = 70; uint16_t muse_tempo = 50; -bool encoder_update(bool clockwise) { +bool encoder_update_user(uint8_t index, bool clockwise) { if (muse_mode) { if (IS_LAYER_ON(_RAISE)) { if (clockwise) { From 25b4c80d5d04282a809f96a1d1252130e9fbb1e3 Mon Sep 17 00:00:00 2001 From: Jakob Weickmann <57487288+jweickm@users.noreply.github.com> Date: Sat, 18 Sep 2021 09:14:36 +0200 Subject: [PATCH 19/31] Remove `#include "quantum.h"` from keymap.c (Feedback by drashna) Co-authored-by: Drashna Jaelre --- keyboards/planck/keymaps/jweickm/keymap.c | 1 - 1 file changed, 1 deletion(-) diff --git a/keyboards/planck/keymaps/jweickm/keymap.c b/keyboards/planck/keymaps/jweickm/keymap.c index ff5b21593320..fff548c63954 100644 --- a/keyboards/planck/keymaps/jweickm/keymap.c +++ b/keyboards/planck/keymaps/jweickm/keymap.c @@ -16,7 +16,6 @@ */ #include QMK_KEYBOARD_H #include "muse.h" -#include "quantum.h" enum planck_layers { _HRWIDECOLEMAK, From 2c54cbd9b6cf6abec4628ae33874a4335754934f Mon Sep 17 00:00:00 2001 From: Jakob Weickmann <57487288+jweickm@users.noreply.github.com> Date: Sat, 18 Sep 2021 09:15:16 +0200 Subject: [PATCH 20/31] Remove redundancy from config.h (Feedback from drashna) Co-authored-by: Drashna Jaelre --- keyboards/planck/keymaps/jweickm/config.h | 132 ---------------------- 1 file changed, 132 deletions(-) diff --git a/keyboards/planck/keymaps/jweickm/config.h b/keyboards/planck/keymaps/jweickm/config.h index af59e4532b1e..192b2607898e 100644 --- a/keyboards/planck/keymaps/jweickm/config.h +++ b/keyboards/planck/keymaps/jweickm/config.h @@ -16,138 +16,6 @@ * along with this program. If not, see . */ -#ifndef REV6_CONFIG_H -#define REV6_CONFIG_H - -/* USB Device descriptor parameter */ -#define PRODUCT_ID 0xA4F9 -#define DEVICE_VER 0x0006 - -#undef MATRIX_ROWS -#undef MATRIX_COLS -/* key matrix size */ -#define MATRIX_ROWS 8 -#define MATRIX_COLS 6 - -/* - * Keyboard Matrix Assignments - * - * Change this to how you wired your keyboard - * COLS: AVR pins used for columns, left to right - * ROWS: AVR pins used for rows, top to bottom - * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) - * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) - * -*/ -/* Note: These are not used for arm boards. They're here purely as documentation. */ -#undef MATRIX_ROW_PINS -#undef MATRIX_COL_PINS - -#define MATRIX_ROW_PINS { A10, A9, A8, B15, C13, C14, C15, A2 } -#define MATRIX_COL_PINS { B11, B10, B2, B1, A7, B0 } - -#define UNUSED_PINS - -#define ENCODERS_PAD_A { B12 } -#define ENCODERS_PAD_B { B13 } - -#define DIP_SWITCH_PINS { B14, A15, A0, B9 } - -#define MUSIC_MAP -#undef AUDIO_VOICES -#undef AUDIO_PIN -#define AUDIO_PIN A5 -#define AUDIO_PIN_ALT A4 -#define AUDIO_PIN_ALT_AS_NEGATIVE - -/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ -// #define DEBOUNCE 6 - -/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ -//#define LOCKING_SUPPORT_ENABLE -/* Locking resynchronize hack */ -//#define LOCKING_RESYNC_ENABLE - -/* - * Force NKRO - * - * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved - * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the - * makefile for this to work.) - * - * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) - * until the next keyboard reset. - * - * NKRO may prevent your keystrokes from being detected in the BIOS, but it is - * fully operational during normal computer usage. - * - * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) - * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by - * bootmagic, NKRO mode will always be enabled until it is toggled again during a - * power-up. - * - */ -//#define FORCE_NKRO - -/* - * Feature disable options - * These options are also useful to firmware size reduction. - */ - -/* disable debug print */ -//#define NO_DEBUG - -/* disable print */ -//#define NO_PRINT - -/* disable action features */ -//#define NO_ACTION_LAYER -//#define NO_ACTION_TAPPING -//#define NO_ACTION_ONESHOT -//#define NO_ACTION_MACRO -//#define NO_ACTION_FUNCTION - -/* - * 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 - -/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ -//#define MIDI_TONE_KEYCODE_OCTAVES 1 - - -/* - * WS2812 Underglow Matrix options - */ -#define RGB_DI_PIN A1 -#define RGBLED_NUM 9 -#define DRIVER_LED_TOTAL RGBLED_NUM - -#define WS2812_PWM_DRIVER PWMD2 -#define WS2812_PWM_CHANNEL 2 -#define WS2812_PWM_PAL_MODE 1 -#define WS2812_DMA_STREAM STM32_DMA1_STREAM2 -#define WS2812_DMA_CHANNEL 2 - -#ifndef RGB_DISABLE_WHEN_USB_SUSPENDED -# define RGB_DISABLE_WHEN_USB_SUSPENDED true -#endif - -#endif - -#define RGBLIGHT_LAYERS #pragma once From 2542d1de2611fdd3d41a933c474d5a8ffdbc6cfe Mon Sep 17 00:00:00 2001 From: Jakob Weickmann <57487288+jweickm@users.noreply.github.com> Date: Sat, 18 Sep 2021 09:16:19 +0200 Subject: [PATCH 21/31] Remove redundancies from rules.mk (Feedback from drashna) Co-authored-by: Drashna Jaelre --- keyboards/planck/keymaps/jweickm/rules.mk | 36 ----------------------- 1 file changed, 36 deletions(-) diff --git a/keyboards/planck/keymaps/jweickm/rules.mk b/keyboards/planck/keymaps/jweickm/rules.mk index bab7b817c451..4d6ad3b7e7b6 100644 --- a/keyboards/planck/keymaps/jweickm/rules.mk +++ b/keyboards/planck/keymaps/jweickm/rules.mk @@ -1,39 +1,3 @@ -# MCU name -MCU = STM32F303 -BOARD = QMK_PROTON_C - -# Bootloader selection -BOOTLOADER = stm32-dfu - -# Build Options -# change to "no" to disable the options, or define them in the Makefile in -# the appropriate keymap folder that will get included automatically -# -BOOTMAGIC_ENABLE = lite # Enable Bootmagic Lite -MOUSEKEY_ENABLE = yes # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = no # Console for debug -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 -UNICODE_ENABLE = no # Unicode -BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID -RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. -WS2812_DRIVER = pwm -API_SYSEX_ENABLE = no TAP_DANCE_ENABLE = yes # enable tap dance functionality -# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE -SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend - -RGB_MATRIX_ENABLE = no -RGB_MATRIX_DRIVER = WS2812 -ENCODER_ENABLE = yes -DIP_SWITCH_ENABLE = yes - -LAYOUTS = ortho_4x12 planck_mit -LAYOUTS_HAS_RGB = no - SRC += muse.c From 47a3351070ddaeca0955db5738c86ff31eae2872 Mon Sep 17 00:00:00 2001 From: Jakob Weickmann Date: Sat, 18 Sep 2021 09:27:30 +0200 Subject: [PATCH 22/31] removed dulicate line in config.h, disabled `console_enable` in rules.mk --- keyboards/planck/keymaps/jweickm/config.h | 1 - keyboards/planck/keymaps/jweickm/rules.mk | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/keyboards/planck/keymaps/jweickm/config.h b/keyboards/planck/keymaps/jweickm/config.h index 192b2607898e..1fa25c51e190 100644 --- a/keyboards/planck/keymaps/jweickm/config.h +++ b/keyboards/planck/keymaps/jweickm/config.h @@ -1,4 +1,3 @@ -#pragma once /* * Copyright 2018 Jack Humbert * diff --git a/keyboards/planck/keymaps/jweickm/rules.mk b/keyboards/planck/keymaps/jweickm/rules.mk index 4d6ad3b7e7b6..0666b96b337b 100644 --- a/keyboards/planck/keymaps/jweickm/rules.mk +++ b/keyboards/planck/keymaps/jweickm/rules.mk @@ -1,3 +1,5 @@ +CONSOLE_ENABLE = no # Console for debug + TAP_DANCE_ENABLE = yes # enable tap dance functionality SRC += muse.c From 7f014ca5aee4461ee751f257ed2b1ae4f428611b Mon Sep 17 00:00:00 2001 From: jweickm Date: Sat, 18 Sep 2021 14:30:57 +0200 Subject: [PATCH 23/31] added back into the config.h --- keyboards/planck/keymaps/jweickm/config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/planck/keymaps/jweickm/config.h b/keyboards/planck/keymaps/jweickm/config.h index 1fa25c51e190..195b844282e7 100644 --- a/keyboards/planck/keymaps/jweickm/config.h +++ b/keyboards/planck/keymaps/jweickm/config.h @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - +#define RGBLIGHT_LAYERS #pragma once From df0d420283d2820424d2235ab2b76d331851f162 Mon Sep 17 00:00:00 2001 From: jweickm Date: Sat, 18 Sep 2021 16:36:56 +0200 Subject: [PATCH 24/31] removed most unicode from ascii art added kc_ralt to try out wincompose --- keyboards/planck/keymaps/jweickm/config.h | 10 ++- keyboards/planck/keymaps/jweickm/keymap.c | 94 ++++++++++++++--------- keyboards/planck/keymaps/jweickm/qmk-vim | 1 + keyboards/planck/keymaps/jweickm/rules.mk | 2 +- 4 files changed, 67 insertions(+), 40 deletions(-) create mode 160000 keyboards/planck/keymaps/jweickm/qmk-vim diff --git a/keyboards/planck/keymaps/jweickm/config.h b/keyboards/planck/keymaps/jweickm/config.h index 195b844282e7..3870b5c0e96f 100644 --- a/keyboards/planck/keymaps/jweickm/config.h +++ b/keyboards/planck/keymaps/jweickm/config.h @@ -57,14 +57,16 @@ // Most tactile encoders have detents every 4 stages #define ENCODER_RESOLUTION 4 -//settings for home row mods +// settings for HOME ROW MODS #define TAPPING_TERM 160 // 200 ms is the default value #define TAPPING_TERM_PER_KEY - //#define PERMISSIVE_HOLD - #define IGNORE_MOD_TAP_INTERRUPT - #define TAPPING_FORCE_HOLD_PER_KEY +// settings for LEADER key +#define LEADER_PER_KEY_TIMING +#define LEADER_TIMEOUT 250 +#define LEADER_NO_TIMEOUT + #define RGBLIGHT_SLEEP // RGB lighting will switch off when the host goes to sleep diff --git a/keyboards/planck/keymaps/jweickm/keymap.c b/keyboards/planck/keymaps/jweickm/keymap.c index fff548c63954..4d2e99f7ed41 100644 --- a/keyboards/planck/keymaps/jweickm/keymap.c +++ b/keyboards/planck/keymaps/jweickm/keymap.c @@ -53,46 +53,46 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* _HRWIDECOLEMAK * ,-----------------------------------------------------------------------------------. - * | G-Q | A-W | S-F | C-P |_Num-B|🔈/🔆+|_Num-J| C-L | S-U | A-Y | G-: | Ü | + * | G-Q | A-W | S-F | C-P |_Num-B|Vol/B+|_Num-J| C-L | S-U | A-Y | G-/ | Ü | * |------+------+------+------+------+------+------+------+------+------+------+------| * | A | R | S | T | G | TAB | M | N | E | I | O | ' | * |------+------+------+------+------+------+------+------+------+------+------+------| - * |_Mo-Z | X | C | D | V |🔈/🔆-| K | H | , | . |_Mo-/ | \ | + * |_Mo-Z | X | C | D | V |Vol/B-| K | H | , | . |_Mo-/ | \ | * |------+------+------+------+------+------+------+------+------+------+------+------| - * |C-CAPS|G-TAB |MN-ESC|_L-BSP| LSFT | _Nav-SPC |_R-ENT|S-DEL |C-TAB |_Na- ←|_Na- →| + * |C-CAPS|G-TAB |MN-ESC|_L-BSP| LSFT | _Nav-SPC |_R-ENT|S-DEL | RALT |_Na <-|_Na ->| * `-----------------------------------------------------------------------------------' */ [_HRWIDECOLEMAK] = LAYOUT_planck_grid( LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM, KC_B), KC_SVU_BU, LT(_NUM, KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Y), RGUI_T(KC_SCLN), DE_ue, KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, LT(_MOUSE, KC_Z), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, LT(_MOUSE, KC_SLSH), KC_BSLS, - LCTL_T(KC_CAPS), LGUI_T(KC_TAB), M_ESCM, LT(_LOWER, KC_BSPC), OSM(MOD_LSFT), LT(_NAV, KC_SPC), LT(_NAV, KC_SPC), LT(_RAISE, KC_ENT), RSFT_T(KC_DEL), RCTL_T(KC_TAB), LT(_NAV, KC_LEFT), LT(_NAV, KC_RIGHT) + LCTL_T(KC_CAPS), LGUI_T(KC_TAB), M_ESCM, LT(_LOWER, KC_BSPC), OSM(MOD_LSFT), LT(_NAV, KC_SPC), LT(_NAV, KC_SPC), LT(_RAISE, KC_ENT), RSFT_T(KC_DEL), KC_RALT, LT(_NAV, KC_LEFT), LT(_NAV, KC_RIGHT) ), /* _HRWIDECOLEMAK_DE * same as above, when the PC is set to German layout * ,-----------------------------------------------------------------------------------. - * | G-Q | A-W | S-F | C-P |_Num-B|🔈/🔆+|_Num-J| C-L | S-U | A-Y | G-: | Ü | + * | G-Q | A-W | S-F | C-P |_Num-B|Vol/B+|_Num-J| C-L | S-U | A-Y | G-/ | Ü | * |------+------+------+------+------+------+------+------+------+------+------+------| * | A | R | S | T | G | TAB | M | N | E | I | O | ' | * |------+------+------+------+------+------+------+------+------+------+------+------| - * |_Mo-Z | X | C | D | V |🔈/🔆-| K | H | , | . |_Mo-/ | \ | + * |_Mo-Z | X | C | D | V |Vol/B-| K | H | , | . |_Mo-/ | \ | * |------+------+------+------+------+------+------+------+------+------+------+------| - * |C-CAPS|G-TAB |MN-ESC|_L-BSP| LSFT | _Nav-SPC |_R-ENT|S-DEL |C-TAB |_Na- ←|_Na- →| + * |C-CAPS|G-TAB |MN-ESC|_L-BSP| LSFT | _Nav-SPC |_R-ENT|S-DEL | RALT |_Na <-|_Na ->| * `-----------------------------------------------------------------------------------' */ [_HRWIDECOLEMAK_DE] = LAYOUT_planck_grid( LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM, KC_B), KC_SVU_BU, LT(_NUM, KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Z), M_RGUI_SCLN, KC_LBRC, KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB, KC_M, KC_N, KC_E, KC_I, KC_O, DE_QUOT, LT(_MOUSE, KC_Y), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, DE_SLSH_QUST, DE_BSLS, - LCTL_T(KC_CAPS), LGUI_T(KC_TAB), M_ESCM, LT(_LOWER_DE, KC_BSPC), OSM(MOD_LSFT), LT(_NAV, KC_SPC), LT(_NAV, KC_SPC), LT(_RAISE_DE, KC_ENT), RSFT_T(KC_DEL), RCTL_T(KC_TAB), LT(_NAV, KC_LEFT), LT(_NAV, KC_RIGHT) + LCTL_T(KC_CAPS), LGUI_T(KC_TAB), M_ESCM, LT(_LOWER_DE, KC_BSPC), OSM(MOD_LSFT), LT(_NAV, KC_SPC), LT(_NAV, KC_SPC), LT(_RAISE_DE, KC_ENT), RSFT_T(KC_DEL), KC_RALT, LT(_NAV, KC_LEFT), LT(_NAV, KC_RIGHT) ), /* _GAMING * ,-----------------------------------------------------------------------------------. - * | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | F5 | F8 | F9 | 🔊 | + * | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | F5 | F8 | F9 |Vol/B+| * |------+------+------+------+------+------+------+------+------+------+------+------| - * | TAB | Q | W | E | R | T | Y | U | I | O | P | 🔉 | + * | TAB | Q | W | E | R | T | Y | U | I | O | P |Vol/B-| * |------+------+------+------+------+------+------+------+------+------+------+------| * | LSFT | A | S | D | F | G | H | J | Z | M | ; |_CM-EN| * |------+------+------+------+------+------+------+------+------+------+------+------| @@ -109,13 +109,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* WIDECOLEMAK * no mod taps * ,-----------------------------------------------------------------------------------. - * | Q | W | F | P | B | 🔈+ | J | L | U | Y | : | Ü | + * | Q | W | F | P | B |Vol/B+| J | L | U | Y | / | Ü | * |------+------+------+------+------+------+------+------+------+------+------+------| * | A | R | S | T | G | TAB | M | N | E | I | O | ' | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Z | X | C | D | V | 🔈- | K | H | , | . | / |!CM-EN| + * | Z | X | C | D | V |Vol/B-| K | H | , | . | / |!CM-EN| * |------+------+------+------+------+------+------+------+------+------+------+------| - * |C-CAPS|G-TAB |MN-ESC|_L-BSP| LSFT | _NAV-SPC |_R-ENT|S-DEL |C-TAB |_Na- ←|_Na- →| + * |C-CAPS|G-TAB |MN-ESC|_L-BSP| LSFT | _NAV-SPC |_R-ENT|S-DEL |C-TAB |_Na <-|_Na ->| * `-----------------------------------------------------------------------------------' */ [_WIDECOLEMAK] = LAYOUT_planck_grid( @@ -131,9 +131,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+------+------+------+------+------+------+------| * | F1 | F2 | F3 | F4 | F5 | F6 | ß | _ | + | { | } | Ä | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | F7 | F8 | F9 | F10 | F11 | F12 | ▶⏸ | / | \ | | | € | è | + * | F7 | F8 | F9 | F10 | F11 | F12 | MPLY | / | \ | | | € | è | * |------+------+------+------+------+------+------+------+------+------+------+------| - * |!MOUSE| ____ | ____ | ____ | ____ | ____ | ____ | 🔈- | 🔈+ | ↓ | ↑ | + * |!MOUSE| ____ | ____ | ____ | ____ | ____ | ____ | Vol- | Vol+ | ↓ | ↑ | * `-----------------------------------------------------------------------------------' */ [_LOWER] = LAYOUT_planck_grid( @@ -149,9 +149,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+------+------+------+------+------+------+------| * | F1 | F2 | F3 | F4 | F5 | F6 | ß | _ | + | { | } | Ä | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | F7 | F8 | F9 | F10 | F11 | F12 | ▶⏸ | / | < | > | € | ` | + * | F7 | F8 | F9 | F10 | F11 | F12 | MPLY | / | < | > | € | ` | * |------+------+------+------+------+------+------+------+------+------+------+------| - * |!MOUSE| ____ | ____ | ____ | ____ | ____ | ____ | 🔈- | 🔈+ | ↓ | ↑ | + * |!MOUSE| ____ | ____ | ____ | ____ | ____ | ____ | Vol- | Vol+ | ↓ | ↑ | * `-----------------------------------------------------------------------------------' */ [_LOWER_DE] = LAYOUT_planck_grid( @@ -167,9 +167,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+------+------+------+------+------+------+------| * | F1 | F2 | F3 | F4 | F5 | F6 | ß | - | = | [ | ] | ä | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | F7 | F8 | F9 | F10 | F11 | F12 | ▶⏸ | \ | , | . | / | é | + * | F7 | F8 | F9 | F10 | F11 | F12 | MPLY | \ | , | . | / | é | * |------+------+------+------+------+------+------+------+------+------+------+------| - * |!MOUSE| ____ | ____ | BSPC | ____ | ____ | ____ | ⏮️ | ⏭️ | ↓ | ↑ | + * |!MOUSE| ____ | ____ | BSPC | ____ | ____ | ____ | |<< | >>| | ↓ | ↑ | * `-----------------------------------------------------------------------------------' */ [_RAISE] = LAYOUT_planck_grid( @@ -185,9 +185,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+------+------+------+------+------+------+------| * | F1 | F2 | F3 | F4 | F5 | F6 | ß | - | = | [ | ] | ä | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | F7 | F8 | F9 | F10 | F11 | F12 | ▶⏸ | \ | , | . | - | ´ | + * | F7 | F8 | F9 | F10 | F11 | F12 | MPLY | \ | , | . | - | ´ | * |------+------+------+------+------+------+------+------+------+------+------+------| - * |!MOUSE| ____ | ____ | BSPC | ____ | ____ | ____ | ⏮️ | ⏭️ | ↓ | ↑ | + * |!MOUSE| ____ | ____ | BSPC | ____ | ____ | ____ | |<< | >>| | ↓ | ↑ | * `-----------------------------------------------------------------------------------' */ [_RAISE_DE] = LAYOUT_planck_grid( @@ -203,7 +203,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+------+------+------+------+------+------+------| * | A-GRV|EEPRST|MU_MOD| AU_ON|AU_OFF|AGNORM|AGSWAP|!HRWCM| !WCM | A-GRV| !LANG| !GAME| * |------+------+------+------+------+------+------+------+------+------+------+------| - * | ____ |MUV_DE|MUV_IN| MU_ON|MU_OFF| MI_ON|MI_OFF| 🔈- | ▶⏸ | 🔈+ | ____ | ____ | + * | ____ |MUV_DE|MUV_IN| MU_ON|MU_OFF| MI_ON|MI_OFF| Vol- | MPLY | Vol+ | ____ | ____ | * |------+------+------+------+------+------+------+------+------+------+------+------| * | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ |EEPRST| * `-----------------------------------------------------------------------------------' @@ -217,11 +217,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* _NAV * ,-----------------------------------------------------------------------------------. - * |A(TAB)| C(→) | !LANG|A(GRV)| C(←) | ⏭️ | HOME | → | PGUP | COPY | PASTE| DE_SW| + * |A(TAB)| C(->)| !LANG|A(GRV)| C(<-)| >>| | HOME | -> | PGUP | COPY | PASTE| DE_SW| * |------+------+------+------+------+------+------+------+------+------+------+------| - * |C(TAB)| TAB | ESC | ENT |VIM_GG| ▶⏸ | ← | ↓ | ↑ | → | END | VIM_O| + * |C(TAB)| TAB | ESC | ENT |VIM_GG| MPLY | <- | ↓ | ↑ | -> | END | VIM_O| * |------+------+------+------+------+------+------+------+------+------+------+------| - * | LSFT | XXXX |S(DEL)| CAPS | VIM_V| 🔇 | HOME | PGDN | LSFT | RFST | C(F) | C(F) | + * | LSFT | XXXX |S(DEL)| CAPS | VIM_V| MUTE | HOME | PGDN | LSFT | RFST | C(F) | C(F) | * |------+------+------+------+------+------+------+------+------+------+------+------| * | XXXX | XXXX | ____ | BSPC | ____ | ____ | ENT | DEL | ____ | ↓ | ↑ | * `-----------------------------------------------------------------------------------' @@ -235,11 +235,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* _VIM * ,-----------------------------------------------------------------------------------. - * |A(TAB)| C(→) | !LANG|A(GRV)| C(←) | ⏭️ | HOME | → | PGUP | COPY | PASTE| DE_SW| + * |A(TAB)| C(->)| !LANG|A(GRV)| C(<-)| >>| | HOME | -> | PGUP | COPY | PASTE| DE_SW| * |------+------+------+------+------+------+------+------+------+------+------+------| - * |C(TAB)| TAB | ESC | ENT |VIM_GG| ▶⏸ | ← | ↓ | ↑ | → | END | VIM_O| + * |C(TAB)| TAB | ESC | ENT |VIM_GG| MPLY | <- | ↓ | ↑ | -> | END | VIM_O| * |------+------+------+------+------+------+------+------+------+------+------+------| - * | LSFT | XXXX |S(DEL)| CAPS | VIM_V| 🔇 | HOME | PGDN | LSFT | RFST | C(F) | C(F) | + * | LSFT | XXXX |S(DEL)| CAPS | VIM_V| MUTE | HOME | PGDN | LSFT | RFST | C(F) | C(F) | * |------+------+------+------+------+------+------+------+------+------+------+------| * | XXXX | XXXX | !VIM | BSPC | ____ | ____ | ENT | DEL | ____ | ↓ | ↑ | * `-----------------------------------------------------------------------------------' @@ -253,11 +253,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* _NUM * ,-----------------------------------------------------------------------------------. - * | F1 | F2 | F3 | F4 | ⏮️ |NUMLCK| ⏭️ | 7 | 8 | 9 | - | ____ | + * | F1 | F2 | F3 | F4 | |<< |NUMLCK| >>| | 7 | 8 | 9 | - | ____ | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | F5 | F6 | F7 | F8 | 🔊 | ▶⏸ | * | 4 | 5 | 6 | + | . | + * | F5 | F6 | F7 | F8 | Vol+ | MPLY | * | 4 | 5 | 6 | + | . | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | F9 | F10 | F11 | F12 | 🔉 | 🔇 | = | 1 | 2 | 3 | / | , | + * | F9 | F10 | F11 | F12 | Vol- | MUTE | = | 1 | 2 | 3 | / | , | * |------+------+------+------+------+------+------+------+------+------+------+------| * | ____ | ____ | ____ | ____ | ____ | ____ | 0 | . | , | = | ____ | * `-----------------------------------------------------------------------------------' @@ -271,13 +271,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* _MOUSE * ,-----------------------------------------------------------------------------------. - * | XXXX | XXXX | MBTN4| MBTN5| XXXX | 🔆+ | XXXX | MWHL↑|MOUSE↑| MWHL↑| XXXX | XXXX | + * | XXXX | XXXX | MBTN4| MBTN5| XXXX | Bri+ | XXXX | MWHL↑|MAUS↑ | MWHL↑| XXXX | XXXX | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | XXXX | MBTN3| MBTN2| MBTN1| XXXX | ▶⏸ | XXXX |MOUSE←|MOUSE↓|MOUSE→| XXXX | XXXX | + * | XXXX | MBTN3| MBTN2| MBTN1| XXXX | MPLY | XXXX |MAUS<-|MAUS↓ |MAUS->| XXXX | XXXX | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | F9 | XXXX | XXXX | XXXX | XXXX | 🔆- | XXXX | MWHL↓| XXXX | XXXX | ____ | XXXX | + * | F9 | XXXX | XXXX | XXXX | XXXX | Bri- | XXXX | MWHL↓| XXXX | XXXX | ____ | XXXX | * |------+------+------+------+------+------+------+------+------+------+------+------| - * |!MOUSE| XXXX | XXXX | ____ | XXXX | MOUSEACCEL 2| ____ | XXXX | XXXX | XXXX | XXXX | + * |!MOUSE| XXXX | XXXX | ____ | XXXX | MAUS_ACCEL2 | ____ | XXXX | XXXX | XXXX | XXXX | * `-----------------------------------------------------------------------------------' */ [_MOUSE] = LAYOUT_planck_grid( @@ -955,7 +955,31 @@ bool dip_switch_update_user(uint8_t index, bool active) { return true; } + +LEADER_EXTERNS(); + void matrix_scan_user(void) { + LEADER_DICTIONARY() { + leading = false; + leader_end(); + + SEQ_ONE_KEY(KC_F) { + // Anything you can do in a macro. + SEND_STRING("QMK is awesome."); + } + SEQ_TWO_KEYS(KC_D, KC_D) { + SEND_STRING(SS_LCTL("a") SS_LCTL("c")); + } + SEQ_THREE_KEYS(KC_D, KC_D, KC_S) { + SEND_STRING("https://start.duckduckgo.com\n"); + } + SEQ_TWO_KEYS(KC_A, KC_S) { + register_code(KC_LGUI); + register_code(KC_S); + unregister_code(KC_S); + unregister_code(KC_LGUI); + } + } #ifdef AUDIO_ENABLE if (muse_mode) { if (muse_counter == 0) { diff --git a/keyboards/planck/keymaps/jweickm/qmk-vim b/keyboards/planck/keymaps/jweickm/qmk-vim new file mode 160000 index 000000000000..ea4af59f8efd --- /dev/null +++ b/keyboards/planck/keymaps/jweickm/qmk-vim @@ -0,0 +1 @@ +Subproject commit ea4af59f8efd56a83c60ba4e42cc5fe2bd48a5d5 diff --git a/keyboards/planck/keymaps/jweickm/rules.mk b/keyboards/planck/keymaps/jweickm/rules.mk index 0666b96b337b..067ac4768c9d 100644 --- a/keyboards/planck/keymaps/jweickm/rules.mk +++ b/keyboards/planck/keymaps/jweickm/rules.mk @@ -1,5 +1,5 @@ CONSOLE_ENABLE = no # Console for debug - +LEADER_ENABLE = yes TAP_DANCE_ENABLE = yes # enable tap dance functionality SRC += muse.c From ee7cf3b680a2000ae0e053afeac3eca5f2fa9b6a Mon Sep 17 00:00:00 2001 From: jweickm Date: Sat, 18 Sep 2021 17:30:34 +0200 Subject: [PATCH 25/31] removed submodule and added leader key --- keyboards/planck/keymaps/jweickm/keymap.c | 64 ++++++++++++++++------- keyboards/planck/keymaps/jweickm/qmk-vim | 1 - 2 files changed, 46 insertions(+), 19 deletions(-) delete mode 160000 keyboards/planck/keymaps/jweickm/qmk-vim diff --git a/keyboards/planck/keymaps/jweickm/keymap.c b/keyboards/planck/keymaps/jweickm/keymap.c index 4d2e99f7ed41..17670b19cfbc 100644 --- a/keyboards/planck/keymaps/jweickm/keymap.c +++ b/keyboards/planck/keymaps/jweickm/keymap.c @@ -33,7 +33,7 @@ enum planck_layers { _MOUSE, }; -enum planck_keycodes { HRWIDECOLEMAK = SAFE_RANGE, GAMING, WIDECOLEMAK, TG_COLEMAK, VIM_O, VIM_V, KC_SVD_BD, KC_SVU_BU, KC_TAB_MPLY, ALT_TAB, CTL_TAB, DE_ae, DE_oe, DE_ue, DE_AE, DE_OE, DE_SZ, DE_EGRAVE, DE_EAIGU, KC_CURRENCY, KC_DE_SWITCH, LANG_SWITCH, DE_SLSH_QUST, DE_QUOT, DE_SCLN, DE_BSLS, M_ESCM, M_RGUI_SCLN }; +enum planck_keycodes { HRWIDECOLEMAK = SAFE_RANGE, GAMING, WIDECOLEMAK, TG_COLEMAK, VIM_O, VIM_V, KC_SVD_BD, KC_SVU_BU, KC_TAB_MPLY, ALT_TAB, CTL_TAB, DE_ae, DE_oe, DE_ue, DE_AE, DE_OE, DE_SZ, DE_EGRAVE, DE_EAIGU, KC_CURRENCY, KC_DE_SWITCH, LANG_SWITCH, DE_SLSH_QUST, DE_QUOT, DE_SCLN, DE_BSLS, M_ESCM, M_RGUI_SCLN, DE_DOT_LAB, DE_COMM_RAB }; // Tap Dance declarations enum tap_dance_codes { @@ -53,39 +53,39 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* _HRWIDECOLEMAK * ,-----------------------------------------------------------------------------------. - * | G-Q | A-W | S-F | C-P |_Num-B|Vol/B+|_Num-J| C-L | S-U | A-Y | G-/ | Ü | + * | G-Q | A-W | S-F | C-P |_Num-B|Vol/B+|_Num-J| C-L | S-U | A-Y | G-/ | ü | * |------+------+------+------+------+------+------+------+------+------+------+------| * | A | R | S | T | G | TAB | M | N | E | I | O | ' | * |------+------+------+------+------+------+------+------+------+------+------+------| * |_Mo-Z | X | C | D | V |Vol/B-| K | H | , | . |_Mo-/ | \ | * |------+------+------+------+------+------+------+------+------+------+------+------| - * |C-CAPS|G-TAB |MN-ESC|_L-BSP| LSFT | _Nav-SPC |_R-ENT|S-DEL | RALT |_Na <-|_Na ->| + * |C-CAPS| LEAD |MN-ESC|_L-BSP| LSFT | _Nav-SPC |_R-ENT|S-DEL | RALT |_Mo <-|_Mo ->| * `-----------------------------------------------------------------------------------' */ [_HRWIDECOLEMAK] = LAYOUT_planck_grid( LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM, KC_B), KC_SVU_BU, LT(_NUM, KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Y), RGUI_T(KC_SCLN), DE_ue, KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, LT(_MOUSE, KC_Z), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, LT(_MOUSE, KC_SLSH), KC_BSLS, - LCTL_T(KC_CAPS), LGUI_T(KC_TAB), M_ESCM, LT(_LOWER, KC_BSPC), OSM(MOD_LSFT), LT(_NAV, KC_SPC), LT(_NAV, KC_SPC), LT(_RAISE, KC_ENT), RSFT_T(KC_DEL), KC_RALT, LT(_NAV, KC_LEFT), LT(_NAV, KC_RIGHT) + LCTL_T(KC_CAPS), KC_LEAD, M_ESCM, LT(_LOWER, KC_BSPC), OSM(MOD_LSFT), LT(_NAV, KC_SPC), LT(_NAV, KC_SPC), LT(_RAISE, KC_ENT), RSFT_T(KC_DEL), KC_RALT, LT(_MOUSE, KC_LEFT), LT(_MOUSE, KC_RIGHT) ), /* _HRWIDECOLEMAK_DE * same as above, when the PC is set to German layout * ,-----------------------------------------------------------------------------------. - * | G-Q | A-W | S-F | C-P |_Num-B|Vol/B+|_Num-J| C-L | S-U | A-Y | G-/ | Ü | + * | G-Q | A-W | S-F | C-P |_Num-B|Vol/B+|_Num-J| C-L | S-U | A-Y | G-/ | ü | * |------+------+------+------+------+------+------+------+------+------+------+------| * | A | R | S | T | G | TAB | M | N | E | I | O | ' | * |------+------+------+------+------+------+------+------+------+------+------+------| * |_Mo-Z | X | C | D | V |Vol/B-| K | H | , | . |_Mo-/ | \ | * |------+------+------+------+------+------+------+------+------+------+------+------| - * |C-CAPS|G-TAB |MN-ESC|_L-BSP| LSFT | _Nav-SPC |_R-ENT|S-DEL | RALT |_Na <-|_Na ->| + * |C-CAPS| LEAD |MN-ESC|_L-BSP| LSFT | _Nav-SPC |_R-ENT|S-DEL | RALT |_Mo <-|_Mo ->| * `-----------------------------------------------------------------------------------' */ [_HRWIDECOLEMAK_DE] = LAYOUT_planck_grid( LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM, KC_B), KC_SVU_BU, LT(_NUM, KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Z), M_RGUI_SCLN, KC_LBRC, KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB, KC_M, KC_N, KC_E, KC_I, KC_O, DE_QUOT, - LT(_MOUSE, KC_Y), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, DE_SLSH_QUST, DE_BSLS, - LCTL_T(KC_CAPS), LGUI_T(KC_TAB), M_ESCM, LT(_LOWER_DE, KC_BSPC), OSM(MOD_LSFT), LT(_NAV, KC_SPC), LT(_NAV, KC_SPC), LT(_RAISE_DE, KC_ENT), RSFT_T(KC_DEL), KC_RALT, LT(_NAV, KC_LEFT), LT(_NAV, KC_RIGHT) + LT(_MOUSE, KC_Y), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, DE_DOT_LAB, DE_COMM_RAB, DE_BSLS, + LCTL_T(KC_CAPS), KC_LEAD, M_ESCM, LT(_LOWER_DE, KC_BSPC), OSM(MOD_LSFT), LT(_NAV, KC_SPC), LT(_NAV, KC_SPC), LT(_RAISE_DE, KC_ENT), RSFT_T(KC_DEL), KC_RALT, LT(_MOUSE, KC_LEFT), LT(_MOUSE, KC_RIGHT) ), /* _GAMING @@ -115,14 +115,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+------+------+------+------+------+------+------| * | Z | X | C | D | V |Vol/B-| K | H | , | . | / |!CM-EN| * |------+------+------+------+------+------+------+------+------+------+------+------| - * |C-CAPS|G-TAB |MN-ESC|_L-BSP| LSFT | _NAV-SPC |_R-ENT|S-DEL |C-TAB |_Na <-|_Na ->| + * |C-CAPS|G-TAB |MN-ESC|_L-BSP| LSFT | _NAV-SPC |_R-ENT|S-DEL |C-TAB |_Mo <-|_Mo ->| * `-----------------------------------------------------------------------------------' */ [_WIDECOLEMAK] = LAYOUT_planck_grid( KC_Q, KC_W, KC_F, KC_P, KC_B, KC_SVU_BU, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, DE_ue, KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB_MPLY, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, KC_Z, KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, TG_COLEMAK, - LCTL_T(KC_CAPS), LGUI_T(KC_TAB), M_ESCM, LT(_LOWER_DE, KC_BSPC), OSM(MOD_LSFT), LT(_NAV, KC_SPC), LT(_NAV, KC_SPC), LT(_RAISE, KC_ENT), RSFT_T(KC_DEL), KC_LALT, LT(_NAV, KC_LEFT), LT(_NAV, KC_RIGHT) + LCTL_T(KC_CAPS), LGUI_T(KC_TAB), M_ESCM, LT(_LOWER_DE, KC_BSPC), OSM(MOD_LSFT), LT(_NAV, KC_SPC), LT(_NAV, KC_SPC), LT(_RAISE, KC_ENT), RSFT_T(KC_DEL), KC_LALT, LT(_MOUSE, KC_LEFT), LT(_MOUSE, KC_RIGHT) ), /* _LOWER @@ -149,7 +149,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+------+------+------+------+------+------+------| * | F1 | F2 | F3 | F4 | F5 | F6 | ß | _ | + | { | } | Ä | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | F7 | F8 | F9 | F10 | F11 | F12 | MPLY | / | < | > | € | ` | + * | F7 | F8 | F9 | F10 | F11 | F12 | MPLY | / | \ | | | € | ` | * |------+------+------+------+------+------+------+------+------+------+------+------| * |!MOUSE| ____ | ____ | ____ | ____ | ____ | ____ | Vol- | Vol+ | ↓ | ↑ | * `-----------------------------------------------------------------------------------' @@ -157,7 +157,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_LOWER_DE] = LAYOUT_planck_grid( KC_EXLM, RALT(KC_Q), KC_BSLS, KC_DLR, KC_PERC, RALT(KC_RBRC), KC_GRV, KC_CIRC, KC_RCBR, TD(TD_PRN_DE), KC_LPRN, LSFT(KC_SCLN), KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, LSFT(KC_SLSH), KC_RBRC, TD(TD_CBR_DE), RALT(KC_0), LSFT(KC_QUOT), - KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, LSFT(KC_7), KC_NUBS, LSFT(KC_NUBS), KC_CURRENCY, KC_PLUS, + KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, LSFT(KC_7), RALT(KC_MINS), RALT(KC_NUBS), KC_CURRENCY, KC_PLUS, TG(_MOUSE), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_DOWN, KC_UP ), @@ -185,7 +185,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+------+------+------+------+------+------+------| * | F1 | F2 | F3 | F4 | F5 | F6 | ß | - | = | [ | ] | ä | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | F7 | F8 | F9 | F10 | F11 | F12 | MPLY | \ | , | . | - | ´ | + * | F7 | F8 | F9 | F10 | F11 | F12 | MPLY | \ | , | . | / | ´ | * |------+------+------+------+------+------+------+------+------+------+------+------| * |!MOUSE| ____ | ____ | BSPC | ____ | ____ | ____ | |<< | >>| | ↓ | ↑ | * `-----------------------------------------------------------------------------------' @@ -193,7 +193,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_RAISE_DE] = LAYOUT_planck_grid( KC_1, KC_2, KC_3, KC_4, KC_5, LSFT(KC_GRV), KC_6, KC_7, KC_8, KC_9, KC_0, KC_SCLN, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_SLSH, LSFT(KC_0), TD(TD_BRC_DE), RALT(KC_9), KC_QUOT, - KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, RALT(KC_MINS), KC_COMM, KC_DOT, KC_SLSH, KC_EQL, + KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, RALT(KC_MINS), KC_COMM, KC_DOT, DE_SLSH_QUST, KC_EQL, TG(_MOUSE), KC_TRNS, KC_BSPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_DOWN, KC_UP ), @@ -223,14 +223,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+------+------+------+------+------+------+------| * | LSFT | XXXX |S(DEL)| CAPS | VIM_V| MUTE | HOME | PGDN | LSFT | RFST | C(F) | C(F) | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | XXXX | XXXX | ____ | BSPC | ____ | ____ | ENT | DEL | ____ | ↓ | ↑ | + * | XXXX | XXXX | ____ | BSPC | ____ | ____ | ENT | DEL | ____ | ____ | DE_SW| * `-----------------------------------------------------------------------------------' */ [_NAV] = LAYOUT_planck_grid( ALT_TAB, LCTL(KC_RGHT), LANG_SWITCH, LALT(KC_GRV), LCTL(KC_LEFT), KC_MNXT, KC_HOME, KC_RIGHT, KC_PGUP, LCTL(KC_INS), LSFT(KC_INS), KC_DE_SWITCH, CTL_TAB, KC_TAB, KC_ESC, KC_ENT, TD(TD_VIM_GG), KC_MPLY, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_END, VIM_O, KC_LSFT, KC_NO, LSFT(KC_DEL), KC_CAPS, VIM_V, KC_MUTE, KC_HOME, KC_PGDN, KC_LSFT, KC_RSFT, LCTL(KC_F), LCTL(KC_F), - KC_NO, KC_NO, KC_TRNS, KC_BSPC, KC_TRNS, LT(_NAV, KC_SPC), LT(_NAV, KC_SPC), KC_ENT, KC_DEL, KC_TRNS, KC_DOWN, KC_UP + KC_NO, KC_NO, KC_TRNS, KC_BSPC, KC_TRNS, LT(_NAV, KC_SPC), LT(_NAV, KC_SPC), KC_ENT, KC_DEL, KC_TRNS, KC_TRNS, KC_DE_SWITCH ), /* _VIM @@ -277,14 +277,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+------+------+------+------+------+------+------| * | F9 | XXXX | XXXX | XXXX | XXXX | Bri- | XXXX | MWHL↓| XXXX | XXXX | ____ | XXXX | * |------+------+------+------+------+------+------+------+------+------+------+------| - * |!MOUSE| XXXX | XXXX | ____ | XXXX | MAUS_ACCEL2 | ____ | XXXX | XXXX | XXXX | XXXX | + * |!MOUSE| XXXX | XXXX | ____ | XXXX | MAUS_ACCEL2 | ____ | XXXX | XXXX | ↓ | ↑ | * `-----------------------------------------------------------------------------------' */ [_MOUSE] = LAYOUT_planck_grid( KC_NO, KC_NO, KC_BTN4, KC_BTN5, KC_NO, KC_BRIU, KC_NO, KC_WH_U, KC_MS_U, KC_WH_U, KC_NO, KC_NO, KC_NO, KC_BTN3, KC_BTN2, KC_BTN1, KC_NO, KC_MPLY, KC_NO, KC_MS_L, KC_MS_D, KC_MS_R, KC_NO, KC_NO, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_BRID, KC_NO, KC_WH_D, KC_NO, KC_NO, KC_TRNS, KC_NO, - TG(_MOUSE), KC_NO, KC_NO, KC_TRNS, KC_NO, KC_ACL2, KC_ACL2, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO + TG(_MOUSE), KC_NO, KC_NO, KC_TRNS, KC_NO, KC_ACL2, KC_ACL2, KC_TRNS, KC_NO, KC_NO, KC_DOWN, KC_UP ) }; @@ -829,6 +829,34 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { unregister_code16(KC_PIPE); } return true; + case DE_DOT_LAB: + if (record->event.pressed) { + uint8_t temp_mods = get_mods() | get_oneshot_mods(); + if (temp_mods & MOD_MASK_SHIFT) { + clear_mods(); + clear_oneshot_mods(); + register_code16(KC_NUBS); // < left angle bracket + } else { + register_code(KC_DOT); // . + } + } else { + unregister_code16(KC_NUBS); + unregister_code(KC_DOT); + } + return true; + case DE_COMM_RAB: + if (record->event.pressed) { + uint8_t temp_mods = get_mods() | get_oneshot_mods(); + if (temp_mods & MOD_MASK_SHIFT) { + register_code16(LSFT(KC_NUBS)); // > right angle bracket + } else { + register_code(KC_COMM); // , + } + } else { + unregister_code16(LSFT(KC_NUBS)); + unregister_code(KC_COMM); + } + return true; case DE_SCLN: if (record->event.pressed) { uint8_t temp_mods = get_mods() | get_oneshot_mods(); diff --git a/keyboards/planck/keymaps/jweickm/qmk-vim b/keyboards/planck/keymaps/jweickm/qmk-vim deleted file mode 160000 index ea4af59f8efd..000000000000 --- a/keyboards/planck/keymaps/jweickm/qmk-vim +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ea4af59f8efd56a83c60ba4e42cc5fe2bd48a5d5 From 4ddcf30c2ac27b747b02deee2b5fceaef4aac1c9 Mon Sep 17 00:00:00 2001 From: Jakob Weickmann <57487288+jweickm@users.noreply.github.com> Date: Sat, 18 Sep 2021 17:33:37 +0200 Subject: [PATCH 26/31] group lines regarding rgblight in config.h Co-authored-by: Drashna Jaelre --- keyboards/planck/keymaps/jweickm/config.h | 1 + 1 file changed, 1 insertion(+) diff --git a/keyboards/planck/keymaps/jweickm/config.h b/keyboards/planck/keymaps/jweickm/config.h index 3870b5c0e96f..e0f7135b5d26 100644 --- a/keyboards/planck/keymaps/jweickm/config.h +++ b/keyboards/planck/keymaps/jweickm/config.h @@ -70,3 +70,4 @@ #define LEADER_NO_TIMEOUT #define RGBLIGHT_SLEEP // RGB lighting will switch off when the host goes to sleep +#define RGBLIGHT_LAYERS From 8c8851c484f526487982a3b5fd35e09a176d6db5 Mon Sep 17 00:00:00 2001 From: Jakob Weickmann <57487288+jweickm@users.noreply.github.com> Date: Sat, 18 Sep 2021 17:33:48 +0200 Subject: [PATCH 27/31] Update keyboards/planck/keymaps/jweickm/config.h Co-authored-by: Drashna Jaelre --- keyboards/planck/keymaps/jweickm/config.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/keyboards/planck/keymaps/jweickm/config.h b/keyboards/planck/keymaps/jweickm/config.h index e0f7135b5d26..b7633e551036 100644 --- a/keyboards/planck/keymaps/jweickm/config.h +++ b/keyboards/planck/keymaps/jweickm/config.h @@ -14,8 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#define RGBLIGHT_LAYERS - #pragma once #ifdef AUDIO_ENABLE From 53a48a7312d8aa2ebfed60f31d98175db512ac78 Mon Sep 17 00:00:00 2001 From: jweickm Date: Sat, 18 Sep 2021 17:45:38 +0200 Subject: [PATCH 28/31] Added left angle bracket and right angle bracket to german layout --- keyboards/planck/keymaps/jweickm/keymap.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/keyboards/planck/keymaps/jweickm/keymap.c b/keyboards/planck/keymaps/jweickm/keymap.c index 17670b19cfbc..7bf9fe89fec9 100644 --- a/keyboards/planck/keymaps/jweickm/keymap.c +++ b/keyboards/planck/keymaps/jweickm/keymap.c @@ -1,7 +1,7 @@ /* Copyright 2015-2017 Jack Humbert * Copyright 2021 Jakob Weickmann * - * This program is free software: you can redistribute it and/or modify + 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. @@ -33,7 +33,7 @@ enum planck_layers { _MOUSE, }; -enum planck_keycodes { HRWIDECOLEMAK = SAFE_RANGE, GAMING, WIDECOLEMAK, TG_COLEMAK, VIM_O, VIM_V, KC_SVD_BD, KC_SVU_BU, KC_TAB_MPLY, ALT_TAB, CTL_TAB, DE_ae, DE_oe, DE_ue, DE_AE, DE_OE, DE_SZ, DE_EGRAVE, DE_EAIGU, KC_CURRENCY, KC_DE_SWITCH, LANG_SWITCH, DE_SLSH_QUST, DE_QUOT, DE_SCLN, DE_BSLS, M_ESCM, M_RGUI_SCLN, DE_DOT_LAB, DE_COMM_RAB }; +enum planck_keycodes { HRWIDECOLEMAK = SAFE_RANGE, GAMING, WIDECOLEMAK, TG_COLEMAK, VIM_O, VIM_V, KC_SVD_BD, KC_SVU_BU, KC_TAB_MPLY, ALT_TAB, CTL_TAB, DE_ae, DE_oe, DE_ue, DE_AE, DE_OE, DE_SZ, DE_EGRAVE, DE_EAIGU, KC_CURRENCY, KC_DE_SWITCH, LANG_SWITCH, DE_SLSH_QUST, DE_QUOT, DE_SCLN, DE_BSLS, M_ESCM, M_RGUI_SCLN, DE_DOT_RAB, DE_COMM_LAB }; // Tap Dance declarations enum tap_dance_codes { @@ -84,7 +84,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_HRWIDECOLEMAK_DE] = LAYOUT_planck_grid( LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM, KC_B), KC_SVU_BU, LT(_NUM, KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Z), M_RGUI_SCLN, KC_LBRC, KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB, KC_M, KC_N, KC_E, KC_I, KC_O, DE_QUOT, - LT(_MOUSE, KC_Y), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, DE_DOT_LAB, DE_COMM_RAB, DE_BSLS, + LT(_MOUSE, KC_Y), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, DE_COMM_LAB, DE_DOT_RAB, DE_SLSH_QUST, DE_BSLS, LCTL_T(KC_CAPS), KC_LEAD, M_ESCM, LT(_LOWER_DE, KC_BSPC), OSM(MOD_LSFT), LT(_NAV, KC_SPC), LT(_NAV, KC_SPC), LT(_RAISE_DE, KC_ENT), RSFT_T(KC_DEL), KC_RALT, LT(_MOUSE, KC_LEFT), LT(_MOUSE, KC_RIGHT) ), @@ -829,31 +829,32 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { unregister_code16(KC_PIPE); } return true; - case DE_DOT_LAB: + case DE_DOT_RAB: if (record->event.pressed) { uint8_t temp_mods = get_mods() | get_oneshot_mods(); if (temp_mods & MOD_MASK_SHIFT) { - clear_mods(); - clear_oneshot_mods(); - register_code16(KC_NUBS); // < left angle bracket + register_code16(LSFT(KC_NUBS)); // > right angle bracket } else { register_code(KC_DOT); // . } } else { - unregister_code16(KC_NUBS); + unregister_code16(LSFT(KC_NUBS)); unregister_code(KC_DOT); } return true; - case DE_COMM_RAB: + case DE_COMM_LAB: if (record->event.pressed) { uint8_t temp_mods = get_mods() | get_oneshot_mods(); if (temp_mods & MOD_MASK_SHIFT) { - register_code16(LSFT(KC_NUBS)); // > right angle bracket + clear_mods(); + clear_oneshot_mods(); + register_code16(KC_NUBS); // < left angle bracket + set_mods(temp_mods); } else { register_code(KC_COMM); // , } } else { - unregister_code16(LSFT(KC_NUBS)); + unregister_code16(KC_NUBS); unregister_code(KC_COMM); } return true; From 1583b586bb3322286570cc568a0c0157f917fcd9 Mon Sep 17 00:00:00 2001 From: jweickm Date: Sat, 18 Sep 2021 18:26:39 +0200 Subject: [PATCH 29/31] added ascii keymaps to readme --- keyboards/planck/keymaps/jweickm/readme.md | 146 +++++++++++++++++++++ 1 file changed, 146 insertions(+) diff --git a/keyboards/planck/keymaps/jweickm/readme.md b/keyboards/planck/keymaps/jweickm/readme.md index 98f78c2f3185..6628dfbdbf16 100644 --- a/keyboards/planck/keymaps/jweickm/readme.md +++ b/keyboards/planck/keymaps/jweickm/readme.md @@ -6,3 +6,149 @@ Home row mods implemented in the top row with individual tapping_terms for diffe Mouse layer accessible through the pinkies. Navigation layer on space. +``` +/* _HRWIDECOLEMAK +* ,-----------------------------------------------------------------------------------. +* | G-Q | A-W | S-F | C-P |_Num-B|Vol/B+|_Num-J| C-L | S-U | A-Y | G-/ | ü | +* |------+------+------+------+------+------+------+------+------+------+------+------| +* | A | R | S | T | G | TAB | M | N | E | I | O | ' | +* |------+------+------+------+------+------+------+------+------+------+------+------| +* |_Mo-Z | X | C | D | V |Vol/B-| K | H | , | . |_Mo-/ | \ | +* |------+------+------+------+------+------+------+------+------+------+------+------| +* |C-CAPS| LEAD |MN-ESC|_L-BSP| LSFT | _Nav-SPC |_R-ENT|S-DEL | RALT |_Mo <-|_Mo ->| +* `-----------------------------------------------------------------------------------' +*/ +/* _HRWIDECOLEMAK_DE +* same as above, when the PC is set to German layout +* ,-----------------------------------------------------------------------------------. +* | G-Q | A-W | S-F | C-P |_Num-B|Vol/B+|_Num-J| C-L | S-U | A-Y | G-/ | ü | +* |------+------+------+------+------+------+------+------+------+------+------+------| +* | A | R | S | T | G | TAB | M | N | E | I | O | ' | +* |------+------+------+------+------+------+------+------+------+------+------+------| +* |_Mo-Z | X | C | D | V |Vol/B-| K | H | , | . |_Mo-/ | \ | +* |------+------+------+------+------+------+------+------+------+------+------+------| +* |C-CAPS| LEAD |MN-ESC|_L-BSP| LSFT | _Nav-SPC |_R-ENT|S-DEL | RALT |_Mo <-|_Mo ->| +* `-----------------------------------------------------------------------------------' +*/ +/* _GAMING +* ,-----------------------------------------------------------------------------------. +* | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | F5 | F8 | F9 |Vol/B+| +* |------+------+------+------+------+------+------+------+------+------+------+------| +* | TAB | Q | W | E | R | T | Y | U | I | O | P |Vol/B-| +* |------+------+------+------+------+------+------+------+------+------+------+------| +* | LSFT | A | S | D | F | G | H | J | Z | M | ; |_CM-EN| +* |------+------+------+------+------+------+------+------+------+------+------+------| +* | LCTL | C | B | X | LALT | SPACE | ENT | RALT | ____ | ____ | !GAME| +* `-----------------------------------------------------------------------------------' +*/ +/* WIDECOLEMAK +* no mod taps +* ,-----------------------------------------------------------------------------------. +* | Q | W | F | P | B |Vol/B+| J | L | U | Y | / | Ü | +* |------+------+------+------+------+------+------+------+------+------+------+------| +* | A | R | S | T | G | TAB | M | N | E | I | O | ' | +* |------+------+------+------+------+------+------+------+------+------+------+------| +* | Z | X | C | D | V |Vol/B-| K | H | , | . | / |!CM-EN| +* |------+------+------+------+------+------+------+------+------+------+------+------| +* |C-CAPS|G-TAB |MN-ESC|_L-BSP| LSFT | _NAV-SPC |_R-ENT|S-DEL |C-TAB |_Mo <-|_Mo ->| +* `-----------------------------------------------------------------------------------' +*/ +/* _LOWER +* ,-----------------------------------------------------------------------------------. +* | ! | @ | # | $ | % | ~ | ^ | & | * | ( | ) | Ö | +* |------+------+------+------+------+------+------+------+------+------+------+------| +* | F1 | F2 | F3 | F4 | F5 | F6 | ß | _ | + | { | } | Ä | +* |------+------+------+------+------+------+------+------+------+------+------+------| +* | F7 | F8 | F9 | F10 | F11 | F12 | MPLY | / | \ | | | € | è | +* |------+------+------+------+------+------+------+------+------+------+------+------| +* |!MOUSE| ____ | ____ | ____ | ____ | ____ | ____ | Vol- | Vol+ | ↓ | ↑ | +* `-----------------------------------------------------------------------------------' +*/ +/* _LOWER_DE +* ,-----------------------------------------------------------------------------------. +* | ! | @ | # | $ | % | ~ | ^ | & | * | ( | ) | Ö | +* |------+------+------+------+------+------+------+------+------+------+------+------| +* | F1 | F2 | F3 | F4 | F5 | F6 | ß | _ | + | { | } | Ä | +* |------+------+------+------+------+------+------+------+------+------+------+------| +* | F7 | F8 | F9 | F10 | F11 | F12 | MPLY | / | \ | | | € | ` | +* |------+------+------+------+------+------+------+------+------+------+------+------| +* |!MOUSE| ____ | ____ | ____ | ____ | ____ | ____ | Vol- | Vol+ | ↓ | ↑ | +* `-----------------------------------------------------------------------------------' +*/ +/* _RAISE +* ,-----------------------------------------------------------------------------------. +* | 1 | 2 | 3 | 4 | 5 | ` | 6 | 7 | 8 | 9 | 0 | ö | +* |------+------+------+------+------+------+------+------+------+------+------+------| +* | F1 | F2 | F3 | F4 | F5 | F6 | ß | - | = | [ | ] | ä | +* |------+------+------+------+------+------+------+------+------+------+------+------| +* | F7 | F8 | F9 | F10 | F11 | F12 | MPLY | \ | , | . | / | é | +* |------+------+------+------+------+------+------+------+------+------+------+------| +* |!MOUSE| ____ | ____ | BSPC | ____ | ____ | ____ | |<< | >>| | ↓ | ↑ | +* `-----------------------------------------------------------------------------------' +*/ +/* _RAISE_DE +* ,-----------------------------------------------------------------------------------. +* | 1 | 2 | 3 | 4 | 5 | ` | 6 | 7 | 8 | 9 | 0 | ö | +* |------+------+------+------+------+------+------+------+------+------+------+------| +* | F1 | F2 | F3 | F4 | F5 | F6 | ß | - | = | [ | ] | ä | +* |------+------+------+------+------+------+------+------+------+------+------+------| +* | F7 | F8 | F9 | F10 | F11 | F12 | MPLY | \ | , | . | / | ´ | +* |------+------+------+------+------+------+------+------+------+------+------+------| +* |!MOUSE| ____ | ____ | BSPC | ____ | ____ | ____ | |<< | >>| | ↓ | ↑ | +* `-----------------------------------------------------------------------------------' +*/ +/* _ADJUST +* ,-----------------------------------------------------------------------------------. +* | A-SFT| RESET| DEBUG|RGBTOG|RGBMOD|RGBHUI|RGBHUD|RGBSAI|RGBSAD|RGBVAI|RGBVAD| DE_SW| +* |------+------+------+------+------+------+------+------+------+------+------+------| +* | A-GRV|EEPRST|MU_MOD| AU_ON|AU_OFF|AGNORM|AGSWAP|!HRWCM| !WCM | A-GRV| !LANG| !GAME| +* |------+------+------+------+------+------+------+------+------+------+------+------| +* | ____ |MUV_DE|MUV_IN| MU_ON|MU_OFF| MI_ON|MI_OFF| Vol- | MPLY | Vol+ | ____ | ____ | +* |------+------+------+------+------+------+------+------+------+------+------+------| +* | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ |EEPRST| +* `-----------------------------------------------------------------------------------' +*/ +/* _NAV +* ,-----------------------------------------------------------------------------------. +* |A(TAB)| C(->)| !LANG|A(GRV)| C(<-)| >>| | HOME | -> | PGUP | COPY | PASTE| DE_SW| +* |------+------+------+------+------+------+------+------+------+------+------+------| +* |C(TAB)| TAB | ESC | ENT |VIM_GG| MPLY | <- | ↓ | ↑ | -> | END | VIM_O| +* |------+------+------+------+------+------+------+------+------+------+------+------| +* | LSFT | XXXX |S(DEL)| CAPS | VIM_V| MUTE | HOME | PGDN | LSFT | RFST | C(F) | C(F) | +* |------+------+------+------+------+------+------+------+------+------+------+------| +* | XXXX | XXXX | ____ | BSPC | ____ | ____ | ENT | DEL | ____ | ____ | DE_SW| +* `-----------------------------------------------------------------------------------' +*/ +/* _VIM +* ,-----------------------------------------------------------------------------------. +* |A(TAB)| C(->)| !LANG|A(GRV)| C(<-)| >>| | HOME | -> | PGUP | COPY | PASTE| DE_SW| +* |------+------+------+------+------+------+------+------+------+------+------+------| +* |C(TAB)| TAB | ESC | ENT |VIM_GG| MPLY | <- | ↓ | ↑ | -> | END | VIM_O| +* |------+------+------+------+------+------+------+------+------+------+------+------| +* | LSFT | XXXX |S(DEL)| CAPS | VIM_V| MUTE | HOME | PGDN | LSFT | RFST | C(F) | C(F) | +* |------+------+------+------+------+------+------+------+------+------+------+------| +* | XXXX | XXXX | !VIM | BSPC | ____ | ____ | ENT | DEL | ____ | ↓ | ↑ | +* `-----------------------------------------------------------------------------------' +*/ +/* _NUM +* ,-----------------------------------------------------------------------------------. +* | F1 | F2 | F3 | F4 | |<< |NUMLCK| >>| | 7 | 8 | 9 | - | ____ | +* |------+------+------+------+------+------+------+------+------+------+------+------| +* | F5 | F6 | F7 | F8 | Vol+ | MPLY | * | 4 | 5 | 6 | + | . | +* |------+------+------+------+------+------+------+------+------+------+------+------| +* | F9 | F10 | F11 | F12 | Vol- | MUTE | = | 1 | 2 | 3 | / | , | +* |------+------+------+------+------+------+------+------+------+------+------+------| +* | ____ | ____ | ____ | ____ | ____ | ____ | 0 | . | , | = | ____ | +* `-----------------------------------------------------------------------------------' +*/ +/* _MOUSE +* ,-----------------------------------------------------------------------------------. +* | XXXX | XXXX | MBTN4| MBTN5| XXXX | Bri+ | XXXX | MWHL↑|MAUS↑ | MWHL↑| XXXX | XXXX | +* |------+------+------+------+------+------+------+------+------+------+------+------| +* | XXXX | MBTN3| MBTN2| MBTN1| XXXX | MPLY | XXXX |MAUS<-|MAUS↓ |MAUS->| XXXX | XXXX | +* |------+------+------+------+------+------+------+------+------+------+------+------| +* | F9 | XXXX | XXXX | XXXX | XXXX | Bri- | XXXX | MWHL↓| XXXX | XXXX | ____ | XXXX | +* |------+------+------+------+------+------+------+------+------+------+------+------| +* |!MOUSE| XXXX | XXXX | ____ | XXXX | MAUS_ACCEL2 | ____ | XXXX | XXXX | ↓ | ↑ | +* `-----------------------------------------------------------------------------------' + */ From 635178e0633d2e677866adea05fdcf648e1aec48 Mon Sep 17 00:00:00 2001 From: jweickm Date: Sat, 18 Sep 2021 23:59:17 +0200 Subject: [PATCH 30/31] swapped esc and bspc position on bottom row to practice for the one-shot layer layout --- keyboards/planck/keymaps/jweickm/keymap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/keyboards/planck/keymaps/jweickm/keymap.c b/keyboards/planck/keymaps/jweickm/keymap.c index 7bf9fe89fec9..02138a876cc3 100644 --- a/keyboards/planck/keymaps/jweickm/keymap.c +++ b/keyboards/planck/keymaps/jweickm/keymap.c @@ -59,14 +59,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+------+------+------+------+------+------+------| * |_Mo-Z | X | C | D | V |Vol/B-| K | H | , | . |_Mo-/ | \ | * |------+------+------+------+------+------+------+------+------+------+------+------| - * |C-CAPS| LEAD |MN-ESC|_L-BSP| LSFT | _Nav-SPC |_R-ENT|S-DEL | RALT |_Mo <-|_Mo ->| + * |C-CAPS| LEAD | BSPC |_L-ESC| LSFT | _Nav-SPC |_R-ENT|S-DEL | RALT |_Mo <-|_Mo ->| * `-----------------------------------------------------------------------------------' */ [_HRWIDECOLEMAK] = LAYOUT_planck_grid( LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM, KC_B), KC_SVU_BU, LT(_NUM, KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Y), RGUI_T(KC_SCLN), DE_ue, KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, LT(_MOUSE, KC_Z), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, KC_COMM, KC_DOT, LT(_MOUSE, KC_SLSH), KC_BSLS, - LCTL_T(KC_CAPS), KC_LEAD, M_ESCM, LT(_LOWER, KC_BSPC), OSM(MOD_LSFT), LT(_NAV, KC_SPC), LT(_NAV, KC_SPC), LT(_RAISE, KC_ENT), RSFT_T(KC_DEL), KC_RALT, LT(_MOUSE, KC_LEFT), LT(_MOUSE, KC_RIGHT) + LCTL_T(KC_CAPS), KC_LEAD, KC_BSPC, LT(_LOWER, KC_ESC), OSM(MOD_LSFT), LT(_NAV, KC_SPC), LT(_NAV, KC_SPC), LT(_RAISE, KC_ENT), RSFT_T(KC_DEL), KC_RALT, LT(_MOUSE, KC_LEFT), LT(_MOUSE, KC_RIGHT) ), /* _HRWIDECOLEMAK_DE @@ -78,14 +78,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+------+------+------+------+------+------+------| * |_Mo-Z | X | C | D | V |Vol/B-| K | H | , | . |_Mo-/ | \ | * |------+------+------+------+------+------+------+------+------+------+------+------| - * |C-CAPS| LEAD |MN-ESC|_L-BSP| LSFT | _Nav-SPC |_R-ENT|S-DEL | RALT |_Mo <-|_Mo ->| + * |C-CAPS| LEAD | BSPC |_L-ESC| LSFT | _Nav-SPC |_R-ENT|S-DEL | RALT |_Mo <-|_Mo ->| * `-----------------------------------------------------------------------------------' */ [_HRWIDECOLEMAK_DE] = LAYOUT_planck_grid( LGUI_T(KC_Q), LALT_T(KC_W), LSFT_T(KC_F), LCTL_T(KC_P), LT(_NUM, KC_B), KC_SVU_BU, LT(_NUM, KC_J), RCTL_T(KC_L), RSFT_T(KC_U), LALT_T(KC_Z), M_RGUI_SCLN, KC_LBRC, KC_A, KC_R, KC_S, KC_T, KC_G, KC_TAB, KC_M, KC_N, KC_E, KC_I, KC_O, DE_QUOT, LT(_MOUSE, KC_Y), KC_X, KC_C, KC_D, KC_V, KC_SVD_BD, KC_K, KC_H, DE_COMM_LAB, DE_DOT_RAB, DE_SLSH_QUST, DE_BSLS, - LCTL_T(KC_CAPS), KC_LEAD, M_ESCM, LT(_LOWER_DE, KC_BSPC), OSM(MOD_LSFT), LT(_NAV, KC_SPC), LT(_NAV, KC_SPC), LT(_RAISE_DE, KC_ENT), RSFT_T(KC_DEL), KC_RALT, LT(_MOUSE, KC_LEFT), LT(_MOUSE, KC_RIGHT) + LCTL_T(KC_CAPS), KC_LEAD, KC_BSPC, LT(_LOWER_DE, KC_ESC), OSM(MOD_LSFT), LT(_NAV, KC_SPC), LT(_NAV, KC_SPC), LT(_RAISE_DE, KC_ENT), RSFT_T(KC_DEL), KC_RALT, LT(_MOUSE, KC_LEFT), LT(_MOUSE, KC_RIGHT) ), /* _GAMING From 8cdedb0399b069e1ba5d941afe4f32688f64b4c2 Mon Sep 17 00:00:00 2001 From: Jakob Weickmann <57487288+jweickm@users.noreply.github.com> Date: Sun, 19 Sep 2021 13:00:08 +0200 Subject: [PATCH 31/31] remove midi comment from config.h Co-authored-by: Ryan --- keyboards/planck/keymaps/jweickm/config.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/keyboards/planck/keymaps/jweickm/config.h b/keyboards/planck/keymaps/jweickm/config.h index b7633e551036..3b34ddf832f2 100644 --- a/keyboards/planck/keymaps/jweickm/config.h +++ b/keyboards/planck/keymaps/jweickm/config.h @@ -49,8 +49,6 @@ */ //#define MIDI_ADVANCED -/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ -//#define MIDI_TONE_KEYCODE_OCTAVES 2 // Most tactile encoders have detents every 4 stages #define ENCODER_RESOLUTION 4