summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/bluetooth/bluefruit_le.cpp8
-rw-r--r--drivers/bluetooth/bluefruit_le.h2
-rw-r--r--drivers/bluetooth/rn42.c32
-rw-r--r--drivers/bluetooth/rn42.h4
-rw-r--r--drivers/haptic/solenoid.c5
-rw-r--r--drivers/led/aw20216.c2
-rw-r--r--drivers/led/aw20216.h2
-rw-r--r--drivers/led/ckled2001-simple.c4
-rw-r--r--drivers/led/ckled2001-simple.h2
-rw-r--r--drivers/led/ckled2001.c4
-rw-r--r--drivers/led/ckled2001.h2
-rw-r--r--drivers/led/issi/is31fl3731-simple.c4
-rw-r--r--drivers/led/issi/is31fl3731-simple.h2
-rw-r--r--drivers/led/issi/is31fl3731.c4
-rw-r--r--drivers/led/issi/is31fl3731.h2
-rw-r--r--drivers/led/issi/is31fl3733-simple.c4
-rw-r--r--drivers/led/issi/is31fl3733-simple.h2
-rw-r--r--drivers/led/issi/is31fl3733.c4
-rw-r--r--drivers/led/issi/is31fl3733.h2
-rw-r--r--drivers/led/issi/is31fl3736.c4
-rw-r--r--drivers/led/issi/is31fl3736.h6
-rw-r--r--drivers/led/issi/is31fl3737.c4
-rw-r--r--drivers/led/issi/is31fl3737.h2
-rw-r--r--drivers/led/issi/is31fl3741.c4
-rw-r--r--drivers/led/issi/is31fl3741.h2
-rw-r--r--drivers/led/issi/is31flcommon.c15
-rw-r--r--drivers/led/issi/is31flcommon.h6
-rw-r--r--drivers/painter/generic/qp_rgb565_surface.c277
-rw-r--r--drivers/painter/generic/qp_rgb565_surface.h42
-rw-r--r--drivers/painter/tft_panel/qp_tft_panel.c4
-rw-r--r--drivers/sensors/cirque_pinnacle.c8
-rw-r--r--drivers/sensors/cirque_pinnacle.h1
-rw-r--r--drivers/sensors/cirque_pinnacle_gestures.c8
-rw-r--r--drivers/sensors/cirque_pinnacle_i2c.c10
-rw-r--r--drivers/sensors/cirque_pinnacle_spi.c10
-rw-r--r--drivers/sensors/pimoroni_trackball.c21
-rw-r--r--drivers/sensors/pmw33xx_common.c19
37 files changed, 413 insertions, 121 deletions
diff --git a/drivers/bluetooth/bluefruit_le.cpp b/drivers/bluetooth/bluefruit_le.cpp
index 19310767cf..50170b83fe 100644
--- a/drivers/bluetooth/bluefruit_le.cpp
+++ b/drivers/bluetooth/bluefruit_le.cpp
@@ -79,9 +79,7 @@ struct sdep_msg {
enum queue_type {
QTKeyReport, // 1-byte modifier + 6-byte key report
QTConsumer, // 16-bit key code
-#ifdef MOUSE_ENABLE
QTMouseMove, // 4-byte mouse report
-#endif
};
struct queue_item {
@@ -442,7 +440,7 @@ bool bluefruit_le_enable_keyboard(void) {
// Disable command echo
static const char kEcho[] PROGMEM = "ATE=0";
// Make the advertised name match the keyboard
- static const char kGapDevName[] PROGMEM = "AT+GAPDEVNAME=" STR(PRODUCT);
+ static const char kGapDevName[] PROGMEM = "AT+GAPDEVNAME=" PRODUCT;
// Turn on keyboard support
static const char kHidEnOn[] PROGMEM = "AT+BLEHIDEN=1";
@@ -581,10 +579,12 @@ static bool process_queue_item(struct queue_item *item, uint16_t timeout) {
snprintf(cmdbuf, sizeof(cmdbuf), fmtbuf, item->key.modifier, item->key.keys[0], item->key.keys[1], item->key.keys[2], item->key.keys[3], item->key.keys[4], item->key.keys[5]);
return at_command(cmdbuf, NULL, 0, true, timeout);
+#ifdef EXTRAKEY_ENABLE
case QTConsumer:
strcpy_P(fmtbuf, PSTR("AT+BLEHIDCONTROLKEY=0x%04x"));
snprintf(cmdbuf, sizeof(cmdbuf), fmtbuf, item->consumer);
return at_command(cmdbuf, NULL, 0, true, timeout);
+#endif
#ifdef MOUSE_ENABLE
case QTMouseMove:
@@ -658,7 +658,6 @@ void bluefruit_le_send_consumer_key(uint16_t usage) {
}
}
-#ifdef MOUSE_ENABLE
void bluefruit_le_send_mouse_move(int8_t x, int8_t y, int8_t scroll, int8_t pan, uint8_t buttons) {
struct queue_item item;
@@ -673,7 +672,6 @@ void bluefruit_le_send_mouse_move(int8_t x, int8_t y, int8_t scroll, int8_t pan,
send_buf_send_one();
}
}
-#endif
uint32_t bluefruit_le_read_battery_voltage(void) {
return state.vbat;
diff --git a/drivers/bluetooth/bluefruit_le.h b/drivers/bluetooth/bluefruit_le.h
index de301c6167..731ba2e370 100644
--- a/drivers/bluetooth/bluefruit_le.h
+++ b/drivers/bluetooth/bluefruit_le.h
@@ -40,12 +40,10 @@ extern void bluefruit_le_send_keys(uint8_t hid_modifier_mask, uint8_t *keys, uin
* (milliseconds) */
extern void bluefruit_le_send_consumer_key(uint16_t usage);
-#ifdef MOUSE_ENABLE
/* Send a mouse/wheel movement report.
* The parameters are signed and indicate positive or negative direction
* change. */
extern void bluefruit_le_send_mouse_move(int8_t x, int8_t y, int8_t scroll, int8_t pan, uint8_t buttons);
-#endif
/* Compute battery voltage by reading an analog pin.
* Returns the integer number of millivolts */
diff --git a/drivers/bluetooth/rn42.c b/drivers/bluetooth/rn42.c
index 5d497cda20..0eb1733723 100644
--- a/drivers/bluetooth/rn42.c
+++ b/drivers/bluetooth/rn42.c
@@ -14,6 +14,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "rn42.h"
+
#include "report.h"
#include "uart.h"
@@ -69,33 +71,35 @@ void rn42_send_keyboard(report_keyboard_t *report) {
uart_write(0xFD);
uart_write(0x09);
uart_write(0x01);
+
uart_write(report->mods);
uart_write(0x00);
- for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) {
- uart_write(report->keys[i]);
- }
+ uart_write(report->keys[0]);
+ uart_write(report->keys[1]);
+ uart_write(report->keys[2]);
+ uart_write(report->keys[3]);
+ uart_write(report->keys[4]);
+ uart_write(report->keys[5]);
}
void rn42_send_mouse(report_mouse_t *report) {
uart_write(0xFD);
- uart_write(0x00);
- uart_write(0x03);
+ uart_write(0x05);
+ uart_write(0x02);
+
uart_write(report->buttons);
uart_write(report->x);
uart_write(report->y);
- uart_write(report->v); // should try sending the wheel v here
- uart_write(report->h); // should try sending the wheel h here
- uart_write(0x00);
+ uart_write(report->v);
}
-void rn42_send_consumer(uint16_t data) {
- static uint16_t last_data = 0;
- if (data == last_data) return;
- last_data = data;
- uint16_t bitmap = rn42_consumer_usage_to_bitmap(data);
+void rn42_send_consumer(uint16_t usage) {
+ uint16_t bitmap = rn42_consumer_usage_to_bitmap(usage);
+
uart_write(0xFD);
uart_write(0x03);
uart_write(0x03);
+
uart_write(bitmap & 0xFF);
- uart_write((bitmap >> 8) & 0xFF);
+ uart_write(bitmap >> 8);
}
diff --git a/drivers/bluetooth/rn42.h b/drivers/bluetooth/rn42.h
index 4747759111..89b716bfcd 100644
--- a/drivers/bluetooth/rn42.h
+++ b/drivers/bluetooth/rn42.h
@@ -14,6 +14,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <stdint.h>
+
#include "report.h"
void rn42_init(void);
@@ -22,4 +24,4 @@ void rn42_send_keyboard(report_keyboard_t *report);
void rn42_send_mouse(report_mouse_t *report);
-void rn42_send_consumer(uint16_t data);
+void rn42_send_consumer(uint16_t usage);
diff --git a/drivers/haptic/solenoid.c b/drivers/haptic/solenoid.c
index 637a77da3d..4e43903255 100644
--- a/drivers/haptic/solenoid.c
+++ b/drivers/haptic/solenoid.c
@@ -20,11 +20,12 @@
#include "haptic.h"
#include "gpio.h"
#include "usb_device_state.h"
+#include "util.h"
#include <stdlib.h>
uint8_t solenoid_dwell = SOLENOID_DEFAULT_DWELL;
static pin_t solenoid_pads[] = SOLENOID_PINS;
-#define NUMBER_OF_SOLENOIDS (sizeof(solenoid_pads) / sizeof(pin_t))
+#define NUMBER_OF_SOLENOIDS ARRAY_SIZE(solenoid_pads)
bool solenoid_on[NUMBER_OF_SOLENOIDS] = {false};
bool solenoid_buzzing[NUMBER_OF_SOLENOIDS] = {false};
uint16_t solenoid_start[NUMBER_OF_SOLENOIDS] = {0};
@@ -147,7 +148,7 @@ void solenoid_check(void) {
void solenoid_setup(void) {
#ifdef SOLENOID_PINS_ACTIVE_STATE
bool state_temp[] = SOLENOID_PINS_ACTIVE_STATE;
- uint8_t bound_check = (sizeof(state_temp) / sizeof(bool));
+ uint8_t bound_check = ARRAY_SIZE(state_temp);
#endif
for (uint8_t i = 0; i < NUMBER_OF_SOLENOIDS; i++) {
diff --git a/drivers/led/aw20216.c b/drivers/led/aw20216.c
index 55083936ef..cbb0b60774 100644
--- a/drivers/led/aw20216.c
+++ b/drivers/led/aw20216.c
@@ -133,7 +133,7 @@ void AW20216_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
}
void AW20216_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
- for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) {
+ for (uint8_t i = 0; i < RGB_MATRIX_LED_COUNT; i++) {
AW20216_set_color(i, red, green, blue);
}
}
diff --git a/drivers/led/aw20216.h b/drivers/led/aw20216.h
index 0a17050fed..c6e71b4b4e 100644
--- a/drivers/led/aw20216.h
+++ b/drivers/led/aw20216.h
@@ -28,7 +28,7 @@ typedef struct aw_led {
uint8_t b;
} aw_led;
-extern const aw_led PROGMEM g_aw_leds[DRIVER_LED_TOTAL];
+extern const aw_led PROGMEM g_aw_leds[RGB_MATRIX_LED_COUNT];
void AW20216_init(pin_t cs_pin, pin_t en_pin);
void AW20216_set_color(int index, uint8_t red, uint8_t green, uint8_t blue);
diff --git a/drivers/led/ckled2001-simple.c b/drivers/led/ckled2001-simple.c
index da4bf20b99..6c4ffd398e 100644
--- a/drivers/led/ckled2001-simple.c
+++ b/drivers/led/ckled2001-simple.c
@@ -148,7 +148,7 @@ void CKLED2001_init(uint8_t addr) {
void CKLED2001_set_value(int index, uint8_t value) {
ckled2001_led led;
- if (index >= 0 && index < DRIVER_LED_TOTAL) {
+ if (index >= 0 && index < LED_MATRIX_LED_COUNT) {
memcpy_P(&led, (&g_ckled2001_leds[index]), sizeof(led));
g_pwm_buffer[led.driver][led.v] = value;
@@ -157,7 +157,7 @@ void CKLED2001_set_value(int index, uint8_t value) {
}
void CKLED2001_set_value_all(uint8_t value) {
- for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
+ for (int i = 0; i < LED_MATRIX_LED_COUNT; i++) {
CKLED2001_set_value(i, value);
}
}
diff --git a/drivers/led/ckled2001-simple.h b/drivers/led/ckled2001-simple.h
index 731da2e1cd..a56cad3461 100644
--- a/drivers/led/ckled2001-simple.h
+++ b/drivers/led/ckled2001-simple.h
@@ -25,7 +25,7 @@ typedef struct ckled2001_led {
uint8_t v;
} __attribute__((packed)) ckled2001_led;
-extern const ckled2001_led PROGMEM g_ckled2001_leds[DRIVER_LED_TOTAL];
+extern const ckled2001_led PROGMEM g_ckled2001_leds[LED_MATRIX_LED_COUNT];
void CKLED2001_init(uint8_t addr);
bool CKLED2001_write_register(uint8_t addr, uint8_t reg, uint8_t data);
diff --git a/drivers/led/ckled2001.c b/drivers/led/ckled2001.c
index b7e7db06cc..1651628175 100644
--- a/drivers/led/ckled2001.c
+++ b/drivers/led/ckled2001.c
@@ -148,7 +148,7 @@ void CKLED2001_init(uint8_t addr) {
void CKLED2001_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
ckled2001_led led;
- if (index >= 0 && index < DRIVER_LED_TOTAL) {
+ if (index >= 0 && index < RGB_MATRIX_LED_COUNT) {
memcpy_P(&led, (&g_ckled2001_leds[index]), sizeof(led));
g_pwm_buffer[led.driver][led.r] = red;
@@ -159,7 +159,7 @@ void CKLED2001_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
}
void CKLED2001_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
- for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
+ for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) {
CKLED2001_set_color(i, red, green, blue);
}
}
diff --git a/drivers/led/ckled2001.h b/drivers/led/ckled2001.h
index 7d5ad34f95..aa70a0623f 100644
--- a/drivers/led/ckled2001.h
+++ b/drivers/led/ckled2001.h
@@ -27,7 +27,7 @@ typedef struct ckled2001_led {
uint8_t b;
} __attribute__((packed)) ckled2001_led;
-extern const ckled2001_led PROGMEM g_ckled2001_leds[DRIVER_LED_TOTAL];
+extern const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT];
void CKLED2001_init(uint8_t addr);
bool CKLED2001_write_register(uint8_t addr, uint8_t reg, uint8_t data);
diff --git a/drivers/led/issi/is31fl3731-simple.c b/drivers/led/issi/is31fl3731-simple.c
index 3abe9ea337..84060f9426 100644
--- a/drivers/led/issi/is31fl3731-simple.c
+++ b/drivers/led/issi/is31fl3731-simple.c
@@ -194,7 +194,7 @@ void IS31FL3731_init(uint8_t addr) {
void IS31FL3731_set_value(int index, uint8_t value) {
is31_led led;
- if (index >= 0 && index < DRIVER_LED_TOTAL) {
+ if (index >= 0 && index < LED_MATRIX_LED_COUNT) {
memcpy_P(&led, (&g_is31_leds[index]), sizeof(led));
// Subtract 0x24 to get the second index of g_pwm_buffer
@@ -204,7 +204,7 @@ void IS31FL3731_set_value(int index, uint8_t value) {
}
void IS31FL3731_set_value_all(uint8_t value) {
- for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
+ for (int i = 0; i < LED_MATRIX_LED_COUNT; i++) {
IS31FL3731_set_value(i, value);
}
}
diff --git a/drivers/led/issi/is31fl3731-simple.h b/drivers/led/issi/is31fl3731-simple.h
index ded94b0470..1ddadd5209 100644
--- a/drivers/led/issi/is31fl3731-simple.h
+++ b/drivers/led/issi/is31fl3731-simple.h
@@ -27,7 +27,7 @@ typedef struct is31_led {
uint8_t v;
} __attribute__((packed)) is31_led;
-extern const is31_led PROGMEM g_is31_leds[DRIVER_LED_TOTAL];
+extern const is31_led PROGMEM g_is31_leds[LED_MATRIX_LED_COUNT];
void IS31FL3731_init(uint8_t addr);
void IS31FL3731_write_register(uint8_t addr, uint8_t reg, uint8_t data);
diff --git a/drivers/led/issi/is31fl3731.c b/drivers/led/issi/is31fl3731.c
index 9c6c29f081..fed5354145 100644
--- a/drivers/led/issi/is31fl3731.c
+++ b/drivers/led/issi/is31fl3731.c
@@ -182,7 +182,7 @@ void IS31FL3731_init(uint8_t addr) {
void IS31FL3731_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
is31_led led;
- if (index >= 0 && index < DRIVER_LED_TOTAL) {
+ if (index >= 0 && index < RGB_MATRIX_LED_COUNT) {
memcpy_P(&led, (&g_is31_leds[index]), sizeof(led));
// Subtract 0x24 to get the second index of g_pwm_buffer
@@ -194,7 +194,7 @@ void IS31FL3731_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
}
void IS31FL3731_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
- for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
+ for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) {
IS31FL3731_set_color(i, red, green, blue);
}
}
diff --git a/drivers/led/issi/is31fl3731.h b/drivers/led/issi/is31fl3731.h
index 6647119eba..6791289c9e 100644
--- a/drivers/led/issi/is31fl3731.h
+++ b/drivers/led/issi/is31fl3731.h
@@ -28,7 +28,7 @@ typedef struct is31_led {
uint8_t b;
} __attribute__((packed)) is31_led;
-extern const is31_led PROGMEM g_is31_leds[DRIVER_LED_TOTAL];
+extern const is31_led PROGMEM g_is31_leds[RGB_MATRIX_LED_COUNT];
void IS31FL3731_init(uint8_t addr);
void IS31FL3731_write_register(uint8_t addr, uint8_t reg, uint8_t data);
diff --git a/drivers/led/issi/is31fl3733-simple.c b/drivers/led/issi/is31fl3733-simple.c
index 2f41a7b1a9..1e0994d780 100644
--- a/drivers/led/issi/is31fl3733-simple.c
+++ b/drivers/led/issi/is31fl3733-simple.c
@@ -195,7 +195,7 @@ void IS31FL3733_init(uint8_t addr, uint8_t sync) {
}
void IS31FL3733_set_value(int index, uint8_t value) {
- if (index >= 0 && index < DRIVER_LED_TOTAL) {
+ if (index >= 0 && index < LED_MATRIX_LED_COUNT) {
is31_led led = g_is31_leds[index];
g_pwm_buffer[led.driver][led.v] = value;
@@ -204,7 +204,7 @@ void IS31FL3733_set_value(int index, uint8_t value) {
}
void IS31FL3733_set_value_all(uint8_t value) {
- for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
+ for (int i = 0; i < LED_MATRIX_LED_COUNT; i++) {
IS31FL3733_set_value(i, value);
}
}
diff --git a/drivers/led/issi/is31fl3733-simple.h b/drivers/led/issi/is31fl3733-simple.h
index f5253e3101..f0ea3adca0 100644
--- a/drivers/led/issi/is31fl3733-simple.h
+++ b/drivers/led/issi/is31fl3733-simple.h
@@ -29,7 +29,7 @@ typedef struct is31_led {
uint8_t v;
} __attribute__((packed)) is31_led;
-extern const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL];
+extern const is31_led __flash g_is31_leds[LED_MATRIX_LED_COUNT];
void IS31FL3733_init(uint8_t addr, uint8_t sync);
bool IS31FL3733_write_register(uint8_t addr, uint8_t reg, uint8_t data);
diff --git a/drivers/led/issi/is31fl3733.c b/drivers/led/issi/is31fl3733.c
index add998f256..379eaa0ae3 100644
--- a/drivers/led/issi/is31fl3733.c
+++ b/drivers/led/issi/is31fl3733.c
@@ -186,7 +186,7 @@ void IS31FL3733_init(uint8_t addr, uint8_t sync) {
void IS31FL3733_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
is31_led led;
- if (index >= 0 && index < DRIVER_LED_TOTAL) {
+ if (index >= 0 && index < RGB_MATRIX_LED_COUNT) {
memcpy_P(&led, (&g_is31_leds[index]), sizeof(led));
g_pwm_buffer[led.driver][led.r] = red;
@@ -197,7 +197,7 @@ void IS31FL3733_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
}
void IS31FL3733_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
- for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
+ for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) {
IS31FL3733_set_color(i, red, green, blue);
}
}
diff --git a/drivers/led/issi/is31fl3733.h b/drivers/led/issi/is31fl3733.h
index 7653dd17c0..29441846ac 100644
--- a/drivers/led/issi/is31fl3733.h
+++ b/drivers/led/issi/is31fl3733.h
@@ -30,7 +30,7 @@ typedef struct is31_led {
uint8_t b;
} __attribute__((packed)) is31_led;
-extern const is31_led PROGMEM g_is31_leds[DRIVER_LED_TOTAL];
+extern const is31_led PROGMEM g_is31_leds[RGB_MATRIX_LED_COUNT];
void IS31FL3733_init(uint8_t addr, uint8_t sync);
bool IS31FL3733_write_register(uint8_t addr, uint8_t reg, uint8_t data);
diff --git a/drivers/led/issi/is31fl3736.c b/drivers/led/issi/is31fl3736.c
index e9943614d2..82e7ee3d18 100644
--- a/drivers/led/issi/is31fl3736.c
+++ b/drivers/led/issi/is31fl3736.c
@@ -168,7 +168,7 @@ void IS31FL3736_init(uint8_t addr) {
void IS31FL3736_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
is31_led led;
- if (index >= 0 && index < DRIVER_LED_TOTAL) {
+ if (index >= 0 && index < RGB_MATRIX_LED_COUNT) {
memcpy_P(&led, (&g_is31_leds[index]), sizeof(led));
g_pwm_buffer[led.driver][led.r] = red;
@@ -179,7 +179,7 @@ void IS31FL3736_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
}
void IS31FL3736_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
- for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
+ for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) {
IS31FL3736_set_color(i, red, green, blue);
}
}
diff --git a/drivers/led/issi/is31fl3736.h b/drivers/led/issi/is31fl3736.h
index f126034615..ccb19afbcc 100644
--- a/drivers/led/issi/is31fl3736.h
+++ b/drivers/led/issi/is31fl3736.h
@@ -28,8 +28,8 @@
# define DRIVER_COUNT 2
#endif
-#ifndef DRIVER_LED_TOTAL
-# define DRIVER_LED_TOTAL 96
+#ifndef RGB_MATRIX_LED_COUNT
+# define RGB_MATRIX_LED_COUNT 96
#endif
typedef struct is31_led {
@@ -39,7 +39,7 @@ typedef struct is31_led {
uint8_t b;
} __attribute__((packed)) is31_led;
-extern const is31_led PROGMEM g_is31_leds[DRIVER_LED_TOTAL];
+extern const is31_led PROGMEM g_is31_leds[RGB_MATRIX_LED_COUNT];
void IS31FL3736_init(uint8_t addr);
void IS31FL3736_write_register(uint8_t addr, uint8_t reg, uint8_t data);
diff --git a/drivers/led/issi/is31fl3737.c b/drivers/led/issi/is31fl3737.c
index 932530ac0a..45a20018c5 100644
--- a/drivers/led/issi/is31fl3737.c
+++ b/drivers/led/issi/is31fl3737.c
@@ -175,7 +175,7 @@ void IS31FL3737_init(uint8_t addr) {
void IS31FL3737_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
is31_led led;
- if (index >= 0 && index < DRIVER_LED_TOTAL) {
+ if (index >= 0 && index < RGB_MATRIX_LED_COUNT) {
memcpy_P(&led, (&g_is31_leds[index]), sizeof(led));
g_pwm_buffer[led.driver][led.r] = red;
@@ -186,7 +186,7 @@ void IS31FL3737_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
}
void IS31FL3737_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
- for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
+ for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) {
IS31FL3737_set_color(i, red, green, blue);
}
}
diff --git a/drivers/led/issi/is31fl3737.h b/drivers/led/issi/is31fl3737.h
index ddb70a9df5..fb0c33420c 100644
--- a/drivers/led/issi/is31fl3737.h
+++ b/drivers/led/issi/is31fl3737.h
@@ -30,7 +30,7 @@ typedef struct is31_led {
uint8_t b;
} __attribute__((packed)) is31_led;
-extern const is31_led PROGMEM g_is31_leds[DRIVER_LED_TOTAL];
+extern const is31_led PROGMEM g_is31_leds[RGB_MATRIX_LED_COUNT];
void IS31FL3737_init(uint8_t addr);
void IS31FL3737_write_register(uint8_t addr, uint8_t reg, uint8_t data);
diff --git a/drivers/led/issi/is31fl3741.c b/drivers/led/issi/is31fl3741.c
index ba6b6761a3..c2cdd4c46f 100644
--- a/drivers/led/issi/is31fl3741.c
+++ b/drivers/led/issi/is31fl3741.c
@@ -179,7 +179,7 @@ void IS31FL3741_init(uint8_t addr) {
void IS31FL3741_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
is31_led led;
- if (index >= 0 && index < DRIVER_LED_TOTAL) {
+ if (index >= 0 && index < RGB_MATRIX_LED_COUNT) {
memcpy_P(&led, (&g_is31_leds[index]), sizeof(led));
g_pwm_buffer[led.driver][led.r] = red;
@@ -190,7 +190,7 @@ void IS31FL3741_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
}
void IS31FL3741_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
- for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
+ for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) {
IS31FL3741_set_color(i, red, green, blue);
}
}
diff --git a/drivers/led/issi/is31fl3741.h b/drivers/led/issi/is31fl3741.h
index 3bdb23bd2d..b0089ea5ba 100644
--- a/drivers/led/issi/is31fl3741.h
+++ b/drivers/led/issi/is31fl3741.h
@@ -30,7 +30,7 @@ typedef struct is31_led {
uint32_t b : 10;
} __attribute__((packed)) is31_led;
-extern const is31_led PROGMEM g_is31_leds[DRIVER_LED_TOTAL];
+extern const is31_led PROGMEM g_is31_leds[RGB_MATRIX_LED_COUNT];
void IS31FL3741_init(uint8_t addr);
void IS31FL3741_write_register(uint8_t addr, uint8_t reg, uint8_t data);
diff --git a/drivers/led/issi/is31flcommon.c b/drivers/led/issi/is31flcommon.c
index 9f4b2123ff..106890a8bf 100644
--- a/drivers/led/issi/is31flcommon.c
+++ b/drivers/led/issi/is31flcommon.c
@@ -135,14 +135,17 @@ void IS31FL_common_update_pwm_register(uint8_t addr, uint8_t index) {
void IS31FL_set_manual_scaling_buffer(void) {
for (int i = 0; i < ISSI_MANUAL_SCALING; i++) {
is31_led scale = g_is31_scaling[i];
- if (scale.driver >= 0 && scale.driver < DRIVER_LED_TOTAL) {
+# ifdef RGB_MATRIX_ENABLE
+ if (scale.driver >= 0 && scale.driver < RGB_MATRIX_LED_COUNT) {
is31_led led = g_is31_leds[scale.driver];
-# ifdef RGB_MATRIX_ENABLE
g_scaling_buffer[led.driver][led.r] = scale.r;
g_scaling_buffer[led.driver][led.g] = scale.g;
g_scaling_buffer[led.driver][led.b] = scale.b;
# elif defined(LED_MATRIX_ENABLE)
+ if (scale.driver >= 0 && scale.driver < LED_MATRIX_LED_COUNT) {
+ is31_led led = g_is31_leds[scale.driver];
+
g_scaling_buffer[led.driver][led.v] = scale.v;
# endif
g_scaling_buffer_update_required[led.driver] = true;
@@ -165,7 +168,7 @@ void IS31FL_common_update_scaling_register(uint8_t addr, uint8_t index) {
#ifdef RGB_MATRIX_ENABLE
// Colour is set by adjusting PWM register
void IS31FL_RGB_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
- if (index >= 0 && index < DRIVER_LED_TOTAL) {
+ if (index >= 0 && index < RGB_MATRIX_LED_COUNT) {
is31_led led = g_is31_leds[index];
g_pwm_buffer[led.driver][led.r] = red;
@@ -176,7 +179,7 @@ void IS31FL_RGB_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
}
void IS31FL_RGB_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
- for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
+ for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) {
IS31FL_RGB_set_color(i, red, green, blue);
}
}
@@ -215,7 +218,7 @@ void IS31FL_simple_set_scaling_buffer(uint8_t index, bool value) {
}
void IS31FL_simple_set_brightness(int index, uint8_t value) {
- if (index >= 0 && index < DRIVER_LED_TOTAL) {
+ if (index >= 0 && index < LED_MATRIX_LED_COUNT) {
is31_led led = g_is31_leds[index];
g_pwm_buffer[led.driver][led.v] = value;
g_pwm_buffer_update_required[led.driver] = true;
@@ -223,7 +226,7 @@ void IS31FL_simple_set_brightness(int index, uint8_t value) {
}
void IS31FL_simple_set_brigntness_all(uint8_t value) {
- for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
+ for (int i = 0; i < LED_MATRIX_LED_COUNT; i++) {
IS31FL_simple_set_brightness(i, value);
}
}
diff --git a/drivers/led/issi/is31flcommon.h b/drivers/led/issi/is31flcommon.h
index 77e9665e32..18432ffc31 100644
--- a/drivers/led/issi/is31flcommon.h
+++ b/drivers/led/issi/is31flcommon.h
@@ -43,11 +43,15 @@ typedef struct is31_led {
uint8_t b;
} __attribute__((packed)) is31_led;
+extern const is31_led __flash g_is31_leds[RGB_MATRIX_LED_COUNT];
+
#elif defined(LED_MATRIX_ENABLE)
typedef struct is31_led {
uint8_t driver;
uint8_t v;
} __attribute__((packed)) is31_led;
+
+extern const is31_led __flash g_is31_leds[LED_MATRIX_LED_COUNT];
#endif
#ifdef ISSI_MANUAL_SCALING
@@ -55,8 +59,6 @@ extern const is31_led __flash g_is31_scaling[];
void IS31FL_se