qmk_firmware

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

indicators.c (1479B)


      1 /* Copyright 2020 B. Fletcher (toraifu) <typefast@kyaa.gg>
      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 "indicators.h"
     18 #include "drivers/led/issi/is31fl3731-mono.h"
     19 #include "i2c_master.h"
     20 
     21 /* Set up IS31FL3731 for use in powering indicator LEDs. Absolutely overkill for this job but it was already in the design.
     22  * init IS31FL3731 and i2c
     23  */
     24 void init_fallacy_leds(void) {
     25     is31fl3731_init_drivers();
     26 }
     27 
     28 
     29 /* update the buffer
     30  */
     31 void update_fallacy_leds(void) {
     32     is31fl3731_flush();
     33 }
     34 
     35 
     36 /* wrapper to actually set the LED PWM
     37  */
     38 void set_fallacy_led(int index, bool state) {
     39     if (state) {
     40         is31fl3731_set_value(index, 128);
     41     } 
     42     else {
     43         is31fl3731_set_value(index, 0);
     44     }
     45 }
     46 
     47 
     48 /* define LED matrix
     49  */
     50 const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT] = {
     51     {0, C1_1},
     52     {0, C2_1},
     53     {0, C3_1},
     54 };