aboutsummaryrefslogtreecommitdiff
path: root/keyboards/preonic/rev3_drop
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/preonic/rev3_drop')
-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
9 files changed, 919 insertions, 0 deletions
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