fda514bbd7bb26a8a6cc12cd1d5e36b0d12e7ae0

Author
ReFil <31960031+ReFil@users.noreply.github.com>
Committer
GitHub <noreply@github.com>
Date

Message

[Keyboard] Polarity works CRBN support (#11107)

* Initial CRBN compatibility

Updated readme.md too

* formatting tweaks to meet requirements

* Update crbn.c

* Create readme.md

* Required fixes and licence header

* Fixes

* Apply suggestions from code review

Co-authored-by: Ryan <fauxpark@gmail.com>

* Update keyboards/crbn/rules.mk

Co-authored-by: Ryan <fauxpark@gmail.com>

* Update keyboards/readme.md

Co-authored-by: Ryan <fauxpark@gmail.com>

* Update crbn.c

* Update keyboards/crbn/crbn.c

Co-authored-by: Drashna Jaelre <drashna@live.com>

* Licence headers

* Create info.json

* Apply suggestions from code review

Co-authored-by: Ryan <fauxpark@gmail.com>

* Configurator support

* Update keymap.c

* Update keymap.c

Co-authored-by: Ryan <fauxpark@gmail.com>
Co-authored-by: Drashna Jaelre <drashna@live.com>

Diff

This diff is truncated to protect this page.

  1diff --git a/keyboards/crbn/config.h b/keyboards/crbn/config.h
  2new file mode 100644
  3index 0000000000000000000000000000000000000000..88730222696730b6d4642169d57fb5bca68bf41a
  4--- /dev/null
  5+++ b/keyboards/crbn/config.h
  6@@ -0,0 +1,54 @@
  7+/* Copyright 2020 Harry Herring
  8+ *
  9+ * This program is free software: you can redistribute it and/or modify
 10+ * it under the terms of the GNU General Public License as published by
 11+ * the Free Software Foundation, either version 2 of the License, or
 12+ * (at your option) any later version.
 13+ *
 14+ * This program is distributed in the hope that it will be useful,
 15+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 16+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 17+ * GNU General Public License for more details.
 18+ *
 19+ * You should have received a copy of the GNU General Public License
 20+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 21+ */
 22+
 23+#pragma once
 24+
 25+#include "config_common.h"
 26+
 27+/* USB Device descriptor parameter */
 28+#define VENDOR_ID       0x726F
 29+#define PRODUCT_ID      0x0002
 30+#define DEVICE_VER      0x0001
 31+#define MANUFACTURER    Polarity Works
 32+#define PRODUCT         CRBN
 33+
 34+/* key matrix size */
 35+#define MATRIX_ROWS 4
 36+#define MATRIX_COLS 12
 37+
 38+/* key matrix pins */
 39+#define MATRIX_ROW_PINS { B3, B1, F7, F6 }
 40+#define MATRIX_COL_PINS { D3, D2, D1, D0, D4, C6, D7, E6, B4, B5, B6, B2 }
 41+#define UNUSED_PINS
 42+
 43+/* COL2ROW or ROW2COL */
 44+#define DIODE_DIRECTION COL2ROW
 45+
 46+/*Rotary Encoder Pins*/
 47+#define ENCODERS_PAD_A { F5 }
 48+#define ENCODERS_PAD_B { F4 }
 49+
 50+/*Sets the number of pulses per increment*/
 51+#define ENCODER_RESOLUTION 2
 52+
 53+/* Set 0 if debouncing isn't needed */
 54+#define DEBOUNCE 5
 55+
 56+/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
 57+#define LOCKING_SUPPORT_ENABLE
 58+
 59+/* Locking resynchronize hack */
 60+#define LOCKING_RESYNC_ENABLE
 61diff --git a/keyboards/crbn/crbn.c b/keyboards/crbn/crbn.c
 62new file mode 100644
 63index 0000000000000000000000000000000000000000..1da726b9c70832c29f820eadefeb7fdb0f19b84b
 64--- /dev/null
 65+++ b/keyboards/crbn/crbn.c
 66@@ -0,0 +1,24 @@
 67+/* Copyright 2020 Harry Herring
 68+ *
 69+ * This program is free software: you can redistribute it and/or modify
 70+ * it under the terms of the GNU General Public License as published by
 71+ * the Free Software Foundation, either version 2 of the License, or
 72+ * (at your option) any later version.
 73+ *
 74+ * This program is distributed in the hope that it will be useful,
 75+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 76+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 77+ * GNU General Public License for more details.
 78+ *
 79+ * You should have received a copy of the GNU General Public License
 80+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 81+ */
 82+#include "crbn.h"
 83+/* Encoder setting. only one encoder despite 4 possible spots */
 84+__attribute__((weak)) void encoder_update_user(uint8_t index, bool clockwise) {
 85+    if (clockwise) {
 86+        tap_code(KC_VOLU);
 87+    } else {
 88+        tap_code(KC_VOLD);
 89+    }
 90+}
 91diff --git a/keyboards/crbn/crbn.h b/keyboards/crbn/crbn.h
 92new file mode 100644
 93index 0000000000000000000000000000000000000000..54ff0070740550d2564c5089a4fd81a1927dfd65
 94--- /dev/null
 95+++ b/keyboards/crbn/crbn.h
 96@@ -0,0 +1,42 @@
 97+/* Copyright 2020 Harry Herring
 98+	*
 99+	* This program is free software: you can redistribute it and/or modify
100+	* it under the terms of the GNU General Public License as published by
101+	* the Free Software Foundation, either version 2 of the License, or
102+	* (at your option) any later version.
103+	*
104+	* This program is distributed in the hope that it will be useful,
105+	* but WITHOUT ANY WARRANTY; without even the implied warranty of
106+	* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
107+	* GNU General Public License for more details.
108+	*
109+	* You should have received a copy of the GNU General Public License
110+	* along with this program.  If not, see <http://www.gnu.org/licenses/>.
111+	*/
112+#pragma once
113+
114+#include "quantum.h"
115+
116+#define LAYOUT_crbn_1x2u( \
117+		K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, \
118+		K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, \
119+		K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, \
120+		K300, K301, K302, K303, K304,    K305,    K307, K308, K309, K310, K311  \
121+) { \
122+		{ K000,  K001,  K002,  K003,  K004,  K005,  K006,  K007,  K008,  K009,  K010,  K011 }, \
123+		{ K100,  K101,  K102,  K103,  K104,  K105,  K106,  K107,  K108,  K109,  K110,  K111 }, \
124+		{ K200,  K201,  K202,  K203,  K204,  K205,  K206,  K207,  K208,  K209,  K210,  K211 }, \
125+		{ K300,  K301,  K302,  K303,  K304,  K305, KC_NO,  K307,  K308,  K309,  K310,  K311 }  \
126+}
127+
128+#define LAYOUT_crbn_2x2u( \
129+		K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, \
130+		K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, \
131+		K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, \
132+		K300, K301, K302, K303,    K304,       K307,    K308, K309, K310, K311  \
133+) { \
134+		{ K000,  K001,  K002,  K003,  K004,  K005,  K006,  K007,  K008,  K009,  K010,  K011 }, \
135+		{ K100,  K101,  K102,  K103,  K104,  K105,  K106,  K107,  K108,  K109,  K110,  K111 }, \
136+		{ K200,  K201,  K202,  K203,  K204,  K205,  K206,  K207,  K208,  K209,  K210,  K211 }, \
137+		{ K300,  K301,  K302,  K303,  K304, KC_NO, KC_NO,  K307,  K308,  K309,  K310,  K311 }  \
138+}
139diff --git a/keyboards/crbn/info.json b/keyboards/crbn/info.json
140new file mode 100644
141index 0000000000000000000000000000000000000000..7b676680758b0126e2b15e04b8e8b925207439b1
142--- /dev/null
143+++ b/keyboards/crbn/info.json
144@@ -0,0 +1,109 @@
145+{
146+  "keyboard_name": "CRBN",
147+  "keyboard_folder": "crbn",
148+  "url": "polarityworks.com",
149+  "maintainer": "qmk",
150+  "width": 12,
151+  "height": 4,
152+  "layouts": {
153+    "LAYOUT_crbn_1x2u": {
154+      "layout": [
155+        { "w": 1, "x": 0, "y": 0 },
156+        { "w": 1, "x": 1, "y": 0 },
157+        { "w": 1, "x": 2, "y": 0 },
158+        { "w": 1, "x": 3, "y": 0 },
159+        { "w": 1, "x": 4, "y": 0 },
160+        { "w": 1, "x": 5, "y": 0 },
161+        { "w": 1, "x": 6, "y": 0 },
162+        { "w": 1, "x": 7, "y": 0 },
163+        { "w": 1, "x": 8, "y": 0 },
164+        { "w": 1, "x": 9, "y": 0 },
165+        { "w": 1, "x": 10, "y": 0 },
166+        { "w": 1, "x": 11, "y": 0 },
167+        { "w": 1, "x": 0, "y": 1 },
168+        { "w": 1, "x": 1, "y": 1 },
169+        { "w": 1, "x": 2, "y": 1 },
170+        { "w": 1, "x": 3, "y": 1 },
171+        { "w": 1, "x": 4, "y": 1 },
172+        { "w": 1, "x": 5, "y": 1 },
173+        { "w": 1, "x": 6, "y": 1 },
174+        { "w": 1, "x": 7, "y": 1 },
175+        { "w": 1, "x": 8, "y": 1 },
176+        { "w": 1, "x": 9, "y": 1 },
177+        { "w": 1, "x": 10, "y": 1 },
178+        { "w": 1, "x": 11, "y": 1 },
179+        { "w": 1, "x": 0, "y": 2 },
180+        { "w": 1, "x": 1, "y": 2 },
181+        { "w": 1, "x": 2, "y": 2 },
182+        { "w": 1, "x": 3, "y": 2 },
183+        { "w": 1, "x": 4, "y": 2 },
184+        { "w": 1, "x": 5, "y": 2 },
185+        { "w": 1, "x": 6, "y": 2 },
186+        { "w": 1, "x": 7, "y": 2 },
187+        { "w": 1, "x": 8, "y": 2 },
188+        { "w": 1, "x": 9, "y": 2 },
189+        { "w": 1, "x": 10, "y": 2 },
190+        { "w": 1, "x": 11, "y": 2 },
191+        { "w": 1, "x": 0, "y": 3 },
192+        { "w": 1, "x": 1, "y": 3 },
193+        { "w": 1, "x": 2, "y": 3 },
194+        { "w": 1, "x": 3, "y": 3 },
195+        { "w": 1, "x": 4, "y": 3 },
196+        { "w": 2, "x": 5, "y": 3 },
197+        { "w": 1, "x": 7, "y": 3 },
198+        { "w": 1, "x": 8, "y": 3 },
199+        { "w": 1, "x": 9, "y": 3 },
200+        { "w": 1, "x": 10, "y": 3 },
201+        { "w": 1, "x": 11, "y": 3 } ]
202+    },
203+    "LAYOUT_crbn_2x2u": {
204+      "layout": [
205+        { "w": 1, "x": 0, "y": 0 },
206+        { "w": 1, "x": 1, "y": 0 },
207+        { "w": 1, "x": 2, "y": 0 },
208+        { "w": 1, "x": 3, "y": 0 },
209+        { "w": 1, "x": 4, "y": 0 },
210+        { "w": 1, "x": 5, "y": 0 },
211+        { "w": 1, "x": 6, "y": 0 },
212+        { "w": 1, "x": 7, "y": 0 },
213+        { "w": 1, "x": 8, "y": 0 },
214+        { "w": 1, "x": 9, "y": 0 },
215+        { "w": 1, "x": 10, "y": 0 },
216+        { "w": 1, "x": 11, "y": 0 },
217+        { "w": 1, "x": 0, "y": 1 },
218+        { "w": 1, "x": 1, "y": 1 },
219+        { "w": 1, "x": 2, "y": 1 },
220+        { "w": 1, "x": 3, "y": 1 },
221+        { "w": 1, "x": 4, "y": 1 },
222+        { "w": 1, "x": 5, "y": 1 },
223+        { "w": 1, "x": 6, "y": 1 },
224+        { "w": 1, "x": 7, "y": 1 },
225+        { "w": 1, "x": 8, "y": 1 },
226+        { "w": 1, "x": 9, "y": 1 },
227+        { "w": 1, "x": 10, "y": 1 },
228+        { "w": 1, "x": 11, "y": 1 },
229+        { "w": 1, "x": 0, "y": 2 },
230+        { "w": 1, "x": 1, "y": 2 },
231+        { "w": 1, "x": 2, "y": 2 },
232+        { "w": 1, "x": 3, "y": 2 },
233+        { "w": 1, "x": 4, "y": 2 },
234+        { "w": 1, "x": 5, "y": 2 },
235+        { "w": 1, "x": 6, "y": 2 },
236+        { "w": 1, "x": 7, "y": 2 },
237+        { "w": 1, "x": 8, "y": 2 },
238+        { "w": 1, "x": 9, "y": 2 },
239+        { "w": 1, "x": 10, "y": 2 },
240+        { "w": 1, "x": 11, "y": 2 },
241+        { "w": 1, "x": 0, "y": 3 },
242+        { "w": 1, "x": 1, "y": 3 },
243+        { "w": 1, "x": 2, "y": 3 },
244diff --git a/keyboards/crbn/keymaps/default/keymap.c b/keyboards/crbn/keymaps/default/keymap.c
245new file mode 100644
246index 0000000000000000000000000000000000000000..a86c5e3d6e6d0366576531d467587775ead1b395
247--- /dev/null
248+++ b/keyboards/crbn/keymaps/default/keymap.c
249@@ -0,0 +1,45 @@
250+/* Copyright 2020 Harry Herring
251+ *
252+ * This program is free software: you can redistribute it and/or modify
253+ * it under the terms of the GNU General Public License as published by
254+ * the Free Software Foundation, either version 2 of the License, or
255+ * (at your option) any later version.
256+ *
257+ * This program is distributed in the hope that it will be useful,
258+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
259+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
260+ * GNU General Public License for more details.
261+ *
262+ * You should have received a copy of the GNU General Public License
263+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
264+ */
265+
266+#include QMK_KEYBOARD_H
267+
268+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
269+
270+		LAYOUT_crbn_1x2u(
271+				KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
272+				KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
273+				KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT,
274+				MO(3), KC_LCTL, KC_LALT, KC_LGUI, MO(1), KC_SPC, MO(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT),
275+
276+		LAYOUT_crbn_1x2u(
277+				KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_TRNS,
278+				KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE,
279+				KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, LSFT(KC_NUHS), LSFT(KC_NUBS), KC_HOME, KC_END, KC_TRNS,
280+				KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY),
281+
282+		LAYOUT_crbn_1x2u(
283+				KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_TRNS,
284+				KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS,
285+				KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, KC_PGUP, KC_PGDN, KC_TRNS,
286+				KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY),
287+
288+		LAYOUT_crbn_1x2u(
289+				RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
290+				KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
291+				KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
292+				KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
293+
294+};
295diff --git a/keyboards/crbn/readme.md b/keyboards/crbn/readme.md
296new file mode 100644
297index 0000000000000000000000000000000000000000..a8a1535c3369ecd6bb42fd048b006e61fc2d2700
298--- /dev/null
299+++ b/keyboards/crbn/readme.md
300@@ -0,0 +1,19 @@
301+# CRBN
302+
303+A compact 40% (12x4) ortholinear keyboard kit made by Polarity Works and sold by keygem
304+
305+* Keyboard Maintainer: [ReFil](https://github.com/ReFil)
306+* Hardware Supported: CRBN kit with a pro micro
307+* Hardware Availability: [Keygem](https://keygem.store/collections/group-buys/products/group-buy-featherlight-40-kit)
308+
309+Support for this keyboard is available in the Polarity Works [discord](https://discord.gg/NysAH3Gser)
310+
311+Make example for this keyboard (after setting up your build environment):
312+
313+    make crbn:default
314+
315+Flashing example for this keyboard:
316+
317+    make crbn:default:flash
318+
319diff --git a/keyboards/crbn/rules.mk b/keyboards/crbn/rules.mk
320new file mode 100644
321index 0000000000000000000000000000000000000000..9e47502904b970112d99777190c798365ecb2b6b
322--- /dev/null
323+++ b/keyboards/crbn/rules.mk
324@@ -0,0 +1,23 @@
325+# MCU name
326+MCU = atmega32u4
327+
328+# Bootloader selection
329+BOOTLOADER = caterina
330+
331+# Build Options
332+#   change yes to no to disable
333+#
334+BOOTMAGIC_ENABLE = full     # Virtual DIP switch configuration
335+MOUSEKEY_ENABLE = yes       # Mouse keys
336+EXTRAKEY_ENABLE = yes       # Audio control and System control
337+CONSOLE_ENABLE = no         # Console for debug
338+COMMAND_ENABLE = no         # Commands for debug and configuration
339+# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
340+SLEEP_LED_ENABLE = no       # Breathing sleep LED during USB suspend
341+# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
342+NKRO_ENABLE = yes           # USB Nkey Rollover
343+BACKLIGHT_ENABLE = no       # Enable keyboard backlight functionality
344+RGBLIGHT_ENABLE = no        # Enable keyboard RGB underglow
345+BLUETOOTH_ENABLE = no       # Enable Bluetooth
346+AUDIO_ENABLE = no           # Audio output
347+ENCODER_ENABLE = yes