summaryrefslogtreecommitdiff
path: root/keyboards
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards')
-rw-r--r--keyboards/barleycorn_smd/matrix.c4
-rw-r--r--keyboards/bpiphany/ghost_squid/matrix.c1
-rw-r--r--keyboards/centromere/matrix.c1
-rw-r--r--keyboards/converter/siemens_tastatur/matrix.c3
-rw-r--r--keyboards/custommk/evo70_r2/matrix.c3
-rw-r--r--keyboards/dc01/right/matrix.c3
-rw-r--r--keyboards/dp60/matrix.c5
-rw-r--r--keyboards/duck/orion/v3/matrix.c5
-rw-r--r--keyboards/evyd13/wasdat/matrix.c3
-rw-r--r--keyboards/evyd13/wasdat_code/matrix.c3
-rw-r--r--keyboards/geistmaschine/macropod/matrix.c3
-rw-r--r--keyboards/gl516/a52gl/matrix.c1
-rw-r--r--keyboards/gl516/j73gl/matrix.c1
-rw-r--r--keyboards/gl516/n51gl/matrix.c1
-rw-r--r--keyboards/glenpickle/chimera_ergo/matrix.c1
-rw-r--r--keyboards/glenpickle/chimera_ls/matrix.c1
-rw-r--r--keyboards/glenpickle/chimera_ortho/matrix.c1
-rw-r--r--keyboards/glenpickle/chimera_ortho_plus/matrix.c1
-rw-r--r--keyboards/gmmk/numpad/matrix.c9
-rw-r--r--keyboards/halfcliff/matrix.c9
-rw-r--r--keyboards/handwired/dqz11n1g/matrix.c7
-rw-r--r--keyboards/handwired/dygma/raise/matrix.c3
-rw-r--r--keyboards/handwired/symmetric70_proto/matrix_debug/matrix.c3
-rw-r--r--keyboards/handwired/symmetric70_proto/matrix_fast/matrix.c4
-rw-r--r--keyboards/hazel/bad_wings/matrix.c9
-rw-r--r--keyboards/hhkb/yang/matrix.c7
-rw-r--r--keyboards/hineybush/hbcp/matrix.c3
-rw-r--r--keyboards/ibm/model_m/mschwingen/matrix.c3
-rw-r--r--keyboards/jones/v03/matrix.c3
-rw-r--r--keyboards/jones/v03_1/matrix.c3
-rw-r--r--keyboards/joshajohnson/hub16/matrix.c3
-rw-r--r--keyboards/kagizaraya/chidori/matrix.c1
-rw-r--r--keyboards/kakunpc/angel64/alpha/matrix.c3
-rw-r--r--keyboards/kakunpc/angel64/rev1/matrix.c3
-rw-r--r--keyboards/kakunpc/choc_taro/matrix.c3
-rw-r--r--keyboards/kakunpc/thedogkeyboard/matrix.c3
-rw-r--r--keyboards/kbdmania/kmac/matrix.c3
-rw-r--r--keyboards/kbdmania/kmac_pad/matrix.c1
-rw-r--r--keyboards/keyboardio/model01/matrix.c2
-rw-r--r--keyboards/keychron/c2_pro/matrix.c4
-rw-r--r--keyboards/keychron/q10/matrix.c3
-rw-r--r--keyboards/keychron/q12/matrix.c3
-rw-r--r--keyboards/keychron/q1v2/matrix.c4
-rw-r--r--keyboards/keychron/q3/matrix.c3
-rw-r--r--keyboards/keychron/q5/matrix.c3
-rw-r--r--keyboards/keychron/q6/matrix.c3
-rw-r--r--keyboards/keychron/q65/matrix.c3
-rw-r--r--keyboards/keychron/v1/matrix.c3
-rw-r--r--keyboards/keychron/v10/matrix.c3
-rw-r--r--keyboards/keychron/v3/matrix.c3
-rw-r--r--keyboards/keychron/v5/matrix.c3
-rw-r--r--keyboards/keychron/v6/matrix.c3
-rw-r--r--keyboards/kinesis/nguyenvietyen/matrix.c2
-rw-r--r--keyboards/matrix/abelx/matrix.c4
-rw-r--r--keyboards/matrix/m12og/rev1/matrix.c3
-rw-r--r--keyboards/matrix/m20add/matrix.c4
-rw-r--r--keyboards/matrix/noah/matrix.c18
-rw-r--r--keyboards/mechlovin/adelais/standard_led/avr/rev1/matrix.c3
-rw-r--r--keyboards/mechlovin/infinity87/rev2/matrix.c3
-rw-r--r--keyboards/mechlovin/infinity875/matrix.c3
-rw-r--r--keyboards/mechlovin/olly/jf/rev1/matrix.c3
-rw-r--r--keyboards/mechlovin/serratus/matrix.c3
-rw-r--r--keyboards/mexsistor/ludmila/matrix.c3
-rw-r--r--keyboards/miiiw/blackio83/matrix.c2
-rw-r--r--keyboards/mitosis/matrix.c1
-rw-r--r--keyboards/moon/matrix.c3
-rw-r--r--keyboards/mt/split75/matrix.c4
-rw-r--r--keyboards/nullbitsco/nibble/matrix.c3
-rw-r--r--keyboards/nullbitsco/snap/matrix.c7
-rw-r--r--keyboards/oddforge/vea/matrix.c4
-rw-r--r--keyboards/om60/matrix.c3
-rw-r--r--keyboards/pierce/matrix.c2
-rw-r--r--keyboards/planck/rev6_drop/matrix.c3
-rw-r--r--keyboards/planck/rev7/matrix.c7
-rw-r--r--keyboards/preonic/rev3_drop/matrix.c5
-rw-r--r--keyboards/qvex/lynepad2/matrix.c7
-rw-r--r--keyboards/rate/pistachio_pro/matrix.c4
-rw-r--r--keyboards/redox/wireless/matrix.c1
-rwxr-xr-xkeyboards/redscarf_iiplus/verb/matrix.c3
-rwxr-xr-xkeyboards/redscarf_iiplus/verc/matrix.c3
-rw-r--r--keyboards/redscarf_iiplus/verd/matrix.c3
-rw-r--r--keyboards/ryanskidmore/rskeys100/matrix.c2
-rw-r--r--keyboards/satt/comet46/matrix.c1
-rw-r--r--keyboards/sirius/uni660/rev1/matrix.c1
-rw-r--r--keyboards/sirius/uni660/rev2/matrix.c1
-rw-r--r--keyboards/spiderisland/split78/matrix.c4
-rw-r--r--keyboards/sthlmkb/lagom/matrix.c3
-rw-r--r--keyboards/switchplate/southpaw_65/matrix.c7
-rw-r--r--keyboards/telophase/matrix.c1
-rw-r--r--keyboards/touchpad/matrix.c13
-rw-r--r--keyboards/viktus/sp111/matrix.c4
-rw-r--r--keyboards/xiudi/xd84/matrix.c7
-rw-r--r--keyboards/xiudi/xd96/matrix.c8
-rw-r--r--keyboards/ydkb/grape/matrix.c3
-rw-r--r--keyboards/yiancardesigns/barleycorn/matrix.c4
-rw-r--r--keyboards/yiancardesigns/gingham/matrix.c4
-rw-r--r--keyboards/yiancardesigns/seigaiha/matrix.c4
97 files changed, 104 insertions, 244 deletions
diff --git a/keyboards/barleycorn_smd/matrix.c b/keyboards/barleycorn_smd/matrix.c
index 315093c8a9..d8880364b6 100644
--- a/keyboards/barleycorn_smd/matrix.c
+++ b/keyboards/barleycorn_smd/matrix.c
@@ -14,10 +14,8 @@ GNU General Public License for more details.
14You should have received a copy of the GNU General Public License 14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17#include <stdint.h> 17#include "matrix.h"
18#include <stdbool.h>
19#include "wait.h" 18#include "wait.h"
20#include "quantum.h"
21#include "i2c_master.h" 19#include "i2c_master.h"
22 20
23static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; 21static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
diff --git a/keyboards/bpiphany/ghost_squid/matrix.c b/keyboards/bpiphany/ghost_squid/matrix.c
index b0ad607555..802d365cb8 100644
--- a/keyboards/bpiphany/ghost_squid/matrix.c
+++ b/keyboards/bpiphany/ghost_squid/matrix.c
@@ -17,7 +17,6 @@
17*/ 17*/
18 18
19#include "matrix.h" 19#include "matrix.h"
20#include "quantum.h"
21 20
22matrix_row_t read_rows(void) { 21matrix_row_t read_rows(void) {
23 return 22 return
diff --git a/keyboards/centromere/matrix.c b/keyboards/centromere/matrix.c
index 0218adf39b..387d31ee07 100644
--- a/keyboards/centromere/matrix.c
+++ b/keyboards/centromere/matrix.c
@@ -16,7 +16,6 @@ You should have received a copy of the GNU General Public License
16along with this program. If not, see <http://www.gnu.org/licenses/>. 16along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
18 18
19#include "quantum.h"
20#include "matrix.h" 19#include "matrix.h"
21#include "uart.h" 20#include "uart.h"
22 21
diff --git a/keyboards/converter/siemens_tastatur/matrix.c b/keyboards/converter/siemens_tastatur/matrix.c
index ea1aa2287e..78054ee0fa 100644
--- a/keyboards/converter/siemens_tastatur/matrix.c
+++ b/keyboards/converter/siemens_tastatur/matrix.c
@@ -14,10 +14,7 @@ GNU General Public License for more details.
14You should have received a copy of the GNU General Public License 14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17#include <stdint.h>
18#include <stdbool.h>
19#include <string.h> 17#include <string.h>
20#include "quantum.h"
21#include "timer.h" 18#include "timer.h"
22#include "wait.h" 19#include "wait.h"
23#include "print.h" 20#include "print.h"
diff --git a/keyboards/custommk/evo70_r2/matrix.c b/keyboards/custommk/evo70_r2/matrix.c
index 99a23a4542..99c3428d80 100644
--- a/keyboards/custommk/evo70_r2/matrix.c
+++ b/keyboards/custommk/evo70_r2/matrix.c
@@ -1,6 +1,7 @@
1// Copyright 2023 David Hoelscher (@customMK) 1// Copyright 2023 David Hoelscher (@customMK)
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3#include "quantum.h" 3#include "matrix.h"
4#include <string.h>
4 5
5// Pin definitions 6// Pin definitions
6static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; 7static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
diff --git a/keyboards/dc01/right/matrix.c b/keyboards/dc01/right/matrix.c
index 04a6d03804..f9b6738145 100644
--- a/keyboards/dc01/right/matrix.c
+++ b/keyboards/dc01/right/matrix.c
@@ -15,8 +15,6 @@ GNU General Public License for more details.
15You should have received a copy of the GNU General Public License 15You should have received a copy of the GNU General Public License
16along with this program. If not, see <http://www.gnu.org/licenses/>. 16along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
18#include <stdint.h>
19#include <stdbool.h>
20#if defined(__AVR__) 18#if defined(__AVR__)
21#include <avr/io.h> 19#include <avr/io.h>
22#include <avr/wdt.h> 20#include <avr/wdt.h>
@@ -31,7 +29,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
31#include "timer.h" 29#include "timer.h"
32#include "i2c_slave.h" 30#include "i2c_slave.h"
33#include "lufa.h" 31#include "lufa.h"
34#include "quantum.h"
35 32
36#define SLAVE_I2C_ADDRESS 0x32 33#define SLAVE_I2C_ADDRESS 0x32
37 34
diff --git a/keyboards/dp60/matrix.c b/keyboards/dp60/matrix.c
index e32c9a58f9..22156745f1 100644
--- a/keyboards/dp60/matrix.c
+++ b/keyboards/dp60/matrix.c
@@ -13,7 +13,10 @@
13 You should have received a copy of the GNU General Public License 13 You should have received a copy of the GNU General Public License
14 along with this program. If not, see <http://www.gnu.org/licenses/>. 14 along with this program. If not, see <http://www.gnu.org/licenses/>.
15*/ 15*/
16#include "quantum.h" 16#include "matrix.h"
17#include "print.h"
18#include "bitwise.h"
19#include "wait.h"
17 20
18#ifndef DEBOUNCE 21#ifndef DEBOUNCE
19# define DEBOUNCE 5 22# define DEBOUNCE 5
diff --git a/keyboards/duck/orion/v3/matrix.c b/keyboards/duck/orion/v3/matrix.c
index c82d5dd999..f392b9b190 100644
--- a/keyboards/duck/orion/v3/matrix.c
+++ b/keyboards/duck/orion/v3/matrix.c
@@ -14,7 +14,10 @@ You should have received a copy of the GNU General Public License
14along with this program. If not, see <http://www.gnu.org/licenses/>. 14along with this program. If not, see <http://www.gnu.org/licenses/>.
15*/ 15*/
16 16
17#include "quantum.h" 17#include "matrix.h"
18#include "debug.h"
19#include "bitwise.h"
20#include "wait.h"
18 21
19#ifndef DEBOUNCE 22#ifndef DEBOUNCE
20# define DEBOUNCE 5 23# define DEBOUNCE 5
diff --git a/keyboards/evyd13/wasdat/matrix.c b/keyboards/evyd13/wasdat/matrix.c
index 60a1ea235a..ae4bb6cb3a 100644
--- a/keyboards/evyd13/wasdat/matrix.c
+++ b/keyboards/evyd13/wasdat/matrix.c
@@ -15,10 +15,7 @@ You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17 17
18#include <stdint.h>
19#include <stdbool.h>
20#include "matrix.h" 18#include "matrix.h"
21#include "quantum.h"
22#include "sn74x138.h" 19#include "sn74x138.h"
23 20
24static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; 21static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
diff --git a/keyboards/evyd13/wasdat_code/matrix.c b/keyboards/evyd13/wasdat_code/matrix.c
index f30ea3355a..d392a31d7c 100644
--- a/keyboards/evyd13/wasdat_code/matrix.c
+++ b/keyboards/evyd13/wasdat_code/matrix.c
@@ -15,10 +15,7 @@ You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17 17
18#include <stdint.h>
19#include <stdbool.h>
20#include "matrix.h" 18#include "matrix.h"
21#include "quantum.h"
22#include "sn74x138.h" 19#include "sn74x138.h"
23 20
24static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; 21static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
diff --git a/keyboards/geistmaschine/macropod/matrix.c b/keyboards/geistmaschine/macropod/matrix.c
index ebc10e2e5a..98796133f1 100644
--- a/keyboards/geistmaschine/macropod/matrix.c
+++ b/keyboards/geistmaschine/macropod/matrix.c
@@ -14,8 +14,9 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16 16
17#include "matrix.h"
17#include "pca9555.h" 18#include "pca9555.h"
18#include "quantum.h" 19#include "timer.h"
19 20
20// PCA9555 i2c address, 0x20: A0 = 0, A1 = 0, A2 = 0 21// PCA9555 i2c address, 0x20: A0 = 0, A1 = 0, A2 = 0
21#define IC1 0x20 22#define IC1 0x20
diff --git a/keyboards/gl516/a52gl/matrix.c b/keyboards/gl516/a52gl/matrix.c
index 1a97fdfd61..af13768b08 100644
--- a/keyboards/gl516/a52gl/matrix.c
+++ b/keyboards/gl516/a52gl/matrix.c
@@ -15,7 +15,6 @@ You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17#include "matrix.h" 17#include "matrix.h"
18#include "quantum.h"
19 18
20static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; 19static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
21static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; 20static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
diff --git a/keyboards/gl516/j73gl/matrix.c b/keyboards/gl516/j73gl/matrix.c
index 1a97fdfd61..af13768b08 100644
--- a/keyboards/gl516/j73gl/matrix.c
+++ b/keyboards/gl516/j73gl/matrix.c
@@ -15,7 +15,6 @@ You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17#include "matrix.h" 17#include "matrix.h"
18#include "quantum.h"
19 18
20static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; 19static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
21static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; 20static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
diff --git a/keyboards/gl516/n51gl/matrix.c b/keyboards/gl516/n51gl/matrix.c
index 1a97fdfd61..af13768b08 100644
--- a/keyboards/gl516/n51gl/matrix.c
+++ b/keyboards/gl516/n51gl/matrix.c
@@ -15,7 +15,6 @@ You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17#include "matrix.h" 17#include "matrix.h"
18#include "quantum.h"
19 18
20static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; 19static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
21static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; 20static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
diff --git a/keyboards/glenpickle/chimera_ergo/matrix.c b/keyboards/glenpickle/chimera_ergo/matrix.c
index 32d7b09310..47c3c61e27 100644
--- a/keyboards/glenpickle/chimera_ergo/matrix.c
+++ b/keyboards/glenpickle/chimera_ergo/matrix.c
@@ -16,7 +16,6 @@ You should have received a copy of the GNU General Public License
16along with this program. If not, see <http://www.gnu.org/licenses/>. 16along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
18 18
19#include "quantum.h"
20#include "matrix.h" 19#include "matrix.h"
21#include "uart.h" 20#include "uart.h"
22 21
diff --git a/keyboards/glenpickle/chimera_ls/matrix.c b/keyboards/glenpickle/chimera_ls/matrix.c
index 9a69724eb7..15a29c5a86 100644
--- a/keyboards/glenpickle/chimera_ls/matrix.c
+++ b/keyboards/glenpickle/chimera_ls/matrix.c
@@ -16,7 +16,6 @@ You should have received a copy of the GNU General Public License
16along with this program. If not, see <http://www.gnu.org/licenses/>. 16along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
18 18
19#include "quantum.h"
20#include "matrix.h" 19#include "matrix.h"
21#include "uart.h" 20#include "uart.h"
22 21
diff --git a/keyboards/glenpickle/chimera_ortho/matrix.c b/keyboards/glenpickle/chimera_ortho/matrix.c
index 9a69724eb7..15a29c5a86 100644
--- a/keyboards/glenpickle/chimera_ortho/matrix.c
+++ b/keyboards/glenpickle/chimera_ortho/matrix.c
@@ -16,7 +16,6 @@ You should have received a copy of the GNU General Public License
16along with this program. If not, see <http://www.gnu.org/licenses/>. 16along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
18 18
19#include "quantum.h"
20#include "matrix.h" 19#include "matrix.h"
21#include "uart.h" 20#include "uart.h"
22 21
diff --git a/keyboards/glenpickle/chimera_ortho_plus/matrix.c b/keyboards/glenpickle/chimera_ortho_plus/matrix.c
index 32d7b09310..47c3c61e27 100644
--- a/keyboards/glenpickle/chimera_ortho_plus/matrix.c
+++ b/keyboards/glenpickle/chimera_ortho_plus/matrix.c
@@ -16,7 +16,6 @@ You should have received a copy of the GNU General Public License
16along with this program. If not, see <http://www.gnu.org/licenses/>. 16along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
18 18
19#include "quantum.h"
20#include "matrix.h" 19#include "matrix.h"
21#include "uart.h" 20#include "uart.h"
22 21
diff --git a/keyboards/gmmk/numpad/matrix.c b/keyboards/gmmk/numpad/matrix.c
index 99adb38f18..68d4ab6524 100644
--- a/keyboards/gmmk/numpad/matrix.c
+++ b/keyboards/gmmk/numpad/matrix.c
@@ -4,15 +4,12 @@
4/* 4/*
5 * scan matrix 5 * scan matrix
6 */ 6 */
7#include <stdint.h> 7#include "matrix.h"
8#include <stdbool.h> 8#include <string.h>
9#include "atomic_util.h"
9#include "wait.h" 10#include "wait.h"
10#include "print.h" 11#include "print.h"
11#include "debug.h" 12#include "debug.h"
12#include "util.h"
13#include "matrix.h"
14#include "debounce.h"
15#include "quantum.h"
16 13
17/* matrix state(1:on, 0:off) */ 14/* matrix state(1:on, 0:off) */
18extern matrix_row_t matrix[MATRIX_ROWS]; // debounced values 15extern matrix_row_t matrix[MATRIX_ROWS]; // debounced values
diff --git a/keyboards/halfcliff/matrix.c b/keyboards/halfcliff/matrix.c
index fd18fd27bd..99598dc1b7 100644
--- a/keyboards/halfcliff/matrix.c
+++ b/keyboards/halfcliff/matrix.c
@@ -14,15 +14,12 @@ GNU General Public License for more details.
14You should have received a copy of the GNU General Public License 14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17#include <stdint.h>
18#include <stdbool.h>
19#include "util.h"
20#include "matrix.h" 17#include "matrix.h"
21#include "debounce.h" 18#include "atomic_util.h"
22#include "quantum.h"
23#include "split_util.h" 19#include "split_util.h"
24#include "config.h"
25#include "transport.h" 20#include "transport.h"
21#include "debounce.h"
22#include "wait.h"
26 23
27#define ERROR_DISCONNECT_COUNT 5 24#define ERROR_DISCONNECT_COUNT 5
28 25
diff --git a/keyboards/handwired/dqz11n1g/matrix.c b/keyboards/handwired/dqz11n1g/matrix.c
index d93dd853b6..398f961aa5 100644
--- a/keyboards/handwired/dqz11n1g/matrix.c
+++ b/keyboards/handwired/dqz11n1g/matrix.c
@@ -15,14 +15,7 @@
15 along with this program. If not, see <http://www.gnu.org/licenses/>. 15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17 17
18#include <stdint.h>
19#include <stdbool.h>
20#include <string.h>
21
22#include <avr/io.h>
23
24#include "spi_master.h" 18#include "spi_master.h"
25#include "quantum.h"
26#include "matrix.h" 19#include "matrix.h"
27 20
28static pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; 21static pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
diff --git a/keyboards/handwired/dygma/raise/matrix.c b/keyboards/handwired/dygma/raise/matrix.c
index bbcf697a59..3f241e8973 100644
--- a/keyboards/handwired/dygma/raise/matrix.c
+++ b/keyboards/handwired/dygma/raise/matrix.c
@@ -13,8 +13,9 @@
13 * You should have received a copy of the GNU General Public License 13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16#include "quantum.h" 16#include "matrix.h"
17#include "i2c_master.h" 17#include "i2c_master.h"
18#include "wait.h"
18#include <string.h> 19#include <string.h>
19#include "wire-protocol-constants.h" 20#include "wire-protocol-constants.h"
20 21
diff --git a/keyboards/handwired/symmetric70_proto/matrix_debug/matrix.c b/keyboards/handwired/symmetric70_proto/matrix_debug/matrix.c
index 8a303714cf..22d92dd99a 100644
--- a/keyboards/handwired/symmetric70_proto/matrix_debug/matrix.c
+++ b/keyboards/handwired/symmetric70_proto/matrix_debug/matrix.c
@@ -14,12 +14,9 @@ GNU General Public License for more details.
14You should have received a copy of the GNU General Public License 14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17#include <stdint.h>
18#include <stdbool.h>
19#include "util.h" 17#include "util.h"
20#include "matrix.h" 18#include "matrix.h"
21#include "debounce.h" 19#include "debounce.h"
22#include "quantum.h"
23#ifndef readPort 20#ifndef readPort
24# include "gpio_extr.h" 21# include "gpio_extr.h"
25#endif 22#endif
diff --git a/keyboards/handwired/symmetric70_proto/matrix_fast/matrix.c b/keyboards/handwired/symmetric70_proto/matrix_fast/matrix.c
index 2bc97bd9e8..3acbdfbeda 100644
--- a/keyboards/handwired/symmetric70_proto/matrix_fast/matrix.c
+++ b/keyboards/handwired/symmetric70_proto/matrix_fast/matrix.c
@@ -15,9 +15,6 @@ You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17// clang-format off 17// clang-format off
18#include <stdint.h>
19#include <stdbool.h>
20#include <gpio.h>
21#ifndef readPort 18#ifndef readPort
22# include "gpio_extr.h" 19# include "gpio_extr.h"
23#endif 20#endif
@@ -25,7 +22,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
25#include "matrix.h" 22#include "matrix.h"
26#include "matrix_extr.h" 23#include "matrix_extr.h"
27#include "debounce.h" 24#include "debounce.h"
28#include "quantum.h"
29 25
30#define ALWAYS_INLINE inline __attribute__((always_inline)) 26#define ALWAYS_INLINE inline __attribute__((always_inline))
31#define NO_INLINE __attribute__((noinline)) 27#define NO_INLINE __attribute__((noinline))
diff --git a/keyboards/hazel/bad_wings/matrix.c b/keyboards/hazel/bad_wings/matrix.c
index 496bebd58f..8a56a927c1 100644
--- a/keyboards/hazel/bad_wings/matrix.c
+++ b/keyboards/hazel/bad_wings/matrix.c
@@ -2,12 +2,11 @@
2// Copyright 2023 @jasonhazel (Jason Hazel) 2// Copyright 2023 @jasonhazel (Jason Hazel)
3// SPDX-License-Identifier: GPL-3.0-or-later 3// SPDX-License-Identifier: GPL-3.0-or-later
4 4
5#include "quantum.h"
6#include "spi_master.h"
7#include <string.h> /* memset */
8#include <unistd.h> /* close */
9#include "quantum.h"
10#include "matrix.h" 5#include "matrix.h"
6#include <string.h>
7#include "spi_master.h"
8#include "debug.h"
9#include "wait.h"
11 10
12#if (!defined(SHIFTREG_MATRIX_COL_CS)) 11#if (!defined(SHIFTREG_MATRIX_COL_CS))
13# error Missing shift register I/O pin definitions 12# error Missing shift register I/O pin definitions
diff --git a/keyboards/hhkb/yang/matrix.c b/keyboards/hhkb/yang/matrix.c
index f0eccc899d..c82c77bed3 100644
--- a/keyboards/hhkb/yang/matrix.c
+++ b/keyboards/hhkb/yang/matrix.c
@@ -16,7 +16,12 @@ You should have received a copy of the GNU General Public License
16along with this program. If not, see <http://www.gnu.org/licenses/>. 16along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
18 18
19#include "quantum.h" 19#include "matrix.h"
20#include "debug.h"
21#include "timer.h"
22#include "wait.h"
23#include "suspend.h"
24#include <avr/interrupt.h>
20 25
21#ifdef BLUETOOTH_ENABLE 26#ifdef BLUETOOTH_ENABLE
22# include "adafruit_ble.h" 27# include "adafruit_ble.h"
diff --git a/keyboards/hineybush/hbcp/matrix.c b/keyboards/hineybush/hbcp/matrix.c
index d493a7e9ef..69ae6ab7b7 100644
--- a/keyboards/hineybush/hbcp/matrix.c
+++ b/keyboards/hineybush/hbcp/matrix.c
@@ -14,12 +14,9 @@ GNU General Public License for more details.
14You should have received a copy of the GNU General Public License 14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17#include <stdint.h>
18#include <stdbool.h>
19#include "util.h" 17#include "util.h"
20#include "matrix.h" 18#include "matrix.h"
21#include "debounce.h" 19#include "debounce.h"
22#include "quantum.h"
23 20
24static const pin_t row_pins[] = MATRIX_ROW_PINS; 21static const pin_t row_pins[] = MATRIX_ROW_PINS;
25static const pin_t col_pins[] = MATRIX_COL_PINS; 22static const pin_t col_pins[] = MATRIX_COL_PINS;
diff --git a/keyboards/ibm/model_m/mschwingen/matrix.c b/keyboards/ibm/model_m/mschwingen/matrix.c
index 361803edec..85df5e5d6f 100644
--- a/keyboards/ibm/model_m/mschwingen/matrix.c
+++ b/keyboards/ibm/model_m/mschwingen/matrix.c
@@ -14,12 +14,9 @@
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17#include <stdint.h>
18#include <stdbool.h>
19#include "util.h" 17#include "util.h"
20#include "matrix.h" 18#include "matrix.h"
21#include "debounce.h" 19#include "debounce.h"
22#include "quantum.h"
23#include "spi_master.h" 20#include "spi_master.h"
24#include "print.h" 21#include "print.h"
25#include "mschwingen.h" 22#include "mschwingen.h"
diff --git a/keyboards/jones/v03/matrix.c b/keyboards/jones/v03/matrix.c
index efcd7043e6..445c1acdc0 100644
--- a/keyboards/jones/v03/matrix.c
+++ b/keyboards/jones/v03/matrix.c
@@ -14,10 +14,7 @@ GNU General Public License for more details.
14You should have received a copy of the GNU General Public License 14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17#include <stdint.h>
18#include <stdbool.h>
19#include "matrix.h" 17#include "matrix.h"
20#include "quantum.h"
21 18
22#define ROW_SHIFTER ((uint16_t)1) 19#define ROW_SHIFTER ((uint16_t)1)
23 20
diff --git a/keyboards/jones/v03_1/matrix.c b/keyboards/jones/v03_1/matrix.c
index efcd7043e6..445c1acdc0 100644
--- a/keyboards/jones/v03_1/matrix.c
+++ b/keyboards/jones/v03_1/matrix.c
@@ -14,10 +14,7 @@ GNU General Public License for more details.
14You should have received a copy of the GNU General Public License 14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17#include <stdint.h>
18#include <stdbool.h>
19#include "matrix.h" 17#include "matrix.h"
20#include "quantum.h"
21 18
22#define ROW_SHIFTER ((uint16_t)1) 19#define ROW_SHIFTER ((uint16_t)1)
23 20
diff --git a/keyboards/joshajohnson/hub16/matrix.c b/keyboards/joshajohnson/hub16/matrix.c
index 4f32070e66..0fe1d41dad 100644
--- a/keyboards/joshajohnson/hub16/matrix.c
+++ b/keyboards/joshajohnson/hub16/matrix.c
@@ -14,12 +14,9 @@ GNU General Public License for more details.
14You should have received a copy of the GNU General Public License 14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17#include <stdint.h>
18#include <stdbool.h>
19#include "wait.h" 17#include "wait.h"
20#include "util.h" 18#include "util.h"
21#include "matrix.h" 19#include "matrix.h"
22#include "quantum.h"
23 20
24// Encoder things 21// Encoder things
25#define SWITCH_1 F7 22#define SWITCH_1 F7
diff --git a/keyboards/kagizaraya/chidori/matrix.c b/keyboards/kagizaraya/chidori/matrix.c
index 6228125d92..e506916f38 100644
--- a/keyboards/kagizaraya/chidori/matrix.c
+++ b/keyboards/kagizaraya/chidori/matrix.c
@@ -15,7 +15,6 @@ You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17 17
18#include "quantum.h"
19#include "matrix.h" 18#include "matrix.h"
20#include "board.h" 19#include "board.h"
21 20
diff --git a/keyboards/kakunpc/angel64/alpha/matrix.c b/keyboards/kakunpc/angel64/alpha/matrix.c
index 7abc50005b..5d731b1068 100644
--- a/keyboards/kakunpc/angel64/alpha/matrix.c
+++ b/keyboards/kakunpc/angel64/alpha/matrix.c
@@ -14,15 +14,12 @@ GNU General Public License for more details.
14You should have received a copy of the GNU General Public License 14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17#include <stdint.h>
18#include <stdbool.h>
19#include "wait.h" 17#include "wait.h"
20#include "print.h" 18#include "print.h"
21#include "debug.h" 19#include "debug.h"
22#include "util.h" 20#include "util.h"
23#include "matrix.h" 21#include "matrix.h"
24#include "debounce.h" 22#include "debounce.h"
25#include "quantum.h"
26 23
27#if (MATRIX_COLS <= 8) 24#if (MATRIX_COLS <= 8)
28# define print_matrix_header() print("\nr/c 01234567\n") 25# define print_matrix_header() print("\nr/c 01234567\n")
diff --git a/keyboards/kakunpc/angel64/rev1/matrix.c b/keyboards/kakunpc/angel64/rev1/matrix.c
index 7abc50005b..5d731b1068 100644
--- a/keyboards/kakunpc/angel64/rev1/matrix.c
+++ b/keyboards/kakunpc/angel64/rev1/matrix.c
@@ -14,15 +14,12 @@ GNU General Public License for more details.
14You should have received a copy of the GNU General Public License 14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17#include <stdint.h>
18#include <stdbool.h>
19#include "wait.h" 17#include "wait.h"
20#include "print.h" 18#include "print.h"
21#include "debug.h" 19#include "debug.h"
22#include "util.h" 20#include "util.h"
23#include "matrix.h" 21#include "matrix.h"
24#include "debounce.h" 22#include "debounce.h"
25#include "quantum.h"
26 23
27#if (MATRIX_COLS <= 8) 24#if (MATRIX_COLS <= 8)
28# define print_matrix_header() print("\nr/c 01234567\n") 25# define print_matrix_header() print("\nr/c 01234567\n")
diff --git a/keyboards/kakunpc/choc_taro/matrix.c b/keyboards/kakunpc/choc_taro/matrix.c
index 02421551da..4547f1a047 100644
--- a/keyboards/kakunpc/choc_taro/matrix.c
+++ b/keyboards/kakunpc/choc_taro/matrix.c
@@ -14,10 +14,7 @@ GNU General Public License for more details.
14You should have received a copy of the GNU General Public License 14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17#include <stdint.h>
18#include <stdbool.h>
19#include "matrix.h" 17#include "matrix.h"
20#include "quantum.h"
21 18
22#if (MATRIX_COLS <= 8) 19#if (MATRIX_COLS <= 8)
23# define ROW_SHIFTER ((uint8_t)1) 20# define ROW_SHIFTER ((uint8_t)1)
diff --git a/keyboards/kakunpc/thedogkeyboard/matrix.c b/keyboards/kakunpc/thedogkeyboard/matrix.c
index 7abc50005b..5d731b1068 100644
--- a/keyboards/kakunpc/thedogkeyboard/matrix.c
+++ b/keyboards/kakunpc/thedogkeyboard/matrix.c
@@ -14,15 +14,12 @@ GNU General Public License for more details.
14You should have received a copy of the GNU General Public License 14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17#include <stdint.h>
18#include <stdbool.h>
19#include "wait.h" 17#include "wait.h"
20#include "print.h" 18#include "print.h"
21#include "debug.h" 19#include "debug.h"
22#include "util.h" 20#include "util.h"
23#include "matrix.h" 21#include "matrix.h"
24#include "debounce.h" 22#include "debounce.h"
25#include "quantum.h"
26 23
27#if (MATRIX_COLS <= 8) 24#if (MATRIX_COLS <= 8)
28# define print_matrix_header() print("\nr/c 01234567\n") 25# define print_matrix_header() print("\nr/c 01234567\n")
diff --git a/keyboards/kbdmania/kmac/matrix.c b/keyboards/kbdmania/kmac/matrix.c
index 6569867032..1843d19fd2 100644
--- a/keyboards/kbdmania/kmac/matrix.c
+++ b/keyboards/kbdmania/kmac/matrix.c
@@ -14,15 +14,12 @@ GNU General Public License for more details.
14You should have received a copy of the GNU General Public License 14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17#include <stdint.h>
18#include <stdbool.h>
19#include "wait.h" 17#include "wait.h"
20#include "print.h" 18#include "print.h"
21#include "debug.h" 19#include "debug.h"
22#include "util.h" 20#include "util.h"
23#include "matrix.h" 21#include "matrix.h"
24#include "debounce.h" 22#include "debounce.h"
25#include "quantum.h"
26 23
27#if (MATRIX_COLS <= 8) 24#if (MATRIX_COLS <= 8)
28# define print_matrix_header() print("\nr/c 01234567\n") 25# define print_matrix_header() print("\nr/c 01234567\n")
diff --git a/keyboards/kbdmania/kmac_pad/matrix.c b/keyboards/kbdmania/kmac_pad/matrix.c
index 476e40f514..ad7919e33c 100644
--- a/keyboards/kbdmania/kmac_pad/matrix.c
+++ b/keyboards/kbdmania/kmac_pad/matrix.c
@@ -17,7 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
18#include "wait.h" 18#include "wait.h"
19#include "matrix.h" 19#include "matrix.h"
20#include "quantum.h"
21 20
22static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; 21static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
23static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; 22static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
diff --git a/keyboards/keyboardio/model01/matrix.c b/keyboards/keyboardio/model01/matrix.c
index 4b788d2812..20359ca971 100644
--- a/keyboards/keyboardio/model01/matrix.c
+++ b/keyboards/keyboardio/model01/matrix.c
@@ -13,7 +13,7 @@
13 * You should have received a copy of the GNU General Public License 13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16#include "quantum.h" 16#include "matrix.h"
17#include "i2c_master.h" 17#include "i2c_master.h"
18#include <string.h> 18#include <string.h>
19#include "model01.h" 19#include "model01.h"
diff --git a/keyboards/keychron/c2_pro/matrix.c b/keyboards/keychron/c2_pro/matrix.c
index 5065f97aa7..8c954c73d0 100644
--- a/keyboards/keychron/c2_pro/matrix.c
+++ b/keyboards/keychron/c2_pro/matrix.c
@@ -14,7 +14,9 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16 16
17#include "quantum.h" 17#include "matrix.h"
18#include "atomic_util.h"
19#include <string.h>
18 20
19#ifndef SHIFT_COL_START 21#ifndef SHIFT_COL_START
20# define SHIFT_COL_START 8 22# define SHIFT_COL_START 8
diff --git a/keyboards/keychron/q10/matrix.c b/keyboards/keychron/q10/matrix.c
index 5c035b0e42..2c2d2ccc37 100644
--- a/keyboards/keychron/q10/matrix.c
+++ b/keyboards/keychron/q10/matrix.c
@@ -15,7 +15,8 @@
15 */ 15 */
16 16
17#include "matrix.h" 17#include "matrix.h"
18#include "quantum.h" 18#include "atomic_util.h"
19#include <string.h>
19 20
20// Pin connected to DS of 74HC595 21// Pin connected to DS of 74HC595
21#define DATA_PIN A7 22#define DATA_PIN A7
diff --git a/keyboards/keychron/q12/matrix.c b/keyboards/keychron/q12/matrix.c
index 8229517fd9..cf8361bd23 100644
--- a/keyboards/keychron/q12/matrix.c
+++ b/keyboards/keychron/q12/matrix.c
@@ -15,7 +15,8 @@
15 */ 15 */
16 16
17#include "matrix.h" 17#include "matrix.h"
18#include "quantum.h" 18#include "atomic_util.h"
19#include <string.h>
19 20
20// Pin connected to DS of 74HC595 21// Pin connected to DS of 74HC595
21#define DATA_PIN C15 22#define DATA_PIN C15
diff --git a/keyboards/keychron/q1v2/matrix.c b/keyboards/keychron/q1v2/matrix.c
index d008a79384..2bdf4bdec7 100644
--- a/keyboards/keychron/q1v2/matrix.c
+++ b/keyboards/keychron/q1v2/matrix.c
@@ -14,7 +14,9 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16 16
17#include "quantum.h" 17#include "matrix.h"
18#include "atomic_util.h"
19#include <string.h>
18 20
19// Pin connected to DS of 74HC595 21// Pin connected to DS of 74HC595
20#define DATA_PIN A7 22#define DATA_PIN A7
diff --git a/keyboards/keychron/q3/matrix.c b/keyboards/keychron/q3/matrix.c
index 26830780ff..188156789b 100644
--- a/keyboards/keychron/q3/matrix.c
+++ b/keyboards/keychron/q3/matrix.c
@@ -15,7 +15,8 @@
15 */ 15 */
16 16
17#include "matrix.h" 17#include "matrix.h"
18#include "quantum.h" 18#include "atomic_util.h"
19#include <string.h>
19 20
20// Pin connected to DS of 74HC595 21// Pin connected to DS of 74HC595
21#define DATA_PIN A7 22#define DATA_PIN A7
diff --git a/keyboards/keychron/q5/matrix.c b/keyboards/keychron/q5/matrix.c
index 28ef877504..4809b20677 100644
--- a/keyboards/keychron/q5/matrix.c
+++ b/keyboards/keychron/q5/matrix.c
@@ -15,7 +15,8 @@
15 */ 15 */
16 16
17#include "matrix.h" 17#include "matrix.h"
18#include "quantum.h" 18#include "atomic_util.h"
19#include <string.h>
19 20
20// Pin connected to DS of 74HC595 21// Pin connected to DS of 74HC595
21#define DATA_PIN C15 22#define DATA_PIN C15
diff --git a/keyboards/keychron/q6/matrix.c b/keyboards/keychron/q6/matrix.c
index 11f3432e6b..c59b229cfa 100644
--- a/keyboards/keychron/q6/matrix.c
+++ b/keyboards/keychron/q6/matrix.c
@@ -15,7 +15,8 @@
15 */ 15 */
16 16
17#include "matrix.h" 17#include "matrix.h"
18#include "quantum.h" 18#include "atomic_util.h"
19#include <string.h>
19 20
20// Pin connected to DS of 74HC595 21// Pin connected to DS of 74HC595
21#define DATA_PIN C15 22#define DATA_PIN C15
diff --git a/keyboards/keychron/q65/matrix.c b/keyboards/keychron/q65/matrix.c
index 5785f5d570..206e301226 100644
--- a/keyboards/keychron/q65/matrix.c
+++ b/keyboards/keychron/q65/matrix.c
@@ -15,7 +15,8 @@
15 */ 15 */
16 16
17#include "matrix.h" 17#include "matrix.h"
18#include "quantum.h" 18#include "atomic_util.h"
19#include <string.h>
19 20
20// Pin connected to DS of 74HC595 21// Pin connected to DS of 74HC595
21#define DATA_PIN C15 22#define DATA_PIN C15
diff --git a/keyboards/keychron/v1/matrix.c b/keyboards/keychron/v1/matrix.c
index 82a883834f..7b9136d490 100644
--- a/keyboards/keychron/v1/matrix.c
+++ b/keyboards/keychron/v1/matrix.c
@@ -15,7 +15,8 @@
15 */ 15 */
16 16
17#include "matrix.h" 17#include "matrix.h"
18#include "quantum.h" 18#include "atomic_util.h"
19#include <string.h>
19 20
20// Pin connected to DS of 74HC595 21// Pin connected to DS of 74HC595
21#define DATA_PIN A7 22#define DATA_PIN A7
diff --git a/keyboards/keychron/v10/matrix.c b/keyboards/keychron/v10/matrix.c
index 9269fed8d6..87cda1774a 100644
--- a/keyboards/keychron/v10/matrix.c
+++ b/keyboards/keychron/v10/matrix.c
@@ -15,7 +15,8 @@
15 */ 15 */
16 16
17#include "matrix.h" 17#include "matrix.h"
18#include "quantum.h" 18#include "atomic_util.h"
19#include <string.h>
19 20
20#ifndef PIN_USED_74HC595 21#ifndef PIN_USED_74HC595
21# define PIN_USED_74HC595 8 22# define PIN_USED_74HC595 8
diff --git a/keyboards/keychron/v3/matrix.c b/keyboards/keychron/v3/matrix.c
index 44a1676afa..c0c39d5b5f 100644
--- a/keyboards/keychron/v3/matrix.c
+++ b/keyboards/keychron/v3/matrix.c
@@ -15,7 +15,8 @@
15 */ 15 */
16 16
17#include "matrix.h" 17#include "matrix.h"
18#include "quantum.h" 18#include "atomic_util.h"
19#include <string.h>
19 20
20// Pin connected to DS of 74HC595 21// Pin connected to DS of 74HC595
21#define DATA_PIN A7 22#define DATA_PIN A7
diff --git a/keyboards/keychron/v5/matrix.c b/keyboards/keychron/v5/matrix.c
index ced8442881..fc3a1c4c2c 100644
--- a/keyboards/keychron/v5/matrix.c
+++ b/keyboards/keychron/v5/matrix.c
@@ -15,7 +15,8 @@
15 */ 15 */
16 16
17#include "matrix.h" 17#include "matrix.h"
18#include "quantum.h" 18#include "atomic_util.h"
19#include <string.h>
19 20
20// Pin connected to DS of 74HC595 21// Pin connected to DS of 74HC595
21#define DATA_PIN C15 22#define DATA_PIN C15
diff --git a/keyboards/keychron/v6/matrix.c b/keyboards/keychron/v6/matrix.c
index 9269fed8d6..87cda1774a 100644
--- a/keyboards/keychron/v6/matrix.c
+++ b/keyboards/keychron/v6/matrix.c
@@ -15,7 +15,8 @@
15 */ 15 */
16 16
17#include "matrix.h" 17#include "matrix.h"
18#include "quantum.h" 18#include "atomic_util.h"
19#include <string.h>
19 20
20#ifndef PIN_USED_74HC595 21#ifndef PIN_USED_74HC595
21# define PIN_USED_74HC595 8 22# define PIN_USED_74HC595 8
diff --git a/keyboards/kinesis/nguyenvietyen/matrix.c b/keyboards/kinesis/nguyenvietyen/matrix.c
index d6ea67da68..4e4ca6f55c 100644
--- a/keyboards/kinesis/nguyenvietyen/matrix.c
+++ b/keyboards/kinesis/nguyenvietyen/matrix.c
@@ -3,8 +3,6 @@
3 3
4#include "matrix.h" 4#include "matrix.h"
5 5
6#include "quantum.h"
7
8static matrix_row_t read_row(uint8_t row) { 6static matrix_row_t read_row(uint8_t row) {
9 matrix_io_delay(); // without this wait read unstable value. 7 matrix_io_delay(); // without this wait read unstable value.
10 8
diff --git a/keyboards/matrix/abelx/matrix.c b/keyboards/matrix/abelx/matrix.c
index d8d87b7d89..d74ed95775 100644
--- a/keyboards/matrix/abelx/matrix.c
+++ b/keyboards/matrix/abelx/matrix.c
@@ -17,10 +17,6 @@
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */ 18 */
19 19
20#include <stdint.h>
21#include <stdbool.h>
22#include <string.h>
23#include "quantum.h"
24#include "matrix.h" 20#include "matrix.h"
25#include "tca6424.h" 21#include "tca6424.h"
26#include "abelx.h" 22#include "abelx.h"
diff --git a/keyboards/matrix/m12og/rev1/matrix.c b/keyboards/matrix/m12og/rev1/matrix.c
index 9c36153da1..c127aa35b9 100644
--- a/keyboards/matrix/m12og/rev1/matrix.c
+++ b/keyboards/matrix/m12og/rev1/matrix.c
@@ -14,12 +14,9 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16 16
17#include <stdint.h>
18#include <stdbool.h>
19#include "util.h" 17#include "util.h"
20#include "matrix.h" 18#include "matrix.h"
21#include "debounce.h" 19#include "debounce.h"
22#include "quantum.h"
23 20
24static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; 21static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
25static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; 22static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
diff --git a/keyboards/matrix/m20add/matrix.c b/keyboards/matrix/m20add/matrix.c
index e9ddbdff62..85f5863725 100644
--- a/keyboards/matrix/m20add/matrix.c
+++ b/keyboards/matrix/m20add/matrix.c
@@ -2,10 +2,6 @@
2 * matrix.c 2 * matrix.c
3 */ 3 */
4 4
5#include <stdint.h>
6#include <stdbool.h>
7#include <string.h>
8#include "quantum.h"
9#include "matrix.h" 5#include "matrix.h"
10#include "tca6424.h" 6#include "tca6424.h"
11#include "m20add.h" 7#include "m20add.h"
diff --git a/keyboards/matrix/noah/matrix.c b/keyboards/matrix/noah/matrix.c
index 90e7006b78..14e8188cb5 100644
--- a/keyboards/matrix/noah/matrix.c
+++ b/keyboards/matrix/noah/matrix.c
@@ -2,16 +2,10 @@
2 * matrix.c 2 * matrix.c
3 */ 3 */
4 4
5#include <stdint.h> 5#include "matrix.h"
6#include <stdio.h>
7#include <stdbool.h>
8#include <string.h>
9#include <hal.h>
10#include "quantum.h"
11#include "timer.h" 6#include "timer.h"
12#include "wait.h" 7#include "wait.h"
13#include "print.h" 8#include "print.h"
14#include "matrix.h"
15 9
16#ifndef DEBOUNCE 10#ifndef DEBOUNCE
17# define DEBOUNCE 5 11# define DEBOUNCE 5
@@ -167,16 +161,16 @@ matrix_row_t matrix_get_row(uint8_t row) { return matrix[row]; }
167 161
168void matrix_print(void) 162void matrix_print(void)
169{ 163{
170 printf("\nr/c 01234567\n"); 164 xprintf("\nr/c 01234567\n");
171 for (uint8_t row = 0; row < MATRIX_ROWS; row++) { 165 for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
172 printf("%X0: ", row); 166 xprintf("%X0: ", row);
173 matrix_row_t data = matrix_get_row(row); 167 matrix_row_t data = matrix_get_row(row);
174 for (int col = 0; col < MATRIX_COLS; col++) { 168 for (int col = 0; col < MATRIX_COLS; col++) {
175 if (data & (1<<col)) 169 if (data & (1<<col))
176 printf("1"); 170 xprintf("1");
177 else 171 else
178 printf("0"); 172 xprintf("0");
179 } 173 }
180 printf("\n"); 174 xprintf("\n");
181 } 175 }
182} 176}
diff --git a/keyboards/mechlovin/adelais/standard_led/avr/rev1/matrix.c b/keyboards/mechlovin/adelais/standard_led/avr/rev1/matrix.c
index 37046790fe..864de5e660 100644
--- a/keyboards/mechlovin/adelais/standard_led/avr/rev1/matrix.c
+++ b/keyboards/mechlovin/adelais/standard_led/avr/rev1/matrix.c
@@ -16,13 +16,10 @@ You should have received a copy of the GNU General Public License
16along with this program. If not, see <http://www.gnu.org/licenses/>. 16along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
18 18
19#include <stdint.h>
20#include <stdbool.h>
21#include "wait.h" 19#include "wait.h"
22#include "util.h" 20#include "util.h"
23#include "matrix.h" 21#include "matrix.h"
24#include "debounce.h" 22#include "debounce.h"
25#include "quantum.h"
26 23
27#ifdef DIRECT_PINS 24#ifdef DIRECT_PINS
28static pin_t direct_pins[MATRIX_ROWS][MATRIX_COLS] = DIRECT_PINS; 25static pin_t direct_pins[MATRIX_ROWS][MATRIX_COLS] = DIRECT_PINS;
diff --git a/keyboards/mechlovin/infinity87/rev2/matrix.c b/keyboards/mechlovin/infinity87/rev2/matrix.c
index b1b0d20654..62a56f687c 100644
--- a/keyboards/mechlovin/infinity87/rev2/matrix.c
+++ b/keyboards/mechlovin/infinity87/rev2/matrix.c
@@ -16,13 +16,10 @@ You should have received a copy of the GNU General Public License
16along with this program. If not, see <http://www.gnu.org/licenses/>. 16along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
18 18
19#include <stdint.h>
20#include <stdbool.h>
21#include "wait.h" 19#include "wait.h"
22#include "util.h" 20#include "util.h"
23#include "matrix.h" 21#include "matrix.h"
24#include "debounce.h" 22#include "debounce.h"
25#include "quantum.h"
26 23
27#ifdef DIRECT_PINS 24#ifdef DIRECT_PINS
28static pin_t direct_pins[MATRIX_ROWS][MATRIX_COLS] = DIRECT_PINS; 25static pin_t direct_pins[MATRIX_ROWS][MATRIX_COLS] = DIRECT_PINS;
diff --git a/keyboards/mechlovin/infinity875/matrix.c b/keyboards/mechlovin/infinity875/matrix.c
index b1b0d20654..62a56f687c 100644
--- a/keyboards/mechlovin/infinity875/matrix.c
+++ b/keyboards/mechlovin/infinity875/matrix.c
@@ -16,13 +16,10 @@ You should have received a copy of the GNU General Public License
16along with this program. If not, see <http://www.gnu.org/licenses/>. 16along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
18 18
19#include <stdint.h>
20#include <stdbool.h>
21#include "wait.h" 19#include "wait.h"
22#include "util.h" 20#include "util.h"
23#include "matrix.h" 21#include "matrix.h"
24#include "debounce.h" 22#include "debounce.h"
25#include "quantum.h"
26 23
27#ifdef DIRECT_PINS 24#ifdef DIRECT_PINS
28static pin_t direct_pins[MATRIX_ROWS][MATRIX_COLS] = DIRECT_PINS; 25static pin_t direct_pins[MATRIX_ROWS][MATRIX_COLS] = DIRECT_PINS;
diff --git a/keyboards/mechlovin/olly/jf/rev1/matrix.c b/keyboards/mechlovin/olly/jf/rev1/matrix.c
index c01879c9a5..2abda55d0e 100644
--- a/keyboards/mechlovin/olly/jf/rev1/matrix.c
+++ b/keyboards/mechlovin/olly/jf/rev1/matrix.c
@@ -16,13 +16,10 @@ You should have received a copy of the GNU General Public License
16along with this program. If not, see <http://www.gnu.org/licenses/>. 16along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
18 18
19#include <stdint.h>
20#include <stdbool.h>
21#include "wait.h" 19#include "wait.h"
22#include "util.h" 20#include "util.h"
23#include "matrix.h" 21#include "matrix.h"
24#include "debounce.h" 22#include "debounce.h"
25#include "quantum.h"
26 23
27#ifdef DIRECT_PINS 24#ifdef DIRECT_PINS
28static pin_t direct_pins[MATRIX_ROWS][MATRIX_COLS] = DIRECT_PINS; 25static pin_t direct_pins[MATRIX_ROWS][MATRIX_COLS] = DIRECT_PINS;
diff --git a/keyboards/mechlovin/serratus/matrix.c b/keyboards/mechlovin/serratus/matrix.c
index b1b0d20654..62a56f687c 100644
--- a/keyboards/mechlovin/serratus/matrix.c
+++ b/keyboards/mechlovin/serratus/matrix.c
@@ -16,13 +16,10 @@ You should have received a copy of the GNU General Public License
16along with this program. If not, see <http://www.gnu.org/licenses/>. 16along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
18 18
19#include <stdint.h>
20#include <stdbool.h>
21#include "wait.h" 19#include "wait.h"
22#include "util.h" 20#include "util.h"
23#include "matrix.h" 21#include "matrix.h"
24#include "debounce.h" 22#include "debounce.h"
25#include "quantum.h"
26 23
27#ifdef DIRECT_PINS 24#ifdef DIRECT_PINS
28static pin_t direct_pins[MATRIX_ROWS][MATRIX_COLS] = DIRECT_PINS; 25static pin_t direct_pins[MATRIX_ROWS][MATRIX_COLS] = DIRECT_PINS;
diff --git a/keyboards/mexsistor/ludmila/matrix.c b/keyboards/mexsistor/ludmila/matrix.c
index 338286a7db..5d27ec683f 100644
--- a/keyboards/mexsistor/ludmila/matrix.c
+++ b/keyboards/mexsistor/ludmila/matrix.c
@@ -14,12 +14,9 @@ GNU General Public License for more details.
14You should have received a copy of the GNU General Public License 14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17#include <stdint.h>
18#include <stdbool.h>
19#include "wait.h" 17#include "wait.h"
20#include "util.h" 18#include "util.h"
21#include "matrix.h" 19#include "matrix.h"
22#include "quantum.h"
23 20
24// Encoder things 21// Encoder things
25#define ENC_SW F7 22#define ENC_SW F7
diff --git a/keyboards/miiiw/blackio83/matrix.c b/keyboards/miiiw/blackio83/matrix.c
index 841ff3c16e..ab252f919b 100644
--- a/keyboards/miiiw/blackio83/matrix.c
+++ b/keyboards/miiiw/blackio83/matrix.c
@@ -14,8 +14,8 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16 16
17#include "quantum.h"
18#include "matrix.h" 17#include "matrix.h"
18#include "wait.h"
19#include "common/shift_register.h" 19#include "common/shift_register.h"
20 20
21static uint8_t read_rows(void); 21static uint8_t read_rows(void);
diff --git a/keyboards/mitosis/matrix.c b/keyboards/mitosis/matrix.c
index e5389bb113..f122b98957 100644
--- a/keyboards/mitosis/matrix.c
+++ b/keyboards/mitosis/matrix.c
@@ -16,7 +16,6 @@ You should have received a copy of the GNU General Public License
16along with this program. If not, see <http://www.gnu.org/licenses/>. 16along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
18 18
19#include "quantum.h"
20#include "matrix.h" 19#include "matrix.h"
21#include "uart.h" 20#include "uart.h"
22 21
diff --git a/keyboards/moon/matrix.c b/keyboards/moon/matrix.c
index 8c9b6214db..1cb9590e9f 100644
--- a/keyboards/moon/matrix.c
+++ b/keyboards/moon/matrix.c
@@ -14,15 +14,12 @@ GNU General Public License for more details.
14You should have received a copy of the GNU General Public License 14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17#include <stdint.h>
18#include <stdbool.h>
19#include "wait.h" 17#include "wait.h"
20#include "print.h" 18#include "print.h"
21#include "debug.h" 19#include "debug.h"
22#include "util.h" 20#include "util.h"
23#include "matrix.h" 21#include "matrix.h"
24#include "debounce.h" 22#include "debounce.h"
25#include "quantum.h"
26#include "pca9555.h" 23#include "pca9555.h"
27 24
28/* 25/*
diff --git a/keyboards/mt/split75/matrix.c b/keyboards/mt/split75/matrix.c
index 196a543faa..df5e9c056b 100644
--- a/keyboards/mt/split75/matrix.c
+++ b/keyboards/mt/split75/matrix.c
@@ -15,9 +15,7 @@ You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17 17
18#include <string.h> 18#include "matrix.h"
19#include <stdio.h>
20#include "quantum.h"
21#include "i2c_master.h" 19#include "i2c_master.h"
22 20
23#define RIGHT_HALF 21#define RIGHT_HALF
diff --git a/keyboards/nullbitsco/nibble/matrix.c b/keyboards/nullbitsco/nibble/matrix.c
index 496c5dbe32..6508b704e9 100644
--- a/keyboards/nullbitsco/nibble/matrix.c
+++ b/keyboards/nullbitsco/nibble/matrix.c
@@ -13,7 +13,8 @@
13 * You should have received a copy of the GNU General Public License 13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16#include "quantum.h" 16#include "matrix.h"
17#include "wait.h"
17 18
18#define COL_SHIFTER ((uint32_t)1) 19#define COL_SHIFTER ((uint32_t)1)
19 20
diff --git a/keyboards/nullbitsco/snap/matrix.c b/keyboards/nullbitsco/snap/matrix.c
index ceb9cd8984..3cd3f5c37e 100644
--- a/keyboards/nullbitsco/snap/matrix.c
+++ b/keyboards/nullbitsco/snap/matrix.c
@@ -13,13 +13,10 @@
13 * You should have received a copy of the GNU General Public License 13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16#include <stdint.h>
17#include <stdbool.h>
18#include <string.h>
19#include "util.h"
20#include "matrix.h" 16#include "matrix.h"
17#include <string.h>
21#include "split_util.h" 18#include "split_util.h"
22#include "quantum.h" 19#include "wait.h"
23 20
24#define VIRT_COLS_PER_HAND 1 21#define VIRT_COLS_PER_HAND 1
25#define PHYS_COLS_PER_HAND (MATRIX_COLS - VIRT_COLS_PER_HAND) 22#define PHYS_COLS_PER_HAND (MATRIX_COLS - VIRT_COLS_PER_HAND)
diff --git a/keyboards/oddforge/vea/matrix.c b/keyboards/oddforge/vea/matrix.c
index 8b054ccbe0..36d4d3d353 100644
--- a/keyboards/oddforge/vea/matrix.c
+++ b/keyboards/oddforge/vea/matrix.c
@@ -15,9 +15,7 @@ You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17 17
18#include <string.h> 18#include "matrix.h"
19#include <stdio.h>
20#include "quantum.h"
21#include "i2c_master.h" 19#include "i2c_master.h"
22 20
23#define RIGHT_HALF 21#define RIGHT_HALF
diff --git a/keyboards/om60/matrix.c b/keyboards/om60/matrix.c
index 3686780468..b0e252ec45 100644
--- a/keyboards/om60/matrix.c
+++ b/keyboards/om60/matrix.c
@@ -15,7 +15,8 @@ GNU General Public License for more details.
15You should have received a copy of the GNU General Public License 15You should have received a copy of the GNU General Public License
16along with this program. If not, see <http://www.gnu.org/licenses/>. 16along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
18#include "quantum.h" 18#include "matrix.h"
19#include "wait.h"
19 20
20#if (MATRIX_COLS <= 8) 21#if (MATRIX_COLS <= 8)
21# define ROW_SHIFTER ((uint8_t)1) 22# define ROW_SHIFTER ((uint8_t)1)
diff --git a/keyboards/pierce/matrix.c b/keyboards/pierce/matrix.c
index 5023024b8b..bcc88f7aa9 100644
--- a/keyboards/pierce/matrix.c
+++ b/keyboards/pierce/matrix.c
@@ -14,7 +14,7 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16 16
17#include "quantum.h" 17#include "matrix.h"
18#include "i2c_slave.h" 18#include "i2c_slave.h"
19 19
20#define MY_I2C_ADDRESS (0x20U << 1) 20#define MY_I2C_ADDRESS (0x20U << 1)
diff --git a/keyboards/planck/rev6_drop/matrix.c b/keyboards/planck/rev6_drop/matrix.c
index e31e473ae2..d140356738 100644
--- a/keyboards/planck/rev6_drop/matrix.c
+++ b/keyboards/planck/rev6_drop/matrix.c
@@ -15,7 +15,8 @@
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18#include "quantum.h" 18#include "matrix.h"
19#include "wait.h"
19 20
20/* matrix state(1:on, 0:off) */ 21/* matrix state(1:on, 0:off) */
21static pin_t matrix_row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; 22static pin_t matrix_row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
diff --git a/keyboards/planck/rev7/matrix.c b/keyboards/planck/rev7/matrix.c
index 350ce93ce0..8cadfa5e8d 100644
--- a/keyboards/planck/rev7/matrix.c
+++ b/keyboards/planck/rev7/matrix.c
@@ -15,11 +15,10 @@
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18#include "gpio.h" 18#include "matrix.h"
19#include "hal_pal.h" 19#include <hal_pal.h>
20#include "hal_pal_lld.h"
21#include "quantum.h"
22#include <math.h> 20#include <math.h>
21#include "wait.h"
23 22
24// STM32-specific watchdog config calculations 23// STM32-specific watchdog config calculations
25// timeout = 31.25us * PR * (RL + 1) 24// timeout = 31.25us * PR * (RL + 1)
diff --git a/keyboards/preonic/rev3_drop/matrix.c b/keyboards/preonic/rev3_drop/matrix.c
index 60718caaba..1d9ab5e811 100644
--- a/keyboards/preonic/rev3_drop/matrix.c
+++ b/keyboards/preonic/rev3_drop/matrix.c
@@ -15,7 +15,10 @@
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18#include "quantum.h" 18#include "matrix.h"
19#include "debug.h"
20#include "timer.h"
21#include "wait.h"
19 22
20#ifndef DEBOUNCE 23#ifndef DEBOUNCE
21# define DEBOUNCE 5 24# define DEBOUNCE 5
diff --git a/keyboards/qvex/lynepad2/matrix.c b/keyboards/qvex/lynepad2/matrix.c
index 878ee6e2f7..89c56b8d40 100644
--- a/keyboards/qvex/lynepad2/matrix.c
+++ b/keyboards/qvex/lynepad2/matrix.c
@@ -14,13 +14,8 @@ You should have received a copy of the GNU General Public License
14along with this program. If not, see <http://www.gnu.org/licenses/>. 14along with this program. If not, see <http://www.gnu.org/licenses/>.
15*/ 15*/
16 16
17#include <stdint.h>
18#include <stdbool.h>
19#include <string.h>
20#include "util.h"
21#include "matrix.h" 17#include "matrix.h"
22#include "debounce.h" 18#include "wait.h"
23#include "quantum.h"
24 19
25static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; 20static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
26static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; 21static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
diff --git a/keyboards/rate/pistachio_pro/matrix.c b/keyboards/rate/pistachio_pro/matrix.c
index 6cbfb6dfea..bb962c76e2 100644
--- a/keyboards/rate/pistachio_pro/matrix.c
+++ b/keyboards/rate/pistachio_pro/matrix.c
@@ -14,10 +14,8 @@ GNU General Public License for more details.
14You should have received a copy of the GNU General Public License 14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17#include <stdint.h>
18#include <stdbool.h>
19#include "matrix.h" 17#include "matrix.h"
20#include "quantum.h" 18#include "atomic_util.h"
21 19
22static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; 20static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
23static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; 21static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
diff --git a/keyboards/redox/wireless/matrix.c b/keyboards/redox/wireless/matrix.c
index 9c50c9cece..92960b916d 100644
--- a/keyboards/redox/wireless/matrix.c
+++ b/keyboards/redox/wireless/matrix.c
@@ -14,7 +14,6 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16 16
17#include "quantum.h"
18#include "matrix.h" 17#include "matrix.h"
19#include "uart.h" 18#include "uart.h"
20 19
diff --git a/keyboards/redscarf_iiplus/verb/matrix.c b/keyboards/redscarf_iiplus/verb/matrix.c
index aa2cd8e510..391a923f16 100755
--- a/keyboards/redscarf_iiplus/verb/matrix.c
+++ b/keyboards/redscarf_iiplus/verb/matrix.c
@@ -14,15 +14,12 @@ GNU General Public License for more details.
14You should have received a copy of the GNU General Public License 14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17#include <stdint.h>
18#include <stdbool.h>
19#include "wait.h" 17#include "wait.h"
20#include "print.h" 18#include "print.h"
21#include "debug.h" 19#include "debug.h"
22#include "util.h" 20#include "util.h"
23#include "matrix.h" 21#include "matrix.h"
24#include "debounce.h" 22#include "debounce.h"
25#include "quantum.h"
26 23
27#if (MATRIX_COLS <= 8) 24#if (MATRIX_COLS <= 8)
28# define print_matrix_header() print("\nr/c 01234567\n") 25# define print_matrix_header() print("\nr/c 01234567\n")
diff --git a/keyboards/redscarf_iiplus/verc/matrix.c b/keyboards/redscarf_iiplus/verc/matrix.c
index aa2cd8e510..391a923f16 100755
--- a/keyboards/redscarf_iiplus/verc/matrix.c
+++ b/keyboards/redscarf_iiplus/verc/matrix.c
@@ -14,15 +14,12 @@ GNU General Public License for more details.
14You should have received a copy of the GNU General Public License 14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17#include <stdint.h>
18#include <stdbool.h>
19#include "wait.h" 17#include "wait.h"
20#include "print.h" 18#include "print.h"
21#include "debug.h" 19#include "debug.h"
22#include "util.h" 20#include "util.h"
23#include "matrix.h" 21#include "matrix.h"
24#include "debounce.h" 22#include "debounce.h"
25#include "quantum.h"
26 23
27#if (MATRIX_COLS <= 8) 24#if (MATRIX_COLS <= 8)
28# define print_matrix_header() print("\nr/c 01234567\n") 25# define print_matrix_header() print("\nr/c 01234567\n")
diff --git a/keyboards/redscarf_iiplus/verd/matrix.c b/keyboards/redscarf_iiplus/verd/matrix.c
index 382847e941..b2046db2ce 100644
--- a/keyboards/redscarf_iiplus/verd/matrix.c
+++ b/keyboards/redscarf_iiplus/verd/matrix.c
@@ -14,15 +14,12 @@ GNU General Public License for more details.
14You should have received a copy of the GNU General Public License 14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17#include <stdint.h>
18#include <stdbool.h>
19#include "wait.h" 17#include "wait.h"
20#include "print.h" 18#include "print.h"
21#include "debug.h" 19#include "debug.h"
22#include "util.h" 20#include "util.h"
23#include "matrix.h" 21#include "matrix.h"
24#include "debounce.h" 22#include "debounce.h"
25#include "quantum.h"
26 23
27#if (MATRIX_COLS <= 8) 24#if (MATRIX_COLS <= 8)
28# define print_matrix_header() print("\nr/c 01234567\n") 25# define print_matrix_header() print("\nr/c 01234567\n")
diff --git a/keyboards/ryanskidmore/rskeys100/matrix.c b/keyboards/ryanskidmore/rskeys100/matrix.c
index faefb29c84..2ab9eafd7f 100644
--- a/keyboards/ryanskidmore/rskeys100/matrix.c
+++ b/keyboards/ryanskidmore/rskeys100/matrix.c
@@ -17,10 +17,8 @@ You should have received a copy of the GNU General Public License
17along with this program. If not, see <http://www.gnu.org/licenses/>. 17along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/ 18*/
19 19
20#include <stdbool.h>
21#include "matrix.h" 20#include "matrix.h"
22#include <util/delay.h> 21#include <util/delay.h>
23#include "quantum.h"
24 22
25static const uint32_t col_values[24] = SHR_COLS; 23static const uint32_t col_values[24] = SHR_COLS;
26 24
diff --git a/keyboards/satt/comet46/matrix.c b/keyboards/satt/comet46/matrix.c
index 9a69724eb7..15a29c5a86 100644
--- a/keyboards/satt/comet46/matrix.c
+++ b/keyboards/satt/comet46/matrix.c
@@ -16,7 +16,6 @@ You should have received a copy of the GNU General Public License
16along with this program. If not, see <http://www.gnu.org/licenses/>. 16along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
18 18
19#include "quantum.h"
20#include "matrix.h" 19#include "matrix.h"
21#include "uart.h" 20#include "uart.h"
22 21
diff --git a/keyboards/sirius/uni660/rev1/matrix.c b/keyboards/sirius/uni660/rev1/matrix.c
index f65bf0f26a..3fe3563c21 100644
--- a/keyboards/sirius/uni660/rev1/matrix.c
+++ b/keyboards/sirius/uni660/rev1/matrix.c
@@ -16,7 +16,6 @@ You should have received a copy of the GNU General Public License
16along with this program. If not, see <http://www.gnu.org/licenses/>. 16along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
18 18
19#include "quantum.h"
20#include "matrix.h" 19#include "matrix.h"
21#include "uart.h" 20#include "uart.h"
22 21
diff --git a/keyboards/sirius/uni660/rev2/matrix.c b/keyboards/sirius/uni660/rev2/matrix.c
index f65bf0f26a..3fe3563c21 100644
--- a/keyboards/sirius/uni660/rev2/matrix.c
+++ b/keyboards/sirius/uni660/rev2/matrix.c
@@ -16,7 +16,6 @@ You should have received a copy of the GNU General Public License
16along with this program. If not, see <http://www.gnu.org/licenses/>. 16along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
18 18
19#include "quantum.h"
20#include "matrix.h" 19#include "matrix.h"
21#include "uart.h" 20#include "uart.h"
22 21
diff --git a/keyboards/spiderisland/split78/matrix.c b/keyboards/spiderisland/split78/matrix.c
index 31ee29eaab..23b3745351 100644
--- a/keyboards/spiderisland/split78/matrix.c
+++ b/keyboards/spiderisland/split78/matrix.c
@@ -15,9 +15,7 @@ You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17 17
18#include <string.h> 18#include "matrix.h"
19#include <stdio.h>
20#include "quantum.h"
21#include "i2c_master.h" 19#include "i2c_master.h"
22 20
23#define RIGHT_HALF 21#define RIGHT_HALF
diff --git a/keyboards/sthlmkb/lagom/matrix.c b/keyboards/sthlmkb/lagom/matrix.c
index d3dc0cb12a..6a16722ad0 100644
--- a/keyboards/sthlmkb/lagom/matrix.c
+++ b/keyboards/sthlmkb/lagom/matrix.c
@@ -13,7 +13,8 @@
13 * You should have received a copy of the GNU General Public License 13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16#include "quantum.h" 16#include "matrix.h"
17#include "wait.h"
17 18
18#define COL_SHIFTER ((uint32_t)1) 19#define COL_SHIFTER ((uint32_t)1)
19 20
diff --git a/keyboards/switchplate/southpaw_65/matrix.c b/keyboards/switchplate/southpaw_65/matrix.c
index a7008e9c7d..059934bf44 100644
--- a/keyboards/switchplate/southpaw_65/matrix.c
+++ b/keyboards/switchplate/southpaw_65/matrix.c
@@ -13,15 +13,8 @@
13 * You should have received a copy of the GNU General Public License 13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16#include <stdint.h>
17#include <stdbool.h>
18#include <avr/io.h>
19#include <string.h>
20#include "matrix.h" 16#include "matrix.h"
21#include "pca9555.h" 17#include "pca9555.h"
22#include "quantum.h"
23
24#include "debug.h"
25 18
26// PCA9555 slave addresses 19// PCA9555 slave addresses
27#define IC1 0x20 20#define IC1 0x20
diff --git a/keyboards/telophase/matrix.c b/keyboards/telophase/matrix.c
index a18a2b20ed..c74ba0d7c7 100644
--- a/keyboards/telophase/matrix.c
+++ b/keyboards/telophase/matrix.c
@@ -16,7 +16,6 @@ You should have received a copy of the GNU General Public License
16along with this program. If not, see <http://www.gnu.org/licenses/>. 16along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
18 18
19#include "quantum.h"
20#include "matrix.h" 19#include "matrix.h"
21#include "uart.h" 20#include "uart.h"
22 21
diff --git a/keyboards/touchpad/matrix.c b/keyboards/touchpad/matrix.c
index 87944cb7cc..7929e0969b 100644
--- a/keyboards/touchpad/matrix.c
+++ b/keyboards/touchpad/matrix.c
@@ -23,7 +23,8 @@ SOFTWARE.
23 23
24#include "matrix.h" 24#include "matrix.h"
25#include "i2c_master.h" 25#include "i2c_master.h"
26#include "quantum.h" 26#include "print.h"
27#include <string.h>
27 28
28#define VIBRATE_LENGTH 50 //Defines number of interrupts motor will vibrate for, must be bigger than 8 for correct operation 29#define VIBRATE_LENGTH 50 //Defines number of interrupts motor will vibrate for, must be bigger than 8 for correct operation
29volatile uint8_t vibrate = 0; //Trigger vibration in interrupt 30volatile uint8_t vibrate = 0; //Trigger vibration in interrupt
@@ -276,16 +277,16 @@ matrix_row_t matrix_get_row(uint8_t row) {
276} 277}
277 278
278void matrix_print(void) { 279void matrix_print(void) {
279 printf("\nr/c 01234567\n"); 280 xprintf("\nr/c 01234567\n");
280 for (uint8_t row = 0; row < MATRIX_ROWS; row++) { 281 for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
281 printf("%X0: ", row); 282 xprintf("%X0: ", row);
282 matrix_row_t data = matrix_get_row(row); 283 matrix_row_t data = matrix_get_row(row);
283 for (int col = 0; col < MATRIX_COLS; col++) { 284 for (int col = 0; col < MATRIX_COLS; col++) {
284 if (data & (1<<col)) 285 if (data & (1<<col))
285 printf("1"); 286 xprintf("1");
286 else 287 else
287 printf("0"); 288 xprintf("0");
288 } 289 }
289 printf("\n"); 290 xprintf("\n");
290 } 291 }
291} 292}
diff --git a/keyboards/viktus/sp111/matrix.c b/keyboards/viktus/sp111/matrix.c
index a39365cef6..35a1a740fc 100644
--- a/keyboards/viktus/sp111/matrix.c
+++ b/keyboards/viktus/sp111/matrix.c
@@ -13,8 +13,10 @@
13 * You should have received a copy of the GNU General Public License 13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16#include "matrix.h"
16#include "mcp23018.h" 17#include "mcp23018.h"
17#include "quantum.h" 18#include "print.h"
19#include "wait.h"
18 20
19// Optimize scanning code for speed as a slight mitigation for the port expander 21// Optimize scanning code for speed as a slight mitigation for the port expander
20#pragma GCC push_options 22#pragma GCC push_options
diff --git a/keyboards/xiudi/xd84/matrix.c b/keyboards/xiudi/xd84/matrix.c
index d92ac83b4a..ea1b4f55b4 100644
--- a/keyboards/xiudi/xd84/matrix.c
+++ b/keyboards/xiudi/xd84/matrix.c
@@ -13,15 +13,8 @@
13 * You should have received a copy of the GNU General Public License 13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16#include <stdint.h>
17#include <stdbool.h>
18#include <avr/io.h>
19#include <string.h>
20#include "matrix.h" 16#include "matrix.h"
21#include "pca9555.h" 17#include "pca9555.h"
22#include "quantum.h"
23
24#include "debug.h"
25 18
26// PCA9555 slave addresses 19// PCA9555 slave addresses
27#define IC1 0x20 20#define IC1 0x20
diff --git a/keyboards/xiudi/xd96/matrix.c b/keyboards/xiudi/xd96/matrix.c
index 641202ca2c..2c433f02b8 100644
--- a/keyboards/xiudi/xd96/matrix.c
+++ b/keyboards/xiudi/xd96/matrix.c
@@ -13,15 +13,9 @@
13 * You should have received a copy of the GNU General Public License 13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16#include <stdint.h>
17#include <stdbool.h>
18#include <avr/io.h>
19#include <string.h>
20#include "matrix.h" 16#include "matrix.h"
21#include "pca9555.h" 17#include "pca9555.h"
22#include "quantum.h" 18#include "wait.h"
23
24#include "debug.h"
25 19
26// PCA9555 slave addresses 20// PCA9555 slave addresses
27#define IC1 0x20 21#define IC1 0x20
diff --git a/keyboards/ydkb/grape/matrix.c b/keyboards/ydkb/grape/matrix.c
index 700761fa44..3e070f8d7d 100644
--- a/keyboards/ydkb/grape/matrix.c
+++ b/keyboards/ydkb/grape/matrix.c
@@ -15,10 +15,7 @@ You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17 17
18#include <stdint.h>
19#include <stdbool.h>
20#include "matrix.h" 18#include "matrix.h"
21#include "quantum.h"
22#include "sn74x138.h" 19#include "sn74x138.h"
23 20
24static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; 21static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
diff --git a/keyboards/yiancardesigns/barleycorn/matrix.c b/keyboards/yiancardesigns/barleycorn/matrix.c
index 9ef2926566..008f096266 100644
--- a/keyboards/yiancardesigns/barleycorn/matrix.c
+++ b/keyboards/yiancardesigns/barleycorn/matrix.c
@@ -14,10 +14,8 @@ GNU General Public License for more details.
14You should have received a copy of the GNU General Public License 14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17#include <stdint.h> 17#include "matrix.h"
18#include <stdbool.h>
19#include "wait.h" 18#include "wait.h"
20#include "quantum.h"
21#include "i2c_master.h" 19#include "i2c_master.h"
22 20
23static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; 21static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
diff --git a/keyboards/yiancardesigns/gingham/matrix.c b/keyboards/yiancardesigns/gingham/matrix.c
index d17518b494..4e6319b52b 100644
--- a/keyboards/yiancardesigns/gingham/matrix.c
+++ b/keyboards/yiancardesigns/gingham/matrix.c
@@ -14,10 +14,8 @@ GNU General Public License for more details.
14You should have received a copy of the GNU General Public License 14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17#include <stdint.h> 17#include "matrix.h"
18#include <stdbool.h>
19#include "wait.h" 18#include "wait.h"
20#include "quantum.h"
21#include "i2c_master.h" 19#include "i2c_master.h"
22 20
23static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; 21static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
diff --git a/keyboards/yiancardesigns/seigaiha/matrix.c b/keyboards/yiancardesigns/seigaiha/matrix.c
index 55ee239db4..dc80c4becf 100644
--- a/keyboards/yiancardesigns/seigaiha/matrix.c
+++ b/keyboards/yiancardesigns/seigaiha/matrix.c
@@ -14,10 +14,8 @@ GNU General Public License for more details.
14You should have received a copy of the GNU General Public License 14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17#include <stdint.h> 17#include "matrix.h"
18#include <stdbool.h>
19#include "wait.h" 18#include "wait.h"
20#include "quantum.h"
21#include "i2c_master.h" 19#include "i2c_master.h"
22 20
23static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; 21static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;