qmk_firmware

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

portico.c (3429B)


      1 /*
      2 Copyright 2020 Terry Mathews
      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 #include "portico.h"
     19 
     20 #ifdef RGB_BACKLIGHT_PORTICO
     21 #    include "drivers/led/issi/is31fl3731.h"
     22 #endif
     23 
     24 #if defined(RGB_MATRIX_ENABLE) || defined(RGB_BACKLIGHT_PORTICO)
     25 
     26 const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = {
     27     { 0, C2_1,  C3_1,  C4_1  },
     28     { 0, C1_1,  C3_2,  C4_2  },
     29     { 0, C1_2,  C2_2,  C4_3  },
     30     { 0, C1_3,  C2_3,  C3_3  },
     31     { 0, C1_4,  C2_4,  C3_4  },
     32     { 0, C1_5,  C2_5,  C3_5  },
     33     { 0, C1_6,  C2_6,  C3_6  },
     34     { 0, C1_7,  C2_7,  C3_7  },
     35     { 0, C1_8,  C2_8,  C3_8  },
     36     { 1, C2_1,  C3_1,  C4_1  },
     37     { 1, C1_1,  C3_2,  C4_2  },
     38     { 1, C1_2,  C2_2,  C4_3  },
     39     { 1, C1_3,  C2_3,  C3_3  },
     40     { 1, C1_4,  C2_4,  C3_4  },
     41     { 1, C1_5,  C2_5,  C3_5  },
     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     { 0, C8_8,  C7_8,  C6_8  },
     52     { 1, C9_1,  C8_1,  C7_1  },
     53     { 1, C9_2,  C8_2,  C7_2  },
     54     { 1, C9_3,  C8_3,  C7_3  },
     55     { 1, C9_4,  C8_4,  C7_4  },
     56     { 1, C9_5,  C8_5,  C7_5  },
     57     { 1, C9_6,  C8_6,  C7_6  },
     58 
     59     { 0, C1_9,  C3_10, C4_10 },
     60     { 0, C1_10, C2_10, C4_11 },
     61     { 0, C1_11, C2_11, C3_11 },
     62     { 0, C1_12, C2_12, C3_12 },
     63     { 0, C1_13, C2_13, C3_13 },
     64     { 0, C1_14, C2_14, C3_14 },
     65     { 0, C1_15, C2_15, C3_15 },
     66     { 0, C1_16, C2_16, C3_16 },
     67     { 1, C1_10, C2_10, C4_11 },
     68     { 1, C1_11, C2_11, C3_11 },
     69     { 1, C1_12, C2_12, C3_12 },
     70     { 1, C1_13, C2_13, C3_13 },
     71     { 1, C1_14, C2_14, C3_14 },
     72     { 1, C9_7,  C8_7,  C6_6  },
     73 
     74     { 0, C2_9,  C3_9,  C4_9  },
     75     { 0, C9_12, C8_12, C7_12 },
     76     { 0, C9_13, C8_13, C7_13 },
     77     { 0, C9_14, C8_14, C7_14 },
     78     { 0, C9_15, C8_15, C6_14 },
     79     { 0, C9_16, C7_15, C6_15 },
     80     { 1, C2_9,  C3_9,  C4_9  },
     81     { 1, C1_9,  C3_10, C4_10 },
     82     { 1, C9_9,  C8_9,  C7_9  },
     83     { 1, C9_10, C8_10, C7_10 },
     84     { 1, C9_11, C8_11, C7_11 },
     85     { 1, C9_14, C8_14, C7_14 },
     86     { 1, C1_15, C2_15, C3_15 },
     87     { 1, C1_16, C2_16, C3_16 },
     88 
     89     { 0, C9_9,  C8_9,  C7_9  },
     90     { 0, C9_10, C8_10, C7_10 },
     91     { 0, C9_11, C8_11, C7_11 },
     92     { 0, C8_16, C7_16, C6_16 },
     93     { 1, C9_12, C8_12, C7_12 },
     94     { 1, C9_13, C8_13, C7_13 },
     95     { 1, C9_15, C8_15, C6_14 },
     96     { 1, C9_16, C7_15, C6_15 },
     97     { 1, C8_16, C7_16, C6_16 }
     98 };
     99 #endif
    100 
    101 #ifdef RGB_MATRIX_ENABLE
    102 bool rgb_matrix_indicators_kb(void) {
    103     if (!rgb_matrix_indicators_user()) {
    104         return false;
    105     }
    106 	if (host_keyboard_led_state().caps_lock) {
    107 		rgb_matrix_set_color(30, 0xFF, 0xFF, 0xFF);
    108 	}
    109 	else {
    110 		rgb_matrix_set_color(30, 0x00, 0x00, 0x00);
    111 	}
    112 	if (!rgb_matrix_is_enabled()) {
    113 		rgb_matrix_driver.flush();
    114     }
    115     return true;
    116 }
    117 #endif
    118