qmk_firmware

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

aw9523b.h (1807B)


      1 /**
      2  * @file aw9523b.h
      3  * @brief driver for aw9523b
      4  * 
      5  * Copyright 2020 astro <yuleiz@gmail.com>
      6  *
      7  * This program is free software: you can redistribute it and/or modify
      8  * it under the terms of the GNU General Public License as published by
      9  * the Free Software Foundation, either version 2 of the License, or
     10  * (at your option) any later version.
     11  *
     12  * This program is distributed in the hope that it will be useful,
     13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15  * GNU General Public License for more details.
     16  *
     17  * You should have received a copy of the GNU General Public License
     18  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
     19  */
     20 
     21 #pragma once
     22 
     23 #include <stdint.h>
     24 
     25 #ifndef AW9523B_ADDR
     26     #define AW9523B_ADDR 0xB6
     27 #endif
     28 
     29 #define AW9523B_PWM_BASE    0x20
     30 
     31 #define AW9523B_P10_PWM     0x20
     32 #define AW9523B_P11_PWM     0x21
     33 #define AW9523B_P12_PWM     0x22
     34 #define AW9523B_P13_PWM     0x23
     35 #define AW9523B_P00_PWM     0x24
     36 #define AW9523B_P01_PWM     0x25
     37 #define AW9523B_P02_PWM     0x26
     38 #define AW9523B_P03_PWM     0x27
     39 #define AW9523B_P04_PWM     0x28
     40 #define AW9523B_P05_PWM     0x29
     41 #define AW9523B_P06_PWM     0x2A
     42 #define AW9523B_P07_PWM     0x2B
     43 #define AW9523B_P14_PWM     0x2C
     44 #define AW9523B_P15_PWM     0x2D
     45 #define AW9523B_P16_PWM     0x2E
     46 #define AW9523B_P17_PWM     0x2F
     47 
     48 #define AW9523B_PWM_SIZE    16
     49 
     50 typedef struct {
     51     uint8_t r;
     52     uint8_t g;
     53     uint8_t b;
     54 } aw9523b_led;
     55 
     56 extern const aw9523b_led g_aw9523b_leds[AW9523B_RGB_NUM];
     57 
     58 void aw9523b_init(uint8_t addr);
     59 
     60 void aw9523b_set_color(int index, uint8_t red, uint8_t green, uint8_t blue);
     61 void aw9523b_set_color_all(uint8_t red, uint8_t green, uint8_t blue);
     62 void aw9523b_update_pwm_buffers(uint8_t addr);