From 0376e34005d59f0bf15d4f8daf736c3ee121d1cf Mon Sep 17 00:00:00 2001 From: bootstrapper Date: Mon, 11 Apr 2022 18:42:57 -0500 Subject: [PATCH 1/3] Added left hand gamer layer, added caps lock --- keyboards/keychron/q3/q3.c | 36 ++ .../keychron/q3/q3_ansi_stm32l432/config.h | 3 + .../q3_ansi_stm32l432/keymaps/snick/keymap.c | 161 +++++++ .../q3_ansi_stm32l432/keymaps/snick/rules.mk | 3 + .../keymaps/snick/snick.json | 452 ++++++++++++++++++ users/snick/config.h | 12 + users/snick/readme.md | 14 + users/snick/rules.mk | 1 + users/snick/snick.c | 55 +++ users/snick/snick.h | 12 + 10 files changed, 749 insertions(+) create mode 100644 keyboards/keychron/q3/q3_ansi_stm32l432/keymaps/snick/keymap.c create mode 100644 keyboards/keychron/q3/q3_ansi_stm32l432/keymaps/snick/rules.mk create mode 100644 keyboards/keychron/q3/q3_ansi_stm32l432/keymaps/snick/snick.json create mode 100644 users/snick/config.h create mode 100644 users/snick/readme.md create mode 100644 users/snick/rules.mk create mode 100644 users/snick/snick.c create mode 100644 users/snick/snick.h diff --git a/keyboards/keychron/q3/q3.c b/keyboards/keychron/q3/q3.c index c5d5a0490c70..e2f6b3faf002 100644 --- a/keyboards/keychron/q3/q3.c +++ b/keyboards/keychron/q3/q3.c @@ -26,6 +26,8 @@ const matrix_row_t matrix_mask[] = { 0b1111111111101111, }; +#ifdef DIP_SWITCH_ENABLE + bool dip_switch_update_kb(uint8_t index, bool active) { if (!dip_switch_update_user(index, active)) { return false;} if (index == 0) { @@ -33,3 +35,37 @@ bool dip_switch_update_kb(uint8_t index, bool active) { } return true; } + +#endif + + +// enabling caps lock light +#if defined(RGB_MATRIX_ENABLE) && defined(CAPS_LOCK_LED_INDEX) + +# define CAPS_LOCK_MAX_BRIGHTNESS 0xff +# ifdef RGB_MATGRIX_MAXIMUM_BRIGHTNESS +# undef CAPS_LOCK_MAX_BRIGHTNESS +# define CAPS_LOCK_MAX_BRIGHTNESS RGB_MATGRIX_MAXIMUM_BRIGHTNESS +#endif + +# define CAPS_LOCK_VAL_STEP 8 +# ifdef RGB_MATRIX_VAL_STEP +# undef CAPS_LOCK_VAL_STEP +# define CAPS_LOCK_VAL_STEP RGB_MATRIX_VAL_STEP +# endif + +void rgb_matrix_indicators_kb(void) { + if(!host_keyboard_led_state().caps_lock) return ; + + uint8_t b = rgb_matrix_get_val(); + if (b< CAPS_LOCK_VAL_STEP) { + b = CAPS_LOCK_VAL_STEP; + } else if (b < (CAPS_LOCK_MAX_BRIGHTNESS - CAPS_LOCK_VAL_STEP)) { + b += CAPS_LOCK_VAL_STEP / 4; // one step more than current brightness + } else { + b = CAPS_LOCK_MAX_BRIGHTNESS; + } + rgb_matrix_set_color(CAPS_LOCK_LED_INDEX, b, b, b); +} + +#endif diff --git a/keyboards/keychron/q3/q3_ansi_stm32l432/config.h b/keyboards/keychron/q3/q3_ansi_stm32l432/config.h index d72a491baabb..12d5fc22b768 100644 --- a/keyboards/keychron/q3/q3_ansi_stm32l432/config.h +++ b/keyboards/keychron/q3/q3_ansi_stm32l432/config.h @@ -28,3 +28,6 @@ #define DRIVER_1_LED_TOTAL 48 #define DRIVER_2_LED_TOTAL 39 #define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) + +/* Enable caps-lock LED */ +#define CAPS_LOCK_LED_INDEX 50 diff --git a/keyboards/keychron/q3/q3_ansi_stm32l432/keymaps/snick/keymap.c b/keyboards/keychron/q3/q3_ansi_stm32l432/keymaps/snick/keymap.c new file mode 100644 index 000000000000..dc55122bd73d --- /dev/null +++ b/keyboards/keychron/q3/q3_ansi_stm32l432/keymaps/snick/keymap.c @@ -0,0 +1,161 @@ +/* Copyright 2021 @ Keychron (https://www.keychron.com) + * + * This pro2gram 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 . + */ + +#include QMK_KEYBOARD_H + +#ifdef VIA_ENABLE + #define USER_START USER00 +#else + #define USER_START SAFE_RANGE +#endif + +enum layers{ + MAC_BASE, + MAC_FN, + WIN_BASE, + LEFT_HANDED_GAMING, + WIN_FN +}; + +enum custom_keycodes { + KC_MISSION_CONTROL = USER_START, + KC_LAUNCHPAD, + KC_LOPTN, + KC_ROPTN, + KC_LCMMD, + KC_RCMMD, + KC_SIRI, + KC_TASK_VIEW, + KC_FILE_EXPLORER, + KC_SCREEN_SHOT, + KC_CORTANA, + KC_RESET +}; + +#define KC_MCTL KC_MISSION_CONTROL +#define KC_LPAD KC_LAUNCHPAD +#define KC_TASK KC_TASK_VIEW +#define KC_FLXP KC_FILE_EXPLORER +#define KC_SNAP KC_SCREEN_SHOT +#define KC_CRTA KC_CORTANA +#define KC_EEPROM_RESET EEPROM_RESET + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [MAC_BASE] = LAYOUT_ansi_87( + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_SNAP, KC_SIRI, RGB_MOD, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LOPTN, KC_LCMMD, KC_SPC, KC_RCMMD, KC_ROPTN,MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [MAC_FN] = LAYOUT_ansi_87( + KC_NO , KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NO , KC_NO , RGB_TOG, + KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , + RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, NK_TOGG, KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , + KC_NO , RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , + KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , + KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO ), + + [WIN_BASE] = LAYOUT_ansi_87( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_CRTA, RGB_MOD, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LCMD, KC_LALT, KC_SPC, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [LEFT_HANDED_GAMING] = LAYOUT_ansi_87( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_CRTA, RGB_MOD, + KC_BSPC, KC_EQL, KC_MINS, KC_0, KC_9, KC_8, KC_7, KC_6, KC_5, KC_4, KC_3, KC_2, KC_1, KC_GRV, KC_INS, KC_HOME, KC_PGUP, + KC_RBRC, KC_LBRC, KC_UP, KC_O, KC_I, KC_U, KC_Y, KC_T, KC_R, KC_E, KC_W, KC_Q, KC_TAB, KC_TAB, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_LEFT, KC_DOWN, KC_RGHT, KC_K, KC_J, KC_H, KC_G, KC_F, KC_A, KC_S, KC_D, KC_ENT, + KC_RSFT, KC_SLSH, KC_DOT, KC_COMM, KC_M, KC_N, KC_B, KC_V, KC_C, KC_X, KC_Z, KC_LSFT, KC_UP, + KC_RCTL, KC_LCMD, KC_RALT, KC_SPC, KC_LALT, KC_RWIN, MO(WIN_FN), KC_LCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [WIN_FN] = LAYOUT_ansi_87( + KC_NO , KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO , KC_NO , RGB_TOG, + KC_NO , TO(WIN_BASE) , TO(LEFT_HANDED_GAMING) , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , + RGB_TOG, RGB_MOD , RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, NK_TOGG, KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , + KC_NO , RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , + KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , QK_RESET , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , + KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO ), +}; + +// layers colors for HSA +#define WHITE {0,0,255} +#define ORANGE {23,255,255} +#define BLUE {170,255,255} +#define NO_COLOR {0,0,0} + +const uint8_t PROGMEM rgb_matrix_led_map[][DRIVER_LED_TOTAL][5] = { + { // MAC_BASE + NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, + NO_COLOR, NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, + NO_COLOR, NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, + NO_COLOR, NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR , + NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR , NO_COLOR, + NO_COLOR, NO_COLOR, NO_COLOR, WHITE , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR + }, { // MAC_FN + NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, + NO_COLOR, NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, + NO_COLOR, NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, + NO_COLOR, NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR , + NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR , NO_COLOR, + NO_COLOR, NO_COLOR, NO_COLOR, WHITE , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR + }, { // WIN_BASE + NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, + NO_COLOR, NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, + NO_COLOR, NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, + NO_COLOR, NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR , + NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR , NO_COLOR, + NO_COLOR, NO_COLOR, NO_COLOR, ORANGE , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR + }, { // LEFT_HANDED_GAMING + NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, + NO_COLOR, NO_COLOR , BLUE , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, + NO_COLOR, BLUE , BLUE , BLUE , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, BLUE , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, + NO_COLOR, NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, BLUE , BLUE , BLUE , NO_COLOR , + NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR , BLUE , + NO_COLOR, NO_COLOR, NO_COLOR, BLUE , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR , BLUE , BLUE , BLUE + }, { // WIN_FN + NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, + NO_COLOR, NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, + NO_COLOR, NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, + NO_COLOR, NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR , + NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR , NO_COLOR, + NO_COLOR, NO_COLOR, NO_COLOR, ORANGE , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR + } +}; + +void set_layer_color(int layer) { + for (int i = 0; i < DRIVER_LED_TOTAL; i++) { + HSV hsv = { + .h = pgm_read_byte(&rgb_matrix_led_map[layer][i][0]), + .s = pgm_read_byte(&rgb_matrix_led_map[layer][i][1]), + .v = pgm_read_byte(&rgb_matrix_led_map[layer][i][2]), + }; + + if (!hsv.h && !hsv.s && !hsv.v) { continue; } + + RGB rgb = hsv_to_rgb( hsv ); + float f = (float)rgb_matrix_config.hsv.v / UINT8_MAX; + rgb_matrix_set_color( i, f * rgb.r, f * rgb.g, f * rgb.b ); + } +} + +void rgb_matrix_indicators_user(void) { + set_layer_color(biton32(layer_state)); +} diff --git a/keyboards/keychron/q3/q3_ansi_stm32l432/keymaps/snick/rules.mk b/keyboards/keychron/q3/q3_ansi_stm32l432/keymaps/snick/rules.mk new file mode 100644 index 000000000000..b073d66c0914 --- /dev/null +++ b/keyboards/keychron/q3/q3_ansi_stm32l432/keymaps/snick/rules.mk @@ -0,0 +1,3 @@ +VIA_ENABLE = yes +MOUSEKEY_ENABLE = yes +RGB_MATRIX_ENABLE = yes diff --git a/keyboards/keychron/q3/q3_ansi_stm32l432/keymaps/snick/snick.json b/keyboards/keychron/q3/q3_ansi_stm32l432/keymaps/snick/snick.json new file mode 100644 index 000000000000..7482b5870bfd --- /dev/null +++ b/keyboards/keychron/q3/q3_ansi_stm32l432/keymaps/snick/snick.json @@ -0,0 +1,452 @@ +{ + "keyboard": "keychron/q3/q3_ansi_stm32l432", + "keymap": "snick", + "layout": "LAYOUT_ansi_87", + "layers": [ + [ + "KC_ESC", + "KC_BRID", + "KC_BRIU", + "KC_MISSION_CONTROL", + "KC_LAUNCHPAD", + "RGB_VAD", + "RGB_VAI", + "KC_MPRV", + "KC_MPLY", + "KC_MNXT", + "KC_MUTE", + "KC_VOLD", + "KC_VOLU", + "KC_SCREEN_SHOT", + "KC_SIRI", + "RGB_MOD", + "KC_GRV", + "KC_1", + "KC_2", + "KC_3", + "KC_4", + "KC_5", + "KC_6", + "KC_7", + "KC_8", + "KC_9", + "KC_0", + "KC_MINS", + "KC_EQL", + "KC_BSPC", + "KC_INS", + "KC_HOME", + "KC_PGUP", + "KC_TAB", + "KC_Q", + "KC_W", + "KC_E", + "KC_R", + "KC_T", + "KC_Y", + "KC_U", + "KC_I", + "KC_O", + "KC_P", + "KC_LBRC", + "KC_RBRC", + "KC_BSLS", + "KC_DEL", + "KC_END", + "KC_PGDN", + "KC_CAPS", + "KC_A", + "KC_S", + "KC_D", + "KC_F", + "KC_G", + "KC_H", + "KC_J", + "KC_K", + "KC_L", + "KC_SCLN", + "KC_QUOT", + "KC_ENT", + "KC_LSFT", + "KC_Z", + "KC_X", + "KC_C", + "KC_V", + "KC_B", + "KC_N", + "KC_M", + "KC_COMM", + "KC_DOT", + "KC_SLSH", + "KC_RSFT", + "KC_UP", + "KC_LCTL", + "KC_LOPTN", + "KC_LCMMD", + "KC_SPC", + "KC_RCMMD", + "KC_ROPTN", + "MO(MAC_FN)", + "KC_RCTL", + "KC_LEFT", + "KC_DOWN", + "KC_RGHT" + ], + [ + "KC_NO", + "KC_F1", + "KC_F2", + "KC_F3", + "KC_F4", + "KC_F5", + "KC_F6", + "KC_F7", + "KC_F8", + "KC_F9", + "KC_F10", + "KC_F11", + "KC_F12", + "KC_NO", + "KC_NO", + "RGB_TOG", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "RGB_TOG", + "RGB_MOD", + "RGB_VAI", + "RGB_HUI", + "RGB_SAI", + "RGB_SPI", + "NK_TOGG", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "RGB_RMOD", + "RGB_VAD", + "RGB_HUD", + "RGB_SAD", + "RGB_SPD", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO" + ], + [ + "KC_ESC", + "KC_F1", + "KC_F2", + "KC_F3", + "KC_F4", + "KC_F5", + "KC_F6", + "KC_F7", + "KC_F8", + "KC_F9", + "KC_F10", + "KC_F11", + "KC_F12", + "KC_PSCR", + "KC_CORTANA", + "RGB_MOD", + "KC_GRV", + "KC_1", + "KC_2", + "KC_3", + "KC_4", + "KC_5", + "KC_6", + "KC_7", + "KC_8", + "KC_9", + "KC_0", + "KC_MINS", + "KC_EQL", + "KC_BSPC", + "KC_INS", + "KC_HOME", + "KC_PGUP", + "KC_TAB", + "KC_Q", + "KC_W", + "KC_E", + "KC_R", + "KC_T", + "KC_Y", + "KC_U", + "KC_I", + "KC_O", + "KC_P", + "KC_LBRC", + "KC_RBRC", + "KC_BSLS", + "KC_DEL", + "KC_END", + "KC_PGDN", + "KC_CAPS", + "KC_A", + "KC_S", + "KC_D", + "KC_F", + "KC_G", + "KC_H", + "KC_J", + "KC_K", + "KC_L", + "KC_SCLN", + "KC_QUOT", + "KC_ENT", + "KC_LSFT", + "KC_Z", + "KC_X", + "KC_C", + "KC_V", + "KC_B", + "KC_N", + "KC_M", + "KC_COMM", + "KC_DOT", + "KC_SLSH", + "KC_RSFT", + "KC_UP", + "KC_LCTL", + "KC_LCMD", + "KC_LALT", + "KC_SPC", + "KC_RALT", + "KC_RWIN", + "MO(WIN_FN)", + "KC_RCTL", + "KC_LEFT", + "KC_DOWN", + "KC_RGHT" + ], + [ + "KC_ESC", + "KC_F1", + "KC_F2", + "KC_F3", + "KC_F4", + "KC_F5", + "KC_F6", + "KC_F7", + "KC_F8", + "KC_F9", + "KC_F10", + "KC_F11", + "KC_F12", + "KC_PSCR", + "KC_CORTANA", + "RGB_MOD", + "KC_BSPC", + "KC_EQL", + "KC_MINS", + "KC_0", + "KC_9", + "KC_8", + "KC_7", + "KC_6", + "KC_5", + "KC_4", + "KC_3", + "KC_2", + "KC_1", + "KC_GRV", + "KC_INS", + "KC_HOME", + "KC_PGUP", + "KC_RBRC", + "KC_LBRC", + "KC_UP", + "KC_O", + "KC_I", + "KC_U", + "KC_Y", + "KC_T", + "KC_R", + "KC_E", + "KC_W", + "KC_Q", + "KC_TAB", + "KC_TAB", + "KC_DEL", + "KC_END", + "KC_PGDN", + "KC_CAPS", + "KC_LEFT", + "KC_DOWN", + "KC_RGHT", + "KC_K", + "KC_J", + "KC_H", + "KC_G", + "KC_F", + "KC_A", + "KC_S", + "KC_D", + "KC_ENT", + "KC_RSFT", + "KC_SLSH", + "KC_DOT", + "KC_COMM", + "KC_M", + "KC_N", + "KC_B", + "KC_V", + "KC_C", + "KC_X", + "KC_Z", + "KC_LSFT", + "KC_UP", + "KC_RCTL", + "KC_LCMD", + "KC_RALT", + "KC_SPC", + "KC_LALT", + "KC_RWIN", + "MO(WIN_FN)", + "KC_LCTL", + "KC_LEFT", + "KC_DOWN", + "KC_RGHT" + ], + [ + "KC_NO", + "KC_BRID", + "KC_BRIU", + "KC_TASK_VIEW", + "KC_FILE_EXPLORER", + "RGB_VAD", + "RGB_VAI", + "KC_MPRV", + "KC_MPLY", + "KC_MNXT", + "KC_MUTE", + "KC_VOLD", + "KC_VOLU", + "KC_NO", + "KC_NO", + "RGB_TOG", + "KC_NO", + "TO(WIN_BASE)", + "TO(LEFT_HANDED_GAMING)", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "RGB_TOG", + "RGB_MOD", + "RGB_VAI", + "RGB_HUI", + "RGB_SAI", + "RGB_SPI", + "NK_TOGG", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "RGB_RMOD", + "RGB_VAD", + "RGB_HUD", + "RGB_SAD", + "RGB_SPD", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "QK_RESET", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO" + ] + ] +} diff --git a/users/snick/config.h b/users/snick/config.h new file mode 100644 index 000000000000..e4a7dc434e5e --- /dev/null +++ b/users/snick/config.h @@ -0,0 +1,12 @@ +#pragma once + +// setup 5 layers +// 0: Mac +// 1: Mac function +// 2: Windows +// 3: Left Handed Gaming +// 4: Windows Function +#define DYNAMIC_KEYMAP_LAYER_COUNT 5 + +#define RGB_MATRIX_KEYPRESSES +#define RGB_MATRIX_KEYRELEASES diff --git a/users/snick/readme.md b/users/snick/readme.md new file mode 100644 index 000000000000..7b9cc34f921b --- /dev/null +++ b/users/snick/readme.md @@ -0,0 +1,14 @@ +Copyright <2022> @ + +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 . diff --git a/users/snick/rules.mk b/users/snick/rules.mk new file mode 100644 index 000000000000..99ba0e527ba4 --- /dev/null +++ b/users/snick/rules.mk @@ -0,0 +1 @@ +SRC += snick.c diff --git a/users/snick/snick.c b/users/snick/snick.c new file mode 100644 index 000000000000..18b9a3145209 --- /dev/null +++ b/users/snick/snick.c @@ -0,0 +1,55 @@ +#include "snick.h" + +void cycle_rgb_matrix_color(int count, int delay, uint8_t red, uint8_t green, uint8_t blue) { + for (size_t i = 0; i < count; i++) + { + rgb_matrix_set_color_all(red, green, blue); + rgb_matrix_driver.flush(); + wait_ms(delay); + rgb_matrix_set_color_all(RGB_BLACK); + rgb_matrix_driver.flush(); + wait_ms(delay); + } +} + +void keyboard_post_init_user(void) { + // Do something after keyboard initialization + rgb_matrix_set_color_all(RGB_BLUE); + rgb_matrix_driver.flush(); + wait_ms(150); +} + +// void suspend_power_down_user(void) { +// // code will run multiple times while keyboard is suspended +// // while(true) { +// rgb_matrix_set_color_all(RGB_MAGENTA); +// rgb_matrix_driver.flush(); +// wait_ms(500); +// // }; +// } + +void suspend_wakeup_init_user(void) { + // code will run on keyboard wakeup + cycle_rgb_matrix_color(3, 50, RGB_GREEN); +} + +// void eeconfig_init_user(void) { // EEPROM is getting reset! + +// } + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + + case QK_RESET: { + if (record->event.pressed) { + eeconfig_init(); + rgb_matrix_set_color_all(RGB_RED); + rgb_matrix_driver.flush(); + } + return true; + } + + default: + return true; // Process all other keycodes normally + } +} diff --git a/users/snick/snick.h b/users/snick/snick.h new file mode 100644 index 000000000000..5236afe5c0b0 --- /dev/null +++ b/users/snick/snick.h @@ -0,0 +1,12 @@ +#pragma once + +#include "quantum.h" +#include "color.h" +#include "rgb_matrix.h" +#include "keymap.h" + + + + + + From 6a76bc7593a576769f2c38ea28d822557be464c1 Mon Sep 17 00:00:00 2001 From: bootstrapper Date: Mon, 11 Apr 2022 18:42:57 -0500 Subject: [PATCH 2/3] Added left hand gamer layer, added caps lock --- keyboards/keychron/q3/q3.c | 36 ++ .../keychron/q3/q3_ansi_stm32l432/config.h | 3 + .../q3_ansi_stm32l432/keymaps/snick/keymap.c | 161 +++++++ .../q3_ansi_stm32l432/keymaps/snick/rules.mk | 3 + .../keymaps/snick/snick.json | 452 ++++++++++++++++++ users/snick/config.h | 12 + users/snick/readme.md | 14 + users/snick/rules.mk | 1 + users/snick/snick.c | 55 +++ users/snick/snick.h | 12 + 10 files changed, 749 insertions(+) create mode 100644 keyboards/keychron/q3/q3_ansi_stm32l432/keymaps/snick/keymap.c create mode 100644 keyboards/keychron/q3/q3_ansi_stm32l432/keymaps/snick/rules.mk create mode 100644 keyboards/keychron/q3/q3_ansi_stm32l432/keymaps/snick/snick.json create mode 100644 users/snick/config.h create mode 100644 users/snick/readme.md create mode 100644 users/snick/rules.mk create mode 100644 users/snick/snick.c create mode 100644 users/snick/snick.h diff --git a/keyboards/keychron/q3/q3.c b/keyboards/keychron/q3/q3.c index c5d5a0490c70..e2f6b3faf002 100644 --- a/keyboards/keychron/q3/q3.c +++ b/keyboards/keychron/q3/q3.c @@ -26,6 +26,8 @@ const matrix_row_t matrix_mask[] = { 0b1111111111101111, }; +#ifdef DIP_SWITCH_ENABLE + bool dip_switch_update_kb(uint8_t index, bool active) { if (!dip_switch_update_user(index, active)) { return false;} if (index == 0) { @@ -33,3 +35,37 @@ bool dip_switch_update_kb(uint8_t index, bool active) { } return true; } + +#endif + + +// enabling caps lock light +#if defined(RGB_MATRIX_ENABLE) && defined(CAPS_LOCK_LED_INDEX) + +# define CAPS_LOCK_MAX_BRIGHTNESS 0xff +# ifdef RGB_MATGRIX_MAXIMUM_BRIGHTNESS +# undef CAPS_LOCK_MAX_BRIGHTNESS +# define CAPS_LOCK_MAX_BRIGHTNESS RGB_MATGRIX_MAXIMUM_BRIGHTNESS +#endif + +# define CAPS_LOCK_VAL_STEP 8 +# ifdef RGB_MATRIX_VAL_STEP +# undef CAPS_LOCK_VAL_STEP +# define CAPS_LOCK_VAL_STEP RGB_MATRIX_VAL_STEP +# endif + +void rgb_matrix_indicators_kb(void) { + if(!host_keyboard_led_state().caps_lock) return ; + + uint8_t b = rgb_matrix_get_val(); + if (b< CAPS_LOCK_VAL_STEP) { + b = CAPS_LOCK_VAL_STEP; + } else if (b < (CAPS_LOCK_MAX_BRIGHTNESS - CAPS_LOCK_VAL_STEP)) { + b += CAPS_LOCK_VAL_STEP / 4; // one step more than current brightness + } else { + b = CAPS_LOCK_MAX_BRIGHTNESS; + } + rgb_matrix_set_color(CAPS_LOCK_LED_INDEX, b, b, b); +} + +#endif diff --git a/keyboards/keychron/q3/q3_ansi_stm32l432/config.h b/keyboards/keychron/q3/q3_ansi_stm32l432/config.h index d72a491baabb..12d5fc22b768 100644 --- a/keyboards/keychron/q3/q3_ansi_stm32l432/config.h +++ b/keyboards/keychron/q3/q3_ansi_stm32l432/config.h @@ -28,3 +28,6 @@ #define DRIVER_1_LED_TOTAL 48 #define DRIVER_2_LED_TOTAL 39 #define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) + +/* Enable caps-lock LED */ +#define CAPS_LOCK_LED_INDEX 50 diff --git a/keyboards/keychron/q3/q3_ansi_stm32l432/keymaps/snick/keymap.c b/keyboards/keychron/q3/q3_ansi_stm32l432/keymaps/snick/keymap.c new file mode 100644 index 000000000000..dc55122bd73d --- /dev/null +++ b/keyboards/keychron/q3/q3_ansi_stm32l432/keymaps/snick/keymap.c @@ -0,0 +1,161 @@ +/* Copyright 2021 @ Keychron (https://www.keychron.com) + * + * This pro2gram 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 . + */ + +#include QMK_KEYBOARD_H + +#ifdef VIA_ENABLE + #define USER_START USER00 +#else + #define USER_START SAFE_RANGE +#endif + +enum layers{ + MAC_BASE, + MAC_FN, + WIN_BASE, + LEFT_HANDED_GAMING, + WIN_FN +}; + +enum custom_keycodes { + KC_MISSION_CONTROL = USER_START, + KC_LAUNCHPAD, + KC_LOPTN, + KC_ROPTN, + KC_LCMMD, + KC_RCMMD, + KC_SIRI, + KC_TASK_VIEW, + KC_FILE_EXPLORER, + KC_SCREEN_SHOT, + KC_CORTANA, + KC_RESET +}; + +#define KC_MCTL KC_MISSION_CONTROL +#define KC_LPAD KC_LAUNCHPAD +#define KC_TASK KC_TASK_VIEW +#define KC_FLXP KC_FILE_EXPLORER +#define KC_SNAP KC_SCREEN_SHOT +#define KC_CRTA KC_CORTANA +#define KC_EEPROM_RESET EEPROM_RESET + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [MAC_BASE] = LAYOUT_ansi_87( + KC_ESC, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_SNAP, KC_SIRI, RGB_MOD, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LOPTN, KC_LCMMD, KC_SPC, KC_RCMMD, KC_ROPTN,MO(MAC_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [MAC_FN] = LAYOUT_ansi_87( + KC_NO , KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NO , KC_NO , RGB_TOG, + KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , + RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, NK_TOGG, KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , + KC_NO , RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , + KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , + KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO ), + + [WIN_BASE] = LAYOUT_ansi_87( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_CRTA, RGB_MOD, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, + KC_LCTL, KC_LCMD, KC_LALT, KC_SPC, KC_RALT, KC_RWIN, MO(WIN_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [LEFT_HANDED_GAMING] = LAYOUT_ansi_87( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_CRTA, RGB_MOD, + KC_BSPC, KC_EQL, KC_MINS, KC_0, KC_9, KC_8, KC_7, KC_6, KC_5, KC_4, KC_3, KC_2, KC_1, KC_GRV, KC_INS, KC_HOME, KC_PGUP, + KC_RBRC, KC_LBRC, KC_UP, KC_O, KC_I, KC_U, KC_Y, KC_T, KC_R, KC_E, KC_W, KC_Q, KC_TAB, KC_TAB, KC_DEL, KC_END, KC_PGDN, + KC_CAPS, KC_LEFT, KC_DOWN, KC_RGHT, KC_K, KC_J, KC_H, KC_G, KC_F, KC_A, KC_S, KC_D, KC_ENT, + KC_RSFT, KC_SLSH, KC_DOT, KC_COMM, KC_M, KC_N, KC_B, KC_V, KC_C, KC_X, KC_Z, KC_LSFT, KC_UP, + KC_RCTL, KC_LCMD, KC_RALT, KC_SPC, KC_LALT, KC_RWIN, MO(WIN_FN), KC_LCTL, KC_LEFT, KC_DOWN, KC_RGHT), + + [WIN_FN] = LAYOUT_ansi_87( + KC_NO , KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO , KC_NO , RGB_TOG, + KC_NO , TO(WIN_BASE) , TO(LEFT_HANDED_GAMING) , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , + RGB_TOG, RGB_MOD , RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, NK_TOGG, KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , + KC_NO , RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , + KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , QK_RESET , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , + KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO ), +}; + +// layers colors for HSA +#define WHITE {0,0,255} +#define ORANGE {23,255,255} +#define BLUE {170,255,255} +#define NO_COLOR {0,0,0} + +const uint8_t PROGMEM rgb_matrix_led_map[][DRIVER_LED_TOTAL][5] = { + { // MAC_BASE + NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, + NO_COLOR, NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, + NO_COLOR, NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, + NO_COLOR, NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR , + NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR , NO_COLOR, + NO_COLOR, NO_COLOR, NO_COLOR, WHITE , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR + }, { // MAC_FN + NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, + NO_COLOR, NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, + NO_COLOR, NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, + NO_COLOR, NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR , + NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR , NO_COLOR, + NO_COLOR, NO_COLOR, NO_COLOR, WHITE , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR + }, { // WIN_BASE + NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, + NO_COLOR, NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, + NO_COLOR, NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, + NO_COLOR, NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR , + NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR , NO_COLOR, + NO_COLOR, NO_COLOR, NO_COLOR, ORANGE , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR + }, { // LEFT_HANDED_GAMING + NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, + NO_COLOR, NO_COLOR , BLUE , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, + NO_COLOR, BLUE , BLUE , BLUE , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, BLUE , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, + NO_COLOR, NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, BLUE , BLUE , BLUE , NO_COLOR , + NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR , BLUE , + NO_COLOR, NO_COLOR, NO_COLOR, BLUE , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR , BLUE , BLUE , BLUE + }, { // WIN_FN + NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, + NO_COLOR, NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, + NO_COLOR, NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, + NO_COLOR, NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR , + NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR , NO_COLOR, + NO_COLOR, NO_COLOR, NO_COLOR, ORANGE , NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR , NO_COLOR, NO_COLOR, NO_COLOR + } +}; + +void set_layer_color(int layer) { + for (int i = 0; i < DRIVER_LED_TOTAL; i++) { + HSV hsv = { + .h = pgm_read_byte(&rgb_matrix_led_map[layer][i][0]), + .s = pgm_read_byte(&rgb_matrix_led_map[layer][i][1]), + .v = pgm_read_byte(&rgb_matrix_led_map[layer][i][2]), + }; + + if (!hsv.h && !hsv.s && !hsv.v) { continue; } + + RGB rgb = hsv_to_rgb( hsv ); + float f = (float)rgb_matrix_config.hsv.v / UINT8_MAX; + rgb_matrix_set_color( i, f * rgb.r, f * rgb.g, f * rgb.b ); + } +} + +void rgb_matrix_indicators_user(void) { + set_layer_color(biton32(layer_state)); +} diff --git a/keyboards/keychron/q3/q3_ansi_stm32l432/keymaps/snick/rules.mk b/keyboards/keychron/q3/q3_ansi_stm32l432/keymaps/snick/rules.mk new file mode 100644 index 000000000000..b073d66c0914 --- /dev/null +++ b/keyboards/keychron/q3/q3_ansi_stm32l432/keymaps/snick/rules.mk @@ -0,0 +1,3 @@ +VIA_ENABLE = yes +MOUSEKEY_ENABLE = yes +RGB_MATRIX_ENABLE = yes diff --git a/keyboards/keychron/q3/q3_ansi_stm32l432/keymaps/snick/snick.json b/keyboards/keychron/q3/q3_ansi_stm32l432/keymaps/snick/snick.json new file mode 100644 index 000000000000..7482b5870bfd --- /dev/null +++ b/keyboards/keychron/q3/q3_ansi_stm32l432/keymaps/snick/snick.json @@ -0,0 +1,452 @@ +{ + "keyboard": "keychron/q3/q3_ansi_stm32l432", + "keymap": "snick", + "layout": "LAYOUT_ansi_87", + "layers": [ + [ + "KC_ESC", + "KC_BRID", + "KC_BRIU", + "KC_MISSION_CONTROL", + "KC_LAUNCHPAD", + "RGB_VAD", + "RGB_VAI", + "KC_MPRV", + "KC_MPLY", + "KC_MNXT", + "KC_MUTE", + "KC_VOLD", + "KC_VOLU", + "KC_SCREEN_SHOT", + "KC_SIRI", + "RGB_MOD", + "KC_GRV", + "KC_1", + "KC_2", + "KC_3", + "KC_4", + "KC_5", + "KC_6", + "KC_7", + "KC_8", + "KC_9", + "KC_0", + "KC_MINS", + "KC_EQL", + "KC_BSPC", + "KC_INS", + "KC_HOME", + "KC_PGUP", + "KC_TAB", + "KC_Q", + "KC_W", + "KC_E", + "KC_R", + "KC_T", + "KC_Y", + "KC_U", + "KC_I", + "KC_O", + "KC_P", + "KC_LBRC", + "KC_RBRC", + "KC_BSLS", + "KC_DEL", + "KC_END", + "KC_PGDN", + "KC_CAPS", + "KC_A", + "KC_S", + "KC_D", + "KC_F", + "KC_G", + "KC_H", + "KC_J", + "KC_K", + "KC_L", + "KC_SCLN", + "KC_QUOT", + "KC_ENT", + "KC_LSFT", + "KC_Z", + "KC_X", + "KC_C", + "KC_V", + "KC_B", + "KC_N", + "KC_M", + "KC_COMM", + "KC_DOT", + "KC_SLSH", + "KC_RSFT", + "KC_UP", + "KC_LCTL", + "KC_LOPTN", + "KC_LCMMD", + "KC_SPC", + "KC_RCMMD", + "KC_ROPTN", + "MO(MAC_FN)", + "KC_RCTL", + "KC_LEFT", + "KC_DOWN", + "KC_RGHT" + ], + [ + "KC_NO", + "KC_F1", + "KC_F2", + "KC_F3", + "KC_F4", + "KC_F5", + "KC_F6", + "KC_F7", + "KC_F8", + "KC_F9", + "KC_F10", + "KC_F11", + "KC_F12", + "KC_NO", + "KC_NO", + "RGB_TOG", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "RGB_TOG", + "RGB_MOD", + "RGB_VAI", + "RGB_HUI", + "RGB_SAI", + "RGB_SPI", + "NK_TOGG", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "RGB_RMOD", + "RGB_VAD", + "RGB_HUD", + "RGB_SAD", + "RGB_SPD", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO" + ], + [ + "KC_ESC", + "KC_F1", + "KC_F2", + "KC_F3", + "KC_F4", + "KC_F5", + "KC_F6", + "KC_F7", + "KC_F8", + "KC_F9", + "KC_F10", + "KC_F11", + "KC_F12", + "KC_PSCR", + "KC_CORTANA", + "RGB_MOD", + "KC_GRV", + "KC_1", + "KC_2", + "KC_3", + "KC_4", + "KC_5", + "KC_6", + "KC_7", + "KC_8", + "KC_9", + "KC_0", + "KC_MINS", + "KC_EQL", + "KC_BSPC", + "KC_INS", + "KC_HOME", + "KC_PGUP", + "KC_TAB", + "KC_Q", + "KC_W", + "KC_E", + "KC_R", + "KC_T", + "KC_Y", + "KC_U", + "KC_I", + "KC_O", + "KC_P", + "KC_LBRC", + "KC_RBRC", + "KC_BSLS", + "KC_DEL", + "KC_END", + "KC_PGDN", + "KC_CAPS", + "KC_A", + "KC_S", + "KC_D", + "KC_F", + "KC_G", + "KC_H", + "KC_J", + "KC_K", + "KC_L", + "KC_SCLN", + "KC_QUOT", + "KC_ENT", + "KC_LSFT", + "KC_Z", + "KC_X", + "KC_C", + "KC_V", + "KC_B", + "KC_N", + "KC_M", + "KC_COMM", + "KC_DOT", + "KC_SLSH", + "KC_RSFT", + "KC_UP", + "KC_LCTL", + "KC_LCMD", + "KC_LALT", + "KC_SPC", + "KC_RALT", + "KC_RWIN", + "MO(WIN_FN)", + "KC_RCTL", + "KC_LEFT", + "KC_DOWN", + "KC_RGHT" + ], + [ + "KC_ESC", + "KC_F1", + "KC_F2", + "KC_F3", + "KC_F4", + "KC_F5", + "KC_F6", + "KC_F7", + "KC_F8", + "KC_F9", + "KC_F10", + "KC_F11", + "KC_F12", + "KC_PSCR", + "KC_CORTANA", + "RGB_MOD", + "KC_BSPC", + "KC_EQL", + "KC_MINS", + "KC_0", + "KC_9", + "KC_8", + "KC_7", + "KC_6", + "KC_5", + "KC_4", + "KC_3", + "KC_2", + "KC_1", + "KC_GRV", + "KC_INS", + "KC_HOME", + "KC_PGUP", + "KC_RBRC", + "KC_LBRC", + "KC_UP", + "KC_O", + "KC_I", + "KC_U", + "KC_Y", + "KC_T", + "KC_R", + "KC_E", + "KC_W", + "KC_Q", + "KC_TAB", + "KC_TAB", + "KC_DEL", + "KC_END", + "KC_PGDN", + "KC_CAPS", + "KC_LEFT", + "KC_DOWN", + "KC_RGHT", + "KC_K", + "KC_J", + "KC_H", + "KC_G", + "KC_F", + "KC_A", + "KC_S", + "KC_D", + "KC_ENT", + "KC_RSFT", + "KC_SLSH", + "KC_DOT", + "KC_COMM", + "KC_M", + "KC_N", + "KC_B", + "KC_V", + "KC_C", + "KC_X", + "KC_Z", + "KC_LSFT", + "KC_UP", + "KC_RCTL", + "KC_LCMD", + "KC_RALT", + "KC_SPC", + "KC_LALT", + "KC_RWIN", + "MO(WIN_FN)", + "KC_LCTL", + "KC_LEFT", + "KC_DOWN", + "KC_RGHT" + ], + [ + "KC_NO", + "KC_BRID", + "KC_BRIU", + "KC_TASK_VIEW", + "KC_FILE_EXPLORER", + "RGB_VAD", + "RGB_VAI", + "KC_MPRV", + "KC_MPLY", + "KC_MNXT", + "KC_MUTE", + "KC_VOLD", + "KC_VOLU", + "KC_NO", + "KC_NO", + "RGB_TOG", + "KC_NO", + "TO(WIN_BASE)", + "TO(LEFT_HANDED_GAMING)", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "RGB_TOG", + "RGB_MOD", + "RGB_VAI", + "RGB_HUI", + "RGB_SAI", + "RGB_SPI", + "NK_TOGG", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "RGB_RMOD", + "RGB_VAD", + "RGB_HUD", + "RGB_SAD", + "RGB_SPD", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "QK_RESET", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO" + ] + ] +} diff --git a/users/snick/config.h b/users/snick/config.h new file mode 100644 index 000000000000..e4a7dc434e5e --- /dev/null +++ b/users/snick/config.h @@ -0,0 +1,12 @@ +#pragma once + +// setup 5 layers +// 0: Mac +// 1: Mac function +// 2: Windows +// 3: Left Handed Gaming +// 4: Windows Function +#define DYNAMIC_KEYMAP_LAYER_COUNT 5 + +#define RGB_MATRIX_KEYPRESSES +#define RGB_MATRIX_KEYRELEASES diff --git a/users/snick/readme.md b/users/snick/readme.md new file mode 100644 index 000000000000..7b9cc34f921b --- /dev/null +++ b/users/snick/readme.md @@ -0,0 +1,14 @@ +Copyright <2022> @ + +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 . diff --git a/users/snick/rules.mk b/users/snick/rules.mk new file mode 100644 index 000000000000..99ba0e527ba4 --- /dev/null +++ b/users/snick/rules.mk @@ -0,0 +1 @@ +SRC += snick.c diff --git a/users/snick/snick.c b/users/snick/snick.c new file mode 100644 index 000000000000..18b9a3145209 --- /dev/null +++ b/users/snick/snick.c @@ -0,0 +1,55 @@ +#include "snick.h" + +void cycle_rgb_matrix_color(int count, int delay, uint8_t red, uint8_t green, uint8_t blue) { + for (size_t i = 0; i < count; i++) + { + rgb_matrix_set_color_all(red, green, blue); + rgb_matrix_driver.flush(); + wait_ms(delay); + rgb_matrix_set_color_all(RGB_BLACK); + rgb_matrix_driver.flush(); + wait_ms(delay); + } +} + +void keyboard_post_init_user(void) { + // Do something after keyboard initialization + rgb_matrix_set_color_all(RGB_BLUE); + rgb_matrix_driver.flush(); + wait_ms(150); +} + +// void suspend_power_down_user(void) { +// // code will run multiple times while keyboard is suspended +// // while(true) { +// rgb_matrix_set_color_all(RGB_MAGENTA); +// rgb_matrix_driver.flush(); +// wait_ms(500); +// // }; +// } + +void suspend_wakeup_init_user(void) { + // code will run on keyboard wakeup + cycle_rgb_matrix_color(3, 50, RGB_GREEN); +} + +// void eeconfig_init_user(void) { // EEPROM is getting reset! + +// } + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + + case QK_RESET: { + if (record->event.pressed) { + eeconfig_init(); + rgb_matrix_set_color_all(RGB_RED); + rgb_matrix_driver.flush(); + } + return true; + } + + default: + return true; // Process all other keycodes normally + } +} diff --git a/users/snick/snick.h b/users/snick/snick.h new file mode 100644 index 000000000000..5236afe5c0b0 --- /dev/null +++ b/users/snick/snick.h @@ -0,0 +1,12 @@ +#pragma once + +#include "quantum.h" +#include "color.h" +#include "rgb_matrix.h" +#include "keymap.h" + + + + + + From 602cc4b47e891dcefaecaeaaac7c0df7f4f387a4 Mon Sep 17 00:00:00 2001 From: bootstrapper Date: Thu, 14 Apr 2022 03:54:53 -0500 Subject: [PATCH 3/3] fixed right layer color on boot --- keyboards/keychron/q3/q3.c | 1 + 1 file changed, 1 insertion(+) diff --git a/keyboards/keychron/q3/q3.c b/keyboards/keychron/q3/q3.c index e2f6b3faf002..f929d70d31f7 100644 --- a/keyboards/keychron/q3/q3.c +++ b/keyboards/keychron/q3/q3.c @@ -31,6 +31,7 @@ const matrix_row_t matrix_mask[] = { bool dip_switch_update_kb(uint8_t index, bool active) { if (!dip_switch_update_user(index, active)) { return false;} if (index == 0) { + layer_state_set(1UL << (active ? 2 : 0)); default_layer_set(1UL << (active ? 2 : 0)); } return true;