summaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
authorフィルターペーパー <76888457+filterpaper@users.noreply.github.com>2025-10-19 10:14:37 +0800
committerGitHub <noreply@github.com>2025-10-19 03:14:37 +0100
commit81df54308687713371ed5fbf4947e38963c7867b (patch)
tree36d0a432adcf7613f8a362f3a534e68b4ddaad19 /quantum
parent4f21beb7153c2b0a1f4d41de7dad5a2173f896b6 (diff)
Debounce: Deprecate num_rows parameter (#25632)
Diffstat (limited to 'quantum')
-rw-r--r--quantum/debounce.h5
-rw-r--r--quantum/debounce/asym_eager_defer_pk.c4
-rw-r--r--quantum/debounce/none.c6
-rw-r--r--quantum/debounce/sym_defer_g.c6
-rw-r--r--quantum/debounce/sym_defer_pk.c4
-rw-r--r--quantum/debounce/sym_defer_pr.c4
-rw-r--r--quantum/debounce/sym_eager_pk.c4
-rw-r--r--quantum/debounce/sym_eager_pr.c4
-rw-r--r--quantum/debounce/tests/debounce_test_common.cpp4
-rw-r--r--quantum/matrix.c6
-rw-r--r--quantum/matrix_common.c6
11 files changed, 26 insertions, 27 deletions
diff --git a/quantum/debounce.h b/quantum/debounce.h
index 30d2621d18..e26106cd3b 100644
--- a/quantum/debounce.h
+++ b/quantum/debounce.h
@@ -9,11 +9,10 @@
9 * 9 *
10 * @param raw The current key state 10 * @param raw The current key state
11 * @param cooked The debounced key state 11 * @param cooked The debounced key state
12 * @param num_rows Number of rows to debounce
13 * @param changed True if raw has changed since the last call 12 * @param changed True if raw has changed since the last call
14 * @return true Cooked has new keychanges after debouncing 13 * @return true Cooked has new keychanges after debouncing
15 * @return false Cooked is the same as before 14 * @return false Cooked is the same as before
16 */ 15 */
17bool debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed); 16bool debounce(matrix_row_t raw[], matrix_row_t cooked[], bool changed);
18 17
19void debounce_init(uint8_t num_rows); 18void debounce_init(void);
diff --git a/quantum/debounce/asym_eager_defer_pk.c b/quantum/debounce/asym_eager_defer_pk.c
index a385301c90..edd07eabc0 100644
--- a/quantum/debounce/asym_eager_defer_pk.c
+++ b/quantum/debounce/asym_eager_defer_pk.c
@@ -38,9 +38,9 @@ static bool cooked_changed;
38static inline void update_debounce_counters_and_transfer_if_expired(matrix_row_t raw[], matrix_row_t cooked[], uint8_t elapsed_time); 38static inline void update_debounce_counters_and_transfer_if_expired(matrix_row_t raw[], matrix_row_t cooked[], uint8_t elapsed_time);
39static inline void transfer_matrix_values(matrix_row_t raw[], matrix_row_t cooked[]); 39static inline void transfer_matrix_values(matrix_row_t raw[], matrix_row_t cooked[]);
40 40
41void debounce_init(uint8_t num_rows) {} 41void debounce_init(void) {}
42 42
43bool debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) { 43bool debounce(matrix_row_t raw[], matrix_row_t cooked[], bool changed) {
44 static fast_timer_t last_time; 44 static fast_timer_t last_time;
45 bool updated_last = false; 45 bool updated_last = false;
46 cooked_changed = false; 46 cooked_changed = false;
diff --git a/quantum/debounce/none.c b/quantum/debounce/none.c
index 0111dd6e31..e614f41a6b 100644
--- a/quantum/debounce/none.c
+++ b/quantum/debounce/none.c
@@ -17,13 +17,13 @@
17#include "debounce.h" 17#include "debounce.h"
18#include <string.h> 18#include <string.h>
19 19
20void debounce_init(uint8_t num_rows) {} 20void debounce_init(void) {}
21 21
22bool debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) { 22bool debounce(matrix_row_t raw[], matrix_row_t cooked[], bool changed) {
23 bool cooked_changed = false; 23 bool cooked_changed = false;
24 24
25 if (changed) { 25 if (changed) {
26 size_t matrix_size = num_rows * sizeof(matrix_row_t); 26 size_t matrix_size = MATRIX_ROWS_PER_HAND * sizeof(matrix_row_t);
27 if (memcmp(cooked, raw, matrix_size) != 0) { 27 if (memcmp(cooked, raw, matrix_size) != 0) {
28 memcpy(cooked, raw, matrix_size); 28 memcpy(cooked, raw, matrix_size);
29 cooked_changed = true; 29 cooked_changed = true;
diff --git a/quantum/debounce/sym_defer_g.c b/quantum/debounce/sym_defer_g.c
index 81f351c126..a60a131072 100644
--- a/quantum/debounce/sym_defer_g.c
+++ b/quantum/debounce/sym_defer_g.c
@@ -20,9 +20,9 @@
20 20
21#if DEBOUNCE > 0 21#if DEBOUNCE > 0
22 22
23void debounce_init(uint8_t num_rows) {} 23void debounce_init(void) {}
24 24
25bool debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) { 25bool debounce(matrix_row_t raw[], matrix_row_t cooked[], bool changed) {
26 static fast_timer_t debouncing_time; 26 static fast_timer_t debouncing_time;
27 static bool debouncing = false; 27 static bool debouncing = false;
28 bool cooked_changed = false; 28 bool cooked_changed = false;
@@ -31,7 +31,7 @@ bool debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool
31 debouncing = true; 31 debouncing = true;
32 debouncing_time = timer_read_fast(); 32 debouncing_time = timer_read_fast();
33 } else if (debouncing && timer_elapsed_fast(debouncing_time) >= DEBOUNCE) { 33 } else if (debouncing && timer_elapsed_fast(debouncing_time) >= DEBOUNCE) {
34 size_t matrix_size = num_rows * sizeof(matrix_row_t); 34 size_t matrix_size = MATRIX_ROWS_PER_HAND * sizeof(matrix_row_t);
35 if (memcmp(cooked, raw, matrix_size) != 0) { 35 if (memcmp(cooked, raw, matrix_size) != 0) {
36 memcpy(cooked, raw, matrix_size); 36 memcpy(cooked, raw, matrix_size);
37 cooked_changed = true; 37 cooked_changed = true;
diff --git a/quantum/debounce/sym_defer_pk.c b/quantum/debounce/sym_defer_pk.c
index 063094efe5..b910571219 100644
--- a/quantum/debounce/sym_defer_pk.c
+++ b/quantum/debounce/sym_defer_pk.c
@@ -32,9 +32,9 @@ static bool cooked_changed;
32static inline void update_debounce_counters_and_transfer_if_expired(matrix_row_t raw[], matrix_row_t cooked[], uint8_t elapsed_time); 32static inline void update_debounce_counters_and_transfer_if_expired(matrix_row_t raw[], matrix_row_t cooked[], uint8_t elapsed_time);
33static inline void start_debounce_counters(matrix_row_t raw[], matrix_row_t cooked[]); 33static inline void start_debounce_counters(matrix_row_t raw[], matrix_row_t cooked[]);
34 34
35void debounce_init(uint8_t num_rows) {} 35void debounce_init(void) {}
36 36
37bool debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) { 37bool debounce(matrix_row_t raw[], matrix_row_t cooked[], bool changed) {
38 static fast_timer_t last_time; 38 static fast_timer_t last_time;
39 bool updated_last = false; 39 bool updated_last = false;
40 cooked_changed = false; 40 cooked_changed = false;
diff --git a/quantum/debounce/sym_defer_pr.c b/quantum/debounce/sym_defer_pr.c
index 2382fae898..feaf55b08a 100644
--- a/quantum/debounce/sym_defer_pr.c
+++ b/quantum/debounce/sym_defer_pr.c
@@ -33,9 +33,9 @@ static bool cooked_changed;
33static inline void update_debounce_counters_and_transfer_if_expired(matrix_row_t raw[], matrix_row_t cooked[], uint8_t elapsed_time); 33static inline void update_debounce_counters_and_transfer_if_expired(matrix_row_t raw[], matrix_row_t cooked[], uint8_t elapsed_time);
34static inline void start_debounce_counters(matrix_row_t raw[], matrix_row_t cooked[]); 34static inline void start_debounce_counters(matrix_row_t raw[], matrix_row_t cooked[]);
35 35
36void debounce_init(uint8_t num_rows) {} 36void debounce_init(void) {}
37 37
38bool debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) { 38bool debounce(matrix_row_t raw[], matrix_row_t cooked[], bool changed) {
39 static fast_timer_t last_time; 39 static fast_timer_t last_time;
40 bool updated_last = false; 40 bool updated_last = false;
41 cooked_changed = false; 41 cooked_changed = false;
diff --git a/quantum/debounce/sym_eager_pk.c b/quantum/debounce/sym_eager_pk.c
index c3a7afde24..1f53330e9c 100644
--- a/quantum/debounce/sym_eager_pk.c
+++ b/quantum/debounce/sym_eager_pk.c
@@ -46,9 +46,9 @@ static bool cooked_changed;
46static inline void update_debounce_counters(uint8_t elapsed_time); 46static inline void update_debounce_counters(uint8_t elapsed_time);
47static inline void transfer_matrix_values(matrix_row_t raw[], matrix_row_t cooked[]); 47static inline void transfer_matrix_values(matrix_row_t raw[], matrix_row_t cooked[]);
48 48
49void debounce_init(uint8_t num_rows) {} 49void debounce_init(void) {}
50 50
51bool debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) { 51bool debounce(matrix_row_t raw[], matrix_row_t cooked[], bool changed) {
52 static fast_timer_t last_time; 52 static fast_timer_t last_time;
53 bool updated_last = false; 53 bool updated_last = false;
54 cooked_changed = false; 54 cooked_changed = false;
diff --git a/quantum/debounce/sym_eager_pr.c b/quantum/debounce/sym_eager_pr.c
index 5a1e3a1bda..c929ff53dc 100644
--- a/quantum/debounce/sym_eager_pr.c
+++ b/quantum/debounce/sym_eager_pr.c
@@ -33,9 +33,9 @@ static bool cooked_changed;
33static inline void update_debounce_counters(uint8_t elapsed_time); 33static inline void update_debounce_counters(uint8_t elapsed_time);
34static inline void transfer_matrix_values(matrix_row_t raw[], matrix_row_t cooked[]); 34static inline void transfer_matrix_values(matrix_row_t raw[], matrix_row_t cooked[]);
35 35
36void debounce_init(uint8_t num_rows) {} 36void debounce_init(void) {}
37 37
38bool debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) { 38bool debounce(matrix_row_t raw[], matrix_row_t cooked[], bool changed) {
39 static fast_timer_t last_time; 39 static fast_timer_t last_time;
40 bool updated_last = false; 40 bool updated_last = false;
41 cooked_changed = false; 41 cooked_changed = false;
diff --git a/quantum/debounce/tests/debounce_test_common.cpp b/quantum/debounce/tests/debounce_test_common.cpp
index 3782f51411..84b91f85e1 100644
--- a/quantum/debounce/tests/debounce_test_common.cpp
+++ b/quantum/debounce/tests/debounce_test_common.cpp
@@ -60,7 +60,7 @@ void DebounceTest::runEventsInternal() {
60 bool first = true; 60 bool first = true;
61 61
62 /* Initialise keyboard with start time (offset to avoid testing at 0) and all keys UP */ 62 /* Initialise keyboard with start time (offset to avoid testing at 0) and all keys UP */
63 debounce_init(MATRIX_ROWS); 63 debounce_init();
64 set_time(time_offset_); 64 set_time(time_offset_);
65 simulate_async_tick(async_time_jumps_); 65 simulate_async_tick(async_time_jumps_);
66 std::fill(std::begin(input_matrix_), std::end(input_matrix_), 0); 66 std::fill(std::begin(input_matrix_), std::end(input_matrix_), 0);
@@ -129,7 +129,7 @@ void DebounceTest::runDebounce(bool changed) {
129 129
130 reset_access_counter(); 130 reset_access_counter();
131 131
132 bool cooked_changed = debounce(raw_matrix_, cooked_matrix_, MATRIX_ROWS, changed); 132 bool cooked_changed = debounce(raw_matrix_, cooked_matrix_, changed);
133 133
134 if (!std::equal(std::begin(input_matrix_), std::end(input_matrix_), std::begin(raw_matrix_))) { 134 if (!std::equal(std::begin(input_matrix_), std::end(input_matrix_), std::begin(raw_matrix_))) {
135 FAIL() << "Fatal error: debounce() modified raw matrix at " << strTime() << "\ninput_matrix: changed=" << changed << "\n" << strMatrix(input_matrix_) << "\nraw_matrix:\n" << strMatrix(raw_matrix_); 135 FAIL() << "Fatal error: debounce() modified raw matrix at " << strTime() << "\ninput_matrix: changed=" << changed << "\n" << strMatrix(input_matrix_) << "\nraw_matrix:\n" << strMatrix(raw_matrix_);
diff --git a/quantum/matrix.c b/quantum/matrix.c
index 167a70e5b6..2e7ea085f4 100644
--- a/quantum/matrix.c
+++ b/quantum/matrix.c
@@ -303,7 +303,7 @@ void matrix_init(void) {
303 memset(matrix, 0, sizeof(matrix)); 303 memset(matrix, 0, sizeof(matrix));
304 memset(raw_matrix, 0, sizeof(raw_matrix)); 304 memset(raw_matrix, 0, sizeof(raw_matrix));
305 305
306 debounce_init(MATRIX_ROWS_PER_HAND); 306 debounce_init();
307 307
308 matrix_init_kb(); 308 matrix_init_kb();
309} 309}
@@ -336,9 +336,9 @@ uint8_t matrix_scan(void) {
336 if (changed) memcpy(raw_matrix, curr_matrix, sizeof(curr_matrix)); 336 if (changed) memcpy(raw_matrix, curr_matrix, sizeof(curr_matrix));
337 337
338#ifdef SPLIT_KEYBOARD 338#ifdef SPLIT_KEYBOARD
339 changed = debounce(raw_matrix, matrix + thisHand, MATRIX_ROWS_PER_HAND, changed) | matrix_post_scan(); 339 changed = debounce(raw_matrix, matrix + thisHand, changed) | matrix_post_scan();
340#else 340#else
341 changed = debounce(raw_matrix, matrix, MATRIX_ROWS_PER_HAND, changed); 341 changed = debounce(raw_matrix, matrix, changed);
342 matrix_scan_kb(); 342 matrix_scan_kb();
343#endif 343#endif
344 return (uint8_t)changed; 344 return (uint8_t)changed;
diff --git a/quantum/matrix_common.c b/quantum/matrix_common.c
index b4a86fc483..26589f29a6 100644
--- a/quantum/matrix_common.c
+++ b/quantum/matrix_common.c
@@ -156,7 +156,7 @@ __attribute__((weak)) void matrix_init(void) {
156 matrix[i] = 0; 156 matrix[i] = 0;
157 } 157 }
158 158
159 debounce_init(MATRIX_ROWS_PER_HAND); 159 debounce_init();
160 160
161 matrix_init_kb(); 161 matrix_init_kb();
162} 162}
@@ -165,9 +165,9 @@ __attribute__((weak)) uint8_t matrix_scan(void) {
165 bool changed = matrix_scan_custom(raw_matrix); 165 bool changed = matrix_scan_custom(raw_matrix);
166 166
167#ifdef SPLIT_KEYBOARD 167#ifdef SPLIT_KEYBOARD
168 changed = debounce(raw_matrix, matrix + thisHand, MATRIX_ROWS_PER_HAND, changed) | matrix_post_scan(); 168 changed = debounce(raw_matrix, matrix + thisHand, changed) | matrix_post_scan();
169#else 169#else
170 changed = debounce(raw_matrix, matrix, MATRIX_ROWS_PER_HAND, changed); 170 changed = debounce(raw_matrix, matrix, changed);
171 matrix_scan_kb(); 171 matrix_scan_kb();
172#endif 172#endif
173 173