qmk_firmware

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

hotswap.c (3612B)


      1 /**
      2  * @file hotswap.c
      3  *
      4     Copyright 2020 astro <yuleiz@gmail.com>
      5 
      6     This program is free software: you can redistribute it and/or modify
      7     it under the terms of the GNU General Public License as published by
      8     the Free Software Foundation, either version 2 of the License, or
      9     (at your option) any later version.
     10 
     11     This program is distributed in the hope that it will be useful,
     12     but WITHOUT ANY WARRANTY; without even the implied warranty of
     13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14     GNU General Public License for more details.
     15 
     16     You should have received a copy of the GNU General Public License
     17     along with this program.  If not, see <http://www.gnu.org/licenses/>.
     18  */
     19 
     20 #include "quantum.h"
     21 
     22 #ifdef RGB_MATRIX_ENABLE
     23 const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = {
     24 /* Refer to IS31 manual for these locations
     25  *   driver
     26  *   |  R location
     27  *   |  |       G location
     28  *   |  |       |       B location
     29  *   |  |       |       | */
     30 // left CA
     31     {0, C1_1,   C3_2,   C4_2},
     32     {0, C1_2,   C2_2,   C4_3},
     33     {0, C1_3,   C2_3,   C3_3},
     34     {0, C1_4,   C2_4,   C3_4},
     35     {0, C1_5,   C2_5,   C3_5},
     36     {0, C1_6,   C2_6,   C3_6},
     37     {0, C1_7,   C2_7,   C3_7},
     38     {0, C1_8,   C2_8,   C3_8},
     39 
     40     //{0, C5_1,   C4_1,   C6_1},
     41     //{0, C5_8,   C4_8,   C6_8},
     42 
     43     {0, C9_1,   C8_1,   C7_1},
     44     {0, C9_2,   C8_2,   C7_2},
     45     //{0, C9_3,   C8_3,   C7_3},
     46     {0, C9_4,   C8_4,   C7_4},
     47     {0, C9_5,   C8_5,   C7_5},
     48     {0, C9_6,   C8_6,   C7_6},
     49     {0, C9_7,   C8_7,   C6_6},
     50     {0, C9_8,   C7_7,   C6_7},
     51 // left CB
     52     {0, C1_9,   C3_10,  C4_10},
     53     {0, C1_10,  C2_10,  C4_11},
     54     {0, C1_11,  C2_11,  C3_11},
     55     {0, C1_12,  C2_12,  C3_12},
     56     {0, C1_13,  C2_13,  C3_13},
     57     {0, C1_14,  C2_14,  C3_14},
     58     {0, C1_15,  C2_15,  C3_15},
     59     {0, C1_16,  C2_16,  C3_16},
     60 
     61     {0, C5_9,   C4_9,   C6_9},
     62     {0, C5_16,  C4_16,  C6_16},
     63 
     64     {0, C9_9,   C8_9,   C7_9},
     65     {0, C9_10,  C8_10,  C7_10},
     66     {0, C9_11,  C8_11,  C7_11},
     67     {0, C9_12,  C8_12,  C7_12},
     68     {0, C9_13,  C8_13,  C7_13},
     69     {0, C9_14,  C8_14,  C7_14},
     70     {0, C9_15,  C8_15,  C6_14},
     71     {0, C9_16,  C7_15,  C6_15},
     72 
     73 // right CA
     74     {1, C1_1,   C3_2,   C4_2},
     75     {1, C1_2,   C2_2,   C4_3},
     76     {1, C1_3,   C2_3,   C3_3},
     77     {1, C1_4,   C2_4,   C3_4},
     78     {1, C1_5,   C2_5,   C3_5},
     79     {1, C1_6,   C2_6,   C3_6},
     80     {1, C1_7,   C2_7,   C3_7},
     81     {1, C1_8,   C2_8,   C3_8},
     82 
     83     //{1, C5_1,   C4_1,   C6_1},
     84     //{1, C5_8,   C4_8,   C6_8},
     85 
     86     {1, C9_1,   C8_1,   C7_1},
     87     {1, C9_2,   C8_2,   C7_2},
     88     {1, C9_3,   C8_3,   C7_3},
     89     {1, C9_4,   C8_4,   C7_4},
     90     {1, C9_5,   C8_5,   C7_5},
     91     {1, C9_6,   C8_6,   C7_6},
     92     {1, C9_7,   C8_7,   C6_6},
     93     {1, C9_8,   C7_7,   C6_7},
     94 // right CB
     95     {1, C1_9,   C3_10,  C4_10},
     96     {1, C1_10,  C2_10,  C4_11},
     97     {1, C1_11,  C2_11,  C3_11},
     98     {1, C1_12,  C2_12,  C3_12},
     99     {1, C1_13,  C2_13,  C3_13},
    100     //{1, C1_14,  C2_14,  C3_14},
    101     {1, C1_15,  C2_15,  C3_15},
    102     {1, C1_16,  C2_16,  C3_16},
    103 
    104     //{1, C5_9,   C4_9,   C6_9},
    105     //{1, C5_16,  C4_16,  C6_16},
    106 
    107     {1, C9_9,   C8_9,   C7_9},
    108     {1, C9_10,  C8_10,  C7_10},
    109     {1, C9_11,  C8_11,  C7_11},
    110     {1, C9_12,  C8_12,  C7_12},
    111     {1, C9_13,  C8_13,  C7_13},
    112     {1, C9_14,  C8_14,  C7_14},
    113     {1, C9_15,  C8_15,  C6_14},
    114     {1, C9_16,  C7_15,  C6_15},
    115 };
    116 
    117 bool rgb_matrix_indicators_kb(void) {
    118     if (!rgb_matrix_indicators_user()) {
    119         return false;
    120     }
    121     if (host_keyboard_led_state().caps_lock) {
    122         rgb_matrix_set_color(8, 0xFF, 0x0, 0x0);
    123     }
    124     return true;
    125 }
    126 
    127 #endif  //RGB_MATRIX_ENABLE