Skip to content

Commit

Permalink
Refactor opendeck/32 (#24233)
Browse files Browse the repository at this point in the history
  • Loading branch information
zvecr authored Aug 3, 2024
1 parent 9f387f5 commit 8808fff
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 112 deletions.
20 changes: 5 additions & 15 deletions keyboards/opendeck/32/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
7 changes: 1 addition & 6 deletions keyboards/opendeck/32/rev1/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
40 changes: 37 additions & 3 deletions keyboards/opendeck/32/rev1/keyboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"lto": true
},
"features": {
"bootmagic": false,
"extrakey": false,
"mousekey": false,
"bootmagic": true,
"extrakey": true,
"mousekey": true,
"nkro": true,
"rgb_matrix": true
},
Expand Down Expand Up @@ -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",
Expand Down
60 changes: 1 addition & 59 deletions keyboards/opendeck/32/rev1/rev1.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include "rev1.h"
#include "quantum.h"

#ifdef RGB_MATRIX_ENABLE
const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = {
Expand Down Expand Up @@ -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);
Expand All @@ -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
29 changes: 0 additions & 29 deletions keyboards/opendeck/32/rev1/rev1.h

This file was deleted.

0 comments on commit 8808fff

Please sign in to comment.