diff options
Diffstat (limited to 'quantum')
-rw-r--r-- | quantum/dynamic_macro.h | 4 | ||||
-rw-r--r-- | quantum/keymap_extras/keymap_spanish.h | 6 | ||||
-rw-r--r-- | quantum/process_keycode/process_tap_dance.c | 14 | ||||
-rw-r--r-- | quantum/process_keycode/process_tap_dance.h | 7 | ||||
-rw-r--r-- | quantum/quantum.c | 8 | ||||
-rw-r--r-- | quantum/quantum_keycodes.h | 3 | ||||
-rw-r--r-- | quantum/visualizer/led_keyframes.c | 14 | ||||
-rw-r--r-- | quantum/visualizer/led_keyframes.h | 3 | ||||
-rw-r--r-- | quantum/visualizer/visualizer.c | 34 | ||||
-rw-r--r-- | quantum/visualizer/visualizer.h | 9 | ||||
-rw-r--r-- | quantum/visualizer/visualizer.mk | 3 |
11 files changed, 93 insertions, 12 deletions
diff --git a/quantum/dynamic_macro.h b/quantum/dynamic_macro.h index f242405def..045ee95b5f 100644 --- a/quantum/dynamic_macro.h +++ b/quantum/dynamic_macro.h @@ -274,6 +274,10 @@ bool process_record_dynamic_macro(uint16_t keycode, keyrecord_t *record) macro_id = 0; } return false; + case DYN_MACRO_PLAY1: + case DYN_MACRO_PLAY2: + dprintln("dynamic macro: ignoring macro play key while recording"); + return false; default: /* Store the key in the macro buffer and process it normally. */ switch (macro_id) { diff --git a/quantum/keymap_extras/keymap_spanish.h b/quantum/keymap_extras/keymap_spanish.h index 3a5787e9c4..224db7be16 100644 --- a/quantum/keymap_extras/keymap_spanish.h +++ b/quantum/keymap_extras/keymap_spanish.h @@ -55,8 +55,8 @@ #define ES_UMLT LSFT(ES_GRV) #define ES_GRTR LSFT(ES_LESS) -#define ES_SCLN LSFT(ES_COMM) -#define ES_COLN LSFT(ES_DOT) +#define ES_SCLN LSFT(KC_COMM) +#define ES_COLN LSFT(KC_DOT) #define ES_UNDS LSFT(ES_MINS) // Alt Gr-ed characters @@ -72,6 +72,6 @@ #define ES_RBRC ALGR(ES_PLUS) #define ES_LCBR ALGR(ES_ACUT) -#define ES_RCRB ALGR(ES_CCED) +#define ES_RCBR ALGR(ES_CCED) #endif diff --git a/quantum/process_keycode/process_tap_dance.c b/quantum/process_keycode/process_tap_dance.c index b807ec3c30..4fd45810bb 100644 --- a/quantum/process_keycode/process_tap_dance.c +++ b/quantum/process_keycode/process_tap_dance.c @@ -127,14 +127,22 @@ bool process_tap_dance(uint16_t keycode, keyrecord_t *record) { return true; } + + void matrix_scan_tap_dance () { if (highest_td == -1) return; + uint16_t tap_user_defined; -for (int i = 0; i <= highest_td; i++) { +for (uint8_t i = 0; i <= highest_td; i++) { qk_tap_dance_action_t *action = &tap_dance_actions[i]; - - if (action->state.count && timer_elapsed (action->state.timer) > TAPPING_TERM) { + if(action->custom_tapping_term > 0 ) { + tap_user_defined = action->custom_tapping_term; + } + else{ + tap_user_defined = TAPPING_TERM; + } + if (action->state.count && timer_elapsed (action->state.timer) > tap_user_defined) { process_tap_dance_action_on_dance_finished (action); reset_tap_dance (&action->state); } diff --git a/quantum/process_keycode/process_tap_dance.h b/quantum/process_keycode/process_tap_dance.h index 330809f83a..f42c154a05 100644 --- a/quantum/process_keycode/process_tap_dance.h +++ b/quantum/process_keycode/process_tap_dance.h @@ -44,6 +44,7 @@ typedef struct qk_tap_dance_user_fn_t on_reset; } fn; qk_tap_dance_state_t state; + uint16_t custom_tapping_term; void *user_data; } qk_tap_dance_action_t; @@ -68,6 +69,12 @@ typedef struct .user_data = NULL, \ } +#define ACTION_TAP_DANCE_FN_ADVANCED_TIME(user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset, tap_specific_tapping_term) { \ + .fn = { user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset }, \ + .user_data = NULL, \ + .custom_tapping_term = tap_specific_tapping_term, \ + } + extern qk_tap_dance_action_t tap_dance_actions[]; /* To be used internally */ diff --git a/quantum/quantum.c b/quantum/quantum.c index 4f4cee4e9b..f5fb1e35c8 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -437,6 +437,14 @@ bool process_record_quantum(keyrecord_t *record) { return false; // break; } + case GRAVE_ESC: { + void (*method)(uint8_t) = (record->event.pressed) ? &add_key : &del_key; + uint8_t shifted = get_mods() & ((MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT) + |MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI))); + + method(shifted ? KC_GRAVE : KC_ESCAPE); + send_keyboard_report(); + } default: { shift_interrupted[0] = true; shift_interrupted[1] = true; diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h index 7354ae0da1..c34ecafa51 100644 --- a/quantum/quantum_keycodes.h +++ b/quantum/quantum_keycodes.h @@ -104,6 +104,7 @@ enum quantum_keycodes { MAGIC_UNHOST_NKRO, MAGIC_UNSWAP_ALT_GUI, MAGIC_TOGGLE_NKRO, + GRAVE_ESC, // Leader key #ifndef DISABLE_LEADER @@ -514,6 +515,8 @@ enum quantum_keycodes { #define MACROTAP(kc) (kc | QK_MACRO | FUNC_TAP<<8) #define MACRODOWN(...) (record->event.pressed ? MACRO(__VA_ARGS__) : MACRO_NONE) +#define KC_GESC GRAVE_ESC + // L-ayer, T-ap - 256 keycode max, 16 layer max #define LT(layer, kc) (kc | QK_LAYER_TAP | ((layer & 0xF) << 8)) diff --git a/quantum/visualizer/led_keyframes.c b/quantum/visualizer/led_keyframes.c index 2dacd990d1..c14491e5e1 100644 --- a/quantum/visualizer/led_keyframes.c +++ b/quantum/visualizer/led_keyframes.c @@ -127,3 +127,17 @@ bool led_keyframe_normal_orientation(keyframe_animation_t* animation, visualizer gdispGSetOrientation(LED_DISPLAY, GDISP_ROTATE_0); return false; } + +bool led_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) { + (void)state; + (void)animation; + gdispGSetPowerMode(LED_DISPLAY, powerOff); + return false; +} + +bool led_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) { + (void)state; + (void)animation; + gdispGSetPowerMode(LED_DISPLAY, powerOn); + return false; +} diff --git a/quantum/visualizer/led_keyframes.h b/quantum/visualizer/led_keyframes.h index a689430417..a59a4f37d1 100644 --- a/quantum/visualizer/led_keyframes.h +++ b/quantum/visualizer/led_keyframes.h @@ -35,6 +35,9 @@ bool led_keyframe_crossfade(keyframe_animation_t* animation, visualizer_state_t* bool led_keyframe_mirror_orientation(keyframe_animation_t* animation, visualizer_state_t* state); bool led_keyframe_normal_orientation(keyframe_animation_t* animation, visualizer_state_t* state); +bool led_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state); +bool led_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state); + extern keyframe_animation_t led_test_animation; diff --git a/quantum/visualizer/visualizer.c b/quantum/visualizer/visualizer.c index 6f134097f0..486ff25b3f 100644 --- a/quantum/visualizer/visualizer.c +++ b/quantum/visualizer/visualizer.c @@ -58,8 +58,11 @@ SOFTWARE. static visualizer_keyboard_status_t current_status = { .layer = 0xFFFFFFFF, .default_layer = 0xFFFFFFFF, - .mods = 0xFF, .leds = 0xFFFFFFFF, +#ifdef BACKLIGHT_ENABLE + .backlight_level = 0, +#endif + .mods = 0xFF, .suspended = false, #ifdef VISUALIZER_USER_DATA_SIZE .user_data = {0} @@ -72,6 +75,9 @@ static bool same_status(visualizer_keyboard_status_t* status1, visualizer_keyboa status1->mods == status2->mods && status1->leds == status2->leds && status1->suspended == status2->suspended +#ifdef BACKLIGHT_ENABLE + && status1->backlight_level == status2->backlight_level +#endif #ifdef VISUALIZER_USER_DATA_SIZE && memcmp(status1->user_data, status2->user_data, VISUALIZER_USER_DATA_SIZE) == 0 #endif @@ -279,6 +285,18 @@ static DECLARE_THREAD_FUNCTION(visualizerThread, arg) { bool enabled = visualizer_enabled; if (force_update || !same_status(&state.status, ¤t_status)) { force_update = false; + #if BACKLIGHT_ENABLE + if(current_status.backlight_level != state.status.backlight_level) { + if (current_status.backlight_level != 0) { + gdispGSetPowerMode(LED_DISPLAY, powerOn); + uint16_t percent = (uint16_t)current_status.backlight_level * 100 / BACKLIGHT_LEVELS; + gdispGSetBacklight(LED_DISPLAY, percent); + } + else { + gdispGSetPowerMode(LED_DISPLAY, powerOff); + } + } + #endif if (visualizer_enabled) { if (current_status.suspended) { stop_all_keyframe_animations(); @@ -309,7 +327,7 @@ static DECLARE_THREAD_FUNCTION(visualizerThread, arg) { update_keyframe_animation(animations[i], &state, delta, &sleep_time); } } -#ifdef LED_ENABLE +#ifdef BACKLIGHT_ENABLE gdispGFlush(LED_DISPLAY); #endif @@ -372,7 +390,7 @@ void visualizer_init(void) { #ifdef LCD_ENABLE LCD_DISPLAY = get_lcd_display(); #endif -#ifdef LED_ENABLE +#ifdef BACKLIGHT_ENABLE LED_DISPLAY = get_led_display(); #endif @@ -445,6 +463,9 @@ void visualizer_update(uint32_t default_state, uint32_t state, uint8_t mods, uin .default_layer = default_state, .mods = mods, .leds = leds, +#ifdef BACKLIGHT_ENABLE + .backlight_level = current_status.backlight_level, +#endif .suspended = current_status.suspended, }; #ifdef VISUALIZER_USER_DATA_SIZE @@ -467,3 +488,10 @@ void visualizer_resume(void) { current_status.suspended = false; update_status(true); } + +#ifdef BACKLIGHT_ENABLE +void backlight_set(uint8_t level) { + current_status.backlight_level = level; + update_status(true); +} +#endif diff --git a/quantum/visualizer/visualizer.h b/quantum/visualizer/visualizer.h index d6f279e101..1c567440fb 100644 --- a/quantum/visualizer/visualizer.h +++ b/quantum/visualizer/visualizer.h @@ -34,6 +34,10 @@ SOFTWARE. #include "lcd_backlight.h" #endif +#ifdef BACKLIGHT_ENABLE +#include "backlight.h" +#endif + // use this function to merge both real_mods and oneshot_mods in a uint16_t uint8_t visualizer_get_mods(void); @@ -65,9 +69,12 @@ struct keyframe_animation_t; typedef struct { uint32_t layer; uint32_t default_layer; - uint8_t mods; uint32_t leds; // See led.h for available statuses + uint8_t mods; bool suspended; +#ifdef BACKLIGHT_ENABLE + uint8_t backlight_level; +#endif #ifdef VISUALIZER_USER_DATA_SIZE uint8_t user_data[VISUALIZER_USER_DATA_SIZE]; #endif diff --git a/quantum/visualizer/visualizer.mk b/quantum/visualizer/visualizer.mk index 5f710124bc..6f97603bd8 100644 --- a/quantum/visualizer/visualizer.mk +++ b/quantum/visualizer/visualizer.mk @@ -42,9 +42,8 @@ SRC += $(VISUALIZER_DIR)/resources/lcd_logo.c OPT_DEFS += -DLCD_BACKLIGHT_ENABLE endif -ifeq ($(strip $(LED_ENABLE)), yes) +ifeq ($(strip $(BACKLIGHT_ENABLE)), yes) SRC += $(VISUALIZER_DIR)/led_keyframes.c -OPT_DEFS += -DLED_ENABLE endif include $(GFXLIB)/gfx.mk |