aboutsummaryrefslogtreecommitdiff
path: root/keyboards/mehkee96
diff options
context:
space:
mode:
authorfauxpark <fauxpark@gmail.com>2020-01-02 17:45:41 +1100
committerGitHub <noreply@github.com>2020-01-02 17:45:41 +1100
commit2557bc8e6f6e61352fa5875646d861126c42a3b0 (patch)
tree40ef2cb1a51c31a2eaa9d43414a7e88c83181dd2 /keyboards/mehkee96
parentb83e3ae556239b4aa6f2c4db20535c536692eb3b (diff)
downloadqmk_firmware-2557bc8e6f6e61352fa5875646d861126c42a3b0.tar.gz
qmk_firmware-2557bc8e6f6e61352fa5875646d861126c42a3b0.zip
Remove custom matrix from PS2AVRGB boards (#7396)
* Remove custom matrix from PS2AVRGB boards * Add custom backlight.c to SRC for bminiex, for now * Add missing DIODE_DIRECTIONs
Diffstat (limited to 'keyboards/mehkee96')
-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
5 files changed, 3 insertions, 154 deletions
diff --git a/keyboards/mehkee96/config.h b/keyboards/mehkee96/config.h
index 4adfcc86b..d506626d1 100644
--- a/keyboards/mehkee96/config.h
+++ b/keyboards/mehkee96/config.h
@@ -12,6 +12,9 @@
12/* matrix size */ 12/* matrix size */
13#define MATRIX_ROWS 8 13#define MATRIX_ROWS 8
14#define MATRIX_COLS 15 14#define MATRIX_COLS 15
15#define MATRIX_ROW_PINS { B0, B1, B2, B3, B4, B5, B6, B7 }
16#define MATRIX_COL_PINS { A0, A1, A2, A3, A4, A5, A6, A7, C7, C6, C5, C4, C3, C2, D7 }
17#define DIODE_DIRECTION COL2ROW
15 18
16#define RGBLED_NUM 16 19#define RGBLED_NUM 16
17#define RGBLIGHT_ANIMATIONS 20#define RGBLIGHT_ANIMATIONS
diff --git a/keyboards/mehkee96/keymaps/default/keymap.c b/keyboards/mehkee96/keymaps/default/keymap.c
index cd69fb2fe..46ee4d19c 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
68 _______ , _______, _______, BL_DEC, BL_TOGG, BL_INC, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, 68 _______ , _______, _______, BL_DEC, BL_TOGG, BL_INC, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
69 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), 69 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
70}; 70};
71
72void matrix_init_user(void) {
73}
74
75void matrix_scan_user(void) {
76}
77
78bool process_record_user(uint16_t keycode, keyrecord_t *record) {
79 return true;
80}
diff --git a/keyboards/mehkee96/matrix.c b/keyboards/mehkee96/matrix.c
deleted file mode 100644
index bbb84e52e..000000000
--- a/keyboards/mehkee96/matrix.c
+++ /dev/null
@@ -1,130 +0,0 @@
1/*
2Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include <avr/io.h>
19#include <util/delay.h>
20
21#include "matrix.h"
22
23#ifndef DEBOUNCE
24# define DEBOUNCE 5
25#endif
26
27static uint8_t debouncing = DEBOUNCE;
28
29static matrix_row_t matrix[MATRIX_ROWS];
30static matrix_row_t matrix_debouncing[MATRIX_ROWS];
31
32void matrix_set_row_status(uint8_t row);
33uint8_t bit_reverse(uint8_t x);
34
35__attribute__ ((weak))
36void matrix_init_kb(void) {
37 matrix_init_user();
38}
39
40__attribute__ ((weak))
41void matrix_scan_kb(void) {
42 matrix_scan_user();
43}
44
45__attribute__ ((weak))
46void matrix_init_user(void) {
47}
48
49__attribute__ ((weak))
50void matrix_scan_user(void) {
51}
52
53void matrix_init(void) {
54 // all outputs for rows high
55 DDRB = 0xFF;
56 PORTB = 0xFF;
57 // all inputs for columns
58 DDRA = 0x00;
59 DDRC &= ~(0x111111<<2);
60 DDRD &= ~(1<<PIND7);
61 // all columns are pulled-up
62 PORTA = 0xFF;
63 PORTC |= (0b111111<<2);
64 PORTD |= (1<<PIND7);
65
66 // initialize matrix state: all keys off
67 for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
68 matrix[row] = 0x00;
69 matrix_debouncing[row] = 0x00;
70 }
71
72 matrix_init_quantum();
73}
74
75uint8_t matrix_scan(void) {
76 for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
77 matrix_set_row_status(row);
78 _delay_us(5);
79
80 matrix_row_t cols = (
81 // cols 0..7, PORTA 0 -> 7
82 (~PINA) & 0xFF
83 ) | (
84 // cols 8..13, PORTC 7 -> 0
85 bit_reverse((~PINC) & 0xFF) << 8
86 ) | (
87 // col 14, PORTD 7
88 ((~PIND) & (1 << PIND7)) << 7
89 );
90
91 if (matrix_debouncing[row] != cols) {
92 matrix_debouncing[row] = cols;
93 debouncing = DEBOUNCE;
94 }
95 }
96
97 if (debouncing) {
98 if (--debouncing) {
99 _delay_ms(1);
100 } else {
101 for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
102 matrix[i] = matrix_debouncing[i];
103 }
104 }
105 }
106
107 matrix_scan_quantum();
108
109 return 1;
110}
111
112// declarations
113void matrix_set_row_status(uint8_t row) {
114 DDRB = (1 << row);
115 PORTB = ~(1 << row);
116}
117
118uint8_t bit_reverse(uint8_t x) {
119 x = ((x >> 1) & 0x55) | ((x << 1) & 0xaa);
120 x = ((x >> 2) & 0x33) | ((x << 2) & 0xcc);
121 x = ((x >> 4) & 0x0f) | ((x << 4) & 0xf0);
122 return x;
123}
124
125inline matrix_row_t matrix_get_row(uint8_t row) {
126 return matrix[row];
127}
128
129void matrix_print(void) {
130}
diff --git a/keyboards/mehkee96/mehkee96.c b/keyboards/mehkee96/mehkee96.c
index 46427ec93..d9e2bac7a 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/>.
16*/ 16*/
17 17
18#include "mehkee96.h" 18#include "mehkee96.h"
19
20void matrix_init_kb(void) { matrix_init_user(); }
21
22__attribute__ ((weak))
23void matrix_init_user(void) {}
24
25void matrix_scan_kb(void) { matrix_scan_user(); }
26
27__attribute__ ((weak))
28void matrix_scan_user(void) {}
diff --git a/keyboards/mehkee96/rules.mk b/keyboards/mehkee96/rules.mk
index 1cbd02948..a7d36548f 100644
--- a/keyboards/mehkee96/rules.mk
+++ b/keyboards/mehkee96/rules.mk
@@ -24,7 +24,3 @@ RGBLIGHT_ENABLE = yes
24WS2812_DRIVER = i2c 24WS2812_DRIVER = i2c
25 25
26OPT_DEFS = -DDEBUG_LEVEL=0 26OPT_DEFS = -DDEBUG_LEVEL=0
27
28# custom matrix setup
29CUSTOM_MATRIX = yes
30SRC = matrix.c