keyboard stuff
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

First TypeK support (#22876)

authored by

Álvaro A. Volpato and committed by
GitHub
12d70ab1 e5466df8

+380
+33
keyboards/typek/config.h
··· 1 + /* 2 + Copyright 2022 Gondolindrim 3 + 4 + This program is free software: you can redistribute it and/or modify 5 + it under the terms of the GNU General Public License as published by 6 + the Free Software Foundation, either version 2 of the License, or 7 + (at your option) any later version. 8 + 9 + This program is distributed in the hope that it will be useful, 10 + but WITHOUT ANY WARRANTY; without even the implied warranty of 11 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 + GNU General Public License for more details. 13 + 14 + You should have received a copy of the GNU General Public License 15 + along with this program. If not, see <http://www.gnu.org/licenses/>. 16 + */ 17 + 18 + #pragma once 19 + 20 + #define WS2812_PWM_COMPLEMENTARY_OUTPUT 21 + #define WS2812_PWM_DRIVER PWMD1 22 + #define WS2812_PWM_CHANNEL 3 23 + #define WS2812_PWM_PAL_MODE 1 24 + #define WS2812_DMA_STREAM STM32_DMA2_STREAM5 25 + #define WS2812_DMA_CHANNEL 6 26 + 27 + /* LED MAP 28 + 0 , 1 , 2 Three indicators 29 + 3 , 4 , 5 Three RGBs on left side 30 + 66, 67, 68 Three RGBs on right side 31 + 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6 Left RGB wing (30 LEDs) 32 + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65 Right RGB wing (30 LEDs) 33 + */
+21
keyboards/typek/halconf.h
··· 1 + /* Copyright 2020 QMK 2 + * 3 + * This program is free software: you can redistribute it and/or modify 4 + * it under the terms of the GNU General Public License as published by 5 + * the Free Software Foundation, either version 2 of the License, or 6 + * (at your option) any later version. 7 + * 8 + * This program is distributed in the hope that it will be useful, 9 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 + * GNU General Public License for more details. 12 + * 13 + * You should have received a copy of the GNU General Public License 14 + * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 + */ 16 + 17 + #pragma once 18 + 19 + #define HAL_USE_PWM TRUE 20 + 21 + #include_next <halconf.h>
+197
keyboards/typek/keyboard.json
··· 1 + { 2 + "manufacturer": "gok", 3 + "keyboard_name": "TypeK-S Rev. Zeta-RC2", 4 + "maintainer": "Gondolindrim", 5 + "bootloader": "stm32-dfu", 6 + "build": { 7 + "lto": true 8 + }, 9 + "diode_direction": "COL2ROW", 10 + "eeprom": { 11 + "wear_leveling": { 12 + "backing_size": 4096 13 + } 14 + }, 15 + "features": { 16 + "bootmagic": true, 17 + "nkro": true, 18 + "rgblight": true 19 + }, 20 + "matrix_pins": { 21 + "cols": ["A3", "B12", "A0", "A10", "B0", "B1", "B10", "B3", "C15", "C14", "C13", "B9", "B8", "B5"], 22 + "rows": ["A7", "A8", "A15", "A1", "A2"] 23 + }, 24 + "processor": "STM32F411", 25 + "rgblight": { 26 + "animations": { 27 + "alternating": true, 28 + "breathing": true, 29 + "christmas": true, 30 + "knight": true, 31 + "rainbow_mood": true, 32 + "rainbow_swirl": true, 33 + "rgb_test": true, 34 + "snake": true, 35 + "static_gradient": true, 36 + "twinkle": true 37 + }, 38 + "default": { 39 + "animation": "rainbow_swirl", 40 + "val": 200 41 + }, 42 + "led_count": 69, 43 + "led_map": [0, 1, 2, 3, 4, 5, 66, 67, 68, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65] 44 + }, 45 + "url": "https://www.gok.design/type-k", 46 + "usb": { 47 + "device_version": "6.2.0", 48 + "pid": "0x8475", 49 + "vid": "0x7179" 50 + }, 51 + "ws2812": { 52 + "driver": "pwm", 53 + "pin": "B15" 54 + }, 55 + "layouts": { 56 + "LAYOUT_all": { 57 + "layout": [ 58 + {"label": "Esc", "matrix": [0, 0], "x": 0.75, "y": 0}, 59 + {"label": "`~", "matrix": [0, 1], "x": 2.5, "y": 0}, 60 + {"label": "1!", "matrix": [0, 2], "x": 3.5, "y": 0}, 61 + {"label": "2@", "matrix": [0, 3], "x": 5, "y": 0}, 62 + {"label": "3#", "matrix": [0, 4], "x": 6, "y": 0}, 63 + {"label": "4$", "matrix": [0, 5], "x": 7, "y": 0}, 64 + {"label": "5%", "matrix": [0, 6], "x": 8, "y": 0}, 65 + {"label": "7&", "matrix": [0, 7], "x": 12.75, "y": 0}, 66 + {"label": "8*", "matrix": [0, 8], "x": 13.75, "y": 0}, 67 + {"label": "9(", "matrix": [0, 9], "x": 14.75, "y": 0}, 68 + {"label": "0)", "matrix": [0, 10], "x": 15.75, "y": 0}, 69 + {"label": "-_", "matrix": [0, 11], "x": 17, "y": 0}, 70 + {"label": "=+", "matrix": [0, 12], "x": 18, "y": 0}, 71 + {"label": "\\|", "matrix": [0, 13], "x": 19, "y": 0}, 72 + {"label": "Page Up", "matrix": [1, 0], "x": 0.5, "y": 1}, 73 + {"label": "Tab", "matrix": [1, 1], "x": 2.25, "y": 1, "w": 1.5}, 74 + {"label": "Q", "matrix": [1, 2], "x": 3.75, "y": 1}, 75 + {"label": "W", "matrix": [1, 3], "x": 5.5, "y": 1}, 76 + {"label": "E", "matrix": [1, 4], "x": 6.5, "y": 1}, 77 + {"label": "R", "matrix": [1, 5], "x": 7.5, "y": 1}, 78 + {"label": "T", "matrix": [1, 6], "x": 8.5, "y": 1}, 79 + {"label": "Y", "matrix": [1, 7], "x": 12, "y": 1}, 80 + {"label": "U", "matrix": [1, 8], "x": 13, "y": 1}, 81 + {"label": "I", "matrix": [1, 9], "x": 14, "y": 1}, 82 + {"label": "O", "matrix": [1, 10], "x": 15, "y": 1}, 83 + {"label": "P", "matrix": [1, 11], "x": 16.75, "y": 1}, 84 + {"label": "[{", "matrix": [1, 12], "x": 17.75, "y": 1}, 85 + {"label": "]}", "matrix": [1, 13], "x": 18.75, "y": 1}, 86 + {"label": "Page Down", "matrix": [2, 0], "x": 0.25, "y": 2}, 87 + {"label": "Caps Lock", "matrix": [2, 1], "x": 2.25, "y": 2, "w": 1.75}, 88 + {"label": "A", "matrix": [2, 2], "x": 4, "y": 2}, 89 + {"label": "S", "matrix": [2, 3], "x": 5.75, "y": 2}, 90 + {"label": "D", "matrix": [2, 4], "x": 6.75, "y": 2}, 91 + {"label": "F", "matrix": [2, 5], "x": 7.75, "y": 2}, 92 + {"label": "G", "matrix": [2, 6], "x": 8.75, "y": 2}, 93 + {"label": "H", "matrix": [2, 7], "x": 12.25, "y": 2}, 94 + {"label": "J", "matrix": [2, 8], "x": 13.25, "y": 2}, 95 + {"label": "K", "matrix": [2, 9], "x": 14.25, "y": 2}, 96 + {"label": "L", "matrix": [2, 10], "x": 15.25, "y": 2}, 97 + {"label": ";:", "matrix": [2, 11], "x": 17.25, "y": 2}, 98 + {"label": "\"", "matrix": [2, 12], "x": 18.25, "y": 2}, 99 + {"label": "Del", "matrix": [2, 13], "x": 20, "y": 0}, 100 + {"label": "End", "matrix": [3, 0], "x": 0, "y": 3}, 101 + {"label": "Shift", "matrix": [3, 1], "x": 1.5, "y": 3, "w": 2.25}, 102 + {"label": "Z", "matrix": [3, 2], "x": 3.75, "y": 3}, 103 + {"label": "X", "matrix": [3, 3], "x": 6, "y": 3}, 104 + {"label": "C", "matrix": [3, 4], "x": 7, "y": 3}, 105 + {"label": "V", "matrix": [3, 5], "x": 8, "y": 3}, 106 + {"label": "B", "matrix": [3, 6], "x": 9, "y": 3}, 107 + {"label": "B", "matrix": [3, 7], "x": 11.75, "y": 3}, 108 + {"label": "N", "matrix": [3, 8], "x": 12.75, "y": 3}, 109 + {"label": "M", "matrix": [3, 9], "x": 13.75, "y": 3}, 110 + {"label": ",<", "matrix": [3, 10], "x": 14.75, "y": 3}, 111 + {"label": ".>", "matrix": [3, 11], "x": 17, "y": 3}, 112 + {"label": "/?", "matrix": [3, 12], "x": 18, "y": 3}, 113 + {"label": "Shift", "matrix": [3, 13], "x": 19, "y": 3, "w": 1.25}, 114 + {"label": "Control", "matrix": [4, 1], "x": 1.5, "y": 4, "w": 1.5}, 115 + {"label": "Alt", "matrix": [4, 2], "x": 6, "y": 4, "w": 1.5}, 116 + {"label": "Space", "matrix": [4, 4], "x": 7.5, "y": 4, "w": 2}, 117 + {"label": "Left GUI", "matrix": [4, 5], "x": 9.5, "y": 4}, 118 + {"label": "^6", "matrix": [4, 6], "x": 9, "y": 0}, 119 + {"label": "Space", "matrix": [4, 7], "x": 11.25, "y": 4}, 120 + {"label": "Space", "matrix": [4, 8], "x": 12.25, "y": 4, "w": 2}, 121 + {"label": "Alt", "matrix": [4, 9], "x": 14.25, "y": 4, "w": 1.5}, 122 + {"label": "Backspace", "matrix": [4, 10], "x": 19.75, "y": 1, "w": 1.5}, 123 + {"label": "Enter", "matrix": [4, 11], "x": 19.25, "y": 2, "w": 2.25}, 124 + {"label": "MO(1)", "matrix": [4, 12], "x": 20.25, "y": 3}, 125 + {"label": "Control", "matrix": [4, 13], "x": 19.25, "y": 4, "w": 1.5} 126 + ] 127 + }, 128 + "LAYOUT_nosplits": { 129 + "layout": [ 130 + {"label": "Esc", "matrix": [0, 0], "x": 0.75, "y": 0}, 131 + {"label": "`~", "matrix": [0, 1], "x": 2.5, "y": 0}, 132 + {"label": "1!", "matrix": [0, 2], "x": 3.5, "y": 0}, 133 + {"label": "2@", "matrix": [0, 3], "x": 5, "y": 0}, 134 + {"label": "3#", "matrix": [0, 4], "x": 6, "y": 0}, 135 + {"label": "4$", "matrix": [0, 5], "x": 7, "y": 0}, 136 + {"label": "5%", "matrix": [0, 6], "x": 8, "y": 0}, 137 + {"label": "7&", "matrix": [0, 7], "x": 12.75, "y": 0}, 138 + {"label": "8*", "matrix": [0, 8], "x": 13.75, "y": 0}, 139 + {"label": "9(", "matrix": [0, 9], "x": 14.75, "y": 0}, 140 + {"label": "0)", "matrix": [0, 10], "x": 15.75, "y": 0}, 141 + {"label": "-_", "matrix": [0, 11], "x": 17, "y": 0}, 142 + {"label": "=+", "matrix": [0, 12], "x": 18, "y": 0}, 143 + {"label": "Backspace", "matrix": [0, 13], "x": 19, "y": 0, "w": 2}, 144 + {"label": "Page Up", "matrix": [1, 0], "x": 0.5, "y": 1}, 145 + {"label": "Tab", "matrix": [1, 1], "x": 2.25, "y": 1, "w": 1.5}, 146 + {"label": "Q", "matrix": [1, 2], "x": 3.75, "y": 1}, 147 + {"label": "W", "matrix": [1, 3], "x": 5.5, "y": 1}, 148 + {"label": "E", "matrix": [1, 4], "x": 6.5, "y": 1}, 149 + {"label": "R", "matrix": [1, 5], "x": 7.5, "y": 1}, 150 + {"label": "T", "matrix": [1, 6], "x": 8.5, "y": 1}, 151 + {"label": "Y", "matrix": [1, 7], "x": 12, "y": 1}, 152 + {"label": "U", "matrix": [1, 8], "x": 13, "y": 1}, 153 + {"label": "I", "matrix": [1, 9], "x": 14, "y": 1}, 154 + {"label": "O", "matrix": [1, 10], "x": 15, "y": 1}, 155 + {"label": "P", "matrix": [1, 11], "x": 16.75, "y": 1}, 156 + {"label": "[{", "matrix": [1, 12], "x": 17.75, "y": 1}, 157 + {"label": "]}", "matrix": [1, 13], "x": 18.75, "y": 1}, 158 + {"label": "Page Down", "matrix": [2, 0], "x": 0.25, "y": 2}, 159 + {"label": "Caps Lock", "matrix": [2, 1], "x": 2.25, "y": 2, "w": 1.75}, 160 + {"label": "A", "matrix": [2, 2], "x": 4, "y": 2}, 161 + {"label": "S", "matrix": [2, 3], "x": 5.75, "y": 2}, 162 + {"label": "D", "matrix": [2, 4], "x": 6.75, "y": 2}, 163 + {"label": "F", "matrix": [2, 5], "x": 7.75, "y": 2}, 164 + {"label": "G", "matrix": [2, 6], "x": 8.75, "y": 2}, 165 + {"label": "H", "matrix": [2, 7], "x": 12.25, "y": 2}, 166 + {"label": "J", "matrix": [2, 8], "x": 13.25, "y": 2}, 167 + {"label": "K", "matrix": [2, 9], "x": 14.25, "y": 2}, 168 + {"label": "L", "matrix": [2, 10], "x": 15.25, "y": 2}, 169 + {"label": ";:", "matrix": [2, 11], "x": 17.25, "y": 2}, 170 + {"label": "\"", "matrix": [2, 12], "x": 18.25, "y": 2}, 171 + {"label": "End", "matrix": [3, 0], "x": 0, "y": 3}, 172 + {"label": "Shift", "matrix": [3, 1], "x": 1.5, "y": 3, "w": 2.25}, 173 + {"label": "Z", "matrix": [3, 2], "x": 3.75, "y": 3}, 174 + {"label": "X", "matrix": [3, 3], "x": 6, "y": 3}, 175 + {"label": "C", "matrix": [3, 4], "x": 7, "y": 3}, 176 + {"label": "V", "matrix": [3, 5], "x": 8, "y": 3}, 177 + {"label": "B", "matrix": [3, 6], "x": 9, "y": 3}, 178 + {"label": "B", "matrix": [3, 7], "x": 11.75, "y": 3}, 179 + {"label": "N", "matrix": [3, 8], "x": 12.75, "y": 3}, 180 + {"label": "M", "matrix": [3, 9], "x": 13.75, "y": 3}, 181 + {"label": ",<", "matrix": [3, 10], "x": 14.75, "y": 3}, 182 + {"label": ".>", "matrix": [3, 11], "x": 17, "y": 3}, 183 + {"label": "/?", "matrix": [3, 12], "x": 18, "y": 3}, 184 + {"label": "Shift", "matrix": [3, 13], "x": 19, "y": 3, "w": 2.25}, 185 + {"label": "Control", "matrix": [4, 1], "x": 1.5, "y": 4, "w": 1.5}, 186 + {"label": "Alt", "matrix": [4, 2], "x": 6, "y": 4, "w": 1.5}, 187 + {"label": "Space", "matrix": [4, 4], "x": 7.5, "y": 4, "w": 3}, 188 + {"label": "^6", "matrix": [4, 6], "x": 9, "y": 0}, 189 + {"label": "Space", "matrix": [4, 8], "x": 11.25, "y": 4, "w": 3}, 190 + {"label": "Alt", "matrix": [4, 9], "x": 14.25, "y": 4, "w": 1.5}, 191 + {"label": "Backspace", "matrix": [4, 10], "x": 19.75, "y": 1, "w": 1.5}, 192 + {"label": "Enter", "matrix": [4, 11], "x": 19.25, "y": 2, "w": 2.25}, 193 + {"label": "Control", "matrix": [4, 13], "x": 19.25, "y": 4, "w": 1.5} 194 + ] 195 + } 196 + } 197 + }
+34
keyboards/typek/keymaps/default/keymap.c
··· 1 + /* Copyright 2023 Gondolindrim 2 + * 3 + * This program is free software: you can redistribute it and/or modify 4 + * it under the terms of the GNU General Public License as published by 5 + * the Free Software Foundation, either version 2 of the License, or 6 + * (at your option) any later version. 7 + * 8 + * This program is distributed in the hope that it will be useful, 9 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 + * GNU General Public License for more details. 12 + * 13 + * You should have received a copy of the GNU General Public License 14 + * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 + */ 16 + #include QMK_KEYBOARD_H 17 + 18 + const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 19 + 20 + [0] = LAYOUT_all( /* Base */ 21 + KC_ESC , KC_GRV , KC_1 , KC_2 , KC_3 , KC_4 , KC_5 , KC_7 , KC_8 , KC_9 , KC_0 , KC_MINS, KC_EQL, KC_BSLS, 22 + 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, 23 + 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_DEL , 24 + MO(1) , KC_LSFT, KC_Z , KC_X , KC_C , KC_V , KC_B , KC_B , KC_N , KC_M , KC_COMM, KC_DOT , KC_SLSH, KC_RSFT, 25 + KC_LCTL, KC_LALT, KC_SPC , KC_LGUI, KC_6 , KC_SPC , KC_SPC , KC_RALT, KC_BSPC, KC_ENT , MO(1) , KC_RCTL 26 + ), 27 + [1] = LAYOUT_all( 28 + QK_BOOT, 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_TRNS, 29 + KC_HOME, KC_TRNS, KC_TRNS, KC_UP , KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, 30 + KC_END , KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, 31 + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, 32 + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS 33 + ) 34 + };
+21
keyboards/typek/mcuconf.h
··· 1 + /* Copyright 2020 QMK 2 + * 3 + * This program is free software: you can redistribute it and/or modify 4 + * it under the terms of the GNU General Public License as published by 5 + * the Free Software Foundation, either version 2 of the License, or 6 + * (at your option) any later version. 7 + * 8 + * This program is distributed in the hope that it will be useful, 9 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 + * GNU General Public License for more details. 12 + * 13 + * You should have received a copy of the GNU General Public License 14 + * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 + */ 16 + 17 + #pragma once 18 + #include_next <mcuconf.h> 19 + 20 + #undef STM32_PWM_USE_TIM1 21 + #define STM32_PWM_USE_TIM1 TRUE
+30
keyboards/typek/readme.md
··· 1 + # gok TypeK QMK Firmware Folder 2 + 3 + ![TK](https://i.imgur.com/0ZEbEZt.jpg) 4 + 5 + ## Introduction 6 + 7 + This is the QMK Firmware repository for the Type K, the tented ergo by Gok. The TypeK went through GB on August, 2023. It is supported by a proprietary PCB ecosystem. 8 + 9 + ## How to flash 10 + 11 + ### Enter bootloader 12 + 13 + The DFU state in the bootloader can be accessed in 3 ways: 14 + 15 + * **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key, escape in the default keymap) and plug in the keyboard; 16 + * **Physical reset button**: press the button on the front of the PCB, next to caps lock, for at least five seconds; 17 + * **Keycode in layout**: Press the key mapped to `RESET`; in the default layout, that is top left key ('escape') in layer 1. 18 + 19 + ### How to compile and flash 20 + 21 + 22 + After setting up your build environment, you can compile the Iron 165R2 default keymap by using one of the options below. 23 + 24 + make typek:default 25 + 26 + And use dfu-util in the command line or through a GUI like QMK toolbox to upload the firmware to the PCB. To directly flash the PCB after it is put into a DFU state, use: 27 + 28 + make typek:default:flash 29 + 30 + See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
+44
keyboards/typek/typek.c
··· 1 + /* Copyright 2023 Gondolindrim <gondolindrim@acheronproject.com> 2 + * 3 + * This program is free software: you can redistribute it and/or modify 4 + * it under the terms of the GNU General Public License as published by 5 + * the Free Software Foundation, either version 2 of the License, or 6 + * (at your option) any later version. 7 + * 8 + * This program is distributed in the hope that it will be useful, 9 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 + * GNU General Public License for more details. 12 + * 13 + * You should have received a copy of the GNU General Public License 14 + * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 + */ 16 + 17 + #include "quantum.h" 18 + 19 + // This function gets called when caps, num, scroll change 20 + bool led_update_kb(led_t led_state) { 21 + bool res = led_update_user(led_state); 22 + if (res) { 23 + led_state.caps_lock? rgblight_setrgb_at(RGB_RED, 0) : rgblight_setrgb_at(RGB_OFF, 0); 24 + } 25 + return res; 26 + } 27 + 28 + // This function is called when layers change 29 + layer_state_t layer_state_set_kb(layer_state_t state) { 30 + state = layer_state_set_user(state); 31 + switch(get_highest_layer(state)) { 32 + case 1: 33 + rgblight_setrgb_at(RGB_GREEN, 1); 34 + break; 35 + case 2: 36 + rgblight_setrgb_at(RGB_BLUE, 2); 37 + break; 38 + default: 39 + rgblight_setrgb_at(RGB_OFF, 1); 40 + rgblight_setrgb_at(RGB_OFF, 2); 41 + break; 42 + } 43 + return state; 44 + }