aboutsummaryrefslogtreecommitdiff
path: root/keyboards/planck
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2021-09-18 20:10:32 -0700
committerGitHub <noreply@github.com>2021-09-18 20:10:32 -0700
commitef5c6ea096033423c9b9e141c1fc94dcc41d84fa (patch)
tree7e0fd17b20c3206e5d0c7320fc0cf4ce7322ffe0 /keyboards/planck
parentf61f79b7cd1cb8edad8d55577c834a9470405b4c (diff)
downloadqmk_firmware-ef5c6ea096033423c9b9e141c1fc94dcc41d84fa.tar.gz
qmk_firmware-ef5c6ea096033423c9b9e141c1fc94dcc41d84fa.zip
[Keyboard] Use old custom matrix for Drop Planck+Preonic (#14488)
Co-authored-by: Ryan <fauxpark@gmail.com> Co-authored-by: Jack Humbert <jack.humb@gmail.com>
Diffstat (limited to 'keyboards/planck')
-rw-r--r--keyboards/planck/planck.h43
-rw-r--r--keyboards/planck/rev6_drop/chconf.h29
-rw-r--r--keyboards/planck/rev6_drop/config.h128
-rw-r--r--keyboards/planck/rev6_drop/halconf.h22
-rw-r--r--keyboards/planck/rev6_drop/info.json262
-rw-r--r--keyboards/planck/rev6_drop/matrix.c166
-rw-r--r--keyboards/planck/rev6_drop/mcuconf.h39
-rw-r--r--keyboards/planck/rev6_drop/readme.md13
-rw-r--r--keyboards/planck/rev6_drop/rev6_drop.c44
-rw-r--r--keyboards/planck/rev6_drop/rev6_drop.h108
-rw-r--r--keyboards/planck/rev6_drop/rules.mk33
11 files changed, 873 insertions, 14 deletions
diff --git a/keyboards/planck/planck.h b/keyboards/planck/planck.h
index 31e3ec915..4b04dfec5 100644
--- a/keyboards/planck/planck.h
+++ b/keyboards/planck/planck.h
@@ -1,26 +1,41 @@
1#ifndef PLANCK_H 1/* Copyright 2018 Jack Humbert <jack.humb@gmail.com>
2#define PLANCK_H 2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
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/>.
15 */
16
17#pragma once
3 18
4#include "quantum.h" 19#include "quantum.h"
5 20
6#if defined(KEYBOARD_planck_ez) 21#if defined(KEYBOARD_planck_ez)
7 #include "ez.h" 22# include "ez.h"
8#elif defined(KEYBOARD_planck_light) 23#elif defined(KEYBOARD_planck_light)
9 #include "light.h" 24# include "light.h"
10#elif defined(KEYBOARD_planck_thk) 25#elif defined(KEYBOARD_planck_thk)
11 #include "thk.h" 26# include "thk.h"
12#elif defined(KEYBOARD_planck_rev1) 27#elif defined(KEYBOARD_planck_rev1)
13 #include "rev1.h" 28# include "rev1.h"
14#elif defined(KEYBOARD_planck_rev2) 29#elif defined(KEYBOARD_planck_rev2)
15 #include "rev2.h" 30# include "rev2.h"
16#elif defined(KEYBOARD_planck_rev3) 31#elif defined(KEYBOARD_planck_rev3)
17 #include "rev3.h" 32# include "rev3.h"
18#elif defined(KEYBOARD_planck_rev4) 33#elif defined(KEYBOARD_planck_rev4)
19 #include "rev4.h" 34# include "rev4.h"
20#elif defined(KEYBOARD_planck_rev5) 35#elif defined(KEYBOARD_planck_rev5)
21 #include "rev5.h" 36# include "rev5.h"
22#elif defined(KEYBOARD_planck_rev6) 37#elif defined(KEYBOARD_planck_rev6)
23 #include "rev6.h" 38# include "rev6.h"
24#endif // Planck revisions 39#elif defined(KEYBOARD_planck_rev6_drop)
25 40# include "rev6_drop.h"
26#endif 41#endif // Planck revisions
diff --git a/keyboards/planck/rev6_drop/chconf.h b/keyboards/planck/rev6_drop/chconf.h
new file mode 100644
index 000000000..e1243f23e
--- /dev/null
+++ b/keyboards/planck/rev6_drop/chconf.h
@@ -0,0 +1,29 @@
1/* Copyright 2020 QMK
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
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/>.
15 */
16
17/*
18 * This file was auto-generated by:
19 * `qmk chibios-confmigrate -i keyboards/planck/rev6/chconf.h -r platforms/chibios/QMK_PROTON_C/configs/chconf.h`
20 */
21
22#pragma once
23
24#define CH_CFG_ST_RESOLUTION 16
25
26#define CH_CFG_ST_FREQUENCY 10000
27
28#include_next <chconf.h>
29
diff --git a/keyboards/planck/rev6_drop/config.h b/keyboards/planck/rev6_drop/config.h
new file mode 100644
index 000000000..c1baa34b7
--- /dev/null
+++ b/keyboards/planck/rev6_drop/config.h
@@ -0,0 +1,128 @@
1/*
2 * Copyright 2018 Jack Humbert <jack.humb@gmail.com>
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
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/>.
16 */
17
18#pragma once
19
20/* USB Device descriptor parameter */
21#define PRODUCT_ID 0xA4F9
22#define DEVICE_VER 0x0006
23#undef MANUFACTURER
24#define MANUFACTURER Drop
25
26#undef MATRIX_ROWS
27#undef MATRIX_COLS
28/* key matrix size */
29#define MATRIX_ROWS 8
30#define MATRIX_COLS 6
31
32/*
33 * Keyboard Matrix Assignments
34 *
35 * Change this to how you wired your keyboard
36 * COLS: AVR pins used for columns, left to right
37 * ROWS: AVR pins used for rows, top to bottom
38 * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
39 * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
40 *
41 */
42/* Note: These are not used for arm boards. They're here purely as documentation. */
43#undef MATRIX_ROW_PINS
44#undef MATRIX_COL_PINS
45
46#define MATRIX_ROW_PINS \
47 { A10, A9, A8, B15, C13, C14, C15, A2 }
48#define MATRIX_COL_PINS \
49 { B11, B10, B2, B1, A7, B0 }
50
51#define UNUSED_PINS
52
53#define ENCODERS_PAD_A \
54 { B12 }
55#define ENCODERS_PAD_B \
56 { B13 }
57
58#define DIP_SWITCH_PINS \
59 { B14, A15, A0, B9 }
60
61#define MUSIC_MAP
62#undef AUDIO_VOICES
63#undef AUDIO_PIN
64#define AUDIO_PIN A5
65#define AUDIO_PIN_ALT A4
66#define AUDIO_PIN_ALT_AS_NEGATIVE
67
68/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
69// #define DEBOUNCE 6
70
71/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
72//#define LOCKING_SUPPORT_ENABLE
73/* Locking resynchronize hack */
74//#define LOCKING_RESYNC_ENABLE
75
76/*
77 * Force NKRO
78 *
79 * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved
80 * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the
81 * makefile for this to work.)
82 *
83 * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N)
84 * until the next keyboard reset.
85 *
86 * NKRO may prevent your keystrokes from being detected in the BIOS, but it is
87 * fully operational during normal computer usage.
88 *
89 * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N)
90 * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by
91 * bootmagic, NKRO mode will always be enabled until it is toggled again during a
92 * power-up.
93 *
94 */
95//#define FORCE_NKRO
96
97/*
98 * Feature disable options
99 * These options are also useful to firmware size reduction.
100 */
101
102/* disable debug print */
103//#define NO_DEBUG
104
105/* disable print */
106//#define NO_PRINT
107
108/* disable action features */
109//#define NO_ACTION_LAYER
110//#define NO_ACTION_TAPPING
111//#define NO_ACTION_ONESHOT
112//#define NO_ACTION_MACRO
113//#define NO_ACTION_FUNCTION
114
115/*
116 * WS2812 Underglow Matrix options
117 */
118#define RGB_DI_PIN A1
119#define RGBLED_NUM 9
120#define DRIVER_LED_TOTAL RGBLED_NUM
121
122#define WS2812_PWM_DRIVER PWMD2
123#define WS2812_PWM_CHANNEL 2
124#define WS2812_PWM_PAL_MODE 1
125#define WS2812_DMA_STREAM STM32_DMA1_STREAM2
126#define WS2812_DMA_CHANNEL 2
127
128#define RGB_DISABLE_WHEN_USB_SUSPENDED
diff --git a/keyboards/planck/rev6_drop/halconf.h b/keyboards/planck/rev6_drop/halconf.h
new file mode 100644
index 000000000..48b76d2f4
--- /dev/null
+++ b/keyboards/planck/rev6_drop/halconf.h
@@ -0,0 +1,22 @@
1/* Copyright 2020 QMK
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <https://www.gnu.org/licenses/>.
15 */
16#pragma once
17
18#define HAL_USE_PWM TRUE
19#define HAL_USE_GPT TRUE
20#define HAL_USE_DAC TRUE
21
22#include_next <halconf.h>
diff --git a/keyboards/planck/rev6_drop/info.json b/keyboards/planck/rev6_drop/info.json
new file mode 100644
index 000000000..114a97129
--- /dev/null
+++ b/keyboards/planck/rev6_drop/info.json
@@ -0,0 +1,262 @@
1{
2 "keyboard_name": "Planck rev 6",
3 "url": "https://olkb.com/planck",
4 "maintainer": "jackhumbert",
5 "layouts": {
6 "LAYOUT_ortho_4x12": {
7 "layout": [
8 { "x": 0, "y": 0 },
9 { "x": 1, "y": 0 },
10 { "x": 2, "y": 0 },
11 { "x": 3, "y": 0 },
12 { "x": 4, "y": 0 },
13 { "x": 5, "y": 0 },
14 { "x": 6, "y": 0 },
15 { "x": 7, "y": 0 },
16 { "x": 8, "y": 0 },
17 { "x": 9, "y": 0 },
18 { "x": 10, "y": 0 },
19 { "x": 11, "y": 0 },
20 { "x": 0, "y": 1 },
21 { "x": 1, "y": 1 },
22 { "x": 2, "y": 1 },
23 { "x": 3, "y": 1 },
24 { "x": 4, "y": 1 },
25 { "x": 5, "y": 1 },
26 { "x": 6, "y": 1 },
27 { "x": 7, "y": 1 },
28 { "x": 8, "y": 1 },
29 { "x": 9, "y": 1 },
30 { "x": 10, "y": 1 },
31 { "x": 11, "y": 1 },
32 { "x": 0, "y": 2 },
33 { "x": 1, "y": 2 },
34 { "x": 2, "y": 2 },
35 { "x": 3, "y": 2 },
36 { "x": 4, "y": 2 },
37 { "x": 5, "y": 2 },
38 { "x": 6, "y": 2 },
39 { "x": 7, "y": 2 },
40 { "x": 8, "y": 2 },
41 { "x": 9, "y": 2 },
42 { "x": 10, "y": 2 },
43 { "x": 11, "y": 2 },
44 { "x": 0, "y": 3 },
45 { "x": 1, "y": 3 },
46 { "x": 2, "y": 3 },
47 { "x": 3, "y": 3 },
48 { "x": 4, "y": 3 },
49 { "x": 5, "y": 3 },
50 { "x": 6, "y": 3 },
51 { "x": 7, "y": 3 },
52 { "x": 8, "y": 3 },
53 { "x": 9, "y": 3 },
54 { "x": 10, "y": 3 },
55 { "x": 11, "y": 3 }
56 ]
57 },
58 "LAYOUT_planck_1x2uC": {
59 "layout": [
60 { "x": 0, "y": 0 },
61 { "x": 1, "y": 0 },
62 { "x": 2, "y": 0 },
63 { "x": 3, "y": 0 },
64 { "x": 4, "y": 0 },
65 { "x": 5, "y": 0 },
66 { "x": 6, "y": 0 },
67 { "x": 7, "y": 0 },
68 { "x": 8, "y": 0 },
69 { "x": 9, "y": 0 },
70 { "x": 10, "y": 0 },
71 { "x": 11, "y": 0 },
72 { "x": 0, "y": 1 },
73 { "x": 1, "y": 1 },
74 { "x": 2, "y": 1 },
75 { "x": 3, "y": 1 },
76 { "x": 4, "y": 1 },
77 { "x": 5, "y": 1 },
78 { "x": 6, "y": 1 },
79 { "x": 7, "y": 1 },
80 { "x": 8, "y": 1 },
81 { "x": 9, "y": 1 },
82 { "x": 10, "y": 1 },
83 { "x": 11, "y": 1 },
84 { "x": 0, "y": 2 },
85 { "x": 1, "y": 2 },
86 { "x": 2, "y": 2 },
87 { "x": 3, "y": 2 },
88 { "x": 4, "y": 2 },
89 { "x": 5, "y": 2 },
90 { "x": 6, "y": 2 },
91 { "x": 7, "y": 2 },
92 { "x": 8, "y": 2 },
93 { "x": 9, "y": 2 },
94 { "x": 10, "y": 2 },
95 { "x": 11, "y": 2 },
96 { "x": 0, "y": 3 },
97 { "x": 1, "y": 3 },
98 { "x": 2, "y": 3 },
99 { "x": 3, "y": 3 },
100 { "x": 4, "y": 3 },
101 { "x": 5, "y": 3, "w": 2 },
102 { "x": 7, "y": 3 },
103 { "x": 8, "y": 3 },
104 { "x": 9, "y": 3 },
105 { "x": 10, "y": 3 },
106 { "x": 11, "y": 3 }
107 ]
108 },
109 "LAYOUT_planck_1x2uL": {
110 "layout": [
111 { "x": 0, "y": 0 },
112 { "x": 1, "y": 0 },
113 { "x": 2, "y": 0 },
114 { "x": 3, "y": 0 },
115 { "x": 4, "y": 0 },
116 { "x": 5, "y": 0 },
117 { "x": 6, "y": 0 },
118 { "x": 7, "y": 0 },
119 { "x": 8, "y": 0 },
120 { "x": 9, "y": 0 },
121 { "x": 10, "y": 0 },
122 { "x": 11, "y": 0 },
123 { "x": 0, "y": 1 },
124 { "x": 1, "y": 1 },
125 { "x": 2, "y": 1 },
126 { "x": 3, "y": 1 },
127 { "x": 4, "y": 1 },
128 { "x": 5, "y": 1 },
129 { "x": 6, "y": 1 },
130 { "x": 7, "y": 1 },
131 { "x": 8, "y": 1 },
132 { "x": 9, "y": 1 },
133 { "x": 10, "y": 1 },
134 { "x": 11, "y": 1 },
135 { "x": 0, "y": 2 },
136 { "x": 1, "y": 2 },
137 { "x": 2, "y": 2 },
138 { "x": 3, "y": 2 },
139 { "x": 4, "y": 2 },
140 { "x": 5, "y": 2 },
141 { "x": 6, "y": 2 },
142 { "x": 7, "y": 2 },
143 { "x": 8, "y": 2 },
144 { "x": 9, "y": 2 },
145 { "x": 10, "y": 2 },
146 { "x": 11, "y": 2 },
147 { "x": 0, "y": 3 },
148 { "x": 1, "y": 3 },
149 { "x": 2, "y": 3 },
150 { "x": 3, "y": 3 },
151 { "x": 4, "y": 3, "w": 2 },
152 { "x": 6, "y": 3 },
153 { "x": 7, "y": 3 },
154 { "x": 8, "y": 3 },
155 { "x": 9, "y": 3 },
156 { "x": 10, "y": 3 },
157 { "x": 11, "y": 3 }
158 ]
159 },
160 "LAYOUT_planck_1x2uR": {
161 "layout": [
162 { "x": 0, "y": 0 },
163 { "x": 1, "y": 0 },
164 { "x": 2, "y": 0 },
165 { "x": 3, "y": 0 },
166 { "x": 4, "y": 0 },
167 { "x": 5, "y": 0 },
168 { "x": 6, "y": 0 },
169 { "x": 7, "y": 0 },
170 { "x": 8, "y": 0 },
171 { "x": 9, "y": 0 },
172 { "x": 10, "y": 0 },
173 { "x": 11, "y": 0 },
174 { "x": 0, "y": 1 },
175 { "x": 1, "y": 1 },
176 { "x": 2, "y": 1 },
177 { "x": 3, "y": 1 },
178 { "x": 4, "y": 1 },
179 { "x": 5, "y": 1 },
180 { "x": 6, "y": 1 },
181 { "x": 7, "y": 1 },
182 { "x": 8, "y": 1 },
183 { "x": 9, "y": 1 },
184 { "x": 10, "y": 1 },
185 { "x": 11, "y": 1 },
186 { "x": 0, "y": 2 },
187 { "x": 1, "y": 2 },
188 { "x": 2, "y": 2 },
189 { "x": 3, "y": 2 },
190 { "x": 4, "y": 2 },
191 { "x": 5, "y": 2 },
192 { "x": 6, "y": 2 },
193 { "x": 7, "y": 2 },
194 { "x": 8, "y": 2 },
195 { "x": 9, "y": 2 },
196 { "x": 10, "y": 2 },
197 { "x": 11, "y": 2 },
198 { "x": 0, "y": 3 },
199 { "x": 1, "y": 3 },
200 { "x": 2, "y": 3 },
201 { "x": 3, "y": 3 },
202 { "x": 4, "y": 3 },
203 { "x": 5, "y": 3 },
204 { "x": 6, "y": 3, "w": 2 },
205 { "x": 8, "y": 3 },
206 { "x": 9, "y": 3 },
207 { "x": 10, "y": 3 },
208 { "x": 11, "y": 3 }
209 ]
210 },
211 "LAYOUT_planck_2x2u": {
212 "layout": [
213 { "x": 0, "y": 0 },
214 { "x": 1, "y": 0 },
215 { "x": 2, "y": 0 },
216 { "x": 3, "y": 0 },
217 { "x": 4, "y": 0 },
218 { "x": 5, "y": 0 },
219 { "x": 6, "y": 0 },
220 { "x": 7, "y": 0 },
221 { "x": 8, "y": 0 },
222 { "x": 9, "y": 0 },
223 { "x": 10, "y": 0 },
224 { "x": 11, "y": 0 },
225 { "x": 0, "y": 1 },
226 { "x": 1, "y": 1 },
227 { "x": 2, "y": 1 },
228 { "x": 3, "y": 1 },
229 { "x": 4, "y": 1 },
230 { "x": 5, "y": 1 },
231 { "x": 6, "y": 1 },
232 { "x": 7, "y": 1 },
233 { "x": 8, "y": 1 },
234 { "x": 9, "y": 1 },
235 { "x": 10, "y": 1 },
236 { "x": 11, "y": 1 },
237 { "x": 0, "y": 2 },
238 { "x": 1, "y": 2 },
239 { "x": 2, "y": 2 },
240 { "x": 3, "y": 2 },
241 { "x": 4, "y": 2 },
242 { "x": 5, "y": 2 },
243 { "x": 6, "y": 2 },
244 { "x": 7, "y": 2 },
245 { "x": 8, "y": 2 },
246 { "x": 9, "y": 2 },
247 { "x": 10, "y": 2 },
248 { "x": 11, "y": 2 },
249 { "x": 0, "y": 3 },
250 { "x": 1, "y": 3 },
251 { "x": 2, "y": 3 },
252 { "x": 3, "y": 3 },
253 { "x": 4, "y": 3, "w": 2 },
254 { "x": 6, "y": 3, "w": 2 },
255 { "x": 8, "y": 3 },
256 { "x": 9, "y": 3 },
257 { "x": 10, "y": 3 },
258 { "x": 11, "y": 3 }
259 ]
260 }
261 }
262}
diff --git a/keyboards/planck/rev6_drop/matrix.c b/keyboards/planck/rev6_drop/matrix.c
new file mode 100644
index 000000000..1fb6ba0d4
--- /dev/null
+++ b/keyboards/planck/rev6_drop/matrix.c
@@ -0,0 +1,166 @@
1/*
2 * Copyright 2018 Jack Humbert <jack.humb@gmail.com>
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
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/>.
16 */
17
18#include <stdint.h>
19#include <stdbool.h>
20#include <string.h>
21#include "hal.h"
22#include "timer.h"
23#include "wait.h"
24#include "debug.h"
25#include "matrix.h"
26
27/*
28 * col: { B11, B10, B2, B1, A7, B0 }
29 * row: { A10, A9, A8, B15, C13, C14, C15, A2 }
30 */
31/* matrix state(1:on, 0:off) */
32static matrix_row_t matrix[MATRIX_ROWS];
33static matrix_row_t matrix_debouncing[MATRIX_COLS];
34static bool debouncing = false;
35static uint16_t debouncing_time = 0;
36
37__attribute__((weak)) void matrix_init_user(void) {}
38
39__attribute__((weak)) void matrix_scan_user(void) {}
40
41__attribute__((weak)) void matrix_init_kb(void) { matrix_init_user(); }
42
43__attribute__((weak)) void matrix_scan_kb(void) { matrix_scan_user(); }
44
45void matrix_init(void) {
46 printf("matrix init\n");
47 // debug_matrix = true;
48
49 // actual matrix setup
50 palSetPadMode(GPIOB, 11, PAL_MODE_OUTPUT_PUSHPULL);
51 palSetPadMode(GPIOB, 10, PAL_MODE_OUTPUT_PUSHPULL);
52 palSetPadMode(GPIOB, 2, PAL_MODE_OUTPUT_PUSHPULL);
53 palSetPadMode(GPIOB, 1, PAL_MODE_OUTPUT_PUSHPULL);
54 palSetPadMode(GPIOA, 7, PAL_MODE_OUTPUT_PUSHPULL);
55 palSetPadMode(GPIOB, 0, PAL_MODE_OUTPUT_PUSHPULL);
56
57 palSetPadMode(GPIOA, 10, PAL_MODE_INPUT_PULLDOWN);
58 palSetPadMode(GPIOA, 9, PAL_MODE_INPUT_PULLDOWN);
59 palSetPadMode(GPIOA, 8, PAL_MODE_INPUT_PULLDOWN);
60 palSetPadMode(GPIOB, 15, PAL_MODE_INPUT_PULLDOWN);
61 palSetPadMode(GPIOC, 13, PAL_MODE_INPUT_PULLDOWN);
62 palSetPadMode(GPIOC, 14, PAL_MODE_INPUT_PULLDOWN);
63 palSetPadMode(GPIOC, 15, PAL_MODE_INPUT_PULLDOWN);
64 palSetPadMode(GPIOA, 2, PAL_MODE_INPUT_PULLDOWN);
65
66 memset(matrix, 0, MATRIX_ROWS * sizeof(matrix_row_t));
67 memset(matrix_debouncing, 0, MATRIX_COLS * sizeof(matrix_row_t));
68
69 matrix_init_quantum();
70}
71
72uint8_t matrix_scan(void) {
73 // actual matrix
74 for (int col = 0; col < MATRIX_COLS; col++) {
75 matrix_row_t data = 0;
76
77 // strobe col { B11, B10, B2, B1, A7, B0 }
78 switch (col) {
79 case 0:
80 palSetPad(GPIOB, 11);
81 break;
82 case 1:
83 palSetPad(GPIOB, 10);
84 break;
85 case 2:
86 palSetPad(GPIOB, 2);
87 break;
88 case 3:
89 palSetPad(GPIOB, 1);
90 break;
91 case 4:
92 palSetPad(GPIOA, 7);
93 break;
94 case 5:
95 palSetPad(GPIOB, 0);
96 break;
97 }
98
99 // need wait to settle pin state
100 wait_us(20);
101
102 // read row data { A10, A9, A8, B15, C13, C14, C15, A2 }
103 data = ((palReadPad(GPIOA, 10) << 0) | (palReadPad(GPIOA, 9) << 1) | (palReadPad(GPIOA, 8) << 2) | (palReadPad(GPIOB, 15) << 3) | (palReadPad(GPIOC, 13) << 4) | (palReadPad(GPIOC, 14) << 5) | (palReadPad(GPIOC, 15) << 6) | (palReadPad(GPIOA, 2) << 7));
104
105 // unstrobe col { B11, B10, B2, B1, A7, B0 }
106 switch (col) {
107 case 0:
108 palClearPad(GPIOB, 11);
109 break;
110 case 1:
111 palClearPad(GPIOB, 10);
112 break;
113 case 2:
114 palClearPad(GPIOB, 2);
115 break;
116 case 3:
117 palClearPad(GPIOB, 1);
118 break;
119 case 4:
120 palClearPad(GPIOA, 7);
121 break;
122 case 5:
123 palClearPad(GPIOB, 0);
124 break;
125 }
126
127 if (matrix_debouncing[col] != data) {
128 matrix_debouncing[col] = data;
129 debouncing = true;
130 debouncing_time = timer_read();
131 }
132 }
133
134 if (debouncing && timer_elapsed(debouncing_time) > DEBOUNCE) {
135 for (int row = 0; row < MATRIX_ROWS; row++) {
136 matrix[row] = 0;
137 for (int col = 0; col < MATRIX_COLS; col++) {
138 matrix[row] |= ((matrix_debouncing[col] & (1 << row) ? 1 : 0) << col);
139 }
140 }
141 debouncing = false;
142 }
143
144 matrix_scan_quantum();
145
146 return 1;
147}
148
149bool matrix_is_on(uint8_t row, uint8_t col) { return (matrix[row] & (1 << col)); }
150
151matrix_row_t matrix_get_row(uint8_t row) { return matrix[row]; }
152
153void matrix_print(void) {
154 printf("\nr/c 01234567\n");
155 for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
156 printf("%X0: ", row);
157 matrix_row_t data = matrix_get_row(row);
158 for (int col = 0; col < MATRIX_COLS; col++) {
159 if (data & (1 << col))
160 printf("1");
161 else
162 printf("0");
163 }
164 printf("\n");
165 }
166}
diff --git a/keyboards/planck/rev6_drop/mcuconf.h b/keyboards/planck/rev6_drop/mcuconf.h
new file mode 100644
index 000000000..31abf13b6
--- /dev/null
+++ b/keyboards/planck/rev6_drop/mcuconf.h
@@ -0,0 +1,39 @@
1/* Copyright 2020 QMK Contributors
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
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/>.
15 */
16
17#include_next "mcuconf.h"
18
19// The SysTick timer from the normal quantum/stm32 uses TIM2 -- the WS2812 pin used
20// on the Planck requires the use of TIM2 to run PWM -- rework which timers are
21// allocated for PWM usage.
22#undef STM32_PWM_USE_TIM2
23#define STM32_PWM_USE_TIM2 TRUE
24
25#undef STM32_DAC_USE_DAC1_CH1
26#define STM32_DAC_USE_DAC1_CH1 TRUE
27#undef STM32_DAC_USE_DAC1_CH2
28#define STM32_DAC_USE_DAC1_CH2 TRUE
29#undef STM32_GPT_USE_TIM6
30#define STM32_GPT_USE_TIM6 TRUE
31#undef STM32_GPT_USE_TIM7
32#define STM32_GPT_USE_TIM7 TRUE
33#undef STM32_GPT_USE_TIM8
34#define STM32_GPT_USE_TIM8 TRUE
35
36// As mentioned above, we need to reallocate the SysTick timer used from
37// TIM2 to TIM3.
38#undef STM32_ST_USE_TIMER
39#define STM32_ST_USE_TIMER 3
diff --git a/keyboards/planck/rev6_drop/readme.md b/keyboards/planck/rev6_drop/readme.md
new file mode 100644
index 000000000..0ea2619ac
--- /dev/null
+++ b/keyboards/planck/rev6_drop/readme.md
@@ -0,0 +1,13 @@
1# Planck
2
3A compact 40% (12x4) ortholinear keyboard kit made and sold by OLKB and Massdrop. A complete hardware rework of the Planck, sporting a faster and more powerful STM32 ARM Cortex-M4 microcontroller, with support for rotary encoders and three additional layouts. [More info on qmk.fm](http://qmk.fm/planck/)
4
5* Keyboard Maintainer: [Jack Humbert](https://github.com/jackhumbert)
6* Hardware Supported: Planck PCB rev6
7* Hardware Availability: [OLKB.com](https://olkb.com), [Massdrop](https://www.massdrop.com/buy/planck-mechanical-keyboard?mode=guest_open)
8
9Make example for this keyboard (after setting up your build environment):
10
11 make planck/rev6_drop:default
12
13See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
diff --git a/keyboards/planck/rev6_drop/rev6_drop.c b/keyboards/planck/rev6_drop/rev6_drop.c
new file mode 100644
index 000000000..4c41af380
--- /dev/null
+++ b/keyboards/planck/rev6_drop/rev6_drop.c
@@ -0,0 +1,44 @@
1/* Copyright 2018 Jack Humbert <jack.humb@gmail.com>
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
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/>.
15 */
16#include "rev6_drop.h"
17
18#ifdef RGB_MATRIX_ENABLE
19// clang-format off
20led_config_t g_led_config = { {
21 // Key Matrix to LED Index
22 { NO_LED, 6, NO_LED, NO_LED, 5, NO_LED },
23 { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
24 { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, 0 },
25 { NO_LED, 7, NO_LED, NO_LED, 2, NO_LED },
26 { NO_LED, 4, NO_LED, NO_LED, 3, NO_LED },
27 { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
28 { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
29 { NO_LED, 1, NO_LED, NO_LED, 8, NO_LED },
30}, {
31 // LED Index to Physical Position
32 {112, 39}, {148, 60}, {206, 53}, {206, 3}, {150, 3}, {74, 3}, {18, 3}, {18, 54}, {77, 60}
33}, {
34 // LED Index to Flag
35 LED_FLAG_ALL, LED_FLAG_ALL, LED_FLAG_ALL, LED_FLAG_ALL, LED_FLAG_ALL,
36 LED_FLAG_ALL, LED_FLAG_ALL, LED_FLAG_ALL, LED_FLAG_ALL
37} };
38
39// LED physical location index
40// 6 5 4 3
41// 0
42// 7 8 1 2
43
44#endif
diff --git a/keyboards/planck/rev6_drop/rev6_drop.h b/keyboards/planck/rev6_drop/rev6_drop.h
new file mode 100644
index 000000000..bc9434a02
--- /dev/null
+++ b/keyboards/planck/rev6_drop/rev6_drop.h
@@ -0,0 +1,108 @@
1/* Copyright 2018 Jack Humbert <jack.humb@gmail.com>
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
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/>.
15 */
16#pragma once
17
18#include "planck.h"
19
20#define LAYOUT_planck_1x2uC( \
21 k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \
22 k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \
23 k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \
24 k30, k31, k32, k33, k34, k36, k37, k38, k39, k3a, k3b \
25) \
26{ \
27 { k00, k01, k02, k03, k04, k05 }, \
28 { k10, k11, k12, k13, k14, k15 }, \
29 { k20, k21, k22, k23, k24, k25 }, \
30 { k30, k31, k32, k39, k3a, k3b }, \
31 { k06, k07, k08, k09, k0a, k0b }, \
32 { k16, k17, k18, k19, k1a, k1b }, \
33 { k26, k27, k28, k29, k2a, k2b }, \
34 { k36, k37, k38, k33, k34, KC_NO } \
35}
36
37#define LAYOUT_planck_1x2uR( \
38 k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \
39 k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \
40 k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \
41 k30, k31, k32, k33, k34, k35, k37, k38, k39, k3a, k3b \
42) \
43{ \
44 { k00, k01, k02, k03, k04, k05 }, \
45 { k10, k11, k12, k13, k14, k15 }, \
46 { k20, k21, k22, k23, k24, k25 }, \
47 { k30, k31, k32, k39, k3a, k3b }, \
48 { k06, k07, k08, k09, k0a, k0b }, \
49 { k16, k17, k18, k19, k1a, k1b }, \
50 { k26, k27, k28, k29, k2a, k2b }, \
51 { KC_NO, k37, k38, k33, k34, k35 } \
52}
53
54#define LAYOUT_planck_1x2uL( \
55 k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \
56 k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \
57 k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \
58 k30, k31, k32, k33, k35, k36, k37, k38, k39, k3a, k3b \
59) \
60{ \
61 { k00, k01, k02, k03, k04, k05 }, \
62 { k10, k11, k12, k13, k14, k15 }, \
63 { k20, k21, k22, k23, k24, k25 }, \
64 { k30, k31, k32, k39, k3a, k3b }, \
65 { k06, k07, k08, k09, k0a, k0b }, \
66 { k16, k17, k18, k19, k1a, k1b }, \
67 { k26, k27, k28, k29, k2a, k2b }, \
68 { k36, k37, k38, k33, KC_NO, k35 } \
69}
70
71#define LAYOUT_planck_2x2u( \
72 k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \
73 k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \
74 k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \
75 k30, k31, k32, k33, k35, k37, k38, k39, k3a, k3b \
76) \
77{ \
78 { k00, k01, k02, k03, k04, k05 }, \
79 { k10, k11, k12, k13, k14, k15 }, \
80 { k20, k21, k22, k23, k24, k25 }, \
81 { k30, k31, k32, k39, k3a, k3b }, \
82 { k06, k07, k08, k09, k0a, k0b }, \
83 { k16, k17, k18, k19, k1a, k1b }, \
84 { k26, k27, k28, k29, k2a, k2b }, \
85 { KC_NO, k37, k38, k33, KC_NO, k35 } \
86}
87
88#define LAYOUT_ortho_4x12( \
89 k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \
90 k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \
91 k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \
92 k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b \
93) \
94{ \
95 { k00, k01, k02, k03, k04, k05 }, \
96 { k10, k11, k12, k13, k14, k15 }, \
97 { k20, k21, k22, k23, k24, k25 }, \
98 { k30, k31, k32, k39, k3a, k3b }, \
99 { k06, k07, k08, k09, k0a, k0b }, \
100 { k16, k17, k18, k19, k1a, k1b }, \
101 { k26, k27, k28, k29, k2a, k2b }, \
102 { k36, k37, k38, k33, k34, k35 } \
103}
104
105
106#define LAYOUT LAYOUT_ortho_4x12
107#define LAYOUT_planck_mit LAYOUT_planck_1x2uC
108#define LAYOUT_planck_grid LAYOUT_ortho_4x12
diff --git a/keyboards/planck/rev6_drop/rules.mk b/keyboards/planck/rev6_drop/rules.mk
new file mode 100644
index 000000000..c35de3d74
--- /dev/null
+++ b/keyboards/planck/rev6_drop/rules.mk
@@ -0,0 +1,33 @@
1# MCU name
2MCU = STM32F303
3
4# Bootloader selection
5BOOTLOADER = stm32-dfu
6
7# Build Options
8# change yes to no to disable
9#
10BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
11MOUSEKEY_ENABLE = yes # Mouse keys
12EXTRAKEY_ENABLE = yes # Audio control and System control
13CONSOLE_ENABLE = yes # Console for debug
14COMMAND_ENABLE = yes # Commands for debug and configuration
15# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
16SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
17# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
18NKRO_ENABLE = yes # USB Nkey Rollover
19BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
20RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
21AUDIO_ENABLE = yes # Audio output
22WS2812_DRIVER = pwm
23CUSTOM_MATRIX = yes
24# Do not enable RGB_MATRIX_ENABLE together with RGBLIGHT_ENABLE
25RGB_MATRIX_ENABLE = no
26RGB_MATRIX_DRIVER = WS2812
27ENCODER_ENABLE = yes
28DIP_SWITCH_ENABLE = yes
29
30SRC += matrix.c
31
32LAYOUTS = ortho_4x12 planck_mit
33LAYOUTS_HAS_RGB = no