diff options
Diffstat (limited to 'drivers/issi/is31fl3741.h')
| -rw-r--r-- | drivers/issi/is31fl3741.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/drivers/issi/is31fl3741.h b/drivers/issi/is31fl3741.h new file mode 100644 index 000000000..3fa853467 --- /dev/null +++ b/drivers/issi/is31fl3741.h | |||
| @@ -0,0 +1,55 @@ | |||
| 1 | /* Copyright 2017 Jason Williams | ||
| 2 | * Copyright 2018 Jack Humbert | ||
| 3 | * Copyright 2018 Yiancar | ||
| 4 | * Copyright 2020 MelGeek | ||
| 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 | #pragma once | ||
| 21 | |||
| 22 | #include <stdint.h> | ||
| 23 | #include <stdbool.h> | ||
| 24 | |||
| 25 | typedef struct is31_led { | ||
| 26 | uint8_t driver : 2; | ||
| 27 | uint8_t rcs; | ||
| 28 | uint8_t rsw; | ||
| 29 | uint8_t gcs; | ||
| 30 | uint8_t gsw; | ||
| 31 | uint8_t bcs; | ||
| 32 | uint8_t bsw; | ||
| 33 | } __attribute__((packed)) is31_led; | ||
| 34 | |||
| 35 | extern const is31_led g_is31_leds[DRIVER_LED_TOTAL]; | ||
| 36 | extern const is31_led g_is31_indicator_leds[DRIVER_INDICATOR_LED_TOTAL]; | ||
| 37 | |||
| 38 | void IS31FL3741_init(uint8_t addr); | ||
| 39 | void IS31FL3741_write_register(uint8_t addr, uint8_t reg, uint8_t data); | ||
| 40 | bool IS31FL3741_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer); | ||
| 41 | |||
| 42 | void IS31FL3741_set_color(int index, uint8_t red, uint8_t green, uint8_t blue); | ||
| 43 | void IS31FL3741_set_color_all(uint8_t red, uint8_t green, uint8_t blue); | ||
| 44 | |||
| 45 | void IS31FL3741_set_led_control_register(uint8_t index, bool red, bool green, bool blue); | ||
| 46 | |||
| 47 | // This should not be called from an interrupt | ||
| 48 | // (eg. from a timer interrupt). | ||
| 49 | // Call this while idle (in between matrix scans). | ||
| 50 | // If the buffer is dirty, it will update the driver with the buffer. | ||
| 51 | void IS31FL3741_update_pwm_buffers(uint8_t addr1, uint8_t addr2); | ||
| 52 | void IS31FL3741_update_led_control_registers(uint8_t addr1, uint8_t addr2); | ||
| 53 | void IS31FL3741_set_scaling_registers(const is31_led *pled, uint8_t red, uint8_t green, uint8_t blue); | ||
| 54 | |||
| 55 | void IS31FL3741_set_pwm_buffer(const is31_led *pled, uint8_t red, uint8_t green, uint8_t blue); | ||
