From 53a6501d71cabbe4c5c41652cf24fdc059609e5d Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Tue, 15 May 2018 19:34:34 -0700 Subject: Yet another update to drashna keymaps and userspace (EEPROM, RGB indicators) (#2959) * More Iris Tweaks * Mess with iris arrow keys * Massive layout overhaul to make everything more OLKB * Additional tweaks * Cleanup Userspace Remove unused layer code, and properly set userspace eeprom structure. * EEPROM stuff * Only use indicators if layer indication is enabled * Iris and Orthodox Tweaks (Status Indicators) * Additional tweaks to finish tri layer conversion * Disable ProMicro ligths globally * Add Pro Micro hacking info * Successfully get mod indication working on thumb clusters * Enable printing when console is enabled * Make Modifier Indicator lights more modular * Keymap cleanup * Tapping test changes * Cleanup and minor tweaks --- keyboards/viterbi/keymaps/drashna/keymap.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) (limited to 'keyboards/viterbi') diff --git a/keyboards/viterbi/keymaps/drashna/keymap.c b/keyboards/viterbi/keymaps/drashna/keymap.c index 09e8bc599..11ffe6ebd 100644 --- a/keyboards/viterbi/keymaps/drashna/keymap.c +++ b/keyboards/viterbi/keymaps/drashna/keymap.c @@ -17,7 +17,6 @@ extern keymap_config_t keymap_config; #define DIABLO TG(_DIABLO) #define GAMEPAD TG(_GAMEPAD) #define MEDIA TT(_MEDIA) -#define COVECUBE TG(_COVECUBE) //enum more_custom_keycodes { @@ -28,7 +27,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_NUMLOCK] = LAYOUT_ortho_5x7( LMACRO, DIABLO, GAMEPAD, KC_NLCK, KC_SLCK, KC_COLN, KC_PSLS, - MEDIA, KC_CALC, COVECUBE,KC_P7, KC_P8, KC_P9, KC_PAST, + MEDIA, KC_CALC, XXXXXXX, KC_P7, KC_P8, KC_P9, KC_PAST, KC_HOME, KC_DEL, KC_PGUP, KC_P4, KC_P5, KC_P6, KC_PMNS, KC_END, KC_UP, KC_PGDN, KC_P1, KC_P2, KC_P3, KC_PPLS, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_COLN, KC_PENT @@ -58,13 +57,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_SALT, KC_MORESALT, KC_SALTHARD, KC_JUSTGAME, KC_AIM, XXXXXXX, KC_PENT ), - [_COVECUBE] = LAYOUT_ortho_5x7( - XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, - XXXXXXX, XXXXXXX, COVECUBE, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, - XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, - XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, - XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX - ), [_MEDIA] = LAYOUT_ortho_5x7( KC_MAKE, KC_RESET,MU_TOG, AU_ON, AU_OFF, CK_TOGG, RGB_SAD, @@ -77,13 +69,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; -void matrix_init_keymap(void) { - DDRD &= ~(1<<5); - PORTD &= ~(1<<5); - DDRB &= ~(1<<0); - PORTB &= ~(1<<0); -} bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { -- cgit v1.2.3 From def0ff48c09e8eae0e00fcd6049358f5ed0ea816 Mon Sep 17 00:00:00 2001 From: Danny Date: Tue, 22 May 2018 15:12:06 -0400 Subject: Add mike808 Viterbi layout (#3019) --- keyboards/viterbi/keymaps/mike808/config.h | 43 ++++++++ keyboards/viterbi/keymaps/mike808/keymap.c | 158 +++++++++++++++++++++++++++++ keyboards/viterbi/keymaps/mike808/rules.mk | 1 + 3 files changed, 202 insertions(+) create mode 100644 keyboards/viterbi/keymaps/mike808/config.h create mode 100644 keyboards/viterbi/keymaps/mike808/keymap.c create mode 100644 keyboards/viterbi/keymaps/mike808/rules.mk (limited to 'keyboards/viterbi') diff --git a/keyboards/viterbi/keymaps/mike808/config.h b/keyboards/viterbi/keymaps/mike808/config.h new file mode 100644 index 000000000..bfca915f2 --- /dev/null +++ b/keyboards/viterbi/keymaps/mike808/config.h @@ -0,0 +1,43 @@ +/* +Copyright 2018 Danny Nguyen + +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 CONFIG_USER_H +#define CONFIG_USER_H + +#include QMK_KEYBOARD_CONFIG_H + +/* Use I2C or Serial, not both */ + +#define USE_SERIAL +// #define USE_I2C + +/* Select hand configuration */ + +#define MASTER_LEFT +// #define MASTER_RIGHT +// #define EE_HANDS + +#define TAPPING_TERM 150 + +#undef RGBLED_NUM +#define RGBLIGHT_ANIMATIONS +#define RGBLED_NUM 2 +#define RGBLIGHT_HUE_STEP 8 +#define RGBLIGHT_SAT_STEP 8 +#define RGBLIGHT_VAL_STEP 8 + +#endif diff --git a/keyboards/viterbi/keymaps/mike808/keymap.c b/keyboards/viterbi/keymaps/mike808/keymap.c new file mode 100644 index 000000000..c7e48b135 --- /dev/null +++ b/keyboards/viterbi/keymaps/mike808/keymap.c @@ -0,0 +1,158 @@ +#include QMK_KEYBOARD_H + +#define _DVORAK 0 +#define _QWERTY 1 +#define _FN1 2 +#define _MOUSE 3 + +enum custom_keycodes { + DVORAK = SAFE_RANGE, + QWERTY, +}; + +#define KC_ KC_TRNS +#define _______ KC_TRNS + +#define KC_DVOR DVORAK +#define KC_QWER QWERTY +#define KC_FN1 MO(_FN1) + +// Tap-Hold keys (QWERTY) +#define KC_S_C MT(MOD_LCTL, KC_S) +#define KC_D_A MT(MOD_LALT, KC_D) +#define KC_F_G MT(MOD_LGUI, KC_F) +#define KC_J_G MT(MOD_RGUI, KC_J) +#define KC_K_A MT(MOD_RALT, KC_K) +#define KC_L_C MT(MOD_RCTL, KC_L) + +// Tap-Hold keys (Dvorak) +#define KC_O_C MT(MOD_LCTL, KC_O) +#define KC_E_A MT(MOD_LALT, KC_E) +#define KC_U_G MT(MOD_LGUI, KC_U) +#define KC_H_G MT(MOD_RGUI, KC_H) +#define KC_T_A MT(MOD_RALT, KC_T) +#define KC_N_C MT(MOD_RCTL, KC_N) + +#define KC_G_A LGUI(KC_A) +#define KC_G_C LGUI(KC_C) +#define KC_G_V LGUI(KC_V) +#define KC_G_X LGUI(KC_X) +#define KC_G_Z LGUI(KC_Z) +#define KC_G_BL LGUI(KC_BSLS) +#define KC_G_TB LGUI(KC_TAB) +#define KC_G_SP LGUI(KC_SPC) + +#define KC_ENTM LT(_MOUSE, KC_ENT) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [_QWERTY] = LAYOUT_kc( + //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. + DVOR,ESC , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 ,MINS,PGUP, + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + G_A ,TAB , Q , W , E , R , T , Y , U , I , O , P ,BSLS,PGDN, + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + G_X ,CAPS, A ,S_C ,D_A ,F_G , G , H ,J_G ,K_A ,L_C ,SCLN,QUOT, UP , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + G_C ,LSFT, Z , X , C , V , B , N , M ,COMM,DOT ,SLSH,RSFT,DOWN, + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + G_V ,FN1 ,G_TB,G_SP,BSPC,SPC ,SPC , ENTM,ENTM,G_Z ,GRV ,EQL ,LEFT,RGHT + //`----+----+----+----+----+----+----' `----+----+----+----+----+----+----' + ), + + [_DVORAK] = LAYOUT_kc( + //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. + QWER,ESC , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 ,EQL ,PGUP, + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + G_A ,TAB ,QUOT,COMM,DOT , P , Y , F , G , C , R , L ,SLSH,PGDN, + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + G_X ,CAPS, A ,O_C ,E_A ,U_G , I , D ,H_G ,T_A ,N_C , S ,MINS, UP , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + G_C ,LSFT,SCLN, Q , J , K , X , B , M , W , V , Z ,RSFT,DOWN, + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + G_V ,FN1 ,G_TB,G_SP,BSPC,SPC ,SPC , ENTM,ENTM,G_Z ,GRV ,BSLS,LEFT,RGHT + //`----+----+----+----+----+----+----' `----+----+----+----+----+----+----' + ), + + [_FN1] = LAYOUT_kc( + //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. + , , F1 , F2 , F3 , F4 , F5 , F6 , F7 , F8 , F9 ,F10 ,F11 , , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + , ,EXLM, AT ,LCBR,RCBR,PIPE, , P7 , P8 , P9 ,ASTR,F12 , , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + , ,HASH,DLR ,LPRN,RPRN,GRV , , P4 , P5 , P6 ,PLUS,MINS, , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + , ,PERC,CIRC,LBRC,RBRC,TILD, AMPR, P1 , P2 , P3 ,SLSH, , , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + , , , , , , , , ,PDOT, P0 ,EQL , , + //`----+----+----+----+----+----+----' `----+----+----+----+----+----+----' + ), + + [_MOUSE] = LAYOUT_kc( + //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. + , , , , , , , , , , , , , , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + , , , ,MS_U, , , , , , , , , , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + , , ,MS_L,MS_D,MS_R, , , , , , , , , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + , , , , , , , , , , , , , , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + , , , ,BTN1,BTN2, , , , , , , , + //`----+----+----+----+----+----+----' `----+----+----+----+----+----+----' + ) +}; + +#ifdef AUDIO_ENABLE +float tone_qwerty[][2] = SONG(QWERTY_SOUND); +float tone_dvorak[][2] = SONG(DVORAK_SOUND); +#endif + +void update_rgblight(uint16_t layer) { + if (layer & (1UL << _DVORAK)) { + rgblight_sethsv_green(); + } else if (layer & (1UL << _QWERTY)) { + rgblight_sethsv_goldenrod(); + } +} + +void persistent_default_layer_set(uint16_t default_layer) { + eeconfig_update_default_layer(default_layer); + default_layer_set(default_layer); + #ifdef RGBLIGHT_ENABLE + update_rgblight(default_layer); + #endif // RGBLIGHT_ENABLE +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_qwerty, false, 0); + #endif + persistent_default_layer_set(1UL << _QWERTY); + } + return false; + break; + case DVORAK: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_dvorak, false, 0); + #endif + persistent_default_layer_set(1UL << _DVORAK); + } + return false; + break; + } + return true; +} + + +void matrix_init_user(void) { + #ifdef RGBLIGHT_ENABLE + rgblight_enable(); + uint8_t default_layer = eeconfig_read_default_layer(); + update_rgblight(default_layer); + #endif +} diff --git a/keyboards/viterbi/keymaps/mike808/rules.mk b/keyboards/viterbi/keymaps/mike808/rules.mk new file mode 100644 index 000000000..1e3cebb14 --- /dev/null +++ b/keyboards/viterbi/keymaps/mike808/rules.mk @@ -0,0 +1 @@ +RGBLIGHT_ENABLE = yes -- cgit v1.2.3 From 24b8d84b6c3e2a49ce98a48738e469079d051bc8 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Fri, 25 May 2018 11:49:43 -0700 Subject: Fix Split keyboards so they compile on Configurator (#3051) * Fix serial split for BFO9000 * Fix serial split for DeltaSplit75 * Fix serial split for Helix * Fix serial split for MiniDox * Fix serial split for Viterbi * Revert "Fix serial split for Helix" since it's super complex This reverts commit 72538df105ba6d5fe6915773a20c509f2a47785d. We'll let the helix owner fix this issue, or dive into the code later --- keyboards/bfo9000/serial.c | 2 +- keyboards/deltasplit75/serial.c | 2 +- keyboards/minidox/serial.c | 2 +- keyboards/viterbi/serial.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'keyboards/viterbi') diff --git a/keyboards/bfo9000/serial.c b/keyboards/bfo9000/serial.c index 4936e4249..fea57b651 100644 --- a/keyboards/bfo9000/serial.c +++ b/keyboards/bfo9000/serial.c @@ -12,7 +12,7 @@ #include #include "serial.h" -#ifdef USE_SERIAL +#ifndef USE_I2C // Serial pulse period in microseconds. Its probably a bad idea to lower this // value. diff --git a/keyboards/deltasplit75/serial.c b/keyboards/deltasplit75/serial.c index 6faed09ce..74bcbb6bf 100644 --- a/keyboards/deltasplit75/serial.c +++ b/keyboards/deltasplit75/serial.c @@ -12,7 +12,7 @@ #include #include "serial.h" -#ifdef USE_SERIAL +#ifndef USE_I2C // Serial pulse period in microseconds. Its probably a bad idea to lower this // value. diff --git a/keyboards/minidox/serial.c b/keyboards/minidox/serial.c index 6faed09ce..74bcbb6bf 100644 --- a/keyboards/minidox/serial.c +++ b/keyboards/minidox/serial.c @@ -12,7 +12,7 @@ #include #include "serial.h" -#ifdef USE_SERIAL +#ifndef USE_I2C // Serial pulse period in microseconds. Its probably a bad idea to lower this // value. diff --git a/keyboards/viterbi/serial.c b/keyboards/viterbi/serial.c index 6faed09ce..74bcbb6bf 100644 --- a/keyboards/viterbi/serial.c +++ b/keyboards/viterbi/serial.c @@ -12,7 +12,7 @@ #include #include "serial.h" -#ifdef USE_SERIAL +#ifndef USE_I2C // Serial pulse period in microseconds. Its probably a bad idea to lower this // value. -- cgit v1.2.3 From 2b677ddac9aaba14f75787ab4b6d81054ad6ffd4 Mon Sep 17 00:00:00 2001 From: Danny Date: Mon, 28 May 2018 18:02:41 -0400 Subject: Fix nyquist (and other splits using D2 in debouncing) (#3067) * Update default Nyquist revision * LED slave fix * Sync changes from lets_split * Add needed check for debouncing * Remove line that was setting PD2 pin and interfering with use of that pin * Add backlight key to keymap --- keyboards/deltasplit75/matrix.c | 1 - keyboards/ergo42/matrix.c | 1 - keyboards/fourier/matrix.c | 1 - keyboards/handwired/dactyl_manuform/matrix.c | 1 - keyboards/iris/matrix.c | 1 - keyboards/lets_split/matrix.c | 1 - keyboards/levinson/matrix.c | 1 - keyboards/nyquist/keymaps/hexwire/keymap.c | 3 +- keyboards/nyquist/matrix.c | 48 ++++++++++++++++++++++++++-- keyboards/nyquist/rules.mk | 6 ++-- keyboards/redox/matrix.c | 1 - keyboards/vitamins_included/matrix.c | 1 - keyboards/viterbi/matrix.c | 1 - keyboards/zen/matrix.c | 1 - 14 files changed, 50 insertions(+), 18 deletions(-) (limited to 'keyboards/viterbi') diff --git a/keyboards/deltasplit75/matrix.c b/keyboards/deltasplit75/matrix.c index db84fb02c..1ac5c5039 100644 --- a/keyboards/deltasplit75/matrix.c +++ b/keyboards/deltasplit75/matrix.c @@ -146,7 +146,6 @@ uint8_t _matrix_scan(void) if (matrix_changed) { debouncing = true; debouncing_time = timer_read(); - PORTD ^= (1 << 2); } # else diff --git a/keyboards/ergo42/matrix.c b/keyboards/ergo42/matrix.c index 80d4ce46a..fc42dd14d 100644 --- a/keyboards/ergo42/matrix.c +++ b/keyboards/ergo42/matrix.c @@ -151,7 +151,6 @@ uint8_t _matrix_scan(void) if (matrix_changed) { debouncing = true; debouncing_time = timer_read(); - PORTD ^= (1 << 2); } # else diff --git a/keyboards/fourier/matrix.c b/keyboards/fourier/matrix.c index ed913f34b..fdeead7dc 100644 --- a/keyboards/fourier/matrix.c +++ b/keyboards/fourier/matrix.c @@ -149,7 +149,6 @@ uint8_t _matrix_scan(void) if (matrix_changed) { debouncing = true; debouncing_time = timer_read(); - PORTD ^= (1 << 2); } # else diff --git a/keyboards/handwired/dactyl_manuform/matrix.c b/keyboards/handwired/dactyl_manuform/matrix.c index c3bfe8042..904850d4d 100644 --- a/keyboards/handwired/dactyl_manuform/matrix.c +++ b/keyboards/handwired/dactyl_manuform/matrix.c @@ -157,7 +157,6 @@ uint8_t _matrix_scan(void) if (matrix_changed) { debouncing = true; debouncing_time = timer_read(); - PORTD ^= (1 << 2); } # else diff --git a/keyboards/iris/matrix.c b/keyboards/iris/matrix.c index 7195fb0ea..217264f26 100644 --- a/keyboards/iris/matrix.c +++ b/keyboards/iris/matrix.c @@ -153,7 +153,6 @@ uint8_t _matrix_scan(void) if (matrix_changed) { debouncing = true; debouncing_time = timer_read(); - PORTD ^= (1 << 2); } # else diff --git a/keyboards/lets_split/matrix.c b/keyboards/lets_split/matrix.c index c3bfe8042..904850d4d 100644 --- a/keyboards/lets_split/matrix.c +++ b/keyboards/lets_split/matrix.c @@ -157,7 +157,6 @@ uint8_t _matrix_scan(void) if (matrix_changed) { debouncing = true; debouncing_time = timer_read(); - PORTD ^= (1 << 2); } # else diff --git a/keyboards/levinson/matrix.c b/keyboards/levinson/matrix.c index 7195fb0ea..217264f26 100644 --- a/keyboards/levinson/matrix.c +++ b/keyboards/levinson/matrix.c @@ -153,7 +153,6 @@ uint8_t _matrix_scan(void) if (matrix_changed) { debouncing = true; debouncing_time = timer_read(); - PORTD ^= (1 << 2); } # else diff --git a/keyboards/nyquist/keymaps/hexwire/keymap.c b/keyboards/nyquist/keymaps/hexwire/keymap.c index 699cc3de5..40df4bcab 100644 --- a/keyboards/nyquist/keymaps/hexwire/keymap.c +++ b/keyboards/nyquist/keymaps/hexwire/keymap.c @@ -36,6 +36,7 @@ enum custom_keycodes { #define KC_X2 RAISE #define KC_X3 LT(_FN3, KC_GRV) #define KC_X4 MT(MOD_LSFT, KC_ENT) +#define KC_BL_S BL_STEP const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { @@ -91,7 +92,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { //|----+----+----+----+----+----| |----+----+----+----+----+----| ,CPYP, , ,DOWN,LCBR, RCBR, P1 , P2 , P3 ,MINS, , //|----+----+----+----+----+----| |----+----+----+----+----+----| - , , , , , , DEL , , P0 ,PDOT, , + BL_S, , , , , , DEL , , P0 ,PDOT, , //`----+----+----+----+----+----' `----+----+----+----+----+----' ), diff --git a/keyboards/nyquist/matrix.c b/keyboards/nyquist/matrix.c index 5fbae1150..3cdad4adb 100644 --- a/keyboards/nyquist/matrix.c +++ b/keyboards/nyquist/matrix.c @@ -1,5 +1,5 @@ /* -Copyright 2017 Danny Nguyen +Copyright 2017 Danny Nguyen 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 @@ -31,6 +31,11 @@ along with this program. If not, see . #include "config.h" #include "timer.h" +#ifdef BACKLIGHT_ENABLE + #include "backlight.h" + extern backlight_config_t backlight_config; +#endif + #ifdef USE_I2C # include "i2c.h" #else // USE_SERIAL @@ -58,6 +63,8 @@ static matrix_row_t matrix_debouncing[MATRIX_ROWS]; #define ERROR_DISCONNECT_COUNT 5 +#define SERIAL_LED_ADDR 0x00 + #define ROWS_PER_HAND (MATRIX_ROWS/2) static uint8_t error_count = 0; @@ -115,12 +122,23 @@ uint8_t matrix_cols(void) void matrix_init(void) { +#ifdef DISABLE_JTAG + // JTAG disable for PORT F. write JTD bit twice within four cycles. + MCUCR |= (1< 0) if (debouncing) return false; +#endif return true; } diff --git a/keyboards/nyquist/rules.mk b/keyboards/nyquist/rules.mk index 840628e1c..e8f184041 100644 --- a/keyboards/nyquist/rules.mk +++ b/keyboards/nyquist/rules.mk @@ -58,13 +58,13 @@ EXTRAKEY_ENABLE = yes # Audio control and System control(+450) CONSOLE_ENABLE = no # Console for debug(+400) COMMAND_ENABLE = yes # Commands for debug and configuration NKRO_ENABLE = no # 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 +BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality MIDI_ENABLE = no # MIDI controls AUDIO_ENABLE = no # Audio output on port C6 UNICODE_ENABLE = no # Unicode BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID -RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. USE_I2C = yes +RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend @@ -72,4 +72,4 @@ CUSTOM_MATRIX = yes LAYOUTS = ortho_5x12 -DEFAULT_FOLDER = nyquist/rev1 \ No newline at end of file +DEFAULT_FOLDER = nyquist/rev2 diff --git a/keyboards/redox/matrix.c b/keyboards/redox/matrix.c index 20c0f1d34..1607775bd 100644 --- a/keyboards/redox/matrix.c +++ b/keyboards/redox/matrix.c @@ -146,7 +146,6 @@ uint8_t _matrix_scan(void) if (matrix_changed) { debouncing = true; debouncing_time = timer_read(); - PORTD ^= (1 << 2); } # else diff --git a/keyboards/vitamins_included/matrix.c b/keyboards/vitamins_included/matrix.c index 7079a8da9..cf4c1064f 100644 --- a/keyboards/vitamins_included/matrix.c +++ b/keyboards/vitamins_included/matrix.c @@ -198,7 +198,6 @@ uint8_t _matrix_scan(void) if (matrix_changed) { debouncing = true; debouncing_time = timer_read(); - PORTD ^= (1 << 2); } # else diff --git a/keyboards/viterbi/matrix.c b/keyboards/viterbi/matrix.c index 5fbae1150..c56b49c5f 100644 --- a/keyboards/viterbi/matrix.c +++ b/keyboards/viterbi/matrix.c @@ -146,7 +146,6 @@ uint8_t _matrix_scan(void) if (matrix_changed) { debouncing = true; debouncing_time = timer_read(); - PORTD ^= (1 << 2); } # else diff --git a/keyboards/zen/matrix.c b/keyboards/zen/matrix.c index 12f22214e..6e274d3ba 100644 --- a/keyboards/zen/matrix.c +++ b/keyboards/zen/matrix.c @@ -148,7 +148,6 @@ uint8_t _matrix_scan(void) if (matrix_changed) { debouncing = true; debouncing_time = timer_read(); - PORTD ^= (1 << 2); } # else -- cgit v1.2.3 From 3d1349b280d9c0a57e37b5347a405426de6dba10 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Thu, 31 May 2018 22:11:06 -0700 Subject: Big overhaul to Drashna keymaps and userspace (#3097) * Optimize secrets code * Orthodox tweaks * rules.mk features * Minor cleanup * Revert mod bits * Force Hold breaks One Shot Tap Toggle * Cleanup * Moke keymaps more consistent * minor ergodox tweak * More OSM for the Orthodox * Cleanup of userspace * Toggle Secrets * Add hidden process record for super secret macros * Make sure secret macros always compiles * finish up making them super secret * Add ColinTA's rgb twinkle as WIP * Optimize RGB Twinkling for typing Also, tweak RGB indicators. AND WTF, I HAVE NO IDEA WHY THE INDICATORS ONLY WORK AS IS. The logical method for getting them working doesn't ... and it's beyond bizarre * Make console logging more configurable * Indicator travisty * Clean up userspace rgb code * Optimize RGB Twinking to work on default layer only, and to base it's color on the curent hue * Eff it... rgblight_sethsv_at runs at every matrix scan * RGB Twinkle cleanup * Update Iris code for new board * Move RGB Indicator and RGB Twinkle into userspace * Move RGB Indicator code to rgb_stuff.c * Major cleanup of RGB Code in userspace * Additional cleanup of RGB code in userspace * Use noeeprom functions to save my boards! * Enable RGB Sleep on all boards now * Add old iris board * tapping tweak * Use byte 19 for eeprom to prepare for possible merge of eeconfig function pr * Add code to fix default layer after eeprom reset --- keyboards/iris/keymaps/drashna/config.h | 11 +- keyboards/iris/keymaps/drashna/keymap.c | 108 ++------- keyboards/iris/keymaps/drashna/rules.mk | 7 +- keyboards/iris/keymaps/drashna_old/config.h | 70 ++++++ keyboards/iris/keymaps/drashna_old/keymap.c | 89 ++++++++ keyboards/iris/keymaps/drashna_old/rules.mk | 17 ++ keyboards/orthodox/keymaps/drashna/config.h | 10 + keyboards/orthodox/keymaps/drashna/keymap.c | 116 ++-------- keyboards/orthodox/keymaps/drashna/rules.mk | 3 + keyboards/viterbi/keymaps/drashna/rules.mk | 7 +- layouts/community/ergodox/drashna/keymap.c | 20 +- layouts/community/ergodox/drashna/rules.mk | 8 +- users/drashna/config.h | 11 +- users/drashna/drashna.c | 340 +++++----------------------- users/drashna/drashna.h | 30 ++- users/drashna/readme.md | 4 +- users/drashna/rgb_stuff.c | 261 +++++++++++++++++++++ users/drashna/rgb_stuff.h | 16 ++ users/drashna/rules.mk | 29 ++- users/drashna/tap_dances.c | 65 ++++++ users/drashna/tap_dances.h | 7 + 21 files changed, 731 insertions(+), 498 deletions(-) create mode 100644 keyboards/iris/keymaps/drashna_old/config.h create mode 100644 keyboards/iris/keymaps/drashna_old/keymap.c create mode 100644 keyboards/iris/keymaps/drashna_old/rules.mk create mode 100644 users/drashna/rgb_stuff.c create mode 100644 users/drashna/rgb_stuff.h create mode 100644 users/drashna/tap_dances.c create mode 100644 users/drashna/tap_dances.h (limited to 'keyboards/viterbi') diff --git a/keyboards/iris/keymaps/drashna/config.h b/keyboards/iris/keymaps/drashna/config.h index bfdd0022b..d2c112923 100644 --- a/keyboards/iris/keymaps/drashna/config.h +++ b/keyboards/iris/keymaps/drashna/config.h @@ -33,7 +33,7 @@ along with this program. If not, see . #ifdef RGBLIGHT_ENABLE #undef RGBLED_NUM -#define RGBLED_NUM 16 // Number of LEDs +#define RGBLED_NUM 18 // Number of LEDs #define RGBLIGHT_ANIMATIONS #define RGBLIGHT_HUE_STEP 12 #define RGBLIGHT_SAT_STEP 12 @@ -58,4 +58,13 @@ along with this program. If not, see . #define PRODUCT Drashna Hacked Iris Rev.2 #endif +#define SHFT_LED1 6 +#define SHFT_LED2 11 + +#define CTRL_LED1 7 +#define CTRL_LED2 10 + +#define GUI_LED1 8 +#define GUI_LED2 9 + #endif diff --git a/keyboards/iris/keymaps/drashna/keymap.c b/keyboards/iris/keymaps/drashna/keymap.c index b24e5fe53..bc3cd38ad 100644 --- a/keyboards/iris/keymaps/drashna/keymap.c +++ b/keyboards/iris/keymaps/drashna/keymap.c @@ -2,15 +2,6 @@ #include QMK_KEYBOARD_H #include "drashna.h" -#ifdef INDICATOR_LIGHTS -extern userspace_config_t userspace_config; - -uint8_t last_mod; -uint8_t last_led; -uint8_t last_osm; -bool has_mods_changed = false; -#endif - #define KC_ALAP ALT_T(KC_APP) #define KC_OSLG OSM(MOD_LGUI) const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { @@ -55,7 +46,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_LOWER] = LAYOUT_wrapper( _______, _________________FUNC_LEFT_________________, _________________FUNC_RIGHT________________, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, _______, _______, _______, _______, _______, _______, _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, _______, _______, _______, _______, _______, _______ @@ -63,7 +54,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_RAISE] = LAYOUT_wrapper( _______, _________________FUNC_LEFT_________________, _________________FUNC_RIGHT________________, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + KC_GRV, ________________NUMBER_LEFT________________, ________________NUMBER_RIGHT_______________, _______, _______, _______, _______, _______, _______, _______, _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END, _______, _______, _______, _______, _______, _______, _______ @@ -71,93 +62,28 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_ADJUST] = LAYOUT_wrapper( KC_MAKE, _______, _______, _______, _______, _______, KC_SEC1, KC_SEC2, KC_SEC3, KC_SEC4, KC_SEC5, KC_RST, - VRSN, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, RGB_TOG, _______, _______, _______, _______, _______, EPRM, - _______, _______, CK_TOGG, AU_ON, AU_OFF, AG_NORM, AG_SWAP, KC_QWERTY, KC_COLEMAK, KC_DVORAK, KC_WORKMAN, _______, - TG(_MODS),RGB_SMOD,RGB_HUD,RGB_SAD, RGB_VAD, KC_RGB_T,_______, _______, MG_NKRO, KC_MUTE, KC_VOLD, KC_VOLU, KC_MNXT, KC_MPLY, + VRSN, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, RGB_TOG, KC_NUKE, _______, _______, _______, _______, EPRM, + _______, _______, CK_TOGG, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, WORKMAN, TG(_MODS), + _______, RGB_SMOD,RGB_HUD, RGB_SAD, RGB_VAD, KC_RGB_T,_______, _______, MG_NKRO, KC_MUTE, KC_VOLD, KC_VOLU, KC_MNXT, KC_MPLY, _______, _______, _______, _______, _______, _______ ) }; -void matrix_init_keymap(void) { +bool indicator_is_this_led_used(uint8_t index) { + switch (index) { #ifdef INDICATOR_LIGHTS - last_mod = get_mods(); - last_led = host_keyboard_leds(); - last_osm =get_oneshot_mods(); + case SHFT_LED1: + case SHFT_LED2: + case CTRL_LED1: + case CTRL_LED2: + case GUI_LED1: + case GUI_LED2: + return true; + break; #endif -} - -uint32_t layer_state_set_keymap (uint32_t state) { -#ifdef INDICATOR_LIGHTS - uint8_t modifiders = get_mods(); - uint8_t led_usb_state = host_keyboard_leds(); - uint8_t one_shot = get_oneshot_mods(); - - - if (modifiders & MODS_SHIFT_MASK || led_usb_state & (1< + +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 CONFIG_USER_H +#define CONFIG_USER_H + +#include "config_common.h" + +/* Use I2C or Serial, not both */ + +#define USE_SERIAL +#undef USE_I2C + +/* Select hand configuration */ + +// #define MASTER_LEFT +// #define MASTER_RIGHT +#define EE_HANDS + +#ifdef RGBLIGHT_ENABLE +#undef RGBLED_NUM +#define RGBLED_NUM 16 // Number of LEDs +#define RGBLIGHT_ANIMATIONS +#define RGBLIGHT_HUE_STEP 12 +#define RGBLIGHT_SAT_STEP 12 +#define RGBLIGHT_VAL_STEP 12 +#define RGBLIGHT_EFFECT_KNIGHT_LENGTH 2 +#define RGBLIGHT_EFFECT_SNAKE_LENGTH 2 +#define RGBLIGHT_EFFECT_BREATHE_CENTER 1 + +#define RGBLIGHT_LIMIT_VAL 225 +#endif // RGBLIGHT_ENABLE + +#ifdef AUDIO_ENABLE +#define C6_AUDIO +#ifdef RGBLIGHT_ENABLE +#define NO_MUSIC_MODE +#endif //RGBLIGHT_ENABLE +#endif //AUDIO_ENABLE + + +#undef PRODUCT +#ifdef KEYBOARD_iris_rev2 +#define PRODUCT Drashna Hacked Iris Rev.2 +#endif + +#define SHFT_LED1 5 +#define SHFT_LED2 10 + +#define CTRL_LED1 6 +#define CTRL_LED2 9 + +#define GUI_LED1 7 +#define GUI_LED2 8 + +#endif diff --git a/keyboards/iris/keymaps/drashna_old/keymap.c b/keyboards/iris/keymaps/drashna_old/keymap.c new file mode 100644 index 000000000..bc3cd38ad --- /dev/null +++ b/keyboards/iris/keymaps/drashna_old/keymap.c @@ -0,0 +1,89 @@ + +#include QMK_KEYBOARD_H +#include "drashna.h" + +#define KC_ALAP ALT_T(KC_APP) +#define KC_OSLG OSM(MOD_LGUI) +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [_QWERTY] = LAYOUT_wrapper( + KC_ESC, ________________NUMBER_LEFT________________, ________________NUMBER_RIGHT_______________, KC_MINS, + KC_TAB , _________________QWERTY_L1_________________, _________________QWERTY_R1_________________, KC_BSLS, + KC_CCCV, _________________QWERTY_L2_________________, _________________QWERTY_R2_________________, KC_QUOT, + KC_MLSF, _________________QWERTY_L3_________________, KC_ALAP, KC_OSLG, _________________QWERTY_R3_________________, KC_MRSF, + LT(_LOWER,KC_GRV), KC_SPC, KC_BSPC, KC_DEL, KC_ENT, RAISE + ), + [_COLEMAK] = LAYOUT_wrapper( + KC_ESC , ________________NUMBER_LEFT________________, ________________NUMBER_RIGHT_______________, KC_MINS, + KC_TAB , _________________COLEMAK_L1________________, _________________COLEMAK_R1________________, KC_BSLS, + KC_CCCV, _________________COLEMAK_L2________________, _________________COLEMAK_R2________________, KC_QUOT, + KC_MLSF, _________________COLEMAK_L3________________, KC_ALAP, KC_OSLG, _________________COLEMAK_R3________________, KC_MRSF, + LT(_LOWER,KC_GRV), KC_SPC, KC_BSPC, KC_DEL, KC_ENT, RAISE + ), + [_DVORAK] = LAYOUT_wrapper( + KC_ESC, ________________NUMBER_LEFT________________, ________________NUMBER_RIGHT_______________, KC_MINS, + KC_TAB , _________________DVORAK_L1_________________, _________________DVORAK_R1_________________, KC_BSLS, + KC_CCCV, _________________DVORAK_L2_________________, _________________DVORAK_R2_________________, KC_QUOT, + KC_MLSF, _________________DVORAK_L3_________________, KC_ALAP, KC_OSLG, _________________DVORAK_R3_________________, KC_MRSF, + LT(_LOWER,KC_GRV), KC_SPC, KC_BSPC, KC_DEL, KC_ENT, RAISE + ), + [_WORKMAN] = LAYOUT_wrapper( + KC_ESC, ________________NUMBER_LEFT________________, ________________NUMBER_RIGHT_______________, KC_MINS, + KC_TAB , _________________WORKMAN_L1________________, _________________WORKMAN_R1________________, KC_BSLS, + KC_CCCV, _________________WORKMAN_L2________________, _________________WORKMAN_R2________________, KC_QUOT, + KC_MLSF, _________________WORKMAN_L3________________, KC_ALAP, KC_OSLG, _________________WORKMAN_R3________________, KC_MRSF, + LT(_LOWER,KC_GRV), KC_SPC, KC_BSPC, KC_DEL, KC_ENT, RAISE + ), + + [_MODS] = LAYOUT_wrapper( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + KC_LSFT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_RSFT, + _______, _______, _______, _______, _______, _______ + ), + + + [_LOWER] = LAYOUT_wrapper( + _______, _________________FUNC_LEFT_________________, _________________FUNC_RIGHT________________, _______, + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, + _______, _______, _______, _______, _______, _______, _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, + _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, + _______, _______, _______, _______, _______, _______ + ), + + [_RAISE] = LAYOUT_wrapper( + _______, _________________FUNC_LEFT_________________, _________________FUNC_RIGHT________________, _______, + KC_GRV, ________________NUMBER_LEFT________________, ________________NUMBER_RIGHT_______________, _______, + _______, _______, _______, _______, _______, _______, _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, + _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END, _______, + _______, _______, _______, _______, _______, _______ + ), + + [_ADJUST] = LAYOUT_wrapper( + KC_MAKE, _______, _______, _______, _______, _______, KC_SEC1, KC_SEC2, KC_SEC3, KC_SEC4, KC_SEC5, KC_RST, + VRSN, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, RGB_TOG, KC_NUKE, _______, _______, _______, _______, EPRM, + _______, _______, CK_TOGG, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, WORKMAN, TG(_MODS), + _______, RGB_SMOD,RGB_HUD, RGB_SAD, RGB_VAD, KC_RGB_T,_______, _______, MG_NKRO, KC_MUTE, KC_VOLD, KC_VOLU, KC_MNXT, KC_MPLY, + _______, _______, _______, _______, _______, _______ + ) + +}; + + +bool indicator_is_this_led_used(uint8_t index) { + switch (index) { +#ifdef INDICATOR_LIGHTS + case SHFT_LED1: + case SHFT_LED2: + case CTRL_LED1: + case CTRL_LED2: + case GUI_LED1: + case GUI_LED2: + return true; + break; +#endif + default: + return false; + } +} diff --git a/keyboards/iris/keymaps/drashna_old/rules.mk b/keyboards/iris/keymaps/drashna_old/rules.mk new file mode 100644 index 000000000..1a6b63f16 --- /dev/null +++ b/keyboards/iris/keymaps/drashna_old/rules.mk @@ -0,0 +1,17 @@ +USER_NAME := drashna + +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = no # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration +TAP_DANCE_ENABLE = no +RGBLIGHT_ENABLE = yes +AUDIO_ENABLE = yes +NKRO_ENABLE = yes +BACKLIGHT_ENABLE = no +SWAP_HANDS_ENABLE = no + +INDICATOR_LIGHTS = yes +MACROS_ENABLED = no +RGBLIGHT_TWINKLE = yes diff --git a/keyboards/orthodox/keymaps/drashna/config.h b/keyboards/orthodox/keymaps/drashna/config.h index 1c3620616..8c283e7ca 100644 --- a/keyboards/orthodox/keymaps/drashna/config.h +++ b/keyboards/orthodox/keymaps/drashna/config.h @@ -76,4 +76,14 @@ along with this program. If not, see . #define QMK_LED B0 #define QMK_SPEAKER C6 + +#define SHFT_LED1 5 +#define SHFT_LED2 10 + +#define CTRL_LED1 6 +#define CTRL_LED2 9 + +#define GUI_LED1 7 +#define GUI_LED2 8 + #endif diff --git a/keyboards/orthodox/keymaps/drashna/keymap.c b/keyboards/orthodox/keymaps/drashna/keymap.c index bcc59268c..c65e21cb0 100644 --- a/keyboards/orthodox/keymaps/drashna/keymap.c +++ b/keyboards/orthodox/keymaps/drashna/keymap.c @@ -28,7 +28,6 @@ extern userspace_config_t userspace_config; uint8_t last_mod; uint8_t last_led; uint8_t last_osm; -bool has_mods_changed = false; #endif // Each layer gets a name for readability, which is then used in the keymap matrix below. @@ -46,25 +45,25 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_QWERTY] = LAYOUT_wrapper(\ KC_ESC, _________________QWERTY_L1_________________, _________________QWERTY_R1_________________, KC_BSPC, - KC_TAB, _________________QWERTY_L2_________________, KC_UP, KC_DOWN, KC_LEFT, KC_RIGHT, _________________QWERTY_R2_________________, KC_QUOT, - KC_MLSF, _________________QWERTY_L3_________________, LOWER, KC_SPACE,KC_BSPC, KC_DEL, KC_ENT, RAISE, _________________QWERTY_R3_________________, KC_LGUI + KC_TAB, _________________QWERTY_L2_________________, ALT_APP, OS_LGUI, KC_LALT, OS_RGUI, _________________QWERTY_R2_________________, KC_QUOT, + KC_MLSF, _________________QWERTY_L3_________________, LOWER, KC_SPACE,KC_BSPC, KC_DEL, KC_ENT, RAISE, _________________QWERTY_R3_________________, KC_MRSF ), [_COLEMAK] = LAYOUT_wrapper(\ KC_ESC, _________________COLEMAK_L1________________, _________________COLEMAK_R1________________, KC_BSPC, - KC_TAB, _________________COLEMAK_L2________________, KC_UP, KC_DOWN, KC_LEFT, KC_RIGHT, _________________COLEMAK_R2________________, KC_QUOT, - KC_MLSF, _________________COLEMAK_L3________________, LOWER, KC_SPACE,KC_BSPC, KC_DEL, KC_ENT, RAISE, _________________COLEMAK_R3________________, KC_LGUI + KC_TAB, _________________COLEMAK_L2________________, ALT_APP, OS_LGUI, KC_LALT, OS_RGUI, _________________COLEMAK_R2________________, KC_QUOT, + KC_MLSF, _________________COLEMAK_L3________________, LOWER, KC_SPACE,KC_BSPC, KC_DEL, KC_ENT, RAISE, _________________COLEMAK_R3________________, KC_MRSF ), [_DVORAK] = LAYOUT_wrapper(\ KC_ESC, _________________DVORAK_L1_________________, _________________DVORAK_R1_________________, KC_BSPC, - KC_TAB, _________________DVORAK_L2_________________, KC_UP, KC_DOWN, KC_LEFT, KC_RIGHT, _________________DVORAK_R2_________________, KC_MINS, - KC_MLSF, _________________DVORAK_L3_________________, LOWER, KC_SPACE,KC_BSPC, KC_DEL, KC_ENT, RAISE, _________________DVORAK_R3_________________, KC_LGUI + KC_TAB, _________________DVORAK_L2_________________, ALT_APP, OS_LGUI, KC_LALT, OS_RGUI, _________________DVORAK_R2_________________, KC_MINS, + KC_MLSF, _________________DVORAK_L3_________________, LOWER, KC_SPACE,KC_BSPC, KC_DEL, KC_ENT, RAISE, _________________DVORAK_R3_________________, KC_MRSF ), [_WORKMAN] = LAYOUT_wrapper(\ KC_ESC, _________________WORKMAN_L1________________, _________________WORKMAN_R1________________, KC_BSPC, - KC_TAB, _________________WORKMAN_L2________________, KC_UP, KC_DOWN, KC_LEFT, KC_RIGHT, _________________WORKMAN_R2________________, KC_MINS, - KC_MLSF, _________________WORKMAN_L3________________, LOWER, KC_SPACE,KC_BSPC, KC_DEL, KC_ENT, RAISE, _________________WORKMAN_R3________________, KC_LGUI + KC_TAB, _________________WORKMAN_L2________________, ALT_APP, OS_LGUI, KC_LALT, OS_RGUI, _________________WORKMAN_R2________________, KC_MINS, + KC_MLSF, _________________WORKMAN_L3________________, LOWER, KC_SPACE,KC_BSPC, KC_DEL, KC_ENT, RAISE, _________________WORKMAN_R3________________, KC_MRSF ), [_MODS] = LAYOUT_wrapper(\ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, @@ -73,105 +72,40 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), [_LOWER] = LAYOUT_wrapper(\ - KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, - _______, _________________FUNC_LEFT_________________, KC_PGUP, KC_PGDN, KC_HOME, KC_END, _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, - _______, _________________FUNC_RIGHT________________, _______, _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______ + 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_F11, _________________FUNC_LEFT_________________, _______, _______, _______, _______, _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, + KC_F12, _________________FUNC_RIGHT________________, _______, _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______ ), [_RAISE] = LAYOUT_wrapper(\ KC_GRV, ________________NUMBER_LEFT________________, ________________NUMBER_RIGHT_______________, KC_BSPC, - _______, _______, _______, _______, _______, _______, KC_PGUP, KC_PGDN, KC_HOME, KC_END, _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END, _______ ), [_ADJUST] = LAYOUT_wrapper(\ KC_MAKE, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, RGB_TOG, KC_SEC1, KC_SEC2, KC_SEC3, KC_SEC4, KC_SEC5, KC_RESET, - VRSN, _______, CK_TOGG, AU_ON, AU_OFF, AG_NORM, _______, _______, _______, _______, AG_SWAP, KC_QWERTY, KC_COLEMAK, KC_DVORAK, KC_WORKMAN, EPRM, + VRSN, _______, CK_TOGG, AU_ON, AU_OFF, AG_NORM, _______, _______, _______, KC_NUKE, AG_SWAP, QWERTY, COLEMAK, DVORAK, WORKMAN, EPRM, TG(_MODS),RGB_RMOD,RGB_HUD,RGB_SAD, RGB_VAD, KC_RGB_T,_______, _______, _______, _______, _______, _______, MG_NKRO, KC_MUTE, KC_VOLD, KC_VOLU, KC_MNXT, KC_MPLY ) }; -void matrix_init_keymap(void) { -#ifdef INDICATOR_LIGHTS - last_mod = get_mods(); - last_led = host_keyboard_leds(); - last_osm =get_oneshot_mods(); -#endif -} -uint32_t layer_state_set_keymap (uint32_t state) { +bool indicator_is_this_led_used(uint8_t index) { + switch (index) { #ifdef INDICATOR_LIGHTS - uint8_t modifiders = get_mods(); - uint8_t led_usb_state = host_keyboard_leds(); - uint8_t one_shot = get_oneshot_mods(); - - - if (modifiders & MODS_SHIFT_MASK || led_usb_state & (1<. #include "drashna.h" #include "version.h" - -#if (__has_include("secrets.h") && !defined(NO_SECRETS)) -#include "secrets.h" -#else -// `PROGMEM const char secret[][x]` may work better, but it takes up more space in the firmware -// And I'm not familiar enough to know which is better or why... -PROGMEM const char secret[][64] = { - "test1", - "test2", - "test3", - "test4", - "test5" -}; -#endif +#include "eeprom.h" +#include "tap_dances.h" +#include "rgb_stuff.h" float tone_copy[][2] = SONG(SCROLL_LOCK_ON_SOUND); float tone_paste[][2] = SONG(SCROLL_LOCK_OFF_SOUND); - static uint16_t copy_paste_timer; userspace_config_t userspace_config; // Helper Functions -void tap(uint16_t keycode){ register_code(keycode); unregister_code(keycode); }; - -#ifdef RGBLIGHT_ENABLE -void rgblight_sethsv_default_helper(uint8_t index) { - uint8_t default_layer = eeconfig_read_default_layer(); - if (default_layer & (1UL << _COLEMAK)) { - rgblight_sethsv_at(300, 255, 255, index); - rgblight_sethsv_at(300, 255, 255, index); - } - else if (default_layer & (1UL << _DVORAK)) { - rgblight_sethsv_at(120, 255, 255, index); - rgblight_sethsv_at(120, 255, 255, index); - } - else if (default_layer & (1UL << _WORKMAN)) { - rgblight_sethsv_at(43, 255, 255, index); - rgblight_sethsv_at(43, 255, 255, index); - } - else { - rgblight_sethsv_at(180, 255, 255, index); - rgblight_sethsv_at(180, 255, 255, index); - } -} -#endif // RGBLIGHT_ENABLE - -// ========================================= TAP DANCE ========================================= -#ifdef TAP_DANCE_ENABLE -//define diablo macro timer variables -static uint16_t diablo_timer[4]; -static uint8_t diablo_times[] = { 0, 1, 3, 5, 10, 30 }; -static uint8_t diablo_key_time[4]; - -// has the correct number of seconds elapsed (as defined by diablo_times) -bool check_dtimer(uint8_t dtimer) { return (timer_elapsed(diablo_timer[dtimer]) < (diablo_key_time[dtimer] * 1000)) ? false : true; }; - -// Cycle through the times for the macro, starting at 0, for disabled. -// Max of six values, so don't exceed -void diablo_tapdance_master(qk_tap_dance_state_t *state, void *user_data, uint8_t diablo_key) { - if (state->count >= 7) { - diablo_key_time[diablo_key] = diablo_times[0]; - reset_tap_dance(state); - } else { - diablo_key_time[diablo_key] = diablo_times[state->count - 1]; - } -} -// Would rather have one function for all of this, but no idea how to do that... -void diablo_tapdance1(qk_tap_dance_state_t *state, void *user_data) { diablo_tapdance_master(state, user_data, 0); } -void diablo_tapdance2(qk_tap_dance_state_t *state, void *user_data) { diablo_tapdance_master(state, user_data, 1); } -void diablo_tapdance3(qk_tap_dance_state_t *state, void *user_data) { diablo_tapdance_master(state, user_data, 2); } -void diablo_tapdance4(qk_tap_dance_state_t *state, void *user_data) { diablo_tapdance_master(state, user_data, 3); } - -//Tap Dance Definitions -qk_tap_dance_action_t tap_dance_actions[] = { - // tap once to disable, and more to enable timed micros - [TD_D3_1] = ACTION_TAP_DANCE_FN(diablo_tapdance1), - [TD_D3_2] = ACTION_TAP_DANCE_FN(diablo_tapdance2), - [TD_D3_3] = ACTION_TAP_DANCE_FN(diablo_tapdance3), - [TD_D3_4] = ACTION_TAP_DANCE_FN(diablo_tapdance4), -}; - -// Sends the key press to system, but only if on the Diablo layer -void send_diablo_keystroke(uint8_t diablo_key) { - if (biton32(layer_state) == _DIABLO) { - switch (diablo_key) { - case 0: - tap(KC_1); break; - case 1: - tap(KC_2); break; - case 2: - tap(KC_3); break; - case 3: - tap(KC_4); break; - } +// This block is for all of the gaming macros, as they were all doing +// the same thing, but with differring text sent. +bool send_game_macro(const char *str, keyrecord_t *record, bool override) { + if (!record->event.pressed || override) { + clear_keyboard(); + tap(userspace_config.is_overwatch ? KC_BSPC : KC_ENTER); + wait_ms(50); + send_string(str); + wait_ms(50); + tap(KC_ENTER); } + if (override) wait_ms(3000); + return false; } -// Checks each of the 4 timers/keys to see if enough time has elapsed -// Runs the "send string" command if enough time has passed, and resets the timer. -void run_diablo_macro_check(void) { - uint8_t dtime; - for (dtime = 0; dtime < 4; dtime++) { - if (check_dtimer(dtime) && diablo_key_time[dtime]) { - diablo_timer[dtime] = timer_read(); - send_diablo_keystroke(dtime); - } - } -} -#endif // TAP_DANCE_ENABLE +void tap(uint16_t keycode){ register_code(keycode); unregister_code(keycode); }; // Add reconfigurable functions here, for keymap customization @@ -147,6 +64,11 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; } +__attribute__ ((weak)) +bool process_record_secrets(uint16_t keycode, keyrecord_t *record) { + return true; +} + __attribute__ ((weak)) uint32_t layer_state_set_keymap (uint32_t state) { return state; @@ -159,9 +81,12 @@ void led_set_keymap(uint8_t usb_led) {} // Call user matrix init, set default RGB colors and then // call the keymap's init function void matrix_init_user(void) { - uint8_t default_layer = eeconfig_read_default_layer(); userspace_config.raw = eeprom_read_byte(EECONFIG_USERSPACE); +#ifdef AUDIO_CLICKY + clicky_enable = userspace_config.clicky_enable; +#endif + #ifdef BOOTLOADER_CATERINA DDRD &= ~(1<<5); PORTD &= ~(1<<5); @@ -170,39 +95,15 @@ void matrix_init_user(void) { PORTB &= ~(1<<0); #endif - if (userspace_config.rgb_layer_change) { -#ifdef RGBLIGHT_ENABLE - rgblight_enable(); -#endif // RGBLIGHT_ENABLE - if (default_layer & (1UL << _COLEMAK)) { - #ifdef RGBLIGHT_ENABLE - rgblight_sethsv_magenta(); - #endif // RGBLIGHT_ENABLE - } else if (default_layer & (1UL << _DVORAK)) { - #ifdef RGBLIGHT_ENABLE - rgblight_sethsv_green(); - #endif // RGBLIGHT_ENABLE - } else if (default_layer & (1UL << _WORKMAN)) { - #ifdef RGBLIGHT_ENABLE - rgblight_sethsv_goldenrod(); - #endif // RGBLIGHT_ENABLE - } else { - #ifdef RGBLIGHT_ENABLE - rgblight_sethsv_teal(); - #endif // RGBLIGHT_ENABLE - } - } -#ifdef AUDIO_CLICKY - clicky_enable = userspace_config.clicky_enable; -#endif - -#if ( defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE) ) +#if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE)) set_unicode_input_mode(UC_WINC); #endif //UNICODE_ENABLE - + matrix_init_rgb(); matrix_init_keymap(); } + + // No global matrix scan code, so just run keymap's matrix // scan function void matrix_scan_user(void) { @@ -211,24 +112,14 @@ void matrix_scan_user(void) { run_diablo_macro_check(); #endif // TAP_DANCE_ENABLE +#ifdef RGBLIGHT_ENABLE + matrix_scan_rgb(); +#endif // RGBLIGHT_ENABLE + matrix_scan_keymap(); } -// This block is for all of the gaming macros, as they were all doing -// the same thing, but with differring text sent. -bool send_game_macro(const char *str, keyrecord_t *record, bool override) { - if (!record->event.pressed || override) { - clear_keyboard(); - tap(userspace_config.is_overwatch ? KC_BSPC : KC_ENTER); - wait_ms(50); - send_string(str); - wait_ms(50); - tap(KC_ENTER); - } - if (override) wait_ms(3000); - return false; -} // Defines actions tor my global custom keycodes. Defined in drashna.h file @@ -236,10 +127,9 @@ bool send_game_macro(const char *str, keyrecord_t *record, bool override) { bool process_record_user(uint16_t keycode, keyrecord_t *record) { // If console is enabled, it will print the matrix position and status of each key pressed -#ifdef CONSOLE_ENABLE +#ifdef KEYLOGGER_ENABLE xprintf("KL: row: %u, column: %u, pressed: %u\n", record->event.key.col, record->event.key.row, record->event.pressed); -#endif //CONSOLE_ENABLE - +#endif //KEYLOGGER_ENABLE switch (keycode) { case KC_QWERTY: @@ -287,8 +177,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case KC_RESET: // Custom RESET code that sets RGBLights to RED if (!record->event.pressed) { #ifdef RGBLIGHT_ENABLE - rgblight_enable(); - rgblight_mode(1); + rgblight_enable_noeeprom(); + rgblight_mode_noeeprom(1); rgblight_setrgb_red(); #endif // RGBLIGHT_ENABLE reset_keyboard(); @@ -300,6 +190,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case EPRM: // Resets EEPROM if (record->event.pressed) { eeconfig_init(); + default_layer_set(1UL<event.pressed) { - clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED); - send_string_P(secret[keycode - KC_SECRET_1]); - } - return false; - break; - +/* Code has been depreciated + case KC_SECRET_1 ... KC_SECRET_5: // Secrets! Externally defined strings, not stored in repo + if (!record->event.pressed) { + clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED); + send_string(decoy_secret[keycode - KC_SECRET_1]); + } + return false; + break; +*/ // These are a serious of gaming macros. // Only enables for the viterbi, basically, // to save on firmware space, since it's limited. -#if !(defined(KEYBOARD_orthodox_rev1) || defined(KEYBOARD_orthodox_rev3) || defined(KEYBOARD_ergodox_ez) || defined(KEYBOARD_iris_rev2)) +#ifdef MACROS_ENABLED case KC_OVERWATCH: // Toggle's if we hit "ENTER" or "BACKSPACE" to input macros if (record->event.pressed) { userspace_config.is_overwatch ^= 1; eeprom_update_byte(EECONFIG_USERSPACE, userspace_config.raw); } #ifdef RGBLIGHT_ENABLE - userspace_config.is_overwatch ? rgblight_mode(17) : rgblight_mode(18); + userspace_config.is_overwatch ? rgblight_mode_noeeprom(17) : rgblight_mode_noeeprom(18); #endif //RGBLIGHT_ENABLE return false; break; case KC_SALT: @@ -353,40 +245,19 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return send_game_macro("OMG!!! C9!!!", record, false); case KC_GGEZ: return send_game_macro("That was a fantastic game, though it was a bit easy. Try harder next time!", record, false); -#endif // !(defined(KEYBOARD_orthodox_rev1) || defined(KEYBOARD_orthodox_rev3) || defined(KEYBOARD_ergodox_ez)) +#endif // MACROS_ENABLED -#ifdef TAP_DANCE_ENABLE case KC_DIABLO_CLEAR: // reset all Diablo timers, disabling them +#ifdef TAP_DANCE_ENABLE if (record->event.pressed) { uint8_t dtime; for (dtime = 0; dtime < 4; dtime++) { diablo_key_time[dtime] = diablo_times[0]; } } +#endif // TAP_DANCE_ENABLE#endif return false; break; -#endif // TAP_DANCE_ENABLE - - - case KC_RGB_T: // This allows me to use underglow as layer indication, or as normal -#ifdef RGBLIGHT_ENABLE - if (record->event.pressed) { - userspace_config.rgb_layer_change ^= 1; - eeprom_update_byte(EECONFIG_USERSPACE, userspace_config.raw); - if (userspace_config.rgb_layer_change) { - layer_state_set(layer_state); // This is needed to immediately set the layer color (looks better) - } - } -#endif // RGBLIGHT_ENABLE - return false; break; -#ifdef RGBLIGHT_ENABLE - case RGB_MODE_FORWARD ... RGB_MODE_GRADIENT: // quantum_keycodes.h L400 for definitions - if (record->event.pressed) { //This disables layer indication, as it's assumed that if you're changing this ... you want that disabled - userspace_config.rgb_layer_change = false; - eeprom_update_byte(EECONFIG_USERSPACE, userspace_config.raw); - } - return true; break; -#endif // RGBLIGHT_ENABLE case KC_CCCV: // One key copy/paste @@ -443,7 +314,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { #endif // UNICODE_ENABLE } - return process_record_keymap(keycode, record); + return process_record_keymap(keycode, record) && process_record_secrets(keycode, record) && process_record_user_rgb(keycode, record); } @@ -452,111 +323,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { // on layer change, no matter where the change was initiated // Then runs keymap's layer change check uint32_t layer_state_set_user(uint32_t state) { - uint8_t default_layer = eeconfig_read_default_layer(); state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST); - - switch (biton32(state)) { - case _MACROS: -#ifdef RGBLIGHT_ENABLE - if (userspace_config.rgb_layer_change) { - rgblight_sethsv_orange(); - userspace_config.is_overwatch ? rgblight_mode(17) : rgblight_mode(18); - } -#endif // RGBLIGHT_ENABLE - - break; - case _MEDIA: -#ifdef RGBLIGHT_ENABLE - if (userspace_config.rgb_layer_change) { - rgblight_sethsv_chartreuse(); - rgblight_mode(22); - } -#endif // RGBLIGHT_ENABLE - - break; - case _GAMEPAD: -#ifdef RGBLIGHT_ENABLE - if (userspace_config.rgb_layer_change) { - rgblight_sethsv_orange(); - rgblight_mode(17); - } -#endif // RGBLIGHT_ENABLE - - break; - case _DIABLO: -#ifdef RGBLIGHT_ENABLE - if (userspace_config.rgb_layer_change) { - rgblight_sethsv_red(); - rgblight_mode(5); - } -#endif // RGBLIGHT_ENABLE - - break; - case _RAISE: #ifdef RGBLIGHT_ENABLE - if (userspace_config.rgb_layer_change) { - rgblight_sethsv_yellow(); - rgblight_mode(5); - } -#endif // RGBLIGHT_ENABLE - - break; - case _LOWER: -#ifdef RGBLIGHT_ENABLE - if (userspace_config.rgb_layer_change) { - rgblight_sethsv_orange(); - rgblight_mode(5); - } -#endif // RGBLIGHT_ENABLE - - break; - case _ADJUST: -#ifdef RGBLIGHT_ENABLE - if (userspace_config.rgb_layer_change) { - rgblight_sethsv_red(); - rgblight_mode(23); - } -#endif // RGBLIGHT_ENABLE - - break; - default: // for any other layers, or the default layer - if (default_layer & (1UL << _COLEMAK)) { -#ifdef RGBLIGHT_ENABLE - if (userspace_config.rgb_layer_change) { rgblight_sethsv_magenta(); } -#endif // RGBLIGHT_ENABLE - - } - else if (default_layer & (1UL << _DVORAK)) { -#ifdef RGBLIGHT_ENABLE - if (userspace_config.rgb_layer_change) { rgblight_sethsv_green(); } + state = layer_state_set_rgb(state); #endif // RGBLIGHT_ENABLE - - } - else if (default_layer & (1UL << _WORKMAN)) { -#ifdef RGBLIGHT_ENABLE - if (userspace_config.rgb_layer_change) { rgblight_sethsv_goldenrod(); } -#endif // RGBLIGHT_ENABLE - - } - else { -#ifdef RGBLIGHT_ENABLE - if (userspace_config.rgb_layer_change) { rgblight_sethsv_teal(); } -#endif // RGBLIGHT_ENABLE - - } - if (biton32(state) == _MODS) { // If the non-OSM layer is enabled, then breathe -#ifdef RGBLIGHT_ENABLE - if (userspace_config.rgb_layer_change) { rgblight_mode(2); } -#endif // RGBLIGHT_ENABLE - - } else { // otherwise, stay solid -#ifdef RGBLIGHT_ENABLE - if (userspace_config.rgb_layer_change) { rgblight_mode(1); } -#endif // RGBLIGHT_ENABLE - - } - break; - } return layer_state_set_keymap (state); } diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h index 87a72f528..e035b86fb 100644 --- a/users/drashna/drashna.h +++ b/users/drashna/drashna.h @@ -42,6 +42,7 @@ enum userspace_layers { #define MODS_ALT_MASK (MOD_BIT(KC_LALT)|MOD_BIT(KC_RALT)) #define MODS_GUI_MASK (MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) + // RGB color codes are no longer located here anymore. Instead, you will want to // head to https://github.com/qmk/qmk_firmware/blob/master/quantum/rgblight_list.h @@ -51,7 +52,11 @@ extern bool clicky_enable; void rgblight_sethsv_default_helper(uint8_t index); #endif // RGBLIGHT_ENABLE -#define EECONFIG_USERSPACE (uint8_t *)20 +void tap(uint16_t keycode); +bool process_record_secrets(uint16_t keycode, keyrecord_t *record); + + +#define EECONFIG_USERSPACE (uint8_t *)19 typedef union { uint8_t raw; @@ -59,6 +64,7 @@ typedef union { bool clicky_enable :1; bool rgb_layer_change :1; bool is_overwatch :1; + bool nuke_switch :1; }; } userspace_config_t; @@ -91,6 +97,8 @@ enum userspace_custom_keycodes { KC_SECRET_4, KC_SECRET_5, KC_CCCV, + KC_NUKE, + #ifdef UNICODE_ENABLE UC_FLIP, #endif //UNICODE_ENABLE @@ -112,8 +120,8 @@ enum userspace_custom_keycodes { #define DVORAK KC_DVORAK #define COLEMAK KC_COLEMAK #define WORKMAN KC_WORKMAN -#define KC_RST KC_RESET +#define KC_RST KC_RESET #ifdef SWAP_HANDS_ENABLE #define KC_C1R3 SH_TT @@ -125,6 +133,16 @@ enum userspace_custom_keycodes { #define KC_MLSF OSM(MOD_LSFT) #define KC_MRSF OSM(MOD_RSFT) +#define OS_LGUI OSM(MOD_LGUI) +#define OS_RGUI OSM(MOD_RGUI) +#define OS_LSFT OSM(MOD_LSFT) +#define OS_RSFT OSM(MOD_RSFT) +#define OS_LCTL OSM(MOD_LCTL) +#define OS_RCTL OSM(MOD_RCTL) +#define OS_LALT OSM(MOD_LALT) +#define OS_RALT OSM(MOD_RALT) +#define ALT_APP ALT_T(KC_APP) + #define MG_NKRO MAGIC_TOGGLE_NKRO @@ -200,8 +218,8 @@ enum { #define ______________COLEMAK_MOD_DH_L3____________ CTL_T(KC_Z), KC_X, KC_C, KC_D, KC_V #define ______________COLEMAK_MOD_DH_R1____________ KC_J, KC_L, KC_U, KC_Y, KC_SCLN -#define ______________COLEMAK_MOD_DH_R2____________ KC_K, KC_N, KC_E, KC_I, KC_O -#define ______________COLEMAK_MOD_DH_R3____________ KC_M, KC_H, KC_COMM, KC_DOT, CTL_T(KC_SLASH) +#define ______________COLEMAK_MOD_DH_R2____________ KC_M, KC_N, KC_E, KC_I, KC_O +#define ______________COLEMAK_MOD_DH_R3____________ KC_K, KC_H, KC_COMM, KC_DOT, CTL_T(KC_SLASH) #define _________________DVORAK_L1_________________ KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y @@ -227,7 +245,7 @@ enum { #define _________________NORMAN_L3_________________ CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B #define _________________NORMAN_R1_________________ KC_J, KC_U, KC_R, KC_L, KC_SCLN -#define _________________NORMAN_R2_________________ KC_J, KC_N, KC_I, KC_O, KC_U +#define _________________NORMAN_R2_________________ KC_Y, KC_N, KC_I, KC_O, KC_U #define _________________NORMAN_R3_________________ KC_P, KC_M, KC_COMM, KC_DOT, CTL_T(KC_SLASH) #define ________________NUMBER_LEFT________________ KC_1, KC_2, KC_3, KC_4, KC_5 @@ -243,7 +261,7 @@ enum { #define ___________ERGODOX_BOTTOM_RIGHT____________ KC_LEFT, KC_DOWN, KC_UP, KC_RGHT -#define __________________ERGODOX_THUMB_CLUSTER_____________________ ALT_T(KC_APP), KC_LGUI, KC_RGUI, CTL_T(KC_ESCAPE), \ +#define __________________ERGODOX_THUMB_CLUSTER_____________________ ALT_T(KC_APP), OSM(MOD_LGUI), OSM(MOD_RGUI), CTL_T(KC_ESCAPE), \ KC_HOME, KC_PGUP, \ LT(_LOWER, KC_SPACE),KC_BSPC, KC_END, KC_PGDN, KC_DEL, LT(_RAISE, KC_ENTER) diff --git a/users/drashna/readme.md b/users/drashna/readme.md index ddf24b24f..0aa73ece9 100644 --- a/users/drashna/readme.md +++ b/users/drashna/readme.md @@ -96,7 +96,7 @@ Then you can create this file and add your macro strings to it: ###### secrets.h ```c -PROGMEM const char secret[][64] = { +static const char * const secrets[] = { "secret1", "secret2", "secret3", @@ -116,7 +116,7 @@ In the `.c` file, you will want to add this to the top: #else // `PROGMEM const char secret[][x]` may work better, but it takes up more space in the firmware // And I'm not familiar enough to know which is better or why... -PROGMEM const char secret[][64] = { +static const char * const secrets[] = { "test1", "test2", "test3", diff --git a/users/drashna/rgb_stuff.c b/users/drashna/rgb_stuff.c new file mode 100644 index 000000000..af7190cc3 --- /dev/null +++ b/users/drashna/rgb_stuff.c @@ -0,0 +1,261 @@ +#include "drashna.h" +#include "rgb_stuff.h" + +extern rgblight_config_t rgblight_config; +extern userspace_config_t userspace_config; + +#ifdef RGBLIGHT_ENABLE +void rgblight_sethsv_default_helper(uint8_t index) { + rgblight_sethsv_at(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, index); +} +#endif // RGBLIGHT_ENABLE + +#ifdef INDICATOR_LIGHTS +uint8_t last_mod; +uint8_t last_led; +uint8_t last_osm; +uint8_t current_mod; +uint8_t current_led; +uint8_t current_osm; + + +void set_rgb_indicators(uint8_t this_mod, uint8_t this_led, uint8_t this_osm) { + if (userspace_config.rgb_layer_change && biton32(layer_state) == 0) { + if (this_mod & MODS_SHIFT_MASK || this_led & (1< 10) { + rgblight_fadeout *light = &lights[light_index]; + litup = true; + + if (light->life) { + light->life -= 1; + if (biton32(layer_state) == 0) { + sethsv(light->hue + rand() % 0xF, 255, light->life, (LED_TYPE *)&led[light_index]); + } + light->timer = timer_read(); + } + else { + if (light->enabled && biton32(layer_state) == 0) { rgblight_sethsv_default_helper(light_index); } + litup = light->enabled = false; + } + } + } + if (litup && biton32(layer_state) == 0) { + rgblight_set(); + } +} + +void start_rgb_light(void) { + + uint8_t indices[RGBLED_NUM]; + uint8_t indices_count = 0; + uint8_t min_life = 0xFF; + uint8_t min_life_index = -1; + for (uint8_t index = 0 ; index < RGBLED_NUM ; ++index ) { + if (indicator_is_this_led_used(index)) { continue; } + if (lights[index].enabled) { + if (min_life_index == -1 || + lights[index].life < min_life) + { + min_life = lights[index].life; + min_life_index = index; + } + continue; + } + + indices[indices_count] = index; + ++indices_count; + } + + uint8_t light_index; + if (!indices_count) { + light_index = min_life_index; + } + else { + light_index = indices[rand() % indices_count]; + } + + rgblight_fadeout *light = &lights[light_index]; + light->enabled = true; + light->timer = timer_read(); + light->life = 0xC0 + rand() % 0x40; + + light->hue = rgblight_config.hue + (rand() % 0xB4) - 0x54; + + rgblight_sethsv_at(light->hue, 255, light->life, light_index); +} +#endif + + +bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { +#ifdef RGBLIGHT_TWINKLE + case KC_A ... KC_SLASH: + case KC_F1 ... KC_F12: + case KC_INSERT ... KC_UP: + case KC_KP_SLASH ... KC_KP_DOT: + case KC_F13 ... KC_F24: + case KC_AUDIO_MUTE ... KC_MEDIA_REWIND: + if (record->event.pressed) { start_rgb_light(); } + return true; break; +#endif // RGBLIGHT_TWINKLE + case KC_RGB_T: // This allows me to use underglow as layer indication, or as normal +#ifdef RGBLIGHT_ENABLE + if (record->event.pressed) { + userspace_config.rgb_layer_change ^= 1; + xprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change); + eeprom_update_byte(EECONFIG_USERSPACE, userspace_config.raw); + if (userspace_config.rgb_layer_change) { + layer_state_set(layer_state); // This is needed to immediately set the layer color (looks better) + } + } +#endif // RGBLIGHT_ENABLE + return false; break; +#ifdef RGBLIGHT_ENABLE + case RGB_MODE_FORWARD ... RGB_MODE_GRADIENT: // quantum_keycodes.h L400 for definitions + if (record->event.pressed) { //This disables layer indication, as it's assumed that if you're changing this ... you want that disabled + if (userspace_config.rgb_layer_change) { + userspace_config.rgb_layer_change = false; + xprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change); + eeprom_update_byte(EECONFIG_USERSPACE, userspace_config.raw); + } + } + return true; break; +#endif // RGBLIGHT_ENABLE + } + return true; +} + + + +void matrix_init_rgb(void) { +#ifdef INDICATOR_LIGHTS + current_mod = last_mod = get_mods(); + current_led = last_led = host_keyboard_leds(); + current_osm = last_osm = get_oneshot_mods(); +#endif + + if (userspace_config.rgb_layer_change) { + uint8_t default_layer = eeconfig_read_default_layer(); + rgblight_enable_noeeprom(); + if (default_layer & (1UL << _COLEMAK)) { + rgblight_sethsv_magenta(); + } else if (default_layer & (1UL << _DVORAK)) { + rgblight_sethsv_green(); + } else if (default_layer & (1UL << _WORKMAN)) { + rgblight_sethsv_goldenrod(); + } else { + rgblight_sethsv_cyan(); + } + } +} + +void matrix_scan_rgb(void) { +#ifdef RGBLIGHT_TWINKLE + scan_rgblight_fadeout(); +#endif // RGBLIGHT_ENABLE + +#ifdef INDICATOR_LIGHTS + matrix_scan_indicator(); +#endif + +} + + +uint32_t layer_state_set_rgb(uint32_t state) { +#ifdef RGBLIGHT_ENABLE + uint8_t default_layer = eeconfig_read_default_layer(); + if (userspace_config.rgb_layer_change) { + switch (biton32(state)) { + case _MACROS: + rgblight_sethsv_noeeprom_orange(); + userspace_config.is_overwatch ? rgblight_mode_noeeprom(17) : rgblight_mode_noeeprom(18); + break; + case _MEDIA: + rgblight_sethsv_noeeprom_chartreuse(); + rgblight_mode_noeeprom(22); + break; + case _GAMEPAD: + rgblight_sethsv_noeeprom_orange(); + rgblight_mode_noeeprom(17); + break; + case _DIABLO: + rgblight_sethsv_noeeprom_red(); + rgblight_mode_noeeprom(5); + break; + case _RAISE: + rgblight_sethsv_noeeprom_yellow(); + rgblight_mode_noeeprom(5); + break; + case _LOWER: + rgblight_sethsv_noeeprom_orange(); + rgblight_mode_noeeprom(5); + break; + case _ADJUST: + rgblight_sethsv_noeeprom_red(); + rgblight_mode_noeeprom(23); + break; + default: // for any other layers, or the default layer + if (default_layer & (1UL << _COLEMAK)) { + rgblight_sethsv_noeeprom_magenta(); + } else if (default_layer & (1UL << _DVORAK)) { + rgblight_sethsv_noeeprom_green(); + } else if (default_layer & (1UL << _WORKMAN)) { + rgblight_sethsv_noeeprom_goldenrod(); + } else { + rgblight_sethsv_noeeprom_cyan(); + } + biton32(state) == _MODS ? rgblight_mode_noeeprom(2) : rgblight_mode_noeeprom(1); // if _MODS layer is on, then breath to denote it + break; + } +// layer_state_set_indicator(); // Runs every scan, so need to call this here .... since I can't get it working "right" anyhow + } +#endif // RGBLIGHT_ENABLE + + return state; +} diff --git a/users/drashna/rgb_stuff.h b/users/drashna/rgb_stuff.h new file mode 100644 index 000000000..6426ea266 --- /dev/null +++ b/users/drashna/rgb_stuff.h @@ -0,0 +1,16 @@ +#include "quantum.h" + +typedef struct { + bool enabled; + uint8_t hue; + uint16_t timer; + uint8_t life; +} rgblight_fadeout; + +bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record); +void scan_rgblight_fadeout(void); +void matrix_init_rgb(void); +void matrix_scan_rgb(void); +uint32_t layer_state_set_rgb(uint32_t state); + + diff --git a/users/drashna/rules.mk b/users/drashna/rules.mk index e2c5a2995..18df665c0 100644 --- a/users/drashna/rules.mk +++ b/users/drashna/rules.mk @@ -1,11 +1,34 @@ -SRC += drashna.c +SRC += drashna.c secrets.c rgb_stuff.c + +ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) + SRC += tap_dances.c +endif + EXTRAFLAGS += -flto ifeq ($(strip $(NO_SECRETS)), yes) OPT_DEFS += -DNO_SECRETS endif -ifeq ($(strip $(INDICATOR_LIGHTS)), yes) - OPT_DEFS += -DINDICATOR_LIGHTS +ifdef RGBLIGHT_ENABLE + ifeq ($(strip $(INDICATOR_LIGHTS)), yes) + OPT_DEFS += -DINDICATOR_LIGHTS + endif + ifeq ($(strip $(RGBLIGHT_TWINKLE)), yes) + OPT_DEFS += -DRGBLIGHT_TWINKLE + endif + ifeq ($(strip $(RGBLIGHT_NOEEPROM)), yes) + OPT_DEFS += -DRGBLIGHT_NOEEPROM + endif +endif + +ifeq ($(strip $(MACROS_ENABLED)), yes) + OPT_DEFS += -DMACROS_ENABLED +endif + +ifdef CONSOLE_ENABLE + ifeq ($(strip $(KEYLOGGER_ENABLE)), yes) + OPT_DEFS += -DKEYLOGGER_ENABLE + endif endif diff --git a/users/drashna/tap_dances.c b/users/drashna/tap_dances.c new file mode 100644 index 000000000..c9e4b1d0f --- /dev/null +++ b/users/drashna/tap_dances.c @@ -0,0 +1,65 @@ +#include "drashna.h" +#include "tap_dances.h" + + +//define diablo macro timer variables +uint16_t diablo_timer[4]; +uint8_t diablo_times[] = { 0, 1, 3, 5, 10, 30 }; +uint8_t diablo_key_time[4]; + +// has the correct number of seconds elapsed (as defined by diablo_times) +bool check_dtimer(uint8_t dtimer) { return (timer_elapsed(diablo_timer[dtimer]) < (diablo_key_time[dtimer] * 1000)) ? false : true; }; + +// Cycle through the times for the macro, starting at 0, for disabled. +// Max of six values, so don't exceed +void diablo_tapdance_master(qk_tap_dance_state_t *state, void *user_data, uint8_t diablo_key) { + if (state->count >= 7) { + diablo_key_time[diablo_key] = diablo_times[0]; + reset_tap_dance(state); + } else { + diablo_key_time[diablo_key] = diablo_times[state->count - 1]; + } +} + +// Would rather have one function for all of this, but no idea how to do that... +void diablo_tapdance1(qk_tap_dance_state_t *state, void *user_data) { diablo_tapdance_master(state, user_data, 0); } +void diablo_tapdance2(qk_tap_dance_state_t *state, void *user_data) { diablo_tapdance_master(state, user_data, 1); } +void diablo_tapdance3(qk_tap_dance_state_t *state, void *user_data) { diablo_tapdance_master(state, user_data, 2); } +void diablo_tapdance4(qk_tap_dance_state_t *state, void *user_data) { diablo_tapdance_master(state, user_data, 3); } + +//Tap Dance Definitions +qk_tap_dance_action_t tap_dance_actions[] = { + // tap once to disable, and more to enable timed micros + [TD_D3_1] = ACTION_TAP_DANCE_FN(diablo_tapdance1), + [TD_D3_2] = ACTION_TAP_DANCE_FN(diablo_tapdance2), + [TD_D3_3] = ACTION_TAP_DANCE_FN(diablo_tapdance3), + [TD_D3_4] = ACTION_TAP_DANCE_FN(diablo_tapdance4), +}; + +// Sends the key press to system, but only if on the Diablo layer +void send_diablo_keystroke(uint8_t diablo_key) { + if (biton32(layer_state) == _DIABLO) { + switch (diablo_key) { + case 0: + tap(KC_1); break; + case 1: + tap(KC_2); break; + case 2: + tap(KC_3); break; + case 3: + tap(KC_4); break; + } + } +} + +// Checks each of the 4 timers/keys to see if enough time has elapsed +// Runs the "send string" command if enough time has passed, and resets the timer. +void run_diablo_macro_check(void) { + uint8_t dtime; + for (dtime = 0; dtime < 4; dtime++) { + if (check_dtimer(dtime) && diablo_key_time[dtime]) { + diablo_timer[dtime] = timer_read(); + send_diablo_keystroke(dtime); + } + } +} diff --git a/users/drashna/tap_dances.h b/users/drashna/tap_dances.h new file mode 100644 index 000000000..8935753f6 --- /dev/null +++ b/users/drashna/tap_dances.h @@ -0,0 +1,7 @@ +//define diablo macro timer variables +extern uint16_t diablo_timer[4]; +extern uint8_t diablo_times[]; +extern uint8_t diablo_key_time[4]; + + +void run_diablo_macro_check(void); -- cgit v1.2.3