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 resetpull/3101/head
parent
8eaf23ae81
commit
3d1349b280
@ -0,0 +1,70 @@
|
||||
/*
|
||||
Copyright 2017 Danny Nguyen <danny@keeb.io>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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
|
@ -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;
|
||||
}
|
||||
}
|
@ -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
|
@ -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<<USB_LED_CAPS_LOCK) || this_osm & MODS_SHIFT_MASK) {
|
||||
rgblight_sethsv_at(0, 255, 255, SHFT_LED1);
|
||||
rgblight_sethsv_at(0, 255, 255, SHFT_LED2);
|
||||
} else {
|
||||
rgblight_sethsv_default_helper(SHFT_LED1);
|
||||
rgblight_sethsv_default_helper(SHFT_LED2);
|
||||
}
|
||||
if (this_mod & MODS_CTRL_MASK || this_osm & MODS_CTRL_MASK) {
|
||||
rgblight_sethsv_at(51, 255, 255, CTRL_LED1);
|
||||
rgblight_sethsv_at(51, 255, 255, CTRL_LED2);
|
||||
} else {
|
||||
rgblight_sethsv_default_helper(CTRL_LED1);
|
||||
rgblight_sethsv_default_helper(CTRL_LED2);
|
||||
}
|
||||
if (this_mod & MODS_GUI_MASK || this_osm & MODS_GUI_MASK) {
|
||||
rgblight_sethsv_at(120, 255, 255, GUI_LED1);
|
||||
rgblight_sethsv_at(120, 255, 255, GUI_LED2);
|
||||
} else {
|
||||
rgblight_sethsv_default_helper(GUI_LED1);
|
||||
rgblight_sethsv_default_helper(GUI_LED2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void matrix_scan_indicator(void) {
|
||||
current_mod = get_mods();
|
||||
current_led = host_keyboard_leds();
|
||||
current_osm = get_oneshot_mods();
|
||||
|
||||
set_rgb_indicators(current_mod, current_led, current_osm);
|
||||
|
||||
last_mod = current_mod;
|
||||
last_led = current_led;
|
||||
last_osm = current_osm;
|
||||
|
||||
}
|
||||
#endif //INDICATOR_LIGHTS
|
||||
|
||||
#ifdef RGBLIGHT_TWINKLE
|
||||
static rgblight_fadeout lights[RGBLED_NUM];
|
||||
|
||||
__attribute__ ((weak))
|
||||
bool indicator_is_this_led_used(uint8_t index) { return false; }
|
||||
|
||||
void scan_rgblight_fadeout(void) { // Don't effing change this function .... rgblight_sethsv is supppppper intensive
|
||||
bool litup = false;
|
||||
for (uint8_t light_index = 0 ; light_index < RGBLED_NUM ; ++light_index ) {
|
||||
if (lights[light_index].enabled && timer_elapsed(lights[light_index].timer) > 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;
|
||||
}
|
@ -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);
|
||||
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@ -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);
|
Loading…
Reference in new issue