summaryrefslogtreecommitdiffstats
path: root/quantum
diff options
context:
space:
mode:
Diffstat (limited to 'quantum')
-rw-r--r--quantum/action.c2
-rw-r--r--quantum/action_layer.h2
-rw-r--r--quantum/action_tapping.c12
-rw-r--r--quantum/audio/song_list.h6
-rw-r--r--quantum/command.c4
-rw-r--r--quantum/debounce.h16
-rw-r--r--quantum/debounce/asym_eager_defer_pk.c11
-rw-r--r--quantum/debounce/none.c11
-rw-r--r--quantum/debounce/sym_defer_g.c12
-rw-r--r--quantum/debounce/sym_defer_pk.c12
-rw-r--r--quantum/debounce/sym_defer_pr.c14
-rw-r--r--quantum/debounce/sym_eager_pk.c7
-rw-r--r--quantum/debounce/sym_eager_pr.c11
-rw-r--r--quantum/debounce/tests/debounce_test_common.cpp6
-rw-r--r--quantum/dynamic_keymap.c6
-rw-r--r--quantum/encoder.c31
-rw-r--r--quantum/keyboard.c2
-rw-r--r--quantum/keycode_config.c4
-rw-r--r--quantum/keycode_config.h1
-rw-r--r--quantum/keymap.h7
-rw-r--r--quantum/keymap_extras/keymap_steno.h28
-rw-r--r--quantum/keymap_introspection.c30
-rw-r--r--quantum/keymap_introspection.h15
-rw-r--r--quantum/led.c12
-rw-r--r--quantum/led.h3
-rw-r--r--quantum/led_matrix/led_matrix.c12
-rw-r--r--quantum/led_matrix/led_matrix.h1
-rw-r--r--quantum/logging/print.c2
-rw-r--r--quantum/logging/print.h68
-rw-r--r--quantum/logging/print.mk17
-rw-r--r--quantum/matrix.c5
-rw-r--r--quantum/matrix_common.c5
-rw-r--r--quantum/mousekey.c27
-rw-r--r--quantum/mousekey.h4
-rw-r--r--quantum/painter/qp.h4
-rw-r--r--quantum/painter/rules.mk13
-rw-r--r--quantum/pointing_device.c38
-rw-r--r--quantum/pointing_device.h12
-rw-r--r--quantum/pointing_device_drivers.c170
-rw-r--r--quantum/pointing_device_gestures.c133
-rw-r--r--quantum/pointing_device_gestures.h58
-rw-r--r--quantum/process_keycode/process_auto_shift.c2
-rw-r--r--quantum/process_keycode/process_dynamic_macro.c3
-rw-r--r--quantum/process_keycode/process_dynamic_tapping_term.c2
-rw-r--r--quantum/process_keycode/process_leader.c1
-rw-r--r--quantum/process_keycode/process_magic.c10
-rw-r--r--quantum/process_keycode/process_steno.c312
-rw-r--r--quantum/process_keycode/process_steno.h24
-rw-r--r--quantum/process_keycode/process_tap_dance.c137
-rw-r--r--quantum/process_keycode/process_tap_dance.h33
-rw-r--r--quantum/process_keycode/process_terminal.c330
-rw-r--r--quantum/process_keycode/process_terminal.h24
-rw-r--r--quantum/process_keycode/process_terminal_nop.h22
-rw-r--r--quantum/quantum.c3
-rw-r--r--quantum/quantum.h11
-rw-r--r--quantum/quantum_keycodes.h14
-rw-r--r--quantum/quantum_keycodes_legacy.h3
-rw-r--r--quantum/rgb_matrix/animations/typing_heatmap_anim.h88
-rw-r--r--quantum/rgb_matrix/rgb_matrix.c23
-rw-r--r--quantum/rgb_matrix/rgb_matrix.h1
-rw-r--r--quantum/send_string.h54
-rw-r--r--quantum/send_string/send_string.c (renamed from quantum/send_string.c)126
-rw-r--r--quantum/send_string/send_string.h152
-rw-r--r--quantum/send_string/send_string_keycodes.h434
-rw-r--r--quantum/send_string_keycodes.h505
-rw-r--r--quantum/split_common/split_util.c12
-rw-r--r--quantum/via.c21
-rw-r--r--quantum/wear_leveling/tests/backing_mocks.cpp154
-rw-r--r--quantum/wear_leveling/tests/backing_mocks.hpp210
-rw-r--r--quantum/wear_leveling/tests/rules.mk66
-rw-r--r--quantum/wear_leveling/tests/testlist.mk6
-rw-r--r--quantum/wear_leveling/tests/wear_leveling_2byte.cpp228
-rw-r--r--quantum/wear_leveling/tests/wear_leveling_2byte_optimized_writes.cpp295
-rw-r--r--quantum/wear_leveling/tests/wear_leveling_4byte.cpp193
-rw-r--r--quantum/wear_leveling/tests/wear_leveling_8byte.cpp178
-rw-r--r--quantum/wear_leveling/tests/wear_leveling_general.cpp204
-rw-r--r--quantum/wear_leveling/wear_leveling.c768
-rw-r--r--quantum/wear_leveling/wear_leveling.h54
-rw-r--r--quantum/wear_leveling/wear_leveling_internal.h151
79 files changed, 4212 insertions, 1476 deletions
diff --git a/quantum/action.c b/quantum/action.c
index 4e81a5466f..83f6e2a970 100644
--- a/quantum/action.c
+++ b/quantum/action.c
@@ -844,7 +844,7 @@ __attribute__((weak)) void register_code(uint8_t code) {
# endif
add_key(KC_CAPS_LOCK);
send_keyboard_report();
- wait_ms(100);
+ wait_ms(TAP_HOLD_CAPS_DELAY);
del_key(KC_CAPS_LOCK);
send_keyboard_report();
}
diff --git a/quantum/action_layer.h b/quantum/action_layer.h
index b87d096eed..bd1085a70f 100644
--- a/quantum/action_layer.h
+++ b/quantum/action_layer.h
@@ -41,7 +41,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#endif
#if !defined(LAYER_STATE_8BIT) && !defined(LAYER_STATE_16BIT) && !defined(LAYER_STATE_32BIT)
-# define LAYER_STATE_32BIT
+# define LAYER_STATE_16BIT
#endif
#if defined(LAYER_STATE_8BIT)
diff --git a/quantum/action_tapping.c b/quantum/action_tapping.c
index 3c8b5678b7..df3317ac05 100644
--- a/quantum/action_tapping.c
+++ b/quantum/action_tapping.c
@@ -125,7 +125,7 @@ void action_tapping_process(keyrecord_t record) {
/* return true when key event is processed or consumed. */
bool process_tapping(keyrecord_t *keyp) {
keyevent_t event = keyp->event;
-# if (defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT)) || defined(TAPPING_TERM_PER_KEY) || defined(PERMISSIVE_HOLD_PER_KEY) || defined(TAPPING_FORCE_HOLD_PER_KEY) || defined(HOLD_ON_OTHER_KEY_PRESS_PER_KEY)
+# if (defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT)) || defined(PERMISSIVE_HOLD_PER_KEY) || defined(TAPPING_FORCE_HOLD_PER_KEY) || defined(HOLD_ON_OTHER_KEY_PRESS_PER_KEY)
uint16_t tapping_keycode = get_record_keycode(&tapping_key, false);
# endif
@@ -164,17 +164,15 @@ bool process_tapping(keyrecord_t *keyp) {
* useful for long TAPPING_TERM but may prevent fast typing.
*/
// clang-format off
-# if defined(TAPPING_TERM_PER_KEY) || (TAPPING_TERM >= 500) || defined(PERMISSIVE_HOLD) || defined(PERMISSIVE_HOLD_PER_KEY) || (defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT))
+# if defined(PERMISSIVE_HOLD) || defined(PERMISSIVE_HOLD_PER_KEY) || (defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT))
else if (
(
- (
- GET_TAPPING_TERM(tapping_keycode, &tapping_key) >= 500
+ IS_RELEASED(event) && waiting_buffer_typed(event)
# ifdef PERMISSIVE_HOLD_PER_KEY
- || get_permissive_hold(tapping_keycode, &tapping_key)
+ && get_permissive_hold(tapping_keycode, &tapping_key)
# elif defined(PERMISSIVE_HOLD)
- || true
+ && true
# endif
- ) && IS_RELEASED(event) && waiting_buffer_typed(event)
)
// Causes nested taps to not wait past TAPPING_TERM/RETRO_SHIFT
// unnecessarily and fixes them for Layer Taps.
diff --git a/quantum/audio/song_list.h b/quantum/audio/song_list.h
index 3e425abb47..ff22e6fe95 100644
--- a/quantum/audio/song_list.h
+++ b/quantum/audio/song_list.h
@@ -144,6 +144,12 @@
*/
#define USSR_ANTHEM B__NOTE(_G6), B__NOTE(_C7), W__NOTE(_G6), H__NOTE(_A6), B__NOTE(_B6), W__NOTE(_E6), W__NOTE(_E6), B__NOTE(_A6), W__NOTE(_G6), H__NOTE(_F6), B__NOTE(_G6), W__NOTE(_C6), W__NOTE(_C6), B__NOTE(_D6), W__NOTE(_D6), W__NOTE(_E6), B__NOTE(_D6), W__NOTE(_D6), W__NOTE(_G6), B__NOTE(_F6), W__NOTE(_G6), W__NOTE(_A6), B__NOTE(_B6),
+/* Title: Hymn Risen
+ * Author/Composer: Terrance Andrew Davis
+ * License: Public Domain
+ */
+#define TOS_HYMN_RISEN H__NOTE(_D5), H__NOTE(_E5), HD_NOTE(_F5), HD_NOTE(_F5), H__NOTE(_F5), HD_NOTE(_D5), E__NOTE(_E5), E__NOTE(_E5), H__NOTE(_C5), Q__NOTE(_D5), Q__NOTE(_D5), H__NOTE(_E5), H__NOTE(_C5), Q__NOTE(_G5), Q__NOTE(_F5), H__NOTE(_D5), H__NOTE(_E5), HD_NOTE(_F5), HD_NOTE(_F5), H__NOTE(_F5), HD_NOTE(_D5), E__NOTE(_E5), E__NOTE(_E5), H__NOTE(_C5), Q__NOTE(_D5), Q__NOTE(_D5), H__NOTE(_E5), H__NOTE(_C5), Q__NOTE(_G5), Q__NOTE(_F5), H__NOTE(_D5), H__NOTE(_C5), W__NOTE(_D5), W__NOTE(_E5), Q__NOTE(_A4), H__NOTE(_A4), Q__NOTE(_E5), Q__NOTE(_E5), Q__NOTE(_F5), Q__NOTE(_E5), Q__NOTE(_D5), Q__NOTE(_G5), Q__NOTE(_B4), Q__NOTE(_D5), Q__NOTE(_C5), M__NOTE(_F5, 80), H__NOTE(_D5), H__NOTE(_C5), W__NOTE(_D5), W__NOTE(_E5), Q__NOTE(_A4), H__NOTE(_A4), Q__NOTE(_E5), Q__NOTE(_E5), Q__NOTE(_F5), Q__NOTE(_E5), Q__NOTE(_D5), Q__NOTE(_G5), Q__NOTE(_B4), Q__NOTE(_D5), Q__NOTE(_C5), M__NOTE(_F5, 80)
+
/* Removed sounds
+ This list is here solely for compatibility, so that removed songs don't just break things
* If you think that any of these songs were wrongfully removed, let us know and provide
diff --git a/quantum/command.c b/quantum/command.c
index f90d73207c..84757b9b01 100644
--- a/quantum/command.c
+++ b/quantum/command.c
@@ -161,7 +161,7 @@ static void command_common_help(void) {
}
static void print_version(void) {
- print(/* clang-format off */
+ xprintf("%s", /* clang-format off */
"\n\t- Version -\n"
"VID: " STR(VENDOR_ID) "(" STR(MANUFACTURER) ") "
"PID: " STR(PRODUCT_ID) "(" STR(PRODUCT) ") "
@@ -282,6 +282,7 @@ static void print_eeconfig(void) {
".swap_grave_esc: %u\n"
".swap_backslash_backspace: %u\n"
".nkro: %u\n"
+ ".swap_escape_capslock: %u\n"
, kc.raw
, kc.swap_control_capslock
@@ -294,6 +295,7 @@ static void print_eeconfig(void) {
, kc.swap_grave_esc
, kc.swap_backslash_backspace
, kc.nkro
+ , kc.swap_escape_capslock
); /* clang-format on */
# ifdef BACKLIGHT_ENABLE
diff --git a/quantum/debounce.h b/quantum/debounce.h
index 3532d9cd7b..a8629654c2 100644
--- a/quantum/debounce.h
+++ b/quantum/debounce.h
@@ -1,10 +1,16 @@
#pragma once
-// raw is the current key state
-// on entry cooked is the previous debounced state
-// on exit cooked is the current debounced state
-// changed is true if raw has changed since the last call
-void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed);
+/**
+ * @brief Debounce raw matrix events according to the choosen debounce algorithm.
+ *
+ * @param raw The current key state
+ * @param cooked The debounced key state
+ * @param num_rows Number of rows to debounce
+ * @param changed True if raw has changed since the last call
+ * @return true Cooked has new keychanges after debouncing
+ * @return false Cooked is the same as before
+ */
+bool debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed);
void debounce_init(uint8_t num_rows);
diff --git a/quantum/debounce/asym_eager_defer_pk.c b/quantum/debounce/asym_eager_defer_pk.c
index b1eb4a2b7b..4745c6f465 100644
--- a/quantum/debounce/asym_eager_defer_pk.c
+++ b/quantum/debounce/asym_eager_defer_pk.c
@@ -55,6 +55,7 @@ static debounce_counter_t *debounce_counters;
static fast_timer_t last_time;
static bool counters_need_update;
static bool matrix_need_update;
+static bool cooked_changed;
# define DEBOUNCE_ELAPSED 0
@@ -77,8 +78,9 @@ void debounce_free(void) {
debounce_counters = NULL;
}
-void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) {
+bool debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) {
bool updated_last = false;
+ cooked_changed = false;
if (counters_need_update) {
fast_timer_t now = timer_read_fast();
@@ -102,6 +104,8 @@ void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool
transfer_matrix_values(raw, cooked, num_rows);
}
+
+ return cooked_changed;
}
static void update_debounce_counters_and_transfer_if_expired(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, uint8_t elapsed_time) {
@@ -123,7 +127,9 @@ static void update_debounce_counters_and_transfer_if_expired(matrix_row_t raw[],
matrix_need_update = true;
} else {
// key-up: defer
- cooked[row] = (cooked[row] & ~col_mask) | (raw[row] & col_mask);
+ matrix_row_t cooked_next = (cooked[row] & ~col_mask) | (raw[row] & col_mask);
+ cooked_changed |= cooked_next ^ cooked[row];
+ cooked[row] = cooked_next;
}
} else {
debounce_pointer->time -= elapsed_time;
@@ -152,6 +158,7 @@ static void transfer_matrix_values(matrix_row_t raw[], matrix_row_t cooked[], ui
if (debounce_pointer->pressed) {
// key-down: eager
cooked[row] ^= col_mask;
+ cooked_changed = true;
}
}
} else if (debounce_pointer->time != DEBOUNCE_ELAPSED) {
diff --git a/quantum/debounce/none.c b/quantum/debounce/none.c
index 8a85cc04a8..4cff5e05e2 100644
--- a/quantum/debounce/none.c
+++ b/quantum/debounce/none.c
@@ -17,13 +17,16 @@
#include "matrix.h"
#include "quantum.h"
#include <stdlib.h>
+#include <string.h>
void debounce_init(uint8_t num_rows) {}
-void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) {
- for (int i = 0; i < num_rows; i++) {
- cooked[i] = raw[i];
- }
+bool debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) {
+ bool cooked_changed = memcmp(raw, cooked, sizeof(matrix_row_t) * num_rows) != 0;
+
+ memcpy(cooked, raw, sizeof(matrix_row_t) * num_rows);
+
+ return cooked_changed;
}
void debounce_free(void) {}
diff --git a/quantum/debounce/sym_defer_g.c b/quantum/debounce/sym_defer_g.c
index 47450992a4..d04310a761 100644
--- a/quantum/debounce/sym_defer_g.c
+++ b/quantum/debounce/sym_defer_g.c
@@ -20,6 +20,7 @@ When no state changes have occured for DEBOUNCE milliseconds, we push the state.
#include "matrix.h"
#include "timer.h"
#include "quantum.h"
+#include <string.h>
#ifndef DEBOUNCE
# define DEBOUNCE 5
#endif
@@ -30,18 +31,23 @@ static fast_timer_t debouncing_time;
void debounce_init(uint8_t num_rows) {}
-void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) {
+bool debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) {
+ bool cooked_changed = false;
+
if (changed) {
debouncing = true;
debouncing_time = timer_read_fast();
}
if (debouncing && timer_elapsed_fast(debouncing_time) >= DEBOUNCE) {
- for (int i = 0; i < num_rows; i++) {
- cooked[i] = raw[i];
+ if (memcmp(cooked, raw, sizeof(matrix_row_t) * num_rows) != 0) {
+ memcpy(cooked, raw, sizeof(matrix_row_t) * num_rows);
+ cooked_changed = true;
}
debouncing = false;
}
+
+ return cooked_changed;
}
void debounce_free(void) {}
diff --git a/quantum/debounce/sym_defer_pk.c b/quantum/debounce/sym_defer_pk.c
index 9dee29e28e..7b59b5e100 100644
--- a/quantum/debounce/sym_defer_pk.c
+++ b/quantum/debounce/sym_defer_pk.c
@@ -48,6 +48,7 @@ typedef uint8_t debounce_counter_t;
static debounce_counter_t *debounce_counters;
static fast_timer_t last_time;
static bool counters_need_update;
+static bool cooked_changed;
# define DEBOUNCE_ELAPSED 0
@@ -70,8 +71,9 @@ void debounce_free(void) {
debounce_counters = NULL;
}
-void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) {
+bool debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) {
bool updated_last = false;
+ cooked_changed = false;
if (counters_need_update) {
fast_timer_t now = timer_read_fast();
@@ -95,6 +97,8 @@ void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool
start_debounce_counters(raw, cooked, num_rows);
}
+
+ return cooked_changed;
}
static void update_debounce_counters_and_transfer_if_expired(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, uint8_t elapsed_time) {
@@ -104,8 +108,10 @@ static void update_debounce_counters_and_transfer_if_expired(matrix_row_t raw[],
for (uint8_t col = 0; col < MATRIX_COLS; col++) {
if (*debounce_pointer != DEBOUNCE_ELAPSED) {
if (*debounce_pointer <= elapsed_time) {
- *debounce_pointer = DEBOUNCE_ELAPSED;
- cooked[row] = (cooked[row] & ~(ROW_SHIFTER << col)) | (raw[row] & (ROW_SHIFTER << col));
+ *debounce_pointer = DEBOUNCE_ELAPSED;
+ matrix_row_t cooked_next = (cooked[row] & ~(ROW_SHIFTER << col)) | (raw[row] & (ROW_SHIFTER << col));
+ cooked_changed |= cooked[row] ^ cooked_next;
+ cooked[row] = cooked_next;
} else {
*debounce_pointer -= elapsed_time;
counters_need_update = true;
diff --git a/quantum/debounce/sym_defer_pr.c b/quantum/debounce/sym_defer_pr.c
index ce24f0922f..452c4599d0 100644
--- a/quantum/debounce/sym_defer_pr.c
+++ b/quantum/debounce/sym_defer_pr.c
@@ -46,11 +46,12 @@ void debounce_free(void) {
last_raw = NULL;
}
-void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) {
- uint16_t now = timer_read();
- uint16_t elapsed16 = TIMER_DIFF_16(now, last_time);
- last_time = now;
- uint8_t elapsed = (elapsed16 > 255) ? 255 : elapsed16;
+bool debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) {
+ uint16_t now = timer_read();
+ uint16_t elapsed16 = TIMER_DIFF_16(now, last_time);
+ last_time = now;
+ uint8_t elapsed = (elapsed16 > 255) ? 255 : elapsed16;
+ bool cooked_changed = false;