From 8808fffc2f03cc1cf53452af63101470036de887 Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Sat, 3 Aug 2024 23:10:09 +0100 Subject: [PATCH] Refactor opendeck/32 (#24233) --- .../opendeck/32/keymaps/default/keymap.c | 20 ++----- keyboards/opendeck/32/rev1/config.h | 7 +-- keyboards/opendeck/32/rev1/keyboard.json | 40 ++++++++++++- keyboards/opendeck/32/rev1/rev1.c | 60 +------------------ keyboards/opendeck/32/rev1/rev1.h | 29 --------- 5 files changed, 44 insertions(+), 112 deletions(-) delete mode 100644 keyboards/opendeck/32/rev1/rev1.h diff --git a/keyboards/opendeck/32/keymaps/default/keymap.c b/keyboards/opendeck/32/keymaps/default/keymap.c index 60cf2d5b71..63a162ae27 100644 --- a/keyboards/opendeck/32/keymaps/default/keymap.c +++ b/keyboards/opendeck/32/keymaps/default/keymap.c @@ -15,23 +15,13 @@ */ #include QMK_KEYBOARD_H -#define _BL 0 - // clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -[_BL] = LAYOUT_ortho_4x8( - LSFT(KC_F13), LSFT(KC_F17), LSFT(KC_F21), LCTL(KC_F13), LCTL(KC_F17), LCTL(KC_F21), LALT(KC_F13), LALT(KC_F17), - LSFT(KC_F14), LSFT(KC_F18), LSFT(KC_F22), LCTL(KC_F14), LCTL(KC_F18), LCTL(KC_F22), LALT(KC_F14), LALT(KC_F18), - LSFT(KC_F15), LSFT(KC_F19), LSFT(KC_F23), LCTL(KC_F15), LCTL(KC_F19), LCTL(KC_F23), LALT(KC_F15), LALT(KC_F19), - LSFT(KC_F16), LSFT(KC_F20), LSFT(KC_F24), LCTL(KC_F16), LCTL(KC_F20), LCTL(KC_F24), LALT(KC_F16), LALT(KC_F20) + [0] = LAYOUT_ortho_4x8( + LSFT(KC_F13), LSFT(KC_F17), LSFT(KC_F21), LCTL(KC_F13), LCTL(KC_F17), LCTL(KC_F21), LALT(KC_F13), LALT(KC_F17), + LSFT(KC_F14), LSFT(KC_F18), LSFT(KC_F22), LCTL(KC_F14), LCTL(KC_F18), LCTL(KC_F22), LALT(KC_F14), LALT(KC_F18), + LSFT(KC_F15), LSFT(KC_F19), LSFT(KC_F23), LCTL(KC_F15), LCTL(KC_F19), LCTL(KC_F23), LALT(KC_F15), LALT(KC_F19), + LSFT(KC_F16), LSFT(KC_F20), LSFT(KC_F24), LCTL(KC_F16), LCTL(KC_F20), LCTL(KC_F24), LALT(KC_F16), LALT(KC_F20) ) }; // clang-format on - -void suspend_power_down_user(void) { - rgb_matrix_set_suspend_state(true); -} - -void suspend_wakeup_init_user(void) { - rgb_matrix_set_suspend_state(false); -} diff --git a/keyboards/opendeck/32/rev1/config.h b/keyboards/opendeck/32/rev1/config.h index 446cb047fa..f58c8fc7ab 100644 --- a/keyboards/opendeck/32/rev1/config.h +++ b/keyboards/opendeck/32/rev1/config.h @@ -19,9 +19,4 @@ #define IS31FL3731_SDB_PIN D2 #define IS31FL3731_IRQ_PIN D3 -#define RGB_MATRIX_DISABLE_KEYCODES - -// Slim down the ROM -#define NO_ACTION_LAYER -#define NO_ACTION_TAPPING -#define NO_ACTION_ONESHOT +#define POWER_LED_PIN F1 diff --git a/keyboards/opendeck/32/rev1/keyboard.json b/keyboards/opendeck/32/rev1/keyboard.json index e55c16c9fd..84d48ceb15 100644 --- a/keyboards/opendeck/32/rev1/keyboard.json +++ b/keyboards/opendeck/32/rev1/keyboard.json @@ -3,9 +3,9 @@ "lto": true }, "features": { - "bootmagic": false, - "extrakey": false, - "mousekey": false, + "bootmagic": true, + "extrakey": true, + "mousekey": true, "nkro": true, "rgb_matrix": true }, @@ -63,6 +63,40 @@ "animation": "cycle_spiral" }, "driver": "is31fl3731", + "layout": [ + {"matrix": [0, 0], "x": 0, "y": 0, "flags": 4}, + {"matrix": [0, 1], "x": 32, "y": 0, "flags": 4}, + {"matrix": [0, 2], "x": 64, "y": 0, "flags": 4}, + {"matrix": [0, 3], "x": 96, "y": 0, "flags": 4}, + {"matrix": [0, 4], "x": 128, "y": 0, "flags": 4}, + {"matrix": [0, 5], "x": 160, "y": 0, "flags": 4}, + {"matrix": [0, 6], "x": 192, "y": 0, "flags": 4}, + {"matrix": [0, 7], "x": 224, "y": 0, "flags": 4}, + {"matrix": [1, 0], "x": 0, "y": 21, "flags": 4}, + {"matrix": [1, 1], "x": 32, "y": 21, "flags": 4}, + {"matrix": [1, 2], "x": 64, "y": 21, "flags": 4}, + {"matrix": [1, 3], "x": 96, "y": 21, "flags": 4}, + {"matrix": [1, 4], "x": 128, "y": 21, "flags": 4}, + {"matrix": [1, 5], "x": 160, "y": 21, "flags": 4}, + {"matrix": [1, 6], "x": 192, "y": 21, "flags": 4}, + {"matrix": [1, 7], "x": 224, "y": 21, "flags": 4}, + {"matrix": [2, 0], "x": 0, "y": 43, "flags": 4}, + {"matrix": [2, 1], "x": 32, "y": 43, "flags": 4}, + {"matrix": [2, 2], "x": 64, "y": 43, "flags": 4}, + {"matrix": [2, 3], "x": 96, "y": 43, "flags": 4}, + {"matrix": [2, 4], "x": 128, "y": 43, "flags": 4}, + {"matrix": [2, 5], "x": 160, "y": 43, "flags": 4}, + {"matrix": [2, 6], "x": 192, "y": 43, "flags": 4}, + {"matrix": [2, 7], "x": 224, "y": 43, "flags": 4}, + {"matrix": [3, 0], "x": 0, "y": 64, "flags": 4}, + {"matrix": [3, 1], "x": 32, "y": 64, "flags": 4}, + {"matrix": [3, 2], "x": 64, "y": 64, "flags": 4}, + {"matrix": [3, 3], "x": 96, "y": 64, "flags": 4}, + {"matrix": [3, 4], "x": 128, "y": 64, "flags": 4}, + {"matrix": [3, 5], "x": 160, "y": 64, "flags": 4}, + {"matrix": [3, 6], "x": 192, "y": 64, "flags": 4}, + {"matrix": [3, 7], "x": 224, "y": 64, "flags": 4} + ], "sleep": true }, "diode_direction": "COL2ROW", diff --git a/keyboards/opendeck/32/rev1/rev1.c b/keyboards/opendeck/32/rev1/rev1.c index ca05d12243..cb5fee178e 100644 --- a/keyboards/opendeck/32/rev1/rev1.c +++ b/keyboards/opendeck/32/rev1/rev1.c @@ -14,7 +14,7 @@ * along with this program. If not, see . */ -#include "rev1.h" +#include "quantum.h" #ifdef RGB_MATRIX_ENABLE const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = { @@ -63,31 +63,6 @@ const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = { // clang-format on }; -// clang-format off -led_config_t g_led_config = { - { - // Key Matrix to LED Index - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 8, 9, 10, 11, 12, 13, 14, 15 }, - { 16, 17, 18, 19, 20, 21, 22, 23 }, - { 24, 25, 26, 27, 28, 29, 30, 31 } - }, { - // LED Index to Physical Position - { 0, 0 }, { 32, 0 }, { 64, 0 }, { 96, 0 }, { 128, 0 }, { 160, 0 }, { 192, 0 }, { 224, 0 }, - { 0, 21 }, { 32, 21 }, { 64, 21 }, { 96, 21 }, { 128, 21 }, { 160, 21 }, { 192, 21 }, { 224, 21 }, - { 0, 43 }, { 32, 43 }, { 64, 43 }, { 96, 43 }, { 128, 43 }, { 160, 43 }, { 192, 43 }, { 224, 43 }, - { 0, 64 }, { 32, 64 }, { 64, 64 }, { 96, 64 }, { 128, 64 }, { 160, 64 }, { 192, 64 }, { 224, 64 } - }, { - // LED Index to Flag - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4 - } -}; - -// clang-format on - void keyboard_pre_init_kb(void) { // Light power LED gpio_set_pin_output(POWER_LED_PIN); @@ -100,37 +75,4 @@ void keyboard_pre_init_kb(void) { keyboard_pre_init_user(); } -void keyboard_post_init_kb(void) { - // RGB enabled by default, no way to turn off. No need to expend EEPROM write cycles here. - rgb_matrix_enable_noeeprom(); - - keyboard_post_init_user(); -} -#endif - -#if defined(KC_WRAPPER_KEY) - -static uint8_t g_key_wrapper_tracker = 0; - -bool process_record_kb(uint16_t keycode, keyrecord_t *record) { - if (!process_record_user(keycode, record)) { return false; } - if (record->event.pressed && keycode != KC_WRAPPER_KEY) { - register_code(KC_WRAPPER_KEY); - register_code(keycode); - g_key_wrapper_tracker++; - return false; - } - return true; -} - -void post_process_record_kb(uint16_t keycode, keyrecord_t *record) { - if (!record->event.pressed && keycode != KC_WRAPPER_KEY) { - --g_key_wrapper_tracker; - if (g_key_wrapper_tracker <= 0) { - unregister_code(KC_WRAPPER_KEY); - g_key_wrapper_tracker = 0; - } - } - post_process_record_user(keycode, record); -} #endif diff --git a/keyboards/opendeck/32/rev1/rev1.h b/keyboards/opendeck/32/rev1/rev1.h deleted file mode 100644 index 455b2ac753..0000000000 --- a/keyboards/opendeck/32/rev1/rev1.h +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright 2020 cmdremily - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#pragma once - -#include "quantum.h" - -#define POWER_LED_PIN F1 - -// If you want something similar to what Taran from LMG does in https://github.com/TaranVH/2nd-keyboard -// you can create a "wrapper key" by uncommenting the row below and chosing your wrapper keycode. -// You can then change the keymap in ../keymaps/default/keymap.c to adjust what key is sent inside the -// wrapper. -// Note: The default is to not wrap and to send F13-F24 with combinations of shift/control/alt as these -// are immediately usable in most software (e.g. OBS and DCSB for streaming) without using AHK. -//#define KC_WRAPPER_KEY KC_F24