qmk_firmware

QMK firmware for my keyboards (Corne, Sweep Ferris) and trackball (Ploopy Adept)
Log | Files | Refs | Submodules | LICENSE

hotswap.c (4896B)


      1 /* Copyright 2021 kb-elmo<mail@elmo.space>
      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 #ifdef RGB_MATRIX_ENABLE
     20 const is31fl3741_led_t PROGMEM g_is31fl3741_leds[IS31FL3741_LED_COUNT] = {
     21     {0, SW1_CS3,  SW1_CS2,  SW1_CS1},  /* RGB0-ESC ROW0*/
     22     {0, SW1_CS6,  SW1_CS5,  SW1_CS4},  /* RGB1-1 */
     23     {0, SW1_CS9,  SW1_CS8,  SW1_CS7},  /* RGB2-2 */
     24     {0, SW1_CS12,  SW1_CS11,  SW1_CS10},  /* RGB3-3 */
     25     {0, SW1_CS15,  SW1_CS14,  SW1_CS13},  /* RGB4-4 */
     26     {0, SW1_CS18,  SW1_CS17,  SW1_CS16},  /* RGB5-5 */
     27     {0, SW1_CS21,  SW1_CS20,  SW1_CS19},  /* RGB6-6 */
     28     {0, SW1_CS24,  SW1_CS23,  SW1_CS22},  /* RGB7-7 */
     29     {0, SW1_CS27,  SW1_CS26,  SW1_CS25},  /* RGB8-8 */
     30     {0, SW1_CS30,  SW1_CS29,  SW1_CS28},  /* RGB9-9 */
     31     {0, SW1_CS33,  SW1_CS32,  SW1_CS31},  /* RGB10-0 */
     32     {0, SW1_CS36,  SW1_CS35,  SW1_CS34},  /* RGB11--- */
     33     {0, SW1_CS39,  SW1_CS38,  SW1_CS37},  /* RGB12-+= */
     34     {0, SW6_CS36,  SW6_CS35,  SW6_CS34},  /* RGB13-BS */
     35     {0, SW7_CS27,  SW7_CS26,  SW7_CS25},  /* RGB14-DEL */
     36     {0, SW2_CS3,  SW2_CS2,  SW2_CS1},  /* RGB15-TAB ----ROW1*/
     37     {0, SW2_CS6,  SW2_CS5,  SW2_CS4}, /* RGB16-Q */
     38     {0, SW2_CS9,  SW2_CS8,  SW2_CS7}, /* RGB17-W */
     39     {0, SW2_CS12,  SW2_CS11,  SW2_CS10}, /* RGB18-E */
     40     {0, SW2_CS15,  SW2_CS14,  SW2_CS13}, /* RGB19-R */
     41     {0, SW2_CS18,  SW2_CS17,  SW2_CS16}, /* RGB20-T */
     42     {0, SW2_CS21,  SW2_CS20,  SW2_CS19}, /* RGB21-Y */
     43     {0, SW2_CS24,  SW2_CS23,  SW2_CS22}, /* RGB22-U */
     44     {0, SW2_CS27,  SW2_CS26,  SW2_CS25}, /* RGB23-I */
     45     {0, SW2_CS30,  SW2_CS29,  SW2_CS28}, /* RGB24-O */
     46     {0, SW2_CS33,  SW2_CS32,  SW2_CS31}, /* RGB25-P */
     47     {0, SW2_CS36,  SW2_CS35,  SW2_CS34}, /* RGB26-[ */
     48     {0, SW2_CS39,  SW2_CS38,  SW2_CS37}, /* RGB27-] */
     49     {0, SW6_CS39,  SW6_CS38,  SW6_CS37}, /* RGB28-\ */
     50     {0, SW7_CS30,  SW7_CS29,  SW7_CS28},  /* RGB29-PGUP */
     51     {0, SW3_CS3,  SW3_CS2,  SW3_CS1},  /* RGB30-CAPS---ROW2*/
     52     {0, SW3_CS6,  SW3_CS5,  SW3_CS4},  /* RGB31-A-- */
     53     {0, SW3_CS9,  SW3_CS8,  SW3_CS7},  /* RGB32-S-- */
     54     {0, SW3_CS12,  SW3_CS11,  SW3_CS10},  /* RGB33-D-- */
     55     {0, SW3_CS15,  SW3_CS14,  SW3_CS13},  /* RGB34-F-- */
     56     {0, SW3_CS18,  SW3_CS17,  SW3_CS16},  /* RGB35-G-- */
     57     {0, SW3_CS21,  SW3_CS20,  SW3_CS19},  /* RGB36-H-- */
     58     {0, SW3_CS24,  SW3_CS23,  SW3_CS22},  /* RGB37-J-- */
     59     {0, SW3_CS27,  SW3_CS26,  SW3_CS25},  /* RGB38-K-- */
     60     {0, SW3_CS30,  SW3_CS29,  SW3_CS28},  /* RGB39-L-- */
     61     {0, SW3_CS33,  SW3_CS32,  SW3_CS31},  /* RGB40-;:- */
     62     {0, SW3_CS36,  SW3_CS35,  SW3_CS34},  /* RGB41-''- */
     63     {0, SW3_CS39,  SW3_CS38,  SW3_CS37},  /* RGB42-ENTER- */
     64     {0, SW7_CS33,  SW7_CS32,  SW7_CS31},  /* RGB43-PGDN */
     65     {0, SW4_CS3,  SW4_CS2,  SW4_CS1},  /* RGB44-LSF --ROW3*/
     66     {0, SW4_CS6,  SW4_CS5,  SW4_CS4},  /* RGB45-Z -*/
     67     {0, SW4_CS9,  SW4_CS8,  SW4_CS7},  /* RGB46-X -*/
     68     {0, SW4_CS12,  SW4_CS11,  SW4_CS10},  /* RGB47-C -*/
     69     {0, SW4_CS15,  SW4_CS14,  SW4_CS13},  /* RGB48-V -*/
     70     {0, SW4_CS18,  SW4_CS17,  SW4_CS16},  /* RGB49-B -*/
     71     {0, SW4_CS21,  SW4_CS20,  SW4_CS19},  /* RGB50-N -*/
     72     {0, SW4_CS24,  SW4_CS23,  SW4_CS22},  /* RGB51-M -*/
     73     {0, SW4_CS27,  SW4_CS26,  SW4_CS25},  /* RGB52-,< -*/
     74     {0, SW4_CS30,  SW4_CS29,  SW4_CS28},  /* RGB53->. -*/
     75     {0, SW4_CS33,  SW4_CS32,  SW4_CS31},  /* RGB54-? -*/
     76     {0, SW4_CS36,  SW4_CS35,  SW4_CS34},  /* RGB55-RSF -*/
     77     {0, SW4_CS39,  SW4_CS38,  SW4_CS37},  /* RGB56-UP -*/
     78     {0, SW7_CS36, SW7_CS35, SW7_CS34}, /* RGB57--MO-- */
     79     {0, SW5_CS3, SW5_CS2, SW5_CS1}, /* RGB58-lct-- row4*/
     80     {0, SW5_CS6, SW5_CS5, SW5_CS4}, /* RGB59-lwin- */
     81     {0, SW5_CS9, SW5_CS8, SW5_CS7}, /* RGB60-lalt- */
     82     {0, SW5_CS18, SW5_CS17, SW5_CS16}, /* RGB61-sp- */
     83     {0, SW5_CS30, SW5_CS29, SW5_CS28}, /* RGB62-ralt- */
     84     {0, SW5_CS33, SW5_CS32, SW5_CS31}, /* RGB63-rct- */
     85     {0, SW5_CS36, SW5_CS35, SW5_CS34}, /* RGB64-left- */
     86     {0, SW5_CS39, SW5_CS38, SW5_CS37}, /* RGB65-dn- */
     87     {0, SW7_CS39, SW7_CS38, SW7_CS37}, /* RGB66-right- */
     88 };
     89 #endif
     90 
     91 bool rgb_matrix_indicators_kb(void) {
     92     if (!rgb_matrix_indicators_user()) {
     93         return false;
     94     }
     95     if (host_keyboard_led_state().caps_lock) {
     96         rgb_matrix_set_color(31, 255, 255, 255);
     97     } else {
     98         rgb_matrix_set_color(31, 0, 0, 0);
     99     }
    100     return true;
    101 }