qmk_firmware

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

is31fl3218-mono.h (2035B)


      1 /* Copyright 2018 Jason Williams (Wilba)
      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 #include <stdint.h>
     20 #include <stdbool.h>
     21 #include "progmem.h"
     22 #include "util.h"
     23 
     24 #define IS31FL3218_REG_SHUTDOWN 0x00
     25 #define IS31FL3218_REG_PWM 0x01
     26 #define IS31FL3218_REG_LED_CONTROL_1 0x13
     27 #define IS31FL3218_REG_LED_CONTROL_2 0x14
     28 #define IS31FL3218_REG_LED_CONTROL_3 0x15
     29 #define IS31FL3218_REG_UPDATE 0x16
     30 #define IS31FL3218_REG_RESET 0x17
     31 
     32 #define IS31FL3218_I2C_ADDRESS 0x54
     33 
     34 #if defined(LED_MATRIX_IS31FL3218)
     35 #    define IS31FL3218_LED_COUNT LED_MATRIX_LED_COUNT
     36 #endif
     37 
     38 typedef struct is31fl3218_led_t {
     39     uint8_t v;
     40 } PACKED is31fl3218_led_t;
     41 
     42 extern const is31fl3218_led_t PROGMEM g_is31fl3218_leds[IS31FL3218_LED_COUNT];
     43 
     44 void is31fl3218_init(void);
     45 
     46 void is31fl3218_write_register(uint8_t reg, uint8_t data);
     47 
     48 void is31fl3218_set_value(int index, uint8_t value);
     49 
     50 void is31fl3218_set_value_all(uint8_t value);
     51 
     52 void is31fl3218_set_led_control_register(uint8_t index, bool value);
     53 
     54 void is31fl3218_update_pwm_buffers(void);
     55 
     56 void is31fl3218_update_led_control_registers(void);
     57 
     58 #define OUT1 0x00
     59 #define OUT2 0x01
     60 #define OUT3 0x02
     61 #define OUT4 0x03
     62 #define OUT5 0x04
     63 #define OUT6 0x05
     64 #define OUT7 0x06
     65 #define OUT8 0x07
     66 #define OUT9 0x08
     67 #define OUT10 0x09
     68 #define OUT11 0x0A
     69 #define OUT12 0x0B
     70 #define OUT13 0x0C
     71 #define OUT14 0x0D
     72 #define OUT15 0x0E
     73 #define OUT16 0x0F
     74 #define OUT17 0x10
     75 #define OUT18 0x11