Merge remote-tracking branch 'qmk/master' into merge-2024-09-07
This commit is contained in:
commit
a780dd1cb1
7600 changed files with 37202 additions and 168275 deletions
|
|
@ -38,20 +38,44 @@ void dynamic_macro_led_blink(void) {
|
|||
|
||||
/* User hooks for Dynamic Macros */
|
||||
|
||||
__attribute__((weak)) void dynamic_macro_record_start_user(int8_t direction) {
|
||||
dynamic_macro_led_blink();
|
||||
__attribute__((weak)) bool dynamic_macro_record_start_kb(int8_t direction) {
|
||||
return dynamic_macro_record_start_user(direction);
|
||||
}
|
||||
|
||||
__attribute__((weak)) void dynamic_macro_play_user(int8_t direction) {
|
||||
__attribute__((weak)) bool dynamic_macro_record_start_user(int8_t direction) {
|
||||
dynamic_macro_led_blink();
|
||||
return true;
|
||||
}
|
||||
|
||||
__attribute__((weak)) void dynamic_macro_record_key_user(int8_t direction, keyrecord_t *record) {
|
||||
dynamic_macro_led_blink();
|
||||
__attribute__((weak)) bool dynamic_macro_play_kb(int8_t direction) {
|
||||
return dynamic_macro_play_user(direction);
|
||||
}
|
||||
|
||||
__attribute__((weak)) void dynamic_macro_record_end_user(int8_t direction) {
|
||||
__attribute__((weak)) bool dynamic_macro_play_user(int8_t direction) {
|
||||
dynamic_macro_led_blink();
|
||||
return true;
|
||||
}
|
||||
|
||||
__attribute__((weak)) bool dynamic_macro_record_key_kb(int8_t direction, keyrecord_t *record) {
|
||||
return dynamic_macro_record_key_user(direction, record);
|
||||
}
|
||||
|
||||
__attribute__((weak)) bool dynamic_macro_record_key_user(int8_t direction, keyrecord_t *record) {
|
||||
dynamic_macro_led_blink();
|
||||
return true;
|
||||
}
|
||||
|
||||
__attribute__((weak)) bool dynamic_macro_record_end_kb(int8_t direction) {
|
||||
return dynamic_macro_record_end_user(direction);
|
||||
}
|
||||
|
||||
__attribute__((weak)) bool dynamic_macro_record_end_user(int8_t direction) {
|
||||
dynamic_macro_led_blink();
|
||||
return true;
|
||||
}
|
||||
|
||||
__attribute__((weak)) bool dynamic_macro_valid_key_kb(uint16_t keycode, keyrecord_t *record) {
|
||||
return dynamic_macro_valid_key_user(keycode, record);
|
||||
}
|
||||
|
||||
__attribute__((weak)) bool dynamic_macro_valid_key_user(uint16_t keycode, keyrecord_t *record) {
|
||||
|
|
@ -74,7 +98,7 @@ __attribute__((weak)) bool dynamic_macro_valid_key_user(uint16_t keycode, keyrec
|
|||
void dynamic_macro_record_start(keyrecord_t **macro_pointer, keyrecord_t *macro_buffer, int8_t direction) {
|
||||
dprintln("dynamic macro recording: started");
|
||||
|
||||
dynamic_macro_record_start_user(direction);
|
||||
dynamic_macro_record_start_kb(direction);
|
||||
|
||||
clear_keyboard();
|
||||
layer_clear();
|
||||
|
|
@ -108,7 +132,7 @@ void dynamic_macro_play(keyrecord_t *macro_buffer, keyrecord_t *macro_end, int8_
|
|||
|
||||
layer_state_set(saved_layer_state);
|
||||
|
||||
dynamic_macro_play_user(direction);
|
||||
dynamic_macro_play_kb(direction);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -134,7 +158,7 @@ void dynamic_macro_record_key(keyrecord_t *macro_buffer, keyrecord_t **macro_poi
|
|||
**macro_pointer = *record;
|
||||
*macro_pointer += direction;
|
||||
}
|
||||
dynamic_macro_record_key_user(direction, record);
|
||||
dynamic_macro_record_key_kb(direction, record);
|
||||
|
||||
dprintf("dynamic macro: slot %d length: %d/%d\n", DYNAMIC_MACRO_CURRENT_SLOT(), DYNAMIC_MACRO_CURRENT_LENGTH(macro_buffer, *macro_pointer), DYNAMIC_MACRO_CURRENT_CAPACITY(macro_buffer, macro2_end));
|
||||
}
|
||||
|
|
@ -144,7 +168,7 @@ void dynamic_macro_record_key(keyrecord_t *macro_buffer, keyrecord_t **macro_poi
|
|||
* pointer to the end of the macro.
|
||||
*/
|
||||
void dynamic_macro_record_end(keyrecord_t *macro_buffer, keyrecord_t *macro_pointer, int8_t direction, keyrecord_t **macro_end) {
|
||||
dynamic_macro_record_end_user(direction);
|
||||
dynamic_macro_record_end_kb(direction);
|
||||
|
||||
/* Do not save the keys being held when stopping the recording,
|
||||
* i.e. the keys used to access the layer DM_RSTP is on.
|
||||
|
|
@ -220,15 +244,7 @@ void dynamic_macro_stop_recording(void) {
|
|||
macro_id = 0;
|
||||
}
|
||||
|
||||
/* Handle the key events related to the dynamic macros. Should be
|
||||
* called from process_record_user() like this:
|
||||
*
|
||||
* bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
* if (!process_record_dynamic_macro(keycode, record)) {
|
||||
* return false;
|
||||
* }
|
||||
* <...THE REST OF THE FUNCTION...>
|
||||
* }
|
||||
/* Handle the key events related to the dynamic macros.
|
||||
*/
|
||||
bool process_dynamic_macro(uint16_t keycode, keyrecord_t *record) {
|
||||
if (macro_id == 0) {
|
||||
|
|
@ -271,7 +287,7 @@ bool process_dynamic_macro(uint16_t keycode, keyrecord_t *record) {
|
|||
return false;
|
||||
#endif
|
||||
default:
|
||||
if (dynamic_macro_valid_key_user(keycode, record)) {
|
||||
if (dynamic_macro_valid_key_kb(keycode, record)) {
|
||||
/* Store the key in the macro buffer and process it normally. */
|
||||
switch (macro_id) {
|
||||
case 1:
|
||||
|
|
|
|||
|
|
@ -37,8 +37,14 @@
|
|||
|
||||
void dynamic_macro_led_blink(void);
|
||||
bool process_dynamic_macro(uint16_t keycode, keyrecord_t *record);
|
||||
void dynamic_macro_record_start_user(int8_t direction);
|
||||
void dynamic_macro_play_user(int8_t direction);
|
||||
void dynamic_macro_record_key_user(int8_t direction, keyrecord_t *record);
|
||||
void dynamic_macro_record_end_user(int8_t direction);
|
||||
bool dynamic_macro_record_start_kb(int8_t direction);
|
||||
bool dynamic_macro_record_start_user(int8_t direction);
|
||||
bool dynamic_macro_play_kb(int8_t direction);
|
||||
bool dynamic_macro_play_user(int8_t direction);
|
||||
bool dynamic_macro_record_key_kb(int8_t direction, keyrecord_t *record);
|
||||
bool dynamic_macro_record_key_user(int8_t direction, keyrecord_t *record);
|
||||
bool dynamic_macro_record_end_kb(int8_t direction);
|
||||
bool dynamic_macro_record_end_user(int8_t direction);
|
||||
bool dynamic_macro_valid_key_kb(uint16_t keycode, keyrecord_t *record);
|
||||
bool dynamic_macro_valid_key_user(uint16_t keycode, keyrecord_t *record);
|
||||
void dynamic_macro_stop_recording(void);
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#include "action_util.h"
|
||||
#include "quantum.h"
|
||||
#include "quantum_keycodes.h"
|
||||
#include "keymap_introspection.h"
|
||||
|
||||
#ifndef KEY_OVERRIDE_REPEAT_DELAY
|
||||
# define KEY_OVERRIDE_REPEAT_DELAY 500
|
||||
|
|
@ -83,9 +84,6 @@ static uint16_t deferred_register = 0;
|
|||
// TODO: in future maybe save in EEPROM?
|
||||
static bool enabled = true;
|
||||
|
||||
// Public variables
|
||||
__attribute__((weak)) const key_override_t **key_overrides = NULL;
|
||||
|
||||
// Forward decls
|
||||
static const key_override_t *clear_active_override(const bool allow_reregister);
|
||||
|
||||
|
|
@ -247,12 +245,12 @@ static bool check_activation_event(const key_override_t *override, const bool ke
|
|||
|
||||
/** Iterates through the list of key overrides and tries activating each, until it finds one that activates or reaches the end of overrides. Returns true if the key action for `keycode` should be sent */
|
||||
static bool try_activating_override(const uint16_t keycode, const uint8_t layer, const bool key_down, const bool is_mod, const uint8_t active_mods, bool *activated) {
|
||||
if (key_overrides == NULL) {
|
||||
if (key_override_count() == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (uint8_t i = 0;; i++) {
|
||||
const key_override_t *const override = key_overrides[i];
|
||||
for (uint8_t i = 0; i < key_override_count(); i++) {
|
||||
const key_override_t *const override = key_override_get(i);
|
||||
|
||||
// End of array
|
||||
if (override == NULL) {
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ typedef enum {
|
|||
} ko_option_t;
|
||||
|
||||
/** Defines a single key override */
|
||||
typedef struct {
|
||||
typedef struct key_override_t {
|
||||
// The non-modifier keycode that triggers the override. This keycode, and the necessary modifiers (trigger_mods) must be pressed to activate this override. Set this to the keycode of the key that should activate the override. Set to KC_NO to require only the necessary modifiers to be pressed and no non-modifier.
|
||||
uint16_t trigger;
|
||||
|
||||
|
|
@ -87,9 +87,6 @@ typedef struct {
|
|||
bool *enabled;
|
||||
} key_override_t;
|
||||
|
||||
/** Define this as a null-terminated array of pointers to key overrides. These key overrides will be used by qmk. */
|
||||
extern const key_override_t **key_overrides;
|
||||
|
||||
/** Turns key overrides on */
|
||||
void key_override_on(void);
|
||||
|
||||
|
|
|
|||
101
quantum/process_keycode/process_rgb_matrix.c
Normal file
101
quantum/process_keycode/process_rgb_matrix.c
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
// Copyright 2024 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "process_rgb_matrix.h"
|
||||
#include "rgb_matrix.h"
|
||||
#include "action_util.h"
|
||||
#include "keycodes.h"
|
||||
#include "modifiers.h"
|
||||
|
||||
bool process_rgb_matrix(uint16_t keycode, keyrecord_t *record) {
|
||||
#ifdef RGB_TRIGGER_ON_KEYDOWN
|
||||
if (record->event.pressed) {
|
||||
#else
|
||||
if (!record->event.pressed) {
|
||||
#endif
|
||||
bool shifted = get_mods() & MOD_MASK_SHIFT;
|
||||
switch (keycode) {
|
||||
case QK_RGB_MATRIX_ON:
|
||||
rgb_matrix_enable();
|
||||
return false;
|
||||
case QK_RGB_MATRIX_OFF:
|
||||
rgb_matrix_disable();
|
||||
return false;
|
||||
case QK_RGB_MATRIX_TOGGLE:
|
||||
rgb_matrix_toggle();
|
||||
return false;
|
||||
case QK_RGB_MATRIX_MODE_NEXT:
|
||||
if (shifted) {
|
||||
rgb_matrix_step_reverse();
|
||||
} else {
|
||||
rgb_matrix_step();
|
||||
}
|
||||
return false;
|
||||
case QK_RGB_MATRIX_MODE_PREVIOUS:
|
||||
if (shifted) {
|
||||
rgb_matrix_step();
|
||||
} else {
|
||||
rgb_matrix_step_reverse();
|
||||
}
|
||||
return false;
|
||||
case QK_RGB_MATRIX_HUE_UP:
|
||||
if (shifted) {
|
||||
rgb_matrix_decrease_hue();
|
||||
} else {
|
||||
rgb_matrix_increase_hue();
|
||||
}
|
||||
return false;
|
||||
case QK_RGB_MATRIX_HUE_DOWN:
|
||||
if (shifted) {
|
||||
rgb_matrix_increase_hue();
|
||||
} else {
|
||||
rgb_matrix_decrease_hue();
|
||||
}
|
||||
return false;
|
||||
case QK_RGB_MATRIX_SATURATION_UP:
|
||||
if (shifted) {
|
||||
rgb_matrix_decrease_sat();
|
||||
} else {
|
||||
rgb_matrix_increase_sat();
|
||||
}
|
||||
return false;
|
||||
case QK_RGB_MATRIX_SATURATION_DOWN:
|
||||
if (shifted) {
|
||||
rgb_matrix_increase_sat();
|
||||
} else {
|
||||
rgb_matrix_decrease_sat();
|
||||
}
|
||||
return false;
|
||||
case QK_RGB_MATRIX_VALUE_UP:
|
||||
if (shifted) {
|
||||
rgb_matrix_decrease_val();
|
||||
} else {
|
||||
rgb_matrix_increase_val();
|
||||
}
|
||||
return false;
|
||||
case QK_RGB_MATRIX_VALUE_DOWN:
|
||||
if (shifted) {
|
||||
rgb_matrix_increase_val();
|
||||
} else {
|
||||
rgb_matrix_decrease_val();
|
||||
}
|
||||
return false;
|
||||
case QK_RGB_MATRIX_SPEED_UP:
|
||||
if (shifted) {
|
||||
rgb_matrix_decrease_speed();
|
||||
} else {
|
||||
rgb_matrix_increase_speed();
|
||||
}
|
||||
return false;
|
||||
case QK_RGB_MATRIX_SPEED_DOWN:
|
||||
if (shifted) {
|
||||
rgb_matrix_increase_speed();
|
||||
} else {
|
||||
rgb_matrix_decrease_speed();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
10
quantum/process_keycode/process_rgb_matrix.h
Normal file
10
quantum/process_keycode/process_rgb_matrix.h
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
// Copyright 2024 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "action.h"
|
||||
|
||||
bool process_rgb_matrix(uint16_t keycode, keyrecord_t *record);
|
||||
|
|
@ -21,6 +21,7 @@
|
|||
#include "action_util.h"
|
||||
#include "timer.h"
|
||||
#include "wait.h"
|
||||
#include "keymap_introspection.h"
|
||||
|
||||
static uint16_t active_td;
|
||||
static uint16_t last_tap_time;
|
||||
|
|
@ -133,7 +134,7 @@ bool preprocess_tap_dance(uint16_t keycode, keyrecord_t *record) {
|
|||
|
||||
if (!active_td || keycode == active_td) return false;
|
||||
|
||||
action = &tap_dance_actions[QK_TAP_DANCE_GET_INDEX(active_td)];
|
||||
action = tap_dance_get(QK_TAP_DANCE_GET_INDEX(active_td));
|
||||
action->state.interrupted = true;
|
||||
action->state.interrupting_keycode = keycode;
|
||||
process_tap_dance_action_on_dance_finished(action);
|
||||
|
|
@ -150,11 +151,16 @@ bool preprocess_tap_dance(uint16_t keycode, keyrecord_t *record) {
|
|||
}
|
||||
|
||||
bool process_tap_dance(uint16_t keycode, keyrecord_t *record) {
|
||||
int td_index;
|
||||
tap_dance_action_t *action;
|
||||
|
||||
switch (keycode) {
|
||||
case QK_TAP_DANCE ... QK_TAP_DANCE_MAX:
|
||||
action = &tap_dance_actions[QK_TAP_DANCE_GET_INDEX(keycode)];
|
||||
td_index = QK_TAP_DANCE_GET_INDEX(keycode);
|
||||
if (td_index >= tap_dance_count()) {
|
||||
return false;
|
||||
}
|
||||
action = tap_dance_get(td_index);
|
||||
|
||||
action->state.pressed = record->event.pressed;
|
||||
if (record->event.pressed) {
|
||||
|
|
@ -182,7 +188,7 @@ void tap_dance_task(void) {
|
|||
|
||||
if (!active_td || timer_elapsed(last_tap_time) <= GET_TAPPING_TERM(active_td, &(keyrecord_t){})) return;
|
||||
|
||||
action = &tap_dance_actions[QK_TAP_DANCE_GET_INDEX(active_td)];
|
||||
action = tap_dance_get(QK_TAP_DANCE_GET_INDEX(active_td));
|
||||
if (!action->state.interrupted) {
|
||||
process_tap_dance_action_on_dance_finished(action);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ typedef struct {
|
|||
|
||||
typedef void (*tap_dance_user_fn_t)(tap_dance_state_t *state, void *user_data);
|
||||
|
||||
typedef struct {
|
||||
typedef struct tap_dance_action_t {
|
||||
tap_dance_state_t state;
|
||||
struct {
|
||||
tap_dance_user_fn_t on_each_tap;
|
||||
|
|
@ -78,8 +78,6 @@ typedef struct {
|
|||
#define TD_INDEX(code) QK_TAP_DANCE_GET_INDEX(code)
|
||||
#define TAP_DANCE_KEYCODE(state) TD(((tap_dance_action_t *)state) - tap_dance_actions)
|
||||
|
||||
extern tap_dance_action_t tap_dance_actions[];
|
||||
|
||||
void reset_tap_dance(tap_dance_state_t *state);
|
||||
|
||||
/* To be used internally */
|
||||
|
|
|
|||
91
quantum/process_keycode/process_underglow.c
Normal file
91
quantum/process_keycode/process_underglow.c
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
// Copyright 2024 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "process_underglow.h"
|
||||
#include "rgblight.h"
|
||||
#include "action_util.h"
|
||||
#include "keycodes.h"
|
||||
#include "modifiers.h"
|
||||
|
||||
bool process_underglow(uint16_t keycode, keyrecord_t *record) {
|
||||
if (record->event.pressed) {
|
||||
uint8_t shifted = get_mods() & MOD_MASK_SHIFT;
|
||||
switch (keycode) {
|
||||
case QK_UNDERGLOW_TOGGLE:
|
||||
rgblight_toggle();
|
||||
return false;
|
||||
case QK_UNDERGLOW_MODE_NEXT:
|
||||
if (shifted) {
|
||||
rgblight_step_reverse();
|
||||
} else {
|
||||
rgblight_step();
|
||||
}
|
||||
return false;
|
||||
case QK_UNDERGLOW_MODE_PREVIOUS:
|
||||
if (shifted) {
|
||||
rgblight_step();
|
||||
} else {
|
||||
rgblight_step_reverse();
|
||||
}
|
||||
return false;
|
||||
case QK_UNDERGLOW_HUE_UP:
|
||||
if (shifted) {
|
||||
rgblight_decrease_hue();
|
||||
} else {
|
||||
rgblight_increase_hue();
|
||||
}
|
||||
return false;
|
||||
case QK_UNDERGLOW_HUE_DOWN:
|
||||
if (shifted) {
|
||||
rgblight_increase_hue();
|
||||
} else {
|
||||
rgblight_decrease_hue();
|
||||
}
|
||||
return false;
|
||||
case QK_UNDERGLOW_SATURATION_UP:
|
||||
if (shifted) {
|
||||
rgblight_decrease_sat();
|
||||
} else {
|
||||
rgblight_increase_sat();
|
||||
}
|
||||
return false;
|
||||
case QK_UNDERGLOW_SATURATION_DOWN:
|
||||
if (shifted) {
|
||||
rgblight_increase_sat();
|
||||
} else {
|
||||
rgblight_decrease_sat();
|
||||
}
|
||||
return false;
|
||||
case QK_UNDERGLOW_VALUE_UP:
|
||||
if (shifted) {
|
||||
rgblight_decrease_val();
|
||||
} else {
|
||||
rgblight_increase_val();
|
||||
}
|
||||
return false;
|
||||
case QK_UNDERGLOW_VALUE_DOWN:
|
||||
if (shifted) {
|
||||
rgblight_increase_hue();
|
||||
} else {
|
||||
rgblight_decrease_hue();
|
||||
}
|
||||
return false;
|
||||
case QK_UNDERGLOW_SPEED_UP:
|
||||
if (shifted) {
|
||||
rgblight_decrease_speed();
|
||||
} else {
|
||||
rgblight_increase_speed();
|
||||
}
|
||||
return false;
|
||||
case QK_UNDERGLOW_SPEED_DOWN:
|
||||
if (shifted) {
|
||||
rgblight_increase_speed();
|
||||
} else {
|
||||
rgblight_decrease_speed();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
10
quantum/process_keycode/process_underglow.h
Normal file
10
quantum/process_keycode/process_underglow.h
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
// Copyright 2024 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "action.h"
|
||||
|
||||
bool process_underglow(uint16_t keycode, keyrecord_t *record);
|
||||
Loading…
Add table
Add a link
Reference in a new issue