aboutsummaryrefslogtreecommitdiff
path: root/drivers/issi/is31fl3731-simple.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/issi/is31fl3731-simple.c')
-rw-r--r--drivers/issi/is31fl3731-simple.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/drivers/issi/is31fl3731-simple.c b/drivers/issi/is31fl3731-simple.c
index 46d51dac7..9c31df209 100644
--- a/drivers/issi/is31fl3731-simple.c
+++ b/drivers/issi/is31fl3731-simple.c
@@ -29,6 +29,7 @@
29#include "is31fl3731-simple.h" 29#include "is31fl3731-simple.h"
30#include "i2c_master.h" 30#include "i2c_master.h"
31#include "progmem.h" 31#include "progmem.h"
32#include "print.h"
32 33
33// This is a 7-bit address, that gets left-shifted and bit 0 34// This is a 7-bit address, that gets left-shifted and bit 0
34// set to 0 for write, 1 for read (as per I2C protocol) 35// set to 0 for write, 1 for read (as per I2C protocol)
@@ -72,10 +73,19 @@ uint8_t g_twi_transfer_buffer[20];
72// We could optimize this and take out the unused registers from these 73// We could optimize this and take out the unused registers from these
73// buffers and the transfers in IS31FL3731_write_pwm_buffer() but it's 74// buffers and the transfers in IS31FL3731_write_pwm_buffer() but it's
74// probably not worth the extra complexity. 75// probably not worth the extra complexity.
75uint8_t g_pwm_buffer[DRIVER_COUNT][144]; 76uint8_t g_pwm_buffer[LED_DRIVER_COUNT][144];
76bool g_pwm_buffer_update_required = false; 77bool g_pwm_buffer_update_required = false;
77 78
78uint8_t g_led_control_registers[DRIVER_COUNT][18] = { { 0 }, { 0 } }; 79/* There's probably a better way to init this... */
80#if LED_DRIVER_COUNT == 1
81 uint8_t g_led_control_registers[LED_DRIVER_COUNT][18] = {{0}};
82#elif LED_DRIVER_COUNT == 2
83 uint8_t g_led_control_registers[LED_DRIVER_COUNT][18] = {{0}, {0}};
84#elif LED_DRIVER_COUNT == 3
85 uint8_t g_led_control_registers[LED_DRIVER_COUNT][18] = {{0}, {0}, {0}};
86#elif LED_DRIVER_COUNT == 4
87 uint8_t g_led_control_registers[LED_DRIVER_COUNT][18] = {{0}, {0}, {0}, {0}};
88#endif
79bool g_led_control_registers_update_required = false; 89bool g_led_control_registers_update_required = false;
80 90
81// This is the bit pattern in the LED control registers 91// This is the bit pattern in the LED control registers
@@ -194,7 +204,7 @@ void IS31FL3731_init(uint8_t addr) {
194} 204}
195 205
196void IS31FL3731_set_value(int index, uint8_t value) { 206void IS31FL3731_set_value(int index, uint8_t value) {
197 if (index >= 0 && index < DRIVER_LED_TOTAL) { 207 if (index >= 0 && index < LED_DRIVER_LED_COUNT) {
198 is31_led led = g_is31_leds[index]; 208 is31_led led = g_is31_leds[index];
199 209
200 // Subtract 0x24 to get the second index of g_pwm_buffer 210 // Subtract 0x24 to get the second index of g_pwm_buffer
@@ -204,7 +214,7 @@ void IS31FL3731_set_value(int index, uint8_t value) {
204} 214}
205 215
206void IS31FL3731_set_value_all(uint8_t value) { 216void IS31FL3731_set_value_all(uint8_t value) {
207 for (int i = 0; i < DRIVER_LED_TOTAL; i++) { 217 for (int i = 0; i < LED_DRIVER_LED_COUNT; i++) {
208 IS31FL3731_set_value(i, value); 218 IS31FL3731_set_value(i, value);
209 } 219 }
210} 220}