8808fffc2f03cc1cf53452af63101470036de887

Author
Joel Challis <git@zvecr.com>
Committer
GitHub <noreply@github.com>
Date

Message

Refactor opendeck/32 (#24233)

Diff

  1diff --git a/keyboards/opendeck/32/keymaps/default/keymap.c b/keyboards/opendeck/32/keymaps/default/keymap.c
  2index 60cf2d5b717b9f596510bde5bd773a6bb7f2e416..63a162ae27fb864225d0c4da627fd6c19bb08b7a 100644
  3--- a/keyboards/opendeck/32/keymaps/default/keymap.c
  4+++ b/keyboards/opendeck/32/keymaps/default/keymap.c
  5@@ -15,23 +15,13 @@
  6  */
  7 #include QMK_KEYBOARD_H
  8 
  9-#define _BL 0
 10-
 11 // clang-format off
 12 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
 13-[_BL] = LAYOUT_ortho_4x8(
 14-    LSFT(KC_F13), LSFT(KC_F17), LSFT(KC_F21), LCTL(KC_F13), LCTL(KC_F17), LCTL(KC_F21), LALT(KC_F13), LALT(KC_F17),
 15-    LSFT(KC_F14), LSFT(KC_F18), LSFT(KC_F22), LCTL(KC_F14), LCTL(KC_F18), LCTL(KC_F22), LALT(KC_F14), LALT(KC_F18),
 16-    LSFT(KC_F15), LSFT(KC_F19), LSFT(KC_F23), LCTL(KC_F15), LCTL(KC_F19), LCTL(KC_F23), LALT(KC_F15), LALT(KC_F19),
 17-    LSFT(KC_F16), LSFT(KC_F20), LSFT(KC_F24), LCTL(KC_F16), LCTL(KC_F20), LCTL(KC_F24), LALT(KC_F16), LALT(KC_F20)
 18+    [0] = LAYOUT_ortho_4x8(
 19+        LSFT(KC_F13), LSFT(KC_F17), LSFT(KC_F21), LCTL(KC_F13), LCTL(KC_F17), LCTL(KC_F21), LALT(KC_F13), LALT(KC_F17),
 20+        LSFT(KC_F14), LSFT(KC_F18), LSFT(KC_F22), LCTL(KC_F14), LCTL(KC_F18), LCTL(KC_F22), LALT(KC_F14), LALT(KC_F18),
 21+        LSFT(KC_F15), LSFT(KC_F19), LSFT(KC_F23), LCTL(KC_F15), LCTL(KC_F19), LCTL(KC_F23), LALT(KC_F15), LALT(KC_F19),
 22+        LSFT(KC_F16), LSFT(KC_F20), LSFT(KC_F24), LCTL(KC_F16), LCTL(KC_F20), LCTL(KC_F24), LALT(KC_F16), LALT(KC_F20)
 23     )
 24 };
 25 // clang-format on
 26-
 27-void suspend_power_down_user(void) {
 28-    rgb_matrix_set_suspend_state(true);
 29-}
 30-
 31-void suspend_wakeup_init_user(void) {
 32-    rgb_matrix_set_suspend_state(false);
 33-}
 34diff --git a/keyboards/opendeck/32/rev1/config.h b/keyboards/opendeck/32/rev1/config.h
 35index 446cb047faa25cde41f3694fe9ebe54a63314bd7..f58c8fc7ab2e3300207f76c62fc207c6d47e6994 100644
 36--- a/keyboards/opendeck/32/rev1/config.h
 37+++ b/keyboards/opendeck/32/rev1/config.h
 38@@ -19,9 +19,4 @@
 39 #define IS31FL3731_SDB_PIN D2
 40 #define IS31FL3731_IRQ_PIN D3
 41 
 42-#define RGB_MATRIX_DISABLE_KEYCODES
 43-
 44-// Slim down the ROM
 45-#define NO_ACTION_LAYER
 46-#define NO_ACTION_TAPPING
 47-#define NO_ACTION_ONESHOT
 48+#define POWER_LED_PIN F1
 49diff --git a/keyboards/opendeck/32/rev1/keyboard.json b/keyboards/opendeck/32/rev1/keyboard.json
 50index e55c16c9fdd5d57f27ea816be87043b3a681cd5a..84d48ceb15ede5390da91331b9ea3eec4c894381 100644
 51--- a/keyboards/opendeck/32/rev1/keyboard.json
 52+++ b/keyboards/opendeck/32/rev1/keyboard.json
 53@@ -3,9 +3,9 @@
 54         "lto": true
 55     },
 56     "features": {
 57-        "bootmagic": false,
 58-        "extrakey": false,
 59-        "mousekey": false,
 60+        "bootmagic": true,
 61+        "extrakey": true,
 62+        "mousekey": true,
 63         "nkro": true,
 64         "rgb_matrix": true
 65     },
 66@@ -63,6 +63,40 @@
 67             "animation": "cycle_spiral"
 68         },
 69         "driver": "is31fl3731",
 70+        "layout": [
 71+            {"matrix": [0, 0], "x": 0, "y": 0, "flags": 4},
 72+            {"matrix": [0, 1], "x": 32, "y": 0, "flags": 4},
 73+            {"matrix": [0, 2], "x": 64, "y": 0, "flags": 4},
 74+            {"matrix": [0, 3], "x": 96, "y": 0, "flags": 4},
 75+            {"matrix": [0, 4], "x": 128, "y": 0, "flags": 4},
 76+            {"matrix": [0, 5], "x": 160, "y": 0, "flags": 4},
 77+            {"matrix": [0, 6], "x": 192, "y": 0, "flags": 4},
 78+            {"matrix": [0, 7], "x": 224, "y": 0, "flags": 4},
 79+            {"matrix": [1, 0], "x": 0, "y": 21, "flags": 4},
 80+            {"matrix": [1, 1], "x": 32, "y": 21, "flags": 4},
 81+            {"matrix": [1, 2], "x": 64, "y": 21, "flags": 4},
 82+            {"matrix": [1, 3], "x": 96, "y": 21, "flags": 4},
 83+            {"matrix": [1, 4], "x": 128, "y": 21, "flags": 4},
 84+            {"matrix": [1, 5], "x": 160, "y": 21, "flags": 4},
 85+            {"matrix": [1, 6], "x": 192, "y": 21, "flags": 4},
 86+            {"matrix": [1, 7], "x": 224, "y": 21, "flags": 4},
 87+            {"matrix": [2, 0], "x": 0, "y": 43, "flags": 4},
 88+            {"matrix": [2, 1], "x": 32, "y": 43, "flags": 4},
 89+            {"matrix": [2, 2], "x": 64, "y": 43, "flags": 4},
 90+            {"matrix": [2, 3], "x": 96, "y": 43, "flags": 4},
 91+            {"matrix": [2, 4], "x": 128, "y": 43, "flags": 4},
 92+            {"matrix": [2, 5], "x": 160, "y": 43, "flags": 4},
 93+            {"matrix": [2, 6], "x": 192, "y": 43, "flags": 4},
 94+            {"matrix": [2, 7], "x": 224, "y": 43, "flags": 4},
 95+            {"matrix": [3, 0], "x": 0, "y": 64, "flags": 4},
 96+            {"matrix": [3, 1], "x": 32, "y": 64, "flags": 4},
 97+            {"matrix": [3, 2], "x": 64, "y": 64, "flags": 4},
 98+            {"matrix": [3, 3], "x": 96, "y": 64, "flags": 4},
 99+            {"matrix": [3, 4], "x": 128, "y": 64, "flags": 4},
100+            {"matrix": [3, 5], "x": 160, "y": 64, "flags": 4},
101+            {"matrix": [3, 6], "x": 192, "y": 64, "flags": 4},
102+            {"matrix": [3, 7], "x": 224, "y": 64, "flags": 4}
103+        ],
104         "sleep": true
105     },
106     "diode_direction": "COL2ROW",
107diff --git a/keyboards/opendeck/32/rev1/rev1.c b/keyboards/opendeck/32/rev1/rev1.c
108index ca05d12243a09552f400a660cdc82fa9fe0133a8..cb5fee178eca97734b22033a902063d9f6523e06 100644
109--- a/keyboards/opendeck/32/rev1/rev1.c
110+++ b/keyboards/opendeck/32/rev1/rev1.c
111@@ -14,7 +14,7 @@
112  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
113  */
114 
115-#include "rev1.h"
116+#include "quantum.h"
117 
118 #ifdef RGB_MATRIX_ENABLE
119 const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = {
120@@ -63,31 +63,6 @@ const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = {
121     // clang-format on
122 };
123 
124-// clang-format off
125-led_config_t g_led_config = {
126-    {
127-        // Key Matrix to LED Index
128-        {  0,  1,  2,  3,  4,  5,  6,  7 },
129-        {  8,  9, 10, 11, 12, 13, 14, 15 },
130-        { 16, 17, 18, 19, 20, 21, 22, 23 },
131-        { 24, 25, 26, 27, 28, 29, 30, 31 }
132-    }, {
133-        // LED Index to Physical Position
134-        { 0,  0 }, { 32,  0 }, { 64,  0 }, { 96,  0 }, { 128,  0 }, { 160,  0 }, { 192,  0 }, { 224,  0 },
135-        { 0, 21 }, { 32, 21 }, { 64, 21 }, { 96, 21 }, { 128, 21 }, { 160, 21 }, { 192, 21 }, { 224, 21 },
136-        { 0, 43 }, { 32, 43 }, { 64, 43 }, { 96, 43 }, { 128, 43 }, { 160, 43 }, { 192, 43 }, { 224, 43 },
137-        { 0, 64 }, { 32, 64 }, { 64, 64 }, { 96, 64 }, { 128, 64 }, { 160, 64 }, { 192, 64 }, { 224, 64 }
138-    }, {
139-        // LED Index to Flag
140-        4, 4, 4, 4, 4, 4, 4, 4,
141-        4, 4, 4, 4, 4, 4, 4, 4,
142-        4, 4, 4, 4, 4, 4, 4, 4,
143-        4, 4, 4, 4, 4, 4, 4, 4
144-    }
145-};
146-
147-// clang-format on
148-
149 void keyboard_pre_init_kb(void) {
150     // Light power LED
151     gpio_set_pin_output(POWER_LED_PIN);
152@@ -100,37 +75,4 @@ void keyboard_pre_init_kb(void) {
153     keyboard_pre_init_user();
154 }
155 
156-void keyboard_post_init_kb(void) {
157-    // RGB enabled by default, no way to turn off. No need to expend EEPROM write cycles here.
158-    rgb_matrix_enable_noeeprom();
159-
160-    keyboard_post_init_user();
161-}
162-#endif
163-
164-#if defined(KC_WRAPPER_KEY)
165-
166-static uint8_t g_key_wrapper_tracker = 0;
167-
168-bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
169-    if (!process_record_user(keycode, record)) { return false; }
170-    if (record->event.pressed && keycode != KC_WRAPPER_KEY) {
171-        register_code(KC_WRAPPER_KEY);
172-        register_code(keycode);
173-        g_key_wrapper_tracker++;
174-        return false;
175-    }
176-    return true;
177-}
178-
179-void post_process_record_kb(uint16_t keycode, keyrecord_t *record) {
180-    if (!record->event.pressed && keycode != KC_WRAPPER_KEY) {
181-        --g_key_wrapper_tracker;
182-        if (g_key_wrapper_tracker <= 0) {
183-            unregister_code(KC_WRAPPER_KEY);
184-            g_key_wrapper_tracker = 0;
185-        }
186-    }
187-    post_process_record_user(keycode, record);
188-}
189 #endif
190diff --git a/keyboards/opendeck/32/rev1/rev1.h b/keyboards/opendeck/32/rev1/rev1.h
191deleted file mode 100644
192index 455b2ac7531da4cbe7d031a331be9327e6781582..0000000000000000000000000000000000000000
193--- a/keyboards/opendeck/32/rev1/rev1.h
194+++ /dev/null
195@@ -1,29 +0,0 @@
196-/* Copyright 2020 cmdremily
197- *
198- * This program is free software: you can redistribute it and/or modify
199- * it under the terms of the GNU General Public License as published by
200- * the Free Software Foundation, either version 2 of the License, or
201- * (at your option) any later version.
202- *
203- * This program is distributed in the hope that it will be useful,
204- * but WITHOUT ANY WARRANTY; without even the implied warranty of
205- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
206- * GNU General Public License for more details.
207- *
208- * You should have received a copy of the GNU General Public License
209- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
210- */
211-
212-#pragma once
213-
214-#include "quantum.h"
215-
216-#define POWER_LED_PIN F1
217-
218-// If you want something similar to what Taran from LMG does in https://github.com/TaranVH/2nd-keyboard
219-// you can create a "wrapper key" by uncommenting the row below and chosing your wrapper keycode.
220-// You can then change the keymap in ../keymaps/default/keymap.c to adjust what key is sent inside the
221-// wrapper.
222-// Note: The default is to not wrap and to send F13-F24 with combinations of shift/control/alt as these
223-// are immediately usable in most software (e.g. OBS and DCSB for streaming) without using AHK.
224-//#define KC_WRAPPER_KEY KC_F24