summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--keyboards/bfake/bfake.c3
-rw-r--r--keyboards/bfake/config.h2
-rw-r--r--keyboards/bfake/matrix.c106
-rw-r--r--keyboards/bfake/rules.mk4
-rw-r--r--keyboards/coseyfannitutti/discipad/discipad.c8
-rw-r--r--keyboards/coseyfannitutti/discipline/discipline.c8
-rw-r--r--keyboards/exclusive/e6v2/le_bmc/keymaps/default/keymap.c12
-rw-r--r--keyboards/exclusive/e6v2/oe_bmc/keymaps/default/keymap.c12
-rw-r--r--keyboards/ft/mars80/keymaps/default/keymap.c12
-rw-r--r--keyboards/jc65/v32a/config.h7
-rw-r--r--keyboards/jc65/v32a/matrix.c106
-rw-r--r--keyboards/jc65/v32a/rules.mk4
-rw-r--r--keyboards/jc65/v32a/v32a.c3
-rw-r--r--keyboards/jc65/v32a/v32a.h30
-rw-r--r--keyboards/jj40/rules.mk15
-rw-r--r--keyboards/jj50/config.h8
-rw-r--r--keyboards/jj50/jj50.c10
-rw-r--r--keyboards/jj50/jj50.h2
-rw-r--r--keyboards/jj50/matrix.c107
-rw-r--r--keyboards/jj50/rules.mk4
-rw-r--r--keyboards/leeku/finger65/config.h2
-rw-r--r--keyboards/mechmini/v1/config.h7
-rw-r--r--keyboards/mechmini/v1/matrix.c112
-rw-r--r--keyboards/mechmini/v1/rules.mk4
-rw-r--r--keyboards/mechmini/v1/v1.c10
-rw-r--r--keyboards/mechmini/v1/v1.h24
-rw-r--r--keyboards/mehkee96/config.h3
-rw-r--r--keyboards/mehkee96/keymaps/default/keymap.c10
-rw-r--r--keyboards/mehkee96/matrix.c130
-rw-r--r--keyboards/mehkee96/mehkee96.c10
-rw-r--r--keyboards/mehkee96/rules.mk4
-rw-r--r--keyboards/mt40/config.h8
-rw-r--r--keyboards/mt40/matrix.c128
-rw-r--r--keyboards/mt40/mt40.h1
-rw-r--r--keyboards/mt40/rules.mk4
-rw-r--r--keyboards/percent/canoe/canoe.c10
-rw-r--r--keyboards/percent/canoe/canoe.h10
-rw-r--r--keyboards/percent/canoe/config.h6
-rw-r--r--keyboards/percent/canoe/matrix.c112
-rw-r--r--keyboards/percent/canoe/rules.mk4
-rw-r--r--keyboards/percent/skog/config.h6
-rw-r--r--keyboards/percent/skog/keymaps/default/keymap.c8
-rw-r--r--keyboards/percent/skog/matrix.c112
-rw-r--r--keyboards/percent/skog/skog.c10
-rw-r--r--keyboards/percent/skog/skog.h1
-rw-r--r--keyboards/winkeyless/bface/config.h2
-rw-r--r--keyboards/winkeyless/bmini/bmini.c3
-rw-r--r--keyboards/winkeyless/bmini/config.h3
-rw-r--r--keyboards/winkeyless/bmini/matrix.c106
-rw-r--r--keyboards/winkeyless/bmini/rules.mk4
-rw-r--r--keyboards/winkeyless/bminiex/config.h3
-rw-r--r--keyboards/winkeyless/bminiex/matrix.c122
-rw-r--r--keyboards/winkeyless/bminiex/rules.mk4
-rw-r--r--keyboards/ymd75/config.h4
-rw-r--r--keyboards/ymd75/matrix.c108
-rw-r--r--keyboards/ymd75/rules.mk4
-rw-r--r--keyboards/ymd75/ymd75.c10
-rw-r--r--keyboards/ymd75/ymd75.h2
-rw-r--r--keyboards/ymd96/config.h3
-rw-r--r--keyboards/ymd96/matrix.c112
-rw-r--r--keyboards/ymd96/rules.mk4
-rw-r--r--keyboards/ymd96/ymd96.c10
-rw-r--r--keyboards/ymd96/ymd96.h2
-rw-r--r--keyboards/ymdk/bface/config.h2
-rw-r--r--keyboards/ymdk/bface/rules.mk15
-rw-r--r--keyboards/ymdk_np21/config.h6
-rw-r--r--keyboards/ymdk_np21/matrix.c129
-rw-r--r--keyboards/ymdk_np21/rules.mk4
-rw-r--r--keyboards/ymdk_np21/ymdk_np21.h2
69 files changed, 81 insertions, 1782 deletions
diff --git a/keyboards/bfake/bfake.c b/keyboards/bfake/bfake.c
index f7d006576c..9039fe5465 100644
--- a/keyboards/bfake/bfake.c
+++ b/keyboards/bfake/bfake.c
@@ -17,9 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "bfake.h"
-__attribute__ ((weak))
-void matrix_scan_user(void) {}
-
void backlight_init_ports(void) {
setPinOutput(D0);
setPinOutput(D1);
diff --git a/keyboards/bfake/config.h b/keyboards/bfake/config.h
index 0a8911b09a..65f1f3a759 100644
--- a/keyboards/bfake/config.h
+++ b/keyboards/bfake/config.h
@@ -32,7 +32,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MATRIX_COLS 11
#define MATRIX_ROW_PINS { B0, B1, B2, B3, B4, B5, B6, B7 }
-#define MATRIX_COL_PINS { A0, A1, A2, A3, A4, A5, A6, A7, C7, C6}
+#define MATRIX_COL_PINS { A0, A1, A2, A3, A4, A5, A6, A7, C7, C6, C5 }
#define UNUSED_PINS
#define DIODE_DIRECTION COL2ROW
diff --git a/keyboards/bfake/matrix.c b/keyboards/bfake/matrix.c
deleted file mode 100644
index 57aa36b5ff..0000000000
--- a/keyboards/bfake/matrix.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
-Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com>
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <avr/io.h>
-#include <util/delay.h>
-
-#include "matrix.h"
-
-#ifndef DEBOUNCE
-#define DEBOUNCE 5
-#endif
-
-static uint8_t debouncing = DEBOUNCE;
-
-static matrix_row_t matrix[MATRIX_ROWS];
-static matrix_row_t matrix_debouncing[MATRIX_ROWS];
-
-void matrix_init(void) {
- // all outputs for rows high
- DDRB = 0xFF;
- PORTB = 0xFF;
- // all inputs for columns
- DDRA = 0x00;
- DDRC &= ~(0x111111<<2);
- DDRD &= ~(1<<PIND7);
- // all columns are pulled-up
- PORTA = 0xFF;
- PORTC |= (0b111111<<2);
- PORTD |= (1<<PIND7);
-
- // initialize matrix state: all keys off
- for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
- matrix[row] = 0x00;
- matrix_debouncing[row] = 0x00;
- }
-}
-
-void matrix_set_row_status(uint8_t row) {
- DDRB = (1 << row);
- PORTB = ~(1 << row);
-}
-
-uint8_t bit_reverse(uint8_t x) {
- x = ((x >> 1) & 0x55) | ((x << 1) & 0xaa);
- x = ((x >> 2) & 0x33) | ((x << 2) & 0xcc);
- x = ((x >> 4) & 0x0f) | ((x << 4) & 0xf0);
- return x;
-}
-
-uint8_t matrix_scan(void) {
- for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
- matrix_set_row_status(row);
- _delay_us(5);
-
- matrix_row_t cols = (
- // cols 0..7, PORTA 0 -> 7
- (~PINA) & 0xFF
- ) | (
- // cols 8..13, PORTC 7 -> 0
- bit_reverse((~PINC) & 0xFF) << 8
- ) | (
- // col 14, PORTD 7
- ((~PIND) & (1 << PIND7)) << 7
- );
-
- if (matrix_debouncing[row] != cols) {
- matrix_debouncing[row] = cols;
- debouncing = DEBOUNCE;
- }
- }
-
- if (debouncing) {
- if (--debouncing) {
- _delay_ms(1);
- } else {
- for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
- matrix[i] = matrix_debouncing[i];
- }
- }
- }
-
- matrix_scan_user();
-
- return 1;
-}
-
-inline matrix_row_t matrix_get_row(uint8_t row) {
- return matrix[row];
-}
-
-void matrix_print(void) {
-}
diff --git a/keyboards/bfake/rules.mk b/keyboards/bfake/rules.mk
index 5963c9810a..107bb4fa90 100644
--- a/keyboards/bfake/rules.mk
+++ b/keyboards/bfake/rules.mk
@@ -22,7 +22,3 @@ RGBLIGHT_ENABLE = no
WS2812_DRIVER = i2c
OPT_DEFS = -DDEBUG_LEVEL=0
-
-# custom matrix setup
-CUSTOM_MATRIX = yes
-SRC = matrix.c
diff --git a/keyboards/coseyfannitutti/discipad/discipad.c b/keyboards/coseyfannitutti/discipad/discipad.c
index c8f6e0a178..4bdb1c6c20 100644
--- a/keyboards/coseyfannitutti/discipad/discipad.c
+++ b/keyboards/coseyfannitutti/discipad/discipad.c
@@ -14,11 +14,3 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "discipad.h"
-
-
-void matrix_init_kb(void) {
- // put your keyboard start-up code here
- // runs once when the firmware starts up
-
- matrix_init_user();
-}
diff --git a/keyboards/coseyfannitutti/discipline/discipline.c b/keyboards/coseyfannitutti/discipline/discipline.c
index 6a788ce0e8..50ba0bae54 100644
--- a/keyboards/coseyfannitutti/discipline/discipline.c
+++ b/keyboards/coseyfannitutti/discipline/discipline.c
@@ -14,11 +14,3 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "discipline.h"
-
-
-void matrix_init_kb(void) {
- // put your keyboard start-up code here
- // runs once when the firmware starts up
-
- matrix_init_user();
-}
diff --git a/keyboards/exclusive/e6v2/le_bmc/keymaps/default/keymap.c b/keyboards/exclusive/e6v2/le_bmc/keymaps/default/keymap.c
index 7300419176..6d9209e487 100644
--- a/keyboards/exclusive/e6v2/le_bmc/keymaps/default/keymap.c
+++ b/keyboards/exclusive/e6v2/le_bmc/keymaps/default/keymap.c
@@ -60,15 +60,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
return true;
}
-
-void matrix_init_user(void) {
-
-}
-
-void matrix_scan_user(void) {
-
-}
-
-void led_set_user(uint8_t usb_led) {
-
-}
diff --git a/keyboards/exclusive/e6v2/oe_bmc/keymaps/default/keymap.c b/keyboards/exclusive/e6v2/oe_bmc/keymaps/default/keymap.c
index 7300419176..6d9209e487 100644
--- a/keyboards/exclusive/e6v2/oe_bmc/keymaps/default/keymap.c
+++ b/keyboards/exclusive/e6v2/oe_bmc/keymaps/default/keymap.c
@@ -60,15 +60,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
return true;
}
-
-void matrix_init_user(void) {
-
-}
-
-void matrix_scan_user(void) {
-
-}
-
-void led_set_user(uint8_t usb_led) {
-
-}
diff --git a/keyboards/ft/mars80/keymaps/default/keymap.c b/keyboards/ft/mars80/keymaps/default/keymap.c
index ba7ef83d98..010102d723 100644
--- a/keyboards/ft/mars80/keymaps/default/keymap.c
+++ b/keyboards/ft/mars80/keymaps/default/keymap.c
@@ -61,15 +61,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
return true;
}
-
-void matrix_init_user(void) {
-
-}
-
-void matrix_scan_user(void) {
-
-}
-
-void led_set_user(uint8_t usb_led) {
-
-}
diff --git a/keyboards/jc65/v32a/config.h b/keyboards/jc65/v32a/config.h
index 444ebad077..5439dbe396 100644
--- a/keyboards/jc65/v32a/config.h
+++ b/keyboards/jc65/v32a/config.h
@@ -26,8 +26,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define PRODUCT JC65 PS2AVRGB
/* matrix size */
-#define MATRIX_ROWS 8
-#define MATRIX_COLS 16
+#define MATRIX_ROWS 7
+#define MATRIX_COLS 15
+#define MATRIX_ROW_PINS { B0, B1, B2, B3, B4, B6, B7 }
+#define MATRIX_COL_PINS { A0, A1, A2, A3, A4, A5, A6, A7, C7, C6, C5, C4, C3, C2, D7 }
+#define DIODE_DIRECTION COL2ROW
#define BACKLIGHT_LEVELS 1
#define RGBLED_NUM 16
diff --git a/keyboards/jc65/v32a/matrix.c b/keyboards/jc65/v32a/matrix.c
deleted file mode 100644
index 57aa36b5ff..0000000000
--- a/keyboards/jc65/v32a/matrix.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
-Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com>
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <avr/io.h>
-#include <util/delay.h>
-
-#include "matrix.h"
-
-#ifndef DEBOUNCE
-#define DEBOUNCE 5
-#endif
-
-static uint8_t debouncing = DEBOUNCE;
-
-static matrix_row_t matrix[MATRIX_ROWS];
-static matrix_row_t matrix_debouncing[MATRIX_ROWS];
-
-void matrix_init(void) {
- // all outputs for rows high
- DDRB = 0xFF;
- PORTB = 0xFF;
- // all inputs for columns
- DDRA = 0x00;
- DDRC &= ~(0x111111<<2);
- DDRD &= ~(1<<PIND7);
- // all columns are pulled-up
- PORTA = 0xFF;
- PORTC |= (0b111111<<2);
- PORTD |= (1<<PIND7);
-
- // initialize matrix state: all keys off
- for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
- matrix[row] = 0x00;
- matrix_debouncing[row] = 0x00;
- }
-}
-
-void matrix_set_row_status(uint8_t row) {
- DDRB = (1 << row);
- PORTB = ~(1 << row);
-}
-
-uint8_t bit_reverse(uint8_t x) {
- x = ((x >> 1) & 0x55) | ((x << 1) & 0xaa);
- x = ((x >> 2) & 0x33) | ((x << 2) & 0xcc);
- x = ((x >> 4) & 0x0f) | ((x << 4) & 0xf0);
- return x;
-}
-
-uint8_t matrix_scan(void) {
- for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
- matrix_set_row_status(row);
- _delay_us(5);
-
- matrix_row_t cols = (
- // cols 0..7, PORTA 0 -> 7
- (~PINA) & 0xFF
- ) | (
- // cols 8..13, PORTC 7 -> 0
- bit_reverse((~PINC) & 0xFF) << 8
- ) | (
- // col 14, PORTD 7
- ((~PIND) & (1 << PIND7)) << 7
- );
-
- if (matrix_debouncing[row] != cols) {
- matrix_debouncing[row] = cols;
- debouncing = DEBOUNCE;
- }
- }
-
- if (debouncing) {
- if (--debouncing) {
- _delay_ms(1);
- } else {
- for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
- matrix[i] = matrix_debouncing[i];
- }
- }
- }
-
- matrix_scan_user();
-
- return 1;
-}
-
-inline matrix_row_t matrix_get_row(uint8_t row) {
- return matrix[row];
-}
-
-void matrix_print(void) {
-}
diff --git a/keyboards/jc65/v32a/rules.mk b/keyboards/jc65/v32a/rules.mk
index 18e7f1de9d..a8fea7efa7 100644
--- a/keyboards/jc65/v32a/rules.mk
+++ b/keyboards/jc65/v32a/rules.mk
@@ -22,7 +22,3 @@ RGBLIGHT_ENABLE = yes
WS2812_DRIVER = i2c
OPT_DEFS = -DDEBUG_LEVEL=0
-
-# custom matrix setup
-CUSTOM_MATRIX = yes
-SRC = matrix.c
diff --git a/keyboards/jc65/v32a/v32a.c b/keyboards/jc65/v32a/v32a.c
index 9b1e07274c..2a289872fe 100644
--- a/keyboards/jc65/v32a/v32a.c
+++ b/keyboards/jc65/v32a/v32a.c
@@ -17,9 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "v32a.h"
-__attribute__ ((weak))
-void matrix_scan_user(void) {}
-
#ifdef BACKLIGHT_ENABLE
void backlight_init_ports(void) {
setPinOutput(D0);
diff --git a/keyboards/jc65/v32a/v32a.h b/keyboards/jc65/v32a/v32a.h
index ba91d80a64..b319ba80af 100644
--- a/keyboards/jc65/v32a/v32a.h
+++ b/keyboards/jc65/v32a/v32a.h
@@ -27,14 +27,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
K01,K30,K11,K21,K31,K41,K51,K46,KE6,KE7,K47,KA1, KB1,K86,K77, \
K00,K10,K20, K40,K56,K50, K57,KB0,KC0,K96,K76,K66 \
){ \
- { K00, K10, K20, K30, K40, K50,KC_NO,KC_NO,KC_NO,KC_NO,KC_NO, KB0, KC0, KD0,KC_NO,KC_NO }, \
- { K01, K11, K21, K31, K41, K51,KC_NO,KC_NO,KC_NO,KC_NO, KA1, KB1,KC_NO,KC_NO,KC_NO,KC_NO }, \
- { K02, K12, K22, K32, K42, K52,KC_NO,KC_NO,KC_NO,KC_NO, KA2, KB2, KC2, KD2,KC_NO,KC_NO }, \
- { K03, K13, K23, K33, K43, K53,KC_NO,KC_NO,KC_NO,KC_NO, KA3, KB3, KC3, KD3,KC_NO,KC_NO }, \
- { K04, K14, K24, K34, K44, K54,KC_NO,KC_NO,KC_NO,KC_NO, KA4, KB4, KC4, KD4, KE4,KC_NO }, \
- { KC_NO,KC_NO,KC_NO,KC_NO,KC_NO,KC_NO,KC_NO,KC_NO,KC_NO,KC_NO,KC_NO,KC_NO,KC_NO,KC_NO,KC_NO,KC_NO }, \
- { KC_NO, K16, K26, K36, K46, K56, K66, K76, K86, K96,KC_NO, KB6, KC6, KD6, KE6,KC_NO }, \
- { KC_NO, K17, K27, K37, K47, K57, K67, K77, K87,KC_NO,KC_NO, KB7, KC7, KD7, KE7,KC_NO } \
+ { K00, K10, K20, K30, K40, K50,KC_NO,KC_NO,KC_NO,KC_NO,KC_NO, KB0, KC0, KD0,KC_NO }, \
+ { K01, K11, K21, K31, K41, K51,KC_NO,KC_NO,KC_NO,KC_NO, KA1, KB1,KC_NO,KC_NO,KC_NO }, \
+ { K02, K12, K22, K32, K42, K52,KC_NO,KC_NO,KC_NO,KC_NO, KA2, KB2, KC2, KD2,KC_NO }, \
+ { K03, K13, K23, K33, K43, K53,KC_NO,KC_NO,KC_NO,KC_NO, KA3, KB3, KC3, KD3,KC_NO }, \
+ { K04, K14, K24, K34, K44, K54,KC_NO,KC_NO,KC_NO,KC_NO, KA4, KB4, KC4, KD4, KE4 }, \
+ { KC_NO, K16, K26, K36, K46, K56, K66, K76, K86, K96,KC_NO, KB6, KC6, KD6, KE6 }, \
+ { KC_NO, K17, K27, K37, K47, K57, K67, K77, K87,KC_NO,KC_NO, KB7, KC7, KD7, KE7 } \
}
#define LAYOUT_kc( \
@@ -45,14 +44,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
K00,K10,K20, K40,K56,K50, K57,KB0,KC0,K96,K76,K66 \
) \
{ \
- { KC_##K00,KC_##K10,KC_##K20,KC_##K30,KC_##K40,KC_##K50, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,KC_##KB0,KC_##KC0,KC_##KD0, KC_NO,KC_NO }, \
- { KC_##K01,KC_##K11,KC_##K21,KC_##K31,KC_##K41,KC_##K51, KC_NO, KC_NO, KC_NO, KC_NO,KC_##KA1,KC_##KB1, KC_NO, KC_NO, KC_NO,KC_NO }, \
- { KC_##K02,KC_##K12,KC_##K22,KC_##K32,KC_##K42,KC_##K52, KC_NO, KC_NO, KC_NO, KC_NO,KC_##KA2,KC_##KB2,KC_##KC2,KC_##KD2, KC_NO,KC_NO }, \
- { KC_##K03,KC_##K13,KC_##K23,KC_##K33,KC_##K43,KC_##K53, KC_NO, KC_NO, KC_NO, KC_NO,KC_##KA3,KC_##KB3,KC_##KC3,KC_##KD3, KC_NO,KC_NO }, \
- { KC_##K04,KC_##K14,KC_##K24,KC_##K34,KC_##K44,KC_##K54, KC_NO, KC_NO, KC_NO, KC_NO,KC_##KA4,KC_##KB4,KC_##KC4,KC_##KD4,KC_##KE4,KC_NO }, \
- { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,KC_NO }, \
- { KC_NO,KC_##K16,KC_##K26,KC_##K36,KC_##K46,KC_##K56,KC_##K66,KC_##K76,KC_##K86,KC_##K96, KC_NO,KC_##KB6,KC_##KC6,KC_##KD6,KC_##KE6,KC_NO }, \
- { KC_NO,KC_##K17,KC_##K27,KC_##K37,KC_##K47,KC_##K57,KC_##K67,KC_##K77,KC_##K87, KC_NO, KC_NO,KC_##KB7,KC_##KC7,KC_##KD7,KC_##KE7,KC_NO } \
+ { KC_##K00,KC_##K10,KC_##K20,KC_##K30,KC_##K40,KC_##K50, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,KC_##KB0,KC_##KC0,KC_##KD0, KC_NO }, \
+ { KC_##K01,KC_##K11,KC_##K21,KC_##K31,KC_##K41,KC_##K51, KC_NO, KC_NO, KC_NO, KC_NO,KC_##KA1,KC_##KB1, KC_NO, KC_NO, KC_NO }, \
+ { KC_##K02,KC_##K12,KC_##K22,KC_##K32,KC_##K42,KC_##K52, KC_NO, KC_NO, KC_NO, KC_NO,KC_##KA2,KC_##KB2,KC_##KC2,KC_##KD2, KC_NO }, \
+ { KC_##K03,KC_##K13,KC_##K23,KC_##K33,KC_##K43,KC_##K53, KC_NO, KC_NO, KC_NO, KC_NO,KC_##KA3,KC_##KB3,KC_##KC3,KC_##KD3, KC_NO }, \
+ { KC_##K04,KC_##K14,KC_##K24,KC_##K34,KC_##K44,KC_##K54, KC_NO, KC_NO, KC_NO, KC_NO,KC_##KA4,KC_##KB4,KC_##KC4,KC_##KD4,KC_##KE4 }, \
+ { KC_NO,KC_##K16,KC_##K26,KC_##K36,KC_##K46,KC_##K56,KC_##K66,KC_##K76,KC_##K86,KC_##K96, KC_NO,KC_##KB6,KC_##KC6,KC_##KD6,KC_##KE6 }, \
+ { KC_NO,KC_##K17,KC_##K27,KC_##K37,KC_##K47,KC_##K57,KC_##K67,KC_##K77,KC_##K87, KC_NO, KC_NO,KC_##KB7,KC_##KC7,KC_##KD7,KC_##KE7 } \
}
#endif
diff --git a/keyboards/jj40/rules.mk b/keyboards/jj40/rules.mk
index 8e0e8c8647..c53a6804c0 100644
--- a/keyboards/jj40/rules.mk
+++ b/keyboards/jj40/rules.mk
@@ -1,18 +1,3 @@
-# Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com>
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
# MCU name
MCU = atmega32a
diff --git a/keyboards/jj50/config.h b/keyboards/jj50/config.h
index dfd8a4a8fb..884a28d506 100644
--- a/keyboards/jj50/config.h
+++ b/keyboards/jj50/config.h
@@ -32,9 +32,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define DESCRIPTION Preonic-like clone
/* matrix size */
-#define MATRIX_ROWS 8
-#define MATRIX_COLS 15
-#define DIODE_DIRECTION ROW2COL
+#define MATRIX_ROWS 5
+#define MATRIX_COLS 12
+#define MATRIX_ROW_PINS { B0, B1, B2, B3, B4 }
+#define MATRIX_COL_PINS { A0, A1, A2, A3, A4, A5, A6, A7, C7, C6, C5, C4 }
+#define DIODE_DIRECTION COL2ROW
//#define BACKLIGHT_PIN D4
#define BACKLIGHT_LEVELS 12
diff --git a/keyboards/jj50/jj50.c b/keyboards/jj50/jj50.c
index 7c3cee95d1..a302adf405 100644
--- a/keyboards/jj50/jj50.c
+++ b/keyboards/jj50/jj50.c
@@ -20,16 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "backlight.h"
#include "backlight_custom.h"
-void matrix_init_kb(void) { matrix_init_user(); }
-
-__attribute__ ((weak))
-void matrix_init_user(void) {}
-
-void matrix_scan_kb(void) { matrix_scan_user(); }
-
-__attribute__ ((weak))
-void matrix_scan_user(void) {}
-
#ifdef BACKLIGHT_ENABLE
void backlight_init_ports(void) {
b_led_init_ports();
diff --git a/keyboards/jj50/jj50.h b/keyboards/jj50/jj50.h
index 8a904897e6..6b1c7eacf3 100644
--- a/keyboards/jj50/jj50.h
+++ b/keyboards/jj50/jj50.h
@@ -25,8 +25,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "keycode.h"
#include "action.h"
-void matrix_init_user(void);
-
#define LAYOUT_ortho_5x12( \
K011, K010, K009, K008, K004, K005, K006, K007, K003, K002, K201, K000, \
K111, K110, K109, K108, K104, K105, K106, K107, K103, K102, K001, K100, \
diff --git a/keyboards/jj50/matrix.c b/keyboards/jj50/matrix.c
deleted file mode 100644
index 95c6057e7c..0000000000
--- a/keyboards/jj50/matrix.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
-Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com>
-Modified 2018 by Wayne K Jones <github.com/WarmCatUK>
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <avr/io.h>
-#include <util/delay.h>
-
-#include "matrix.h"
-
-#ifndef DEBOUNCE
-# define DEBOUNCE 5
-#endif
-
-static uint8_t debouncing = DEBOUNCE;
-
-static matrix_row_t matrix[MATRIX_ROWS];
-static matrix_row_t matrix_debouncing[MATRIX_ROWS];
-
-void matrix_init(void) {
- // all outputs for rows high
- DDRB = 0xFF;
- PORTB = 0xFF;
- // all inputs for columns
- DDRA = 0x00;
- DDRC &= ~(0x111111<<2);
- //----> DDRD &= ~(1<<PIND7);
- // Port D not used on this keyboard
- // all columns are pulled-up
- PORTA = 0xFF;
- PORTC |= (0b111111<<2);
- //PORTD |= (1<<PIND7);
- // Port D not used on this keyboard
-
- // initialize matrix state: all keys off
- for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
- matrix[row] = 0x00;
- matrix_debouncing[row] = 0x00;
- }
- matrix_init_quantum(); // missing from original port by Luiz
-}
-
-void matrix_set_row_status(uint8_t row) {
- DDRB = (1 << row);
- PORTB = ~(1 << row);
-}
-
-uint8_t bit_reverse(uint8_t x) {
- x = ((x >> 1) & 0x55) | ((x << 1) & 0xaa);
- x = ((x >> 2) & 0x33) | ((x << 2) & 0xcc);
- x = ((x >> 4) & 0x0f) | ((x << 4) & 0xf0);
- return x;
-}
-
-uint8_t matrix_scan(void) {
- for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
- matrix_set_row_status(row);
- _delay_us(5);
-
- matrix_row_t cols = (
- // cols 0..7, PORTA 0 -> 7
- (~PINA) & 0xFF
- ) | (
- // cols 8..13, PORTC 7 -> 0
- bit_reverse((~PINC) & 0xFF) << 8
- );
-
- if (matrix_debouncing[row] != cols) {
- matrix_debouncing[row] = cols;
- debouncing = DEBOUNCE;
- }
- }
-
- if (debouncing) {
- if (--debouncing) {
- _delay_ms(1);
- } else {
- for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
- matrix[i] = matrix_debouncing[i];
- }
- }
- }
- matrix_scan_quantum(); // also missing in original PS2AVRGB implementation
- //matrix_scan_user();
-
- return 1;
-}
-
-inline matrix_row_t matrix_get_row(uint8_t row) {
- return matrix[row];
-}
-
-void matrix_print(void) {
-}
diff --git a/keyboards/jj50/rules.mk b/keyboards/jj50/rules.mk
index 40473e6ecc..62b21e4df2 100644
--- a/keyboards/jj50/rules.mk
+++ b/keyboards/jj50/rules.mk
@@ -29,8 +29,6 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
#OPT_DEFS = -DDEBUG_LEVEL=0
-# custom matrix setup
-CUSTOM_MATRIX = yes
-SRC = matrix.c backlight.c
+SRC = backlight.c
LAYOUTS = ortho_5x12
diff --git a/keyboards/leeku/finger65/config.h b/keyboards/leeku/finger65/config.h
index 3e6eebb324..584db4ad31 100644
--- a/keyboards/leeku/finger65/config.h
+++ b/keyboards/leeku/finger65/config.h
@@ -37,6 +37,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MATRIX_ROW_PINS { C3, C4, C5, C6, C7 }
#define UNUSED_PINS
+#define DIODE_DIRECTION COL2ROW
+
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCE 5
diff --git a/keyboards/mechmini/v1/config.h b/keyboards/mechmini/v1/config.h
index 9355a6dc33..eb15a368ad 100644
--- a/keyboards/mechmini/v1/config.h
+++ b/keyboards/mechmini/v1/config.h
@@ -30,8 +30,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define DESCRIPTION 40% modular keyboard
/* matrix size */
-#define MATRIX_ROWS 8
-#define MATRIX_COLS 15
+#define MATRIX_ROWS 4
+#define MATRIX_COLS 12
+#define MATRIX_ROW_PINS { B0, B1, B2, B3 }
+#define MATRIX_COL_PINS { A0, A1, A2, A3, A4, A5, A6, A7, C7, C6, C5, C4 }
+#define DIODE_DIRECTION COL2ROW
#define NO_UART 1
diff --git a/keyboards/mechmini/v1/matrix.c b/keyboards/mechmini/v1/matrix.c
deleted file mode 100644
index 245813dfd2..0000000000
--- a/keyboards/mechmini/v1/matrix.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
-Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com>
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <avr/io.h>
-#include <util/delay.h>
-
-#include "matrix.h"
-
-#ifndef DEBOUNCE
-# define DEBOUNCE 5
-#endif
-
-static uint8_t debouncing = DEBOUNCE;
-
-static matrix_row_t matrix[MATRIX_ROWS];
-static matrix_row_t matrix_debouncing[MATRIX_ROWS];
-
-void matrix_set_row_status(uint8_t row);
-uint8_t bit_reverse(uint8_t x);
-
-void matrix_init(void) {
- // all outputs for rows high
- DDRB = 0xFF;
- PORTB = 0xFF;
- // all inputs for columns
- DDRA = 0x00;
- DDRC &= ~(0x111111<<2);
- DDRD &= ~(1<<PIND7);
- // all columns are pulled-up
- PORTA = 0xFF;
- PORTC |= (0b111111<<2);
- PORTD |= (1<<PIND7);
-
- // initialize matrix state: all keys off
- for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
- matrix[row] = 0x00;
- matrix_debouncing[row] = 0x00;
- }
-
- matrix_init_quantum();
-}
-
-uint8_t matrix_scan(void) {
- for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
- matrix_set_row_status(row);
- _delay_us(5);
-
- matrix_row_t cols = (
- // cols 0..7, PORTA 0 -> 7
- (~PINA) & 0xFF
- ) | (
- // cols 8..13, PORTC 7 -> 0
- bit_reverse((~PINC) & 0xFF) << 8
- ) | (
- // col 14, PORTD 7
- ((~PIND) & (1 << PIND7)) << 7
- );
-
- if (matrix_debouncing[row] != cols) {
- matrix_debouncing[row] = cols;
- debouncing = DEBOUNCE;
- }
- }
-
- if (debouncing) {
- if (--debouncing) {
- _delay_ms(1);
- } else {
- for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
- matrix[i] = matrix_debouncing[i];
- }
- }
- }
-
- matrix_scan_quantum();
-
- return 1;
-}
-
-// declarations
-void matrix_set_row_status(uint8_t row) {
- DDRB = (1 << row);
- PORTB = ~(1 << row);
-}
-
-uint8_t bit_reverse(uint8_t x) {
- x = ((x >> 1) & 0x55) | ((x << 1) & 0xaa);
- x = ((x >> 2) & 0x33) | ((x << 2) & 0xcc);
- x = ((x >> 4) & 0x0f) | ((x << 4) & 0xf0);
- return x;
-}
-
-inline matrix_row_t matrix_get_row(uint8_t row) {
- return matrix[row];
-}
-
-void matrix_print(void) {
-}
diff --git a/keyboards/mechmini/v1/rules.mk b/keyboards/mechmini/v1/rules.mk
index ee023b43ba..1c6252c59b 100644
--- a/keyboards/mechmini/v1/rules.mk
+++ b/keyboards/mechmini/v1/rules.mk
@@ -22,7 +22,3 @@ RGBLIGHT_ENABLE = yes
WS2812_DRIVER = i2c
OPT_DEFS = -DDEBUG_LEVEL=0
-
-# custom matrix setup
-CUSTOM_MATRIX = yes
-SRC = matrix.c
diff --git a/keyboards/mechmini/v1/v1.c b/keyboards/mechmini/v1/v1.c
index 2c910d9658..ba0e095209 100644
--- a/keyboards/mechmini/v1/v1.c
+++ b/keyboards/mechmini/v1/v1.c
@@ -16,13 +16,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "v1.h"
-
-void matrix_init_kb(void) { matrix_init_user(); }
-
-__attribute__ ((weak))
-void matrix_init_user(void) {}
-
-void matrix_scan_kb(void) { matrix_scan_user(); }
-
-__attribute__ ((weak))
-void matrix_scan_user(void) {}
diff --git a/keyboards/mechmini/v1/v1.h b/keyboards/mechmini/v1/v1.h
index 1e392b3530..acdad5c6d6 100644
--- a/keyboards/mechmini/v1/v1.h
+++ b/keyboards/mechmini/v1/v1.h
@@ -30,14 +30,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
K00, K10, K20, K56, K57, KB0, KC0, K66 \
) \
{ \
- { K00, K10, K20, K56, KC_NO, K57, KC_NO, KC_NO, KB0, KC0, K66, KC_NO, KC_NO, KC_NO, KC_NO }, \
- { K01, K11, K21, K31, K41, K51, K46, KE6, KE7, K47, KA1, KC_NO, KC_NO, KC_NO, KC_NO }, \
- { K02, K12, K22, K32, K42, K52, K36, KD6, KD7, K37, KA2, KC_NO, KC_NO, KC_NO, KC_NO }, \
- { K03, K13, K23, K33, K43, K53, K26, KC6, KC7, K27, KA3, KB3, KC_NO, KC_NO, KC_NO }, \
- { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
- { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
- { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
- { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO } \
+ { K00, K10, K20, K56, KC_NO, K57, KC_NO, KC_NO, KB0, KC0, K66, KC_NO }, \
+ { K01, K11, K21, K31, K41, K51, K46, KE6, KE7, K47, KA1, KC_NO }, \
+ { K02, K12, K22, K32, K42, K52, K36, KD6, KD7, K37, KA2, KC_NO }, \
+ { K03, K13, K23, K33, K43, K53, K26, KC6, KC7, K27, KA3, KB3 } \
}
#define LAYOUT_split_space( \
@@ -47,14 +43,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
K00, K10, K20, K56, K57, KB0, KC0, K66 \
) \
{ \
- { K00, K10, K20, K56, KC_NO, KC_NO, K57, KC_NO, KB0, KC0, K66, KC_NO, KC_NO, KC_NO, KC_NO }, \
- { K01, K11, K21, K31, K41, K51, K46, KE6, KE7, K47, KA1, KC_NO, KC_NO, KC_NO, KC_NO }, \
- { K02, K12, K22, K32, K42, K52, K36, KD6, KD7, K37, KA2, KC_NO, KC_NO, KC_NO, KC_NO }, \
- { K03, K13, K23, K33, K43, K53, K26, KC6, KC7, K27, KA3, KB3, KC_NO, KC_NO, KC_NO }, \
- { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
- { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
- { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
- { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO } \
+ { K00, K10, K20, K56, KC_NO, KC_NO, K57, KC_NO, KB0, KC0, K66, KC_NO }, \
+ { K01, K11, K21, K31, K41, K51, K46, KE6, KE7, K47, KA1, KC_NO }, \
+ { K02, K12, K22, K32, K42, K52, K36, KD6, KD7, K37, KA2, KC_NO }, \
+ { K03, K13, K23, K33, K43, K53, K26, KC6, KC7, K27, KA3, KB3 } \
}
#endif
diff --git a/keyboards/mehkee96/config.h b/keyboards/mehkee96/config.h
index 4adfcc86b9..d506626d1e 100644
--- a/keyboards/mehkee96/config.h
+++ b/keyboards/mehkee96/config.h
@@ -12,6 +12,9 @@
/* matrix size */
#define MATRIX_ROWS 8
#define MATRIX_COLS 15
+#define MATRIX_ROW_PINS { B0, B1, B2, B3, B4, B5, B6, B7 }
+#define MATRIX_COL_PINS { A0, A1, A2, A3, A4, A5, A6, A7, C7, C6, C5, C4, C3, C2, D7 }
+#define DIODE_DIRECTION COL2ROW
#define RGBLED_NUM 16
#define RGBLIGHT_ANIMATIONS
diff --git a/keyboards/mehkee96/keymaps/default/keymap.c b/keyboards/mehkee96/keymaps/default/keymap.c
index cd69fb2fe9..46ee4d19cc 100644
--- a/keyboards/mehkee96/keymaps/default/keymap.c
+++ b/keyboards/mehkee96/keymaps/default/keymap.c
@@ -68,13 +68,3 @@ BL_TOGG, BL_DEC, BL_INC changes the in-switch LEDs
_______ , _______, _______, BL_DEC, BL_TOGG, BL_INC, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
};
-
-void matrix_init_user(void) {
-}
-
-void matrix_scan_user(void) {
-}
-
-bool process_record_user(uint16_t keycode, keyrecord_t *record) {
- return true;
-}
diff --git a/keyboards/mehkee96/matrix.c b/keyboards/mehkee96/matrix.c
deleted file mode 100644
index bbb84e52e4..0000000000
--- a/keyboards/mehkee96/matrix.c
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
-Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com>
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <avr/io.h>
-#include <util/delay.h>
-
-#include "matrix.h"
-
-#ifndef DEBOUNCE
-# define DEBOUNCE 5
-#endif
-
-static uint8_t debouncing = DEBOUNCE;
-
-static matrix_row_t matrix[MATRIX_ROWS];
-static matrix_row_t matrix_debouncing[MATRIX_ROWS];
-
-void matrix_set_row_status(uint8_t row);
-uint8_t bit_reverse(uint8_t x);
-
-__attribute__ ((weak))
-void matrix_init_kb(void) {
- matrix_init_user();
-}
-
-__attribute__ ((weak))
-void matrix_scan_kb(void) {
- matrix_scan_user();
-}
-
-__attribute__ ((weak))
-void matrix_init_user(void) {
-}
-
-__attribute__ ((weak))
-void matrix_scan_user(void) {
-}
-
-void matrix_init(void) {
- // all outputs for rows high
- DDRB = 0xFF;
- PORTB = 0xFF;
- // all inputs for columns
- DDRA = 0x00;
- DDRC &= ~(0x111111<<2);
- DDRD &= ~(1<<PIND7);
- // all columns are pulled-up
- PORTA = 0xFF;
- PORTC |= (0b111111<<2);
- PORTD |= (1<<PIND7);
-
- // initialize matrix state: all keys off
- for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
- matrix[row] = 0x00;
- matrix_debouncing[row] = 0x00;
- }
-
- matrix_init_quantum();
-}
-
-uint8_t matrix_scan(void) {
- for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
- matrix_set_row_status(row);
- _delay_us(5);
-
- matrix_row_t cols = (
- // cols 0..7, PORTA 0 -> 7
- (~PINA) & 0xFF
- ) | (
- // cols 8..13, PORTC 7 -> 0
- bit_reverse((~PINC) & 0xFF) << 8
- ) | (
- // col 14, PORTD 7
- ((~PIND) & (1 << PIND7)) << 7
- );
-
- if (matrix_debouncing[row] != cols) {
- matrix_debouncing[row] = cols;
- debouncing = DEBOUNCE;
- }
- }
-
- if (debouncing) {
- if (--debouncing) {
- _delay_ms(1);
- } else {
- for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
- matrix[i] = matrix_debouncing[i];
- }
- }
- }
-
- matrix_scan_quantum();
-
- return 1;
-}
-
-// declarations
-void matrix_set_row_status(uint8_t row) {
- DDRB = (1 << row);
- PORTB = ~(1 << row);
-}
-
-uint8_t bit_reverse(uint8_t x) {
- x = ((x >> 1) & 0x55) | ((x << 1) & 0xaa);
- x = ((x >> 2) & 0x33) | ((x << 2) & 0xcc);
- x = ((x >> 4) & 0x0f) | ((x << 4) & 0xf0);
- return x;
-}
-
-inline matrix_row_t matrix_get_row(uint8_t row) {
- return matrix[row];
-}
-
-void matrix_print(void) {
-}
diff --git a/keyboards/mehkee96/mehkee96.c b/keyboards/mehkee96/mehkee96.c
index 46427ec93b..d9e2bac7a5 100644
--- a/keyboards/mehkee96/mehkee96.c
+++ b/keyboards/mehkee96/mehkee96.c
@@ -16,13 +16,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "mehkee96.h"
-
-void matrix_init_kb(void) { matrix_init_user(); }
-
-__attribute__ ((weak))
-void matrix_init_user(void) {}
-
-void matrix_scan_kb(void) { matrix_scan_user(); }
-
-__attribute__ ((weak))
-void matrix_scan_user(void) {}
diff --git a/keyboards/mehkee96/rules.mk b/keyboards/mehkee96/rules.mk
index 1cbd02948f..a7d36548f0 100644
--- a/keyboards/mehkee96/rules.mk
+++ b/keyboards/mehkee96/rules.mk
@@ -24,7 +24,3 @@ RGBLIGHT_ENABLE = yes
WS2812_DRIVER = i2c
OPT_DEFS = -DDEBUG_LEVEL=0
-
-# custom matrix setup
-CUSTOM_MATRIX = yes
-SRC = matrix.c
diff --git a/keyboards/mt40/config.h b/keyboards/mt40/config.h
index 48f707f71f..f5038fb541 100644
--- a/keyboards/mt40/config.h
+++ b/keyboards/mt40/config.h
@@ -32,7 +32,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define DESCRIPTION A Planck clone
/* key matrix size */
-#define MATRIX_ROWS 8
+#define MATRIX_ROWS 7
#define MATRIX_COLS 15
#define NO_UART 1
@@ -55,12 +55,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* #define CB6 0x37 // B7 */
/* #define CC7 0x62 // C2 */
-#define MATRIX_ROW_PINS { B0, B1, B2, B3, B4, B5, B6, B7 }
-#define MATRIX_COL_PINS { A0, A1, A2, A3, A4, A5, A6, A7, C2, C3, C4, C5, C6, C7, D7 }
+#define MATRIX_ROW_PINS { B0, B1, B2, B3, B4, B6, B7 }
+#define MATRIX_COL_PINS { A0, A1, A2, A3, A4, A5, A6, A7, C7, C6, C5, C4, C3, C2, D7 }
/* #define UNUSED_PINS */
/* COL2ROW, ROW2COL*/
-/* #define DIODE_DIRECTION COL2ROW */
+#define DIODE_DIRECTION COL2ROW
#define BACKLIGHT_PIN D2
diff --git a/keyboards/mt40/matrix.c b/keyboards/mt40/matrix.c
deleted file mode 100644
index d75fcc221a..0000000000
--- a/keyboards/mt40/matrix.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
-Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com>
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <avr/io.h>
-#include <util/delay.h>
-
-#include "matrix.h"
-#include "config.h"
-
-#ifndef DEBOUNCE
-# define DEBOUNCE 5
-#endif
-
-static uint8_t debouncing = DEBOUNCE;
-
-static matrix_row_t matrix[MATRIX_ROWS];
-static matrix_row_t matrix_debouncing[MATRIX_ROWS];
-
-__attribute__ ((weak))
-void matrix_init_kb(void) {
- matrix_init_user();
-}
-
-__attribute__ ((weak))
-void matrix_scan_kb(void) {
- matrix_scan_user();
-}
-
-__attribute__ ((weak))
-void matrix_init_user(void) {
-}
-
-__attribute__ ((weak))
-void matrix_scan_user(void) {
-}
-
-
-
-void matrix_init(void) {
- // all outputs for rows high
- DDRB = 0xFF;
- PORTB = 0xFF;
- // all inputs for columns
- DDRA = 0x00;
- DDRC &= ~(0x111111<<2);
- DDRD &= ~(1<<PIND7);
- // all columns are pulled-up
- PORTA = 0xFF;
- PORTC |= (0b111111<<2);
- PORTD |= (1<<PIND7);
-
- // initialize matrix state: all keys off
- for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
- matrix[row] = 0x00;
- matrix_debouncing[row] = 0x00;
- }
- matrix_init_kb();
-}
-
-void matrix_set_row_status(uint8_t row) {
- DDRB = (1 << row);
- PORTB = ~(1 << row);
-}
-
-uint8_t bit_reverse(uint8_t x) {
- x = ((x >> 1) & 0x55) | ((x << 1) & 0xaa);
- x = ((x >> 2) & 0x33) | ((x << 2) & 0xcc);
- x = ((x >> 4) & 0x0f) | ((x << 4) & 0xf0);
- return x;
-}
-
-uint8_t matrix_scan(void) {
- for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
- matrix_set_row_status(row);
- _delay_us(5);
-
- matrix_row_t cols = (
- // cols 0..7, PORTA 0 -> 7
- (~PINA) & 0xFF
- ) | (
- // cols 8..13, PORTC 7 -> 0
- bit_reverse((~PINC) & 0xFF) << 8
- ) | (
- // col 14, PORTD 7
- ((~PIND) & (1 << PIND7)) << 7
- );
-
- if (matrix_debouncing[row] != cols) {
- matrix_debouncing[row] = cols;
- debouncing = DEBOUNCE;
- }
- }
-
- if (debouncing) {
- if (--debouncing) {
- _delay_ms(1);
- } else {
- for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
- matrix[i] = matrix_debouncing[i];
- }
- }
- }
-
- matrix_scan_kb();
-
- return 1;
-}
-
-inline matrix_row_t matrix_get_row(uint8_t row) {
- return matrix[row];
-}
-
-void matrix_print(void) {
-}
diff --git a/keyboards/mt40/mt40.h b/keyboards/mt40/mt40.h
index a539577082..3ff9c89d00 100644
--- a/keyboards/mt40/mt40.h
+++ b/keyboards/mt40/mt40.h
@@ -34,7 +34,6 @@
{ K30, K11, K12, K13, K14, K15, KC_NO, KC_NO, KC_NO, KC_NO, K1A, K1B, KC_NO, KC_NO, KC_NO }, \
{ K10, K01, K02, K03, K04, K05, KC_NO, KC_NO, KC_NO, KC_NO, K0A, KC_NO, KC_NO, KC_NO, KC_NO }, \
{ K00, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, K0B }, \
- { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
{ KC_NO, KC_NO, K06, K16, K26, K35, K38, K3A, K39, K3B, KC_NO, KC_NO, K07, K17, K27 }, \
{ KC_NO, KC_NO, K09, K19, K29, KC_NO, K2B, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, K08, K18, K28 } \
}
diff --git a/keyboards/mt40/rules.mk b/keyboards/mt40/rules.mk
index 0cbf90c674..338a83cc74 100644
--- a/keyboards/mt40/rules.mk
+++ b/keyboards/mt40/rules.mk
@@ -29,9 +29,5 @@ TAP_DANCE_ENABLE = no
OPT_DEFS = -DDEBUG_LEVEL=0
-# custom matrix setup
-CUSTOM_MATRIX = yes
-SRC = matrix.c
-
LAYOUTS = planck_mit
LAYOUTS_HAS_RGB = no
diff --git a/keyboards/percent/canoe/canoe.c b/keyboards/percent/canoe/canoe.c
index e59b0dd7bc..79c6330fe8 100644
--- a/keyboards/percent/canoe/canoe.c
+++ b/keyboards/percent/canoe/canoe.c
@@ -17,16 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "canoe.h"
-void matrix_init_kb(void) { matrix_init_user(); }
-
-__attribute__ ((weak))
-void matrix_init_user(void) {}
-
-void matrix_scan_kb(void) { matrix_scan_user(); }
-
-__attribute__ ((weak))
-void matrix_scan_user(void) {}
-
#ifdef BACKLIGHT_ENABLE
void backlight_set(uint8_t level) {
if (level == 0) {
diff --git a/keyboards/percent/canoe/canoe.h b/keyboards/percent/canoe/canoe.h
index 9e1e3e3d6a..83d7c08bb5 100644
--- a/keyboards/percent/canoe/canoe.h
+++ b/keyboards/percent/canoe/canoe.h
@@ -32,10 +32,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E }, \
{ _x_, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E }, \
{ K30, _x_, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E }, \
- { K40, _x_, K42, K43, K44, _x_, _x_, _x_, K48, _x_, K4A, K4B, K4C, K4D, K4E }, \
- { _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_ }, \
- { _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_ }, \
- { _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_ } \
+ { K40, _x_, K42, K43, K44, _x_, _x_, _x_, K48, _x_, K4A, K4B, K4C, K4D, K4E } \
}
#define LAYOUT_65_ansi_blocker( \
@@ -49,10 +46,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E }, \
{ _x_, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E }, \
{ K30, _x_, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E }, \
- { K40, _x_, K42, K43, K44, _x_, _x_, _x_, K48, _x_, _x_, K4B, K4C, K4D, K4E }, \
- { _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_ }, \
- { _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_ }, \
- { _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_, _x_ } \
+ { K40, _x_, K42, K43, K44, _x_, _x_, _x_, K48, _x_, _x_, K4B, K4C, K4D, K4E } \
}
#define LAYOUT LAYOUT_65_ansi_blocker // added to not break existing checked in keymaps
diff --git a/keyboards/percent/canoe/config.h b/keyboards/percent/canoe/config.h
index bae6ed20fa..950e0806e5 100644
--- a/keyboards/percent/canoe/config.h
+++ b/keyboards/percent/canoe/config.h
@@ -28,11 +28,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define RGBLED_NUM 2
-#define MATRIX_ROWS 8
+#define MATRIX_ROWS 5
#define MATRIX_COLS 15
-#define MATRIX_ROW_PINS { B0, B1, B2, B3, B4, B5, B6, B7 }
-#define MATRIX_COL_PINS { A0, A1, A2, A3, A4, A5, A6, A7, C7, C6, C5, C4, C3, C2, C1 }
+#define MATRIX_ROW_PINS { B0, B1, B2, B3, B4 }
+#define MATRIX_COL_PINS { A0, A1, A2, A3, A4, A5, A6, A7, C7, C6, C5, C4, C3, C2, D7 }
#define UNUSED_PINS
#define DIODE_DIRECTION COL2ROW
diff --git a/keyboards/percent/canoe/matrix.c b/keyboards/percent/canoe/matrix.c
deleted file mode 100644
index 245813dfd2..0000000000
--- a/keyboards/percent/canoe/matrix.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
-Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com>
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <avr/io.h>
-#include <util/delay.h>
-
-#include "matrix.h"
-
-#ifndef DEBOUNCE
-# define DEBOUNCE 5
-#endif
-
-static uint8_t debouncing = DEBOUNCE;
-
-static matrix_row_t matrix[MATRIX_ROWS];
-static matrix_row_t matrix_debouncing[MATRIX_ROWS];
-
-void matrix_set_row_status(uint8_t row);
-uint8_t bit_reverse(uint8_t x);
-
-void matrix_init(void) {
- // all outputs for rows high
- DDRB = 0xFF;
- PORTB = 0xFF;
- // all inputs for columns
- DDRA = 0x00;
- DDRC &= ~(0x111111<<2);
- DDRD &= ~(1<<PIND7);
- // all columns are pulled-up
- PORTA = 0xFF;
- PORTC |= (0b111111<<2);
- PORTD |= (1<<PIND7);
-
- // initialize matrix state: all keys off
- for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
- matrix[row] = 0x00;
- matrix_debouncing[row] = 0x00;
- }
-
- matrix_init_quantum();
-}
-
-uint8_t matrix_scan(void) {
- for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
- matrix_set_row_status(row);
- _delay_us(5);
-
- matrix_row_t cols = (
- // cols 0..7, PORTA 0 -> 7
- (~PINA) & 0xFF
- ) | (
- // cols 8..13, PORTC 7 -> 0
- bit_reverse((~PINC) & 0xFF) << 8
- ) | (
- // col 14, PORTD 7
- ((~PIND) & (1 << PIND7)) << 7
- );
-
- if (matrix_debouncing[row] != cols) {
- matrix_debouncing[row] = cols;
- debouncing = DEBOUNCE;
- }
- }
-
- if (debouncing) {
- if (--debouncing) {
- _delay_ms(1);
- } else {
- for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
- matrix[i] = matrix_debouncing[i];
- }
- }
- }
-
- matrix_scan_quantum();
-
- return 1;
-}
-
-// declarations
-void matrix_set_row_status(uint8_t row) {
- DDRB = (1 << row);
- PORTB = ~(1 << row);
-}
-
-uint8_t bit_reverse(uint8_t x) {
- x = ((x >> 1) & 0x55) | ((x << 1) & 0xaa);
- x = ((x >> 2) & 0x33) | ((x << 2) & 0xcc);
- x = ((x >> 4) & 0x0f) | ((x << 4) & 0xf0);
- return x;
-}
-
-inline matrix_row_t matrix_get_row(uint8_t row) {
- return matrix[row];
-}
-
-void matrix_print(void) {
-}
diff --git a/keyboards/percent/canoe/rules.mk b/keyboards/percent/canoe/rules.mk
index f2f6ee4e5b..6340c81224 100644
--- a/keyboards/percent/canoe/rules.mk
+++ b/keyboards/percent/canoe/rules.mk
@@ -23,8 +23,4 @@ WS2812_DRIVER = i2c
OPT_DEFS = -DDEBUG_LEVEL=0
-# custom matrix setup
-CUSTOM_MATRIX = yes
-SRC = matrix.c
-
LAYOUTS = 65_ansi_blocker 65_iso_blocker
diff --git a/keyboards/percent/skog/config.h b/keyboards/percent/skog/config.h
index 7c68d797d5..7a0c703ec9 100644
--- a/keyboards/percent/skog/config.h
+++ b/keyboards/percent/skog/config.h
@@ -26,9 +26,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define PRODUCT Skog TKL
/* matrix size */
-#define MATRIX_ROWS 8
+#define MATRIX_ROWS 7
#define MATRIX_COLS 14
+#define MATRIX_ROW_PINS { B0, B1, B2, B3, B5, B6, B7 }
+#define MATRIX_COL_PINS { A0, A1, A2, A3, A4, A5, A6, A7, C7, C6, C5, C4, C3, C2 }
+#define DIODE_DIRECTION COL2ROW
+
#define RGBLED_NUM 2
#define RGBLIGHT_ANIMATIONS
diff --git a/keyboards/percent/skog/keymaps/default/keymap.c b/keyboards/percent/skog/keymaps/default/keymap.c
index eefc24cb0d..282ce39a50 100644
--- a/keyboards/percent/skog/keymaps/default/keymap.c
+++ b/keyboards/percent/skog/keymaps/default/keymap.c
@@ -27,11 +27,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, KC_MENU, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
)
};
-
-void matrix_init_user(void) {
-
-}
-
-void matrix_scan_user(void) {
-
-}
diff --git a/keyboards/percent/skog/matrix.c b/keyboards/percent/skog/matrix.c
deleted file mode 100644
index 245813dfd2..0000000000
--- a/keyboards/percent/skog/matrix.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
-Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com>
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <avr/io.h>
-#include <util/delay.h>
-
-#include "matrix.h"
-
-#ifndef DEBOUNCE
-# define DEBOUNCE 5
-#endif
-
-static uint8_t debouncing = DEBOUNCE;
-
-static matrix_row_t matrix[MATRIX_ROWS];
-static matrix_row_t matrix_debouncing[MATRIX_ROWS];
-
-void matrix_set_row_status(uint8_t row);
-uint8_t bit_reverse(uint8_t x);
-
-void matrix_init(void) {
- // all outputs for rows high
- DDRB = 0xFF;
- PORTB = 0xFF;
- // all inputs for columns
- DDRA = 0x00;
- DDRC &= ~(0x111111<<2);
- DDRD &= ~(1<<PIND7);
- // all columns are pulled-up
- PORTA = 0xFF;
- PORTC |= (0b111111<<2);
- PORTD |= (1<<PIND7);
-
- // initialize matrix state: all keys off
- for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
- matrix[row] = 0x00;
- matrix_debouncing[row] = 0x00;
- }
-
- matrix_init_quantum();
-}
-
-uint8_t matrix_scan(void) {
- for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
- matrix_set_row_status(row);
- _delay_us(5);
-
- matrix_row_t cols = (
- // cols 0..7, PORTA 0 -> 7
- (~PINA) & 0xFF
- ) | (
- // cols 8..13, PORTC 7 -> 0
- bit_reverse((~PINC) & 0xFF) << 8
- ) | (
- // col 14, PORTD 7
- ((~PIND) & (1 << PIND7)) << 7
- );
-
- if (matrix_debouncing[row] != cols) {
- matrix_debouncing[row] = cols;
- debouncing = DEBOUNCE;
- }
- }
-
- if (debouncing) {
- if (--debouncing) {
- _delay_ms(1);
- } else {
- for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
- matrix[i] = matrix_debouncing[i];
- }
- }
- }
-
- matrix_scan_quantum();
-
- return 1;
-}
-
-// declarations
-void matrix_set_row_status(uint8_t row) {
- DDRB = (1 << row);
- PORTB = ~(1 << row);
-}
-
-uint8_t bit_reverse(uint8_t x) {
- x = ((x >> 1) & 0x55) | ((x << 1) & 0xaa);
- x = ((x >> 2) & 0x33) | ((x << 2) & 0xcc);
- x = ((x >> 4) & 0x0f) | ((x << 4) & 0xf0);
- return x;
-}
-
-inline matrix_row_t matrix_get_row(uint8_t row) {
- return matrix[row];
-}
-
-void matrix_print(void) {
-}
diff --git a/keyboards/percent/skog/skog.c b/keyboards/percent/skog/skog.c
index 8678d483a7..1c26c550e5 100644
--- a/keyboards/percent/skog/skog.c
+++ b/keyboards/percent/skog/skog.c
@@ -22,16 +22,6 @@ ps2avrGB support code by Kenneth A. (bminiex/.[ch])
#include "backlight.h"
#include "backlight_custom.h"
-void matrix_init_kb(void) { matrix_init_user(); }
-
-__attribute__ ((weak))
-void matrix_init_user(void) {}
-
-void matrix_scan_kb(void) { matrix_scan_user(); }
-
-__attribute__ ((weak))
-void matrix_scan_user(void) {}
-
#ifdef BACKLIGHT_ENABLE
/// Overrides functions in `quantum.c`
void backlight_init_ports(void) {
diff --git a/keyboards/percent/skog/skog.h b/keyboards/percent/skog/skog.h
index 17be94621b..c04a765b2e 100644
--- a/keyboards/percent/skog/skog.h
+++ b/keyboards/percent/skog/skog.h
@@ -32,7 +32,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{ K01, K11, K21, K31, K41, K51, K61, KC_NO, K81, K91, KA1, KB1, KC1, KD1 }, \
{ K02, K12, K22, K32, K42, K52, K62, K72, K82, K92, KA2, KB2, KC2, KD2 }, \
{ K03, K13, K23, K33, K43, K53, K63, K73, K83, K93, KA3, KB3, KC3, KD3 }, \
- { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
{ K05, K15, K25, K35, K45, K55, K65, K75, K85, K95, KA5, KB5, KC5, KC_NO }, \
{ K06, K16, K26, K36, K46, K56, K66, K76, K86, K96, KA6, KB6, KC6, KD6 }, \
{ K07, K17, K27, K37, KC_NO, K57, KC_NO, KC_NO, K87, K97, KA7, KB7, KC7, KD7 } \
diff --git a/keyboards/winkeyless/bface/config.h b/keyboards/winkeyless/bface/config.h
index 9d90e16a3d..95d44557a5 100644
--- a/keyboards/winkeyless/bface/config.h
+++ b/keyboards/winkeyless/bface/config.h
@@ -35,6 +35,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MATRIX_COL_PINS { A0, A1, A2, A3, A4, A5, A6, A7, C7, C6, C5, C4, C3, C2, D7}
#define UNUSED_PINS
+#define DIODE_DIRECTION COL2ROW
+
#define RGBLED_NUM 16
#define RGBLIGHT_ANIMATIONS
diff --git a/keyboards/winkeyless/bmini/bmini.c b/keyboards/winkeyless/bmini/bmini.c
index 87a31d0520..f44fd36a8c 100644
--- a/keyboards/winkeyless/bmini/bmini.c
+++ b/keyboards/winkeyless/bmini/bmini.c
@@ -16,6 +16,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "bmini.h"
-
-__attribute__ ((weak))
-void matrix_scan_user(void) {}
diff --git a/keyboards/winkeyless/bmini/config.h b/keyboards/winkeyless/bmini/config.h
index 37df80f80a..f8a26e4f00 100644
--- a/keyboards/winkeyless/bmini/config.h
+++ b/keyboards/winkeyless/bmini/config.h
@@ -31,6 +31,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* matrix size */
#define MATRIX_ROWS 8
#define MATRIX_COLS 15
+#define MATRIX_ROW_PINS { B0, B1, B2, B3, B4, B5, B6, B7 }
+#define MATRIX_COL_PINS { A0, A1, A2, A3, A4, A5, A6, A7, C7, C6, C5, C4, C3, C2, D7 }
+#define DIODE_DIRECTION COL2ROW
#define RGBLIGHT_ANIMATIONS
diff --git a/keyboards/winkeyless/bmini/matrix.c b/keyboards/winkeyless/bmini/matrix.c
deleted file mode 100644
index 57aa36b5ff..0000000000
--- a/keyboards/winkeyless/bmini/matrix.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
-Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com>
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <avr/io.h>
-#include <util/delay.h>
-
-#include "matrix.h"
-
-#ifndef DEBOUNCE
-#define DEBOUNCE 5
-#endif
-
-static uint8_t debouncing = DEBOUNCE;
-
-static matrix_row_t matrix[MATRIX_ROWS];
-static matrix_row_t matrix_debouncing[MATRIX_ROWS];
-
-void matrix_init(void) {
- // all outputs for rows high
- DDRB = 0xFF;
- PORTB = 0xFF;
- // all inputs for columns
- DDRA = 0x00;
- DDRC &= ~(0x111111<<2);
- DDRD &= ~(1<<PIND7);
- // all columns are pulled-up
- PORTA = 0xFF;
- PORTC |= (0b111111<<2);
- PORTD |= (1<<PIND7);
-
- // initialize matrix state: all keys off
- for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
- matrix[row] = 0x00;
- matrix_debouncing[row] = 0x00;
- }
-}
-
-void matrix_set_row_status(uint8_t row) {
- DDRB = (1 << row);
- PORTB = ~(1 << row);
-}
-
-uint8_t bit_reverse(uint8_t x) {
- x = ((x >> 1) & 0x55) | ((x << 1) & 0xaa);
- x = ((x >> 2) & 0x33) | ((x << 2) & 0xcc);
- x = ((x >> 4) & 0x0f) | ((x << 4) & 0xf0);
- return x;
-}
-
-uint8_t matrix_scan(void) {
- for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
- matrix_set_row_status(row);
- _delay_us(5);
-
- matrix_row_t cols = (
- // cols 0..7, PORTA 0 -> 7
- (~PINA) & 0xFF
- ) | (
- // cols 8..13, PORTC 7 -> 0
- bit_reverse((~PINC) & 0xFF) << 8
- ) | (
- // col 14, PORTD 7
- ((~PIND) & (1 << PIND7)) << 7
- );
-
- if (matrix_debouncing[row] != cols) {
- matrix_debouncing[row] = cols;
- debouncing = DEBOUNCE;
- }
- }
-
- if (debouncing) {
- if (--debouncing) {
- _delay_ms(1);
- } else {
- for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
- matrix[i] = matrix_debouncing[i];
- }
- }
- }
-
- matrix_scan_user();
-
- return 1;
-}
-
-inline matrix_row_t matrix_get_row(uint8_t row) {
- return matrix[row];
-}
-
-void matrix_print(void) {
-}
diff --git a/keyboards/winkeyless/bmini/rules.mk b/keyboards/winkeyless/bmini/rules.mk
index 7822bd8301..530e8ea329 100644
--- a/keyboards/winkeyless/bmini/rules.mk
+++ b/keyboards/winkeyless/bmini/rules.mk
@@ -22,7 +22,3 @@ RGBLIGHT_ENABLE = yes
WS2812_DRIVER = i2c
OPT_DEFS = -DDEBUG_LEVEL=0
-
-# custom matrix setup
-CUSTOM_MATRIX = yes
-SRC = matrix.c
diff --git a/keyboards/winkeyless/bminiex/config.h b/keyboards/winkeyless/bminiex/config.h
index 35c8ce933d..037ca00284 100644
--- a/keyboards/winkeyless/bminiex/config.h
+++ b/keyboards/winkeyless/bminiex/config.h
@@ -30,6 +30,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* matrix size */
#define MATRIX_ROWS 8
#define MATRIX_COLS 15
+#define MATRIX_ROW_PINS { B0, B1, B2, B3, B4, B5, B6, B7 }
+#define MATRIX_COL_PINS { A0, A1, A2, A3, A4, A5, A6, A7, C7, C6, C5, C4, C3, C2, D7 }
+#define DIODE_DIRECTION COL2ROW
#define RGBLIGHT_ANIMATIONS
diff --git a/keyboards/winkeyless/bminiex/matrix.c b/keyboards/winkeyless/bminiex/matrix.c
deleted file mode 100644
index 8faaed8ac0..0000000000
--- a/keyboards/winkeyless/bminiex/matrix.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
-Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com>
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <avr/io.h>
-#include <util/delay.h>
-
-#include "matrix.h"
-#include "backlight.h"
-
-#ifndef DEBOUNCE
-#define DEBOUNCE 5
-#endif
-
-static uint8_t debouncing = DEBOUNCE;
-
-static matrix_row_t matrix[MATRIX_ROWS];
-static matrix_row_t matrix_debouncing[MATRIX_ROWS];
-
-__attribute__ ((weak))
-void matrix_init_user(void) {}
-__attribute__ ((weak))
-void matrix_scan_user(void) {}
-__attribute__ ((weak))
-void matrix_init_kb(void) {
- matrix_init_user();
-}
-__attribute__ ((weak))
-void matrix_scan_kb(void) {
- matrix_scan_user();
-}
-
-void matrix_init(void) {
- // all outputs for rows high
- DDRB = 0xFF;
- PORTB = 0xFF;
- // all inputs for columns
- DDRA = 0x00;
- DDRC &= ~(0x111111<<2);
- DDRD &= ~(1<<PIND7);
- // all columns are pulled-up
- PORTA = 0xFF;
- PORTC |= (0b111111<<2);
- PORTD |= (1<<PIND7);
-
- // initialize matrix state: all keys off
- for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
- matrix[row] = 0x00;
- matrix_debouncing[row] = 0x00;
- }
-
- matrix_init_quantum();
-}
-
-void matrix_set_row_status(uint8_t row) {
- DDRB = (1 << row);
- PORTB = ~(1 << row);
-}
-
-uint8_t bit_reverse(uint8_t x) {
- x = ((x >> 1) & 0x55) | ((x << 1) & 0xaa);
- x = ((x >> 2) & 0x33) | ((x << 2) & 0xcc);
- x = ((x >> 4) & 0x0f) | ((x << 4) & 0xf0);
- return x;
-}
-
-uint8_t matrix_scan(void) {
- for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
- matrix_set_row_status(row);
- _delay_us(5);
-
- matrix_row_t cols = (
- // cols 0..7, PORTA 0 -> 7
- (~PINA) & 0xFF
- ) | (
- // cols 8..13, PORTC 7 -> 0
- bit_reverse((~PINC) & 0xFF) << 8
- ) | (
- // col 14, PORTD 7
- ((~PIND) & (1 << PIND7)) << 7
- );
-
- if (matrix_debouncing[row] != cols) {
- matrix_debouncing[row] = cols;
- debouncing = DEBOUNCE;
- }
- }
-
- if (debouncing) {
- if (--debouncing) {
- _delay_ms(1);
- } else {
- for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
- matrix[i] = matrix_debouncing[i];
- }
- }
- }
-
- matrix_scan_quantum();
-
- return 1;
-}
-
-inline matrix_row_t matrix_get_row(uint8_t row) {
- return matrix[row];
-}
-
-void matrix_print(void) {
-}
diff --git a/keyboards/winkeyless/bminiex/rules.mk b/keyboards/winkeyless/bminiex/rules.mk
index 39a77bda12..2c999dcbf6 100644
--- a/keyboards/winkeyless/bminiex/rules.mk
+++ b/keyboards/winkeyless/bminiex/rules.mk
@@ -29,6 +29,4 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
OPT_DEFS = -DDEBUG_LEVEL=0
-# custom matrix setup
-CUSTOM_MATRIX = yes
-SRC = matrix.c backlight.c
+SRC += backlight.c
diff --git a/keyboards/ymd75/config.h b/keyboards/ymd75/config.h
index a56a1b54b8..00f6bd292c 100644
--- a/keyboards/ymd75/config.h
+++ b/keyboards/ymd75/config.h
@@ -35,7 +35,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* matrix size */
#define MATRIX_ROWS 8
#define MATRIX_COLS 15
-#define DIODE_DIRECTION ROW2COL
+#define MATRIX_ROW_PINS { B0, B1, B2, B3, B4, B5, B6, B7 }
+#define MATRIX_COL_PINS { A0, A1, A2, A3, A4, A5, A6, A7, C7, C6, C5, C4, C3, C2, D7 }
+#define DIODE_DIRECTION COL2ROW
#define BACKLIGHT_LEVELS 12
diff --git a/keyboards/ymd75/matrix.c b/keyboards/ymd75/matrix.c
deleted file mode 100644
index a726ee889f..0000000000
--- a/keyboards/ymd75/matrix.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
-Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com>
-Modified 2018 by Wayne K Jones <github.com/WarmCatUK>
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <avr/io.h>
-#include <util/delay.h>
-
-#include "matrix.h"
-
-#ifndef DEBOUNCE
-# define DEBOUNCE 5
-#endif
-
-static uint8_t debouncing = DEBOUNCE;
-
-static matrix_row_t matrix[MATRIX_ROWS];
-static matrix_row_t matrix_debouncing[MATRIX_ROWS];
-
-void matrix_init(void) {
- // all outputs for rows high
- DDRB = 0xFF;
- PORTB = 0xFF;
- // all inputs for columns
- DDRA = 0x00;
- DDRC &= ~(0x111111<<2);
- DDRD &= ~(1<<PIND7);
- // all columns are pulled-up
- PORTA = 0xFF;
- PORTC |= (0b111111<<2);
- PORTD |= (1<<PIND7);
-
- // initialize matrix state: all keys off
- for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
- matrix[row] = 0x00;
- matrix_debouncing[row] = 0x00;
- }
- matrix_init_quantum(); // missing from original port by Luiz
-}
-
-void matrix_set_row_status(uint8_t row) {
- DDRB = (1 << row);
- PORTB = ~(1 << row);
-}
-
-uint8_t bit_reverse(uint8_t x) {
- x = ((x >> 1) & 0x55) | ((x << 1) & 0xaa);
- x = ((x >> 2) & 0x33) | ((x << 2) & 0xcc);
- x = ((x >> 4) & 0x0f) | ((x << 4) & 0xf0);
- return x;
-}
-
-uint8_t matrix_scan(void) {
- for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
- matrix_set_row_status(row);
- _delay_us(5);
-
- matrix_row_t cols = (
- // cols 0..7, PORTA 0 -> 7
- (~PINA) & 0xFF
- ) | (
- // cols 8..13, PORTC 7 -> 0
- bit_reverse((~PINC) & 0xFF) << 8
- ) | (
- // col 14, PORTD 7
- ((~PIND) & (1 << PIND7)) << 7
- );
-
- if (matrix_debouncing[row] != cols) {
- matrix_debouncing[row] = cols;
- debouncing = DEBOUNCE;
- }
- }
-
- if (debouncing) {
- if (--debouncing) {
- _delay_ms(1);
- } else {
- for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
- matrix[i] = matrix_debouncing[i];
- }
- }
- }
- matrix_scan_quantum(); // also missing in original PS2AVRGB implementation
- //matrix_scan_user();
-
- return 1;
-}
-
-inline matrix_row_t matrix_get_row(uint8_t row) {
- return matrix[row];
-}
-
-void matrix_print(void) {
-}
diff --git a/keyboards/ymd75/rules.mk b/keyboards/ymd75/rules.mk
index 0c1c9110ca..eb41e19cf3 100644
--- a/keyboards/ymd75/rules.mk
+++ b/keyboards/ymd75/rules.mk
@@ -33,6 +33,4 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
#OPT_DEFS = -DDEBUG_LEVEL=0
-# custom matrix setup
-CUSTOM_MATRIX = yes
-SRC = matrix.c backlight.c
+SRC = backlight.c
diff --git a/keyboards/ymd75/ymd75.c b/keyboards/ymd75/ymd75.c
index 74f7c6a493..e32a745bfd 100644
--- a/keyboards/ymd75/ymd75.c
+++ b/keyboards/ymd75/ymd75.c
@@ -20,16 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "backlight.h"
#include "backlight_custom.h"
-void matrix_init_kb(void) { matrix_init_user(); }
-
-__attribute__ ((weak))
-void matrix_init_user(void) {}
-
-void matrix_scan_kb(void) { matrix_scan_user(); }
-
-__attribute__ ((weak))
-void matrix_scan_user(void) {}
-
#ifdef BACKLIGHT_ENABLE
/// Overrides functions in `quantum.c`
void backlight_init_ports(void) {
diff --git a/keyboards/ymd75/ymd75.h b/keyboards/ymd75/ymd75.h
index e17dedeb31..0c9fff58cb 100644
--- a/keyboards/ymd75/ymd75.h
+++ b/keyboards/ymd75/ymd75.h
@@ -25,8 +25,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "keycode.h"
#include "action.h"
-void matrix_init_user(void);
-
#define LAYOUT( \
K05, K25, K35, K45, K55, K06, KA6, KA7, K07, KB5, KC5, KD5, KE5, KD1, KE1, KE2, \
K04, K14, K24, K34, K44, K54, K16, KB6, KB7, K17, KA4, KB4, KC4, KE4, KD0, \
diff --git a/keyboards/ymd96/config.h b/keyboards/ymd96/config.h
index 5c496d8d25..1232f90c28 100644
--- a/keyboards/ymd96/config.h
+++ b/keyboards/ymd96/config.h
@@ -31,7 +31,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* matrix size */
#define MATRIX_ROWS 8
#define MATRIX_COLS 15
-//#define DIODE_DIRECTION ROW2COL
+#define MATRIX_ROW_PINS { B0, B1, B2, B3, B4, B5, B6, B7 }
+#define MATRIX_COL_PINS { A0, A1, A2, A3, A4, A5, A6, A7, C7, C6, C5, C4, C3, C2, D7 }
//#define RGB_DI_PIN C4
/* COL2ROW or ROW2COL */
diff --git a/keyboards/ymd96/matrix.c b/keyboards/ymd96/matrix.c
deleted file mode 100644
index 2932976dde..0000000000
--- a/keyboards/ymd96/matrix.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
-Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com>
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <avr/io.h>
-#include <util/delay.h>
-
-#include "matrix.h"
-
-#ifndef DEBOUNCE
-# define DEBOUNCE 5
-#endif
-
-static uint8_t debouncing = DEBOUNCE;
-
-static matrix_row_t matrix[MATRIX_ROWS];
-static matrix_row_t matrix_debouncing[MATRIX_ROWS];
-
-void matrix_set_row_status(uint8_t row);
-uint8_t bit_reverse(uint8_t x);
-
-void matrix_init(void) {
- // all outputs for rows high
- DDRB = 0xFF;
- PORTB = 0xFF;
- // all inputs for columns
- DDRA = 0x00;
- DDRC &= ~(0x111111<<2);
- DDRD &= ~(1<<PIND7);
- // all columns are pulled-up
- PORTA = 0xFF;
- PORTC |= (0b111111<<2);
- PORTD |= (1<<PIND7);
-
- // initialize matrix state: all keys off
- for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
- matrix[row] = 0x00;
- matrix_debouncing[row] = 0x00;
- }
-
- matrix_init_quantum(); // missing from original port by Luiz
-}
-
-uint8_t matrix_scan(void) {
- for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
- matrix_set_row_status(row);
- _delay_us(5);
-
- matrix_row_t cols = (
- // cols 0..7, PORTA 0 -> 7
- (~PINA) & 0xFF
- ) | (
- // cols 8..13, PORTC 7 -> 0
- bit_reverse((~PINC) & 0xFF) << 8
- ) | (
- // col 14, PORTD 7
- ((~PIND) & (1 << PIND7)) << 7
- );
-
- if (matrix_debouncing[row] != cols) {
- matrix_debouncing[row] = cols;
- debouncing = DEBOUNCE;
- }
- }
-
- if (debouncing) {
- if (--debouncing) {
- _delay_ms(1);
- } else {
- for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
- matrix[i] = matrix_debouncing[i];
- }
- }
- }
-
- matrix_scan_quantum(); // also missing in original PS2AVRGB implementation
-
- return 1;
-}
-
-// declarations
-void matrix_set_row_status(uint8_t row) {
- DDRB = (1 << row);
- PORTB = ~(1 << row);
-}
-
-uint8_t bit_reverse(uint8_t x) {
- x = ((x >> 1) & 0x55) | ((x << 1) & 0xaa);
- x = ((x >> 2) & 0x33) | ((x << 2) & 0xcc);
- x = ((x >> 4) & 0x0f) | ((x << 4) & 0xf0);
- return x;
-}
-
-inline matrix_row_t matrix_get_row(uint8_t row) {
- return matrix[row];
-}
-
-void matrix_print(void) {
-}
diff --git a/keyboards/ymd96/rules.mk b/keyboards/ymd96/rules.mk
index 19d9fd81ab..3c892daabb 100644
--- a/keyboards/ymd96/rules.mk
+++ b/keyboards/ymd96/rules.mk
@@ -31,6 +31,4 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
OPT_DEFS = -DDEBUG_LEVEL=0
-# custom matrix setup
-CUSTOM_MATRIX = yes
-SRC = matrix.c backlight.c
+SRC = backlight.c
diff --git a/keyboards/ymd96/ymd96.c b/keyboards/ymd96/ymd96.c
index 546a4c6e3a..eae84ade19 100644
--- a/keyboards/ymd96/ymd96.c
+++ b/keyboards/ymd96/ymd96.c
@@ -21,16 +21,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "backlight.h"
#include "backlight_custom.h"
-void matrix_init_kb(void) { matrix_init_user(); }
-
-__attribute__ ((weak))
-void matrix_init_user(void) {}
-
-void matrix_scan_kb(void) { matrix_scan_user(); }
-
-__attribute__ ((weak))
-void matrix_scan_user(void) {}
-
#ifdef BACKLIGHT_ENABLE
/// Overrides functions in `quantum.c`
void backlight_init_ports(void) {
diff --git a/keyboards/ymd96/ymd96.h b/keyboards/ymd96/ymd96.h
index a516297c19..c89be71686 100644
--- a/keyboards/ymd96/ymd96.h
+++ b/keyboards/ymd96/ymd96.h
@@ -20,8 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "quantum.h"
-void matrix_init_user(void); // TODO port this to other PS2AVRGB boards
-
#define LAYOUT_default( \
K50, K52, K53, K54, K55, K60, K6A, K7A, K70, K5B, K5C, K5D, K5E, K1D, K2E, K0D, K76, K79, K78, \
K40, K41, K42, K43, K44, K45, K61, K6B, K7B, K71, K4A, K4B, K4C, K4E, K46, K47, K48, K49, \
diff --git a/keyboards/ymdk/bface/config.h b/keyboards/ymdk/bface/config.h
index 9e5a9134ff..2273b7e84e 100644
--- a/keyboards/ymdk/bface/config.h
+++ b/keyboards/ymdk/bface/config.h
@@ -34,6 +34,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MATRIX_COL_PINS { A0, A1, A2, A3, A4, A5, A6, A7, C7, C6, C5, C4, C3, C2, D7}
#define UNUSED_PINS
+#define DIODE_DIRECTION COL2ROW
+
#define NO_UART 1
#define BACKLIGHT_PIN D4
diff --git a/keyboards/ymdk/bface/rules.mk b/keyboards/ymdk/bface/rules.mk
index 7b829530b2..f6f026cf30 100644
--- a/keyboards/ymdk/bface/rules.mk
+++ b/keyboards/ymdk/bface/rules.mk
@@ -1,18 +1,3 @@
-# Copyright 2019 Ethan Durrant (emdarcher)
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
# MCU name
MCU = atmega32a
diff --git a/keyboards/ymdk_np21/config.h b/keyboards/ymdk_np21/config.h
index 4a846f5e94..60c5277761 100644
--- a/keyboards/ymdk_np21/config.h
+++ b/keyboards/ymdk_np21/config.h
@@ -29,8 +29,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define PRODUCT np21
/* matrix size */
-#define MATRIX_ROWS 8
-#define MATRIX_COLS 15
+#define MATRIX_ROWS 4
+#define MATRIX_COLS 6
+#define MATRIX_ROW_PINS { B0, B1, B2, B3 }
+#define MATRIX_COL_PINS { A0, A1, A2, A3, A4, A5 }
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW
diff --git a/keyboards/ymdk_np21/matrix.c b/keyboards/ymdk_np21/matrix.c
deleted file mode 100644
index b2bfb2f0bb..0000000000
--- a/keyboards/ymdk_np21/matrix.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
-Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com>
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <avr/io.h>
-#include <util/delay.h>
-
-#include "matrix.h"
-
-#ifndef DEBOUNCE
-# define DEBOUNCE 5
-#endif
-
-static uint8_t debouncing = DEBOUNCE;
-
-static matrix_row_t matrix[MATRIX_ROWS];
-static matrix_row_t matrix_debouncing[MATRIX_ROWS];
-
-void matrix_set_row_status(uint8_t row);
-uint8_t bit_reverse(uint8_t x);
-
-void matrix_init(void) {
- // all outputs for rows high
- DDRB = 0xFF;
- PORTB = 0xFF;
- // all inputs for columns
- DDRA = 0x00;
- DDRC &= ~(0x111111<<2);
- DDRD &= ~(1<<PIND7);
- // all columns are pulled-up
- PORTA = 0xFF;
- PORTC |= (0b111111<<2);
- PORTD |= (1<<PIND7);
-
- // initialize matrix state: all keys off
- for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
- matrix[row] = 0x00;
- matrix_debouncing[row] = 0x00;
- }
-
- matrix_init_quantum(); // missing from original port by Luiz
-}
-
-uint8_t matrix_scan(void) {
- for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
- matrix_set_row_status(row);
- _delay_us(5);
-
- matrix_row_t cols = (
- // cols 0..7, PORTA 0 -> 7
- (~PINA) & 0xFF
- ) | (
- // cols 8..13, PORTC 7 -> 0
- bit_reverse((~PINC) & 0xFF) << 8
- ) | (
- // col 14, PORTD 7
- ((~PIND) & (1 << PIND7)) << 7
- );
-
- if (matrix_debouncing[row] != cols) {
- matrix_debouncing[row] = cols;
- debouncing = DEBOUNCE;
- }
- }
-
- if (debouncing) {
- if (--debouncing) {
- _delay_ms(1);
- } else {
- for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
- matrix[i] = matrix_debouncing[i];
- }
- }
- }
-
- matrix_scan_quantum(); // also missing in original PS2AVRGB implementation
-
- return 1;
-}
-
-__attribute__ ((weak))
-void matrix_scan_user(void) {};
-
-__attribute__ ((weak))
-void matrix_scan_kb(void) {
- // Looping keyboard code goes here
- // This runs every cycle (a lot)
- matrix_scan_user();
-};
-
-__attribute__ ((weak))
-void matrix_init_user(void) {};
-
-__attribute__ ((weak))
-void matrix_init_kb(void) {
- matrix_init_user();
-}
-// declarations
-void matrix_set_row_status(uint8_t row) {
- DDRB = (1 << row);
- PORTB = ~(1 << row);
-}
-
-uint8_t bit_reverse(uint8_t x) {
- x = ((x >> 1) & 0x55) | ((x << 1) & 0xaa);
- x = ((x >> 2) & 0x33) | ((x << 2) & 0xcc);
- x = ((x >> 4) & 0x0f) | ((x << 4) & 0xf0);
- return x;
-}
-
-inline matrix_row_t matrix_get_row(uint8_t row) {
- return matrix[row];
-}
-
-void matrix_print(void) {
-}
diff --git a/keyboards/ymdk_np21/rules.mk b/keyboards/ymdk_np21/rules.mk
index 2bab3043e8..772bee9285 100644
--- a/keyboards/ymdk_np21/rules.mk
+++ b/keyboards/ymdk_np21/rules.mk
@@ -31,6 +31,4 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
OPT_DEFS = -DDEBUG_LEVEL=0
-# custom matrix setup
-CUSTOM_MATRIX = yes
-SRC = matrix.c backlight.c
+SRC = backlight.c
diff --git a/keyboards/ymdk_np21/ymdk_np21.h b/keyboards/ymdk_np21/ymdk_np21.h
index 728406d6e5..2cd2d13c21 100644
--- a/keyboards/ymdk_np21/ymdk_np21.h
+++ b/keyboards/ymdk_np21/ymdk_np21.h
@@ -23,8 +23,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "keycode.h"
#include "action.h"
-void matrix_init_user(void); // TODO port this to other PS2AVRGB boards
-
#define LAYOUT( \
K01, K02, K03, K04, K05, K06, \
K11, K12, K13, K14, K15, K16, \