aboutsummaryrefslogtreecommitdiff
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
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>
-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
-rw-r--r--keyboards/preonic/preonic.h35
-rw-r--r--keyboards/preonic/rev3_drop/chconf.h29
-rw-r--r--keyboards/preonic/rev3_drop/config.h110
-rw-r--r--keyboards/preonic/rev3_drop/halconf.h22
-rw-r--r--keyboards/preonic/rev3_drop/info.json342
-rw-r--r--keyboards/preonic/rev3_drop/matrix.c168
-rw-r--r--keyboards/preonic/rev3_drop/mcuconf.h39
-rw-r--r--keyboards/preonic/rev3_drop/rev3_drop.c61
-rw-r--r--keyboards/preonic/rev3_drop/rev3_drop.h115
-rw-r--r--keyboards/preonic/rev3_drop/rules.mk33
21 files changed, 1817 insertions, 24 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
diff --git a/keyboards/preonic/preonic.h b/keyboards/preonic/preonic.h
index 4f8ebcc3e..6b10a425a 100644
--- a/keyboards/preonic/preonic.h
+++ b/keyboards/preonic/preonic.h
@@ -1,3 +1,20 @@
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
1#pragma once 18#pragma once
2 19
3#include "quantum.h" 20#include "quantum.h"
@@ -5,16 +22,14 @@
5/************************************************** 22/**************************************************
6** Include headers specific to keyboard revision ** 23** Include headers specific to keyboard revision **
7**************************************************/ 24**************************************************/
8#ifdef KEYBOARD_preonic_rev1 25#if defined(KEYBOARD_preonic_rev1)
9 #include "rev1.h" 26# include "rev1.h"
10#endif 27#elif defined(KEYBOARD_preonic_rev2)
11 28# include "rev2.h"
12#ifdef KEYBOARD_preonic_rev2 29#elif defined(KEYBOARD_preonic_rev3)
13 #include "rev2.h" 30# include "rev3.h"
14#endif 31#elif defined(KEYBOARD_preonic_rev3_drop)
15 32# include "rev3_drop.h"
16#ifdef KEYBOARD_preonic_rev3
17 #include "rev3.h"
18#endif 33#endif
19 34
20 35
diff --git a/keyboards/preonic/rev3_drop/chconf.h b/keyboards/preonic/rev3_drop/chconf.h
new file mode 100644
index 000000000..47dd995f8
--- /dev/null
+++ b/keyboards/preonic/rev3_drop/chconf.h
@@ -0,0 +1,29 @@
1/* Copyright 2021 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 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/preonic/rev3/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/preonic/rev3_drop/config.h b/keyboards/preonic/rev3_drop/config.h
new file mode 100644
index 000000000..1a0605e73
--- /dev/null
+++ b/keyboards/preonic/rev3_drop/config.h
@@ -0,0 +1,110 @@
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 DEVICE_VER 0x0003
22#define PRODUCT_ID 0xA649
23#undef MANUFACTURER
24#define MANUFACTURER Drop
25
26#undef MATRIX_ROWS
27#undef MATRIX_COLS
28/* key matrix size */
29#define MATRIX_ROWS 10
30#define MATRIX_COLS 6
31
32#undef MATRIX_ROW_PINS
33#undef MATRIX_COL_PINS
34#define MATRIX_ROW_PINS { A10, A9, A8, B15, C13, C14, C15, A2, A3, A6 }
35#define MATRIX_COL_PINS { B11, B10, B2, B1, A7, B0 }
36#define UNUSED_PINS
37
38#define ENCODERS_PAD_A { B12 }
39#define ENCODERS_PAD_B { B13 }
40
41#define DIP_SWITCH_PINS { B14, A15, A0, B9 }
42
43#define MUSIC_MAP
44#undef AUDIO_VOICES
45#undef AUDIO_PIN
46#define AUDIO_PIN A5
47#define AUDIO_PIN_ALT A4
48#define AUDIO_PIN_ALT_AS_NEGATIVE
49
50/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
51// #define DEBOUNCE 6
52
53/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
54//#define LOCKING_SUPPORT_ENABLE
55/* Locking resynchronize hack */
56//#define LOCKING_RESYNC_ENABLE
57
58/*
59 * Force NKRO
60 *
61 * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved
62 * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the
63 * makefile for this to work.)
64 *
65 * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N)
66 * until the next keyboard reset.
67 *
68 * NKRO may prevent your keystrokes from being detected in the BIOS, but it is
69 * fully operational during normal computer usage.
70 *
71 * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N)
72 * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by
73 * bootmagic, NKRO mode will always be enabled until it is toggled again during a
74 * power-up.
75 *
76 */
77//#define FORCE_NKRO
78
79/*
80 * Feature disable options
81 * These options are also useful to firmware size reduction.
82 */
83
84/* disable debug print */
85//#define NO_DEBUG
86
87/* disable print */
88//#define NO_PRINT
89
90/* disable action features */
91//#define NO_ACTION_LAYER
92//#define NO_ACTION_TAPPING
93//#define NO_ACTION_ONESHOT
94//#define NO_ACTION_MACRO
95//#define NO_ACTION_FUNCTION
96
97/*
98 * WS2812 Underglow Matrix options
99 */
100#define RGB_DI_PIN A1
101#define RGBLED_NUM 9
102#define RGBLIGHT_ANIMATIONS
103// RGB Matrix support
104#define DRIVER_LED_TOTAL RGBLED_NUM
105
106#define WS2812_PWM_DRIVER PWMD2
107#define WS2812_PWM_CHANNEL 2
108#define WS2812_PWM_PAL_MODE 1
109#define WS2812_DMA_STREAM STM32_DMA1_STREAM2
110#define WS2812_DMA_CHANNEL 2
diff --git a/keyboards/preonic/rev3_drop/halconf.h b/keyboards/preonic/rev3_drop/halconf.h
new file mode 100644
index 000000000..48b76d2f4
--- /dev/null
+++ b/keyboards/preonic/rev3_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/preonic/rev3_drop/info.json b/keyboards/preonic/rev3_drop/info.json
new file mode 100644
index 000000000..8b7a65384
--- /dev/null
+++ b/keyboards/preonic/rev3_drop/info.json
@@ -0,0 +1,342 @@
1{
2 "keyboard_name": "Preonic rev. 3",
3 "url": "https://olkb.com/preonic",
4 "maintainer": "jackhumbert",
5 "layouts": {
6 "LAYOUT_preonic_1x2uC": {
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
21 {"x": 0, "y": 1},
22 {"x": 1, "y": 1},
23 {"x": 2, "y": 1},
24 {"x": 3, "y": 1},
25 {"x": 4, "y": 1},
26 {"x": 5, "y": 1},
27 {"x": 6, "y": 1},
28 {"x": 7, "y": 1},
29 {"x": 8, "y": 1},
30 {"x": 9, "y": 1},
31 {"x": 10, "y": 1},
32 {"x": 11, "y": 1},
33
34 {"x": 0, "y": 2},
35 {"x": 1, "y": 2},
36 {"x": 2, "y": 2},
37 {"x": 3, "y": 2},
38 {"x": 4, "y": 2},
39 {"x": 5, "y": 2},
40 {"x": 6, "y": 2},
41 {"x": 7, "y": 2},
42 {"x": 8, "y": 2},
43 {"x": 9, "y": 2},
44 {"x": 10, "y": 2},
45 {"x": 11, "y": 2},
46
47 {"x": 0, "y": 3},
48 {"x": 1, "y": 3},
49 {"x": 2, "y": 3},
50 {"x": 3, "y": 3},
51 {"x": 4, "y": 3},
52 {"x": 5, "y": 3},
53 {"x": 6, "y": 3},
54 {"x": 7, "y": 3},
55 {"x": 8, "y": 3},
56 {"x": 9, "y": 3},
57 {"x": 10, "y": 3},
58 {"x": 11, "y": 3},
59
60 {"x": 0, "y": 4},
61 {"x": 1, "y": 4},
62 {"x": 2, "y": 4},
63 {"x": 3, "y": 4},
64 {"x": 4, "y": 4},
65 {"x": 5, "y": 4, "w": 2},
66 {"x": 7, "y": 4},
67 {"x": 8, "y": 4},
68 {"x": 9, "y": 4},
69 {"x": 10, "y": 4},
70 {"x": 11, "y": 4}
71 ]
72 },
73 "LAYOUT_preonic_1x2uR": {
74 "layout": [
75 {"x": 0, "y": 0},
76 {"x": 1, "y": 0},
77 {"x": 2, "y": 0},
78 {"x": 3, "y": 0},
79 {"x": 4, "y": 0},
80 {"x": 5, "y": 0},
81 {"x": 6, "y": 0},
82 {"x": 7, "y": 0},
83 {"x": 8, "y": 0},
84 {"x": 9, "y": 0},
85 {"x": 10, "y": 0},
86 {"x": 11, "y": 0},
87
88 {"x": 0, "y": 1},
89 {"x": 1, "y": 1},
90 {"x": 2, "y": 1},
91 {"x": 3, "y": 1},
92 {"x": 4, "y": 1},
93 {"x": 5, "y": 1},
94 {"x": 6, "y": 1},
95 {"x": 7, "y": 1},
96 {"x": 8, "y": 1},
97 {"x": 9, "y": 1},
98 {"x": 10, "y": 1},
99 {"x": 11, "y": 1},
100
101 {"x": 0, "y": 2},
102 {"x": 1, "y": 2},
103 {"x": 2, "y": 2},
104 {"x": 3, "y": 2},
105 {"x": 4, "y": 2},
106 {"x": 5, "y": 2},
107 {"x": 6, "y": 2},
108 {"x": 7, "y": 2},
109 {"x": 8, "y": 2},
110 {"x": 9, "y": 2},
111 {"x": 10, "y": 2},
112 {"x": 11, "y": 2},
113
114 {"x": 0, "y": 3},
115 {"x": 1, "y": 3},
116 {"x": 2, "y": 3},
117 {"x": 3, "y": 3},
118 {"x": 4, "y": 3},
119 {"x": 5, "y": 3},
120 {"x": 6, "y": 3},
121 {"x": 7, "y": 3},
122 {"x": 8, "y": 3},
123 {"x": 9, "y": 3},
124 {"x": 10, "y": 3},
125 {"x": 11, "y": 3},
126
127 {"x": 0, "y": 4},
128 {"x": 1, "y": 4},
129 {"x": 2, "y": 4},
130 {"x": 3, "y": 4},
131 {"x": 4, "y": 4},
132 {"x": 5, "y": 4},
133 {"x": 6, "y": 4, "w": 2},
134 {"x": 8, "y": 4},
135 {"x": 9, "y": 4},
136 {"x": 10, "y": 4},
137 {"x": 11, "y": 4}
138 ]
139 },
140 "LAYOUT_preonic_1x2uL": {
141 "layout": [
142 {"x": 0, "y": 0},
143 {"x": 1, "y": 0},
144 {"x": 2, "y": 0},
145 {"x": 3, "y": 0},
146 {"x": 4, "y": 0},
147 {"x": 5, "y": 0},
148 {"x": 6, "y": 0},
149 {"x": 7, "y": 0},
150 {"x": 8, "y": 0},
151 {"x": 9, "y": 0},
152 {"x": 10, "y": 0},
153 {"x": 11, "y": 0},
154
155 {"x": 0, "y": 1},
156 {"x": 1, "y": 1},
157 {"x": 2, "y": 1},
158 {"x": 3, "y": 1},
159 {"x": 4, "y": 1},
160 {"x": 5, "y": 1},
161 {"x": 6, "y": 1},
162 {"x": 7, "y": 1},
163 {"x": 8, "y": 1},
164 {"x": 9, "y": 1},
165 {"x": 10, "y": 1},
166 {"x": 11, "y": 1},
167
168 {"x": 0, "y": 2},
169 {"x": 1, "y": 2},
170 {"x": 2, "y": 2},
171 {"x": 3, "y": 2},
172 {"x": 4, "y": 2},
173 {"x": 5, "y": 2},
174 {"x": 6, "y": 2},
175 {"x": 7, "y": 2},
176 {"x": 8, "y": 2},
177 {"x": 9, "y": 2},
178 {"x": 10, "y": 2},
179 {"x": 11, "y": 2},
180
181 {"x": 0, "y": 3},
182 {"x": 1, "y": 3},
183 {"x": 2, "y": 3},
184 {"x": 3, "y": 3},
185 {"x": 4, "y": 3},
186 {"x": 5, "y": 3},
187 {"x": 6, "y": 3},
188 {"x": 7, "y": 3},
189 {"x": 8, "y": 3},
190 {"x": 9, "y": 3},
191 {"x": 10, "y": 3},
192 {"x": 11, "y": 3},
193
194 {"x": 0, "y": 4},
195 {"x": 1, "y": 4},
196 {"x": 2, "y": 4},
197 {"x": 3, "y": 4},
198 {"x": 4, "y": 4, "w": 2},
199 {"x": 6, "y": 4},
200 {"x": 7, "y": 4},
201 {"x": 8, "y": 4},
202 {"x": 9, "y": 4},
203 {"x": 10, "y": 4},
204 {"x": 11, "y": 4}
205 ]
206 },
207 "LAYOUT_preonic_2x2u": {
208 "layout": [
209 {"x": 0, "y": 0},
210 {"x": 1, "y": 0},
211 {"x": 2, "y": 0},
212 {"x": 3, "y": 0},
213 {"x": 4, "y": 0},
214 {"x": 5, "y": 0},
215 {"x": 6, "y": 0},
216 {"x": 7, "y": 0},
217 {"x": 8, "y": 0},
218 {"x": 9, "y": 0},
219 {"x": 10, "y": 0},
220 {"x": 11, "y": 0},
221
222 {"x": 0, "y": 1},
223 {"x": 1, "y": 1},
224 {"x": 2, "y": 1},
225 {"x": 3, "y": 1},
226 {"x": 4, "y": 1},
227 {"x": 5, "y": 1},
228 {"x": 6, "y": 1},
229 {"x": 7, "y": 1},
230 {"x": 8, "y": 1},
231 {"x": 9, "y": 1},
232 {"x": 10, "y": 1},
233 {"x": 11, "y": 1},
234
235 {"x": 0, "y": 2},
236 {"x": 1, "y": 2},
237 {"x": 2, "y": 2},
238 {"x": 3, "y": 2},
239 {"x": 4, "y": 2},
240 {"x": 5, "y": 2},
241 {"x": 6, "y": 2},
242 {"x": 7, "y": 2},
243 {"x": 8, "y": 2},
244 {"x": 9, "y": 2},
245 {"x": 10, "y": 2},
246 {"x": 11, "y": 2},
247
248 {"x": 0, "y": 3},
249 {"x": 1, "y": 3},
250 {"x": 2, "y": 3},
251 {"x": 3, "y": 3},
252 {"x": 4, "y": 3},
253 {"x": 5, "y": 3},
254 {"x": 6, "y": 3},
255 {"x": 7, "y": 3},
256 {"x": 8, "y": 3},
257 {"x": 9, "y": 3},
258 {"x": 10, "y": 3},
259 {"x": 11, "y": 3},
260
261 {"x": 0, "y": 4},
262 {"x": 1, "y": 4},
263 {"x": 2, "y": 4},
264 {"x": 3, "y": 4},
265 {"x": 4, "y": 4, "w": 2},
266 {"x": 6, "y": 4, "w": 2},
267 {"x": 8, "y": 4},
268 {"x": 9, "y": 4},
269 {"x": 10, "y": 4},
270 {"x": 11, "y": 4}
271 ]
272 },
273 "LAYOUT_ortho_5x12": {
274 "layout": [
275 {"x": 0, "y": 0},
276 {"x": 1, "y": 0},
277 {"x": 2, "y": 0},
278 {"x": 3, "y": 0},
279 {"x": 4, "y": 0},
280 {"x": 5, "y": 0},
281 {"x": 6, "y": 0},
282 {"x": 7, "y": 0},
283 {"x": 8, "y": 0},
284 {"x": 9, "y": 0},
285 {"x": 10, "y": 0},
286 {"x": 11, "y": 0},
287
288 {"x": 0, "y": 1},
289 {"x": 1, "y": 1},
290 {"x": 2, "y": 1},
291 {"x": 3, "y": 1},
292 {"x": 4, "y": 1},
293 {"x": 5, "y": 1},
294 {"x": 6, "y": 1},
295 {"x": 7, "y": 1},
296 {"x": 8, "y": 1},
297 {"x": 9, "y": 1},
298 {"x": 10, "y": 1},
299 {"x": 11, "y": 1},
300
301 {"x": 0, "y": 2},
302 {"x": 1, "y": 2},
303 {"x": 2, "y": 2},
304 {"x": 3, "y": 2},
305 {"x": 4, "y": 2},
306 {"x": 5, "y": 2},
307 {"x": 6, "y": 2},
308 {"x": 7, "y": 2},
309 {"x": 8, "y": 2},
310 {"x": 9, "y": 2},
311 {"x": 10, "y": 2},
312 {"x": 11, "y": 2},
313
314 {"x": 0, "y": 3},
315 {"x": 1, "y": 3},
316 {"x": 2, "y": 3},
317 {"x": 3, "y": 3},
318 {"x": 4, "y": 3},
319 {"x": 5, "y": 3},
320 {"x": 6, "y": 3},
321 {"x": 7, "y": 3},
322 {"x": 8, "y": 3},
323 {"x": 9, "y": 3},
324 {"x": 10, "y": 3},
325 {"x": 11, "y": 3},
326
327 {"x": 0, "y": 4},
328 {"x": 1, "y": 4},
329 {"x": 2, "y": 4},
330 {"x": 3, "y": 4},
331 {"x": 4, "y": 4},
332 {"x": 5, "y": 4},
333 {"x": 6, "y": 4},
334 {"x": 7, "y": 4},
335 {"x": 8, "y": 4},
336 {"x": 9, "y": 4},
337 {"x": 10, "y": 4},
338 {"x": 11, "y": 4}
339 ]
340 }
341 }
342}
diff --git a/keyboards/preonic/rev3_drop/matrix.c b/keyboards/preonic/rev3_drop/matrix.c
new file mode 100644
index 000000000..b094d28cd
--- /dev/null
+++ b/keyboards/preonic/rev3_drop/matrix.c
@@ -0,0 +1,168 @@
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 palSetPadMode(GPIOA, 3, PAL_MODE_INPUT_PULLDOWN);
66 palSetPadMode(GPIOA, 6, PAL_MODE_INPUT_PULLDOWN);
67
68 memset(matrix, 0, MATRIX_ROWS * sizeof(matrix_row_t));
69 memset(matrix_debouncing, 0, MATRIX_COLS * sizeof(matrix_row_t));
70
71 matrix_init_quantum();
72}
73
74uint8_t matrix_scan(void) {
75 // actual matrix
76 for (int col = 0; col < MATRIX_COLS; col++) {
77 matrix_row_t data = 0;
78
79 // strobe col { B11, B10, B2, B1, A7, B0 }
80 switch (col) {
81 case 0:
82 palSetPad(GPIOB, 11);
83 break;
84 case 1:
85 palSetPad(GPIOB, 10);
86 break;
87 case 2:
88 palSetPad(GPIOB, 2);
89 break;
90 case 3:
91 palSetPad(GPIOB, 1);
92 break;
93 case 4:
94 palSetPad(GPIOA, 7);
95 break;
96 case 5:
97 palSetPad(GPIOB, 0);
98 break;
99 }
100
101 // need wait to settle pin state
102 wait_us(20);
103
104 // read row data { A10, A9, A8, B15, C13, C14, C15, A2 }
105 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) | (palReadPad(GPIOA, 3) << 8) | (palReadPad(GPIOA, 6) << 9));
106
107 // unstrobe col { B11, B10, B2, B1, A7, B0 }
108 switch (col) {
109 case 0:
110 palClearPad(GPIOB, 11);
111 break;
112 case 1:
113 palClearPad(GPIOB, 10);
114 break;
115 case 2:
116 palClearPad(GPIOB, 2);
117 break;
118 case 3:
119 palClearPad(GPIOB, 1);
120 break;
121 case 4:
122 palClearPad(GPIOA, 7);
123 break;
124 case 5:
125 palClearPad(GPIOB, 0);
126 break;
127 }
128
129 if (matrix_debouncing[col] != data) {
130 matrix_debouncing[col] = data;
131 debouncing = true;
132 debouncing_time = timer_read();
133 }
134 }
135
136 if (debouncing && timer_elapsed(debouncing_time) > DEBOUNCE) {
137 for (int row = 0; row < MATRIX_ROWS; row++) {
138 matrix[row] = 0;
139 for (int col = 0; col < MATRIX_COLS; col++) {
140 matrix[row] |= ((matrix_debouncing[col] & (1 << row) ? 1 : 0) << col);
141 }
142 }
143 debouncing = false;
144 }
145
146 matrix_scan_quantum();
147
148 return 1;
149}
150
151bool matrix_is_on(uint8_t row, uint8_t col) { return (matrix[row] & (1 << col)); }
152
153matrix_row_t matrix_get_row(uint8_t row) { return matrix[row]; }
154
155void matrix_print(void) {
156 printf("\nr/c 01234567\n");
157 for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
158 printf("%X0: ", row);
159 matrix_row_t data = matrix_get_row(row);
160 for (int col = 0; col < MATRIX_COLS; col++) {
161 if (data & (1 << col))
162 printf("1");
163 else
164 printf("0");
165 }
166 printf("\n");
167 }
168}
diff --git a/keyboards/preonic/rev3_drop/mcuconf.h b/keyboards/preonic/rev3_drop/mcuconf.h
new file mode 100644
index 000000000..31abf13b6
--- /dev/null
+++ b/keyboards/preonic/rev3_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/preonic/rev3_drop/rev3_drop.c b/keyboards/preonic/rev3_drop/rev3_drop.c
new file mode 100644
index 000000000..0b3f452c4
--- /dev/null
+++ b/keyboards/preonic/rev3_drop/rev3_drop.c
@@ -0,0 +1,61 @@
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 "rev3_drop.h"
17
18#ifdef RGB_MATRIX_ENABLE
19led_config_t g_led_config = { {
20 // Key Matrix to LED Index
21 { NO_LED, 6, NO_LED, NO_LED, 5, NO_LED },
22 { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
23 { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, 0 },
24 { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
25 { NO_LED, 4, NO_LED, NO_LED, 3, NO_LED },
26 { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, 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, 7, NO_LED, NO_LED, 2, NO_LED },
30 { NO_LED, 1, NO_LED, NO_LED, 8, NO_LED },
31}, {
32 // LED Index to Physical Position
33 {112, 39}, {148, 60}, {206, 53}, {206, 3}, {150, 3}, {74, 3}, {18, 3}, {18, 54}, {77, 60}
34}, {
35 // LED Index to Flag
36 LED_FLAG_ALL, LED_FLAG_ALL, LED_FLAG_ALL, LED_FLAG_ALL, LED_FLAG_ALL,
37 LED_FLAG_ALL, LED_FLAG_ALL, LED_FLAG_ALL, LED_FLAG_ALL
38} };
39
40// LED physical location index
41// 6 5 4 3
42// 0
43// 7 8 1 2
44#endif
45
46
47#ifdef SWAP_HANDS_ENABLE
48__attribute__ ((weak))
49const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = {
50 {{5, 4}, {4, 4}, {3, 4}, {2, 4}, {1, 4}, {0, 4}},
51 {{5, 5}, {4, 5}, {3, 5}, {2, 5}, {1, 5}, {0, 5}},
52 {{5, 6}, {4, 6}, {3, 6}, {2, 6}, {1, 6}, {0, 6}},
53 {{5, 7}, {4, 7}, {3, 7}, {2, 7}, {1, 7}, {0, 7}},
54 {{5, 0}, {4, 0}, {3, 0}, {2, 0}, {1, 0}, {0, 0}},
55 {{5, 1}, {4, 1}, {3, 1}, {2, 1}, {1, 1}, {0, 1}},
56 {{5, 2}, {4, 2}, {3, 2}, {2, 2}, {1, 2}, {0, 2}},
57 {{5, 3}, {4, 3}, {3, 3}, {2, 3}, {1, 3}, {0, 3}},
58 {{5, 8}, {4, 8}, {3, 8}, {2, 8}, {1, 8}, {0, 8}},
59 {{5, 9}, {4, 9}, {3, 9}, {2, 9}, {1, 9}, {0, 9}},
60};
61#endif
diff --git a/keyboards/preonic/rev3_drop/rev3_drop.h b/keyboards/preonic/rev3_drop/rev3_drop.h
new file mode 100644
index 000000000..3cb936875
--- /dev/null
+++ b/keyboards/preonic/rev3_drop/rev3_drop.h
@@ -0,0 +1,115 @@
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
17#pragma once
18
19#include "preonic.h"
20
21// clang-format off
22#define LAYOUT_preonic_1x2uC( \
23 k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \
24 k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \
25 k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \
26 k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, \
27 k40, k41, k42, k43, k44, k45, k47, k48, k49, k4a, k4b \
28) { \
29 { k00, k01, k02, k03, k04, k05 }, \
30 { k10, k11, k12, k13, k14, k15 }, \
31 { k20, k21, k22, k23, k24, k25 }, \
32 { k30, k31, k32, k33, k34, k35 }, \
33 { k06, k07, k08, k09, k0a, k0b }, \
34 { k16, k17, k18, k19, k1a, k1b }, \
35 { k26, k27, k28, k29, k2a, k2b }, \
36 { k36, k37, k38, k39, k3a, k3b }, \
37 { k40, k41, k42, k49, k4a, k4b }, \
38 { k45, k47, k48, k43, k44, k45 } \
39}
40
41#define LAYOUT_preonic_1x2uR( \
42 k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \
43 k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \
44 k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \
45 k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, \
46 k40, k41, k42, k43, k44, k45, k47, k48, k49, k4a, k4b \
47 ) { \
48 { k00, k01, k02, k03, k04, k05 }, \
49 { k10, k11, k12, k13, k14, k15 }, \
50 { k20, k21, k22, k23, k24, k25 }, \
51 { k30, k31, k32, k33, k34, k35 }, \
52 { k06, k07, k08, k09, k0a, k0b }, \
53 { k16, k17, k18, k19, k1a, k1b }, \
54 { k26, k27, k28, k29, k2a, k2b }, \
55 { k36, k37, k38, k39, k3a, k3b }, \
56 { k40, k41, k42, k49, k4a, k4b }, \
57 { k47, k47, k48, k43, k44, k45 } \
58}
59
60#define LAYOUT_preonic_1x2uL( \
61 k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \
62 k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \
63 k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \
64 k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, \
65 k40, k41, k42, k43, k44, k46, k47, k48, k49, k4a, k4b \
66) { \
67 { k00, k01, k02, k03, k04, k05 }, \
68 { k10, k11, k12, k13, k14, k15 }, \
69 { k20, k21, k22, k23, k24, k25 }, \
70 { k30, k31, k32, k33, k34, k35 }, \
71 { k06, k07, k08, k09, k0a, k0b }, \
72 { k16, k17, k18, k19, k1a, k1b }, \
73 { k26, k27, k28, k29, k2a, k2b }, \
74 { k36, k37, k38, k39, k3a, k3b }, \
75 { k40, k41, k42, k49, k4a, k4b }, \
76 { k46, k47, k48, k43, k44, k44 } \
77}
78
79#define LAYOUT_preonic_2x2u( \
80 k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \
81 k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \
82 k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \
83 k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, \
84 k40, k41, k42, k43, k44, k46, k48, k49, k4a, k4b \
85) { \
86 { k00, k01, k02, k03, k04, k05 }, \
87 { k10, k11, k12, k13, k14, k15 }, \
88 { k20, k21, k22, k23, k24, k25 }, \
89 { k30, k31, k32, k33, k34, k35 }, \
90 { k06, k07, k08, k09, k0a, k0b }, \
91 { k16, k17, k18, k19, k1a, k1b }, \
92 { k26, k27, k28, k29, k2a, k2b }, \
93 { k36, k37, k38, k39, k3a, k3b }, \
94 { k40, k41, k42, k49, k4a, k4b }, \
95 { k46, k46, k48, k43, k44, k44 } \
96}
97
98#define LAYOUT_ortho_5x12( \
99 k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \
100 k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \
101 k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \
102 k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, \
103 k40, k41, k42, k43, k44, k45, k46, k47, k48, k49, k4a, k4b \
104) { \
105 { k00, k01, k02, k03, k04, k05 }, \
106 { k10, k11, k12, k13, k14, k15 }, \
107 { k20, k21, k22, k23, k24, k25 }, \
108 { k30, k31, k32, k33, k34, k35 }, \
109 { k06, k07, k08, k09, k0a, k0b }, \
110 { k16, k17, k18, k19, k1a, k1b }, \
111 { k26, k27, k28, k29, k2a, k2b }, \
112 { k36, k37, k38, k39, k3a, k3b }, \
113 { k40, k41, k42, k49, k4a, k4b }, \
114 { k46, k47, k48, k43, k44, k45 } \
115}
diff --git a/keyboards/preonic/rev3_drop/rules.mk b/keyboards/preonic/rev3_drop/rules.mk
new file mode 100644
index 000000000..8ab62afe2
--- /dev/null
+++ b/keyboards/preonic/rev3_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
24ENCODER_ENABLE = yes
25DIP_SWITCH_ENABLE = yes
26
27# Do not enable RGB_MATRIX_ENABLE together with RGBLIGHT_ENABLE
28RGB_MATRIX_ENABLE = no
29RGB_MATRIX_DRIVER = WS2812
30
31SRC += matrix.c
32
33LAYOUTS = ortho_5x12