1 /* Copyright 2017 Jason Williams
2 * Copyright 2018 Jack Humbert
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.
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.
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/>.
18 #ifndef IS31FL3731_DRIVER_H
19 #define IS31FL3731_DRIVER_H
24 typedef struct is31_led {
29 } __attribute__((packed)) is31_led;
31 extern const is31_led g_is31_leds[DRIVER_LED_TOTAL];
33 void IS31FL3731_init(uint8_t addr);
34 void IS31FL3731_write_register(uint8_t addr, uint8_t reg, uint8_t data);
35 void IS31FL3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer);
37 void IS31FL3731_set_color(int index, uint8_t red, uint8_t green, uint8_t blue);
38 void IS31FL3731_set_color_all(uint8_t red, uint8_t green, uint8_t blue);
40 void IS31FL3731_set_led_control_register(uint8_t index, bool red, bool green, bool blue);
42 // This should not be called from an interrupt
43 // (eg. from a timer interrupt).
44 // Call this while idle (in between matrix scans).
45 // If the buffer is dirty, it will update the driver with the buffer.
46 void IS31FL3731_update_pwm_buffers(uint8_t addr, uint8_t index);
47 void IS31FL3731_update_led_control_registers(uint8_t addr, uint8_t index);
211 #endif // IS31FL3731_DRIVER_H