summaryrefslogtreecommitdiffstats
path: root/drivers/led
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2021-07-31 14:35:30 +0100
committerGitHub <noreply@github.com>2021-07-31 14:35:30 +0100
commit70fb3e1aaf406cbbd5137916a93ed814d6891ef2 (patch)
tree822d9ec1df59c75f07f886fdf3f77002e8b2c926 /drivers/led
parent206a995ccd53b0843e72da606abebe06f39c9c28 (diff)
__flash? (#13799)
Diffstat (limited to 'drivers/led')
-rw-r--r--drivers/led/aw20216.h3
-rw-r--r--drivers/led/issi/is31fl3731-simple.h3
-rw-r--r--drivers/led/issi/is31fl3731.h3
-rw-r--r--drivers/led/issi/is31fl3733.h3
-rw-r--r--drivers/led/issi/is31fl3736.h3
-rw-r--r--drivers/led/issi/is31fl3737.c9
-rw-r--r--drivers/led/issi/is31fl3737.h3
-rw-r--r--drivers/led/issi/is31fl3741.h3
8 files changed, 16 insertions, 14 deletions
diff --git a/drivers/led/aw20216.h b/drivers/led/aw20216.h
index c55d9605fc..97ac6dc5bf 100644
--- a/drivers/led/aw20216.h
+++ b/drivers/led/aw20216.h
@@ -18,6 +18,7 @@
#include <stdint.h>
#include <stdbool.h>
+#include "progmem.h"
#include "gpio.h"
typedef struct aw_led {
@@ -27,7 +28,7 @@ typedef struct aw_led {
uint8_t b;
} aw_led;
-extern const aw_led g_aw_leds[DRIVER_LED_TOTAL];
+extern const aw_led __flash g_aw_leds[DRIVER_LED_TOTAL];
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/issi/is31fl3731-simple.h b/drivers/led/issi/is31fl3731-simple.h
index 9665d6ed35..ecde31eed5 100644
--- a/drivers/led/issi/is31fl3731-simple.h
+++ b/drivers/led/issi/is31fl3731-simple.h
@@ -20,13 +20,14 @@
#include <stdint.h>
#include <stdbool.h>
+#include "progmem.h"
typedef struct is31_led {
uint8_t driver : 2;
uint8_t v;
} __attribute__((packed)) is31_led;
-extern const is31_led g_is31_leds[DRIVER_LED_TOTAL];
+extern const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL];
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.h b/drivers/led/issi/is31fl3731.h
index 19e8e6251f..803ea3ea12 100644
--- a/drivers/led/issi/is31fl3731.h
+++ b/drivers/led/issi/is31fl3731.h
@@ -19,6 +19,7 @@
#include <stdint.h>
#include <stdbool.h>
+#include "progmem.h"
typedef struct is31_led {
uint8_t driver : 2;
@@ -27,7 +28,7 @@ typedef struct is31_led {
uint8_t b;
} __attribute__((packed)) is31_led;
-extern const is31_led g_is31_leds[DRIVER_LED_TOTAL];
+extern const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL];
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.h b/drivers/led/issi/is31fl3733.h
index 603d505a13..64fd38eb19 100644
--- a/drivers/led/issi/is31fl3733.h
+++ b/drivers/led/issi/is31fl3733.h
@@ -20,6 +20,7 @@
#include <stdint.h>
#include <stdbool.h>
+#include "progmem.h"
typedef struct is31_led {
uint8_t driver : 2;
@@ -28,7 +29,7 @@ typedef struct is31_led {
uint8_t b;
} __attribute__((packed)) is31_led;
-extern const is31_led g_is31_leds[DRIVER_LED_TOTAL];
+extern const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL];
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.h b/drivers/led/issi/is31fl3736.h
index e48e31c279..c956c87f7c 100644
--- a/drivers/led/issi/is31fl3736.h
+++ b/drivers/led/issi/is31fl3736.h
@@ -18,6 +18,7 @@
#include <stdint.h>
#include <stdbool.h>
+#include "progmem.h"
// Simple interface option.
// If these aren't defined, just define them to make it compile
@@ -37,7 +38,7 @@ typedef struct is31_led {
uint8_t b;
} __attribute__((packed)) is31_led;
-extern const is31_led g_is31_leds[DRIVER_LED_TOTAL];
+extern const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL];
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 30906b4840..0bb4ddd425 100644
--- a/drivers/led/issi/is31fl3737.c
+++ b/drivers/led/issi/is31fl3737.c
@@ -19,7 +19,6 @@
#include "is31fl3737.h"
#include "i2c_master.h"
#include "wait.h"
-#include "progmem.h"
// This is a 7-bit address, that gets left-shifted and bit 0
// set to 0 for write, 1 for read (as per I2C protocol)
@@ -155,9 +154,7 @@ void IS31FL3737_init(uint8_t addr) {
void IS31FL3737_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
if (index >= 0 && index < DRIVER_LED_TOTAL) {
- // copy the led config from progmem to SRAM
- is31_led led;
- memcpy_P(&led, (&g_is31_leds[index]), sizeof(led));
+ is31_led led = g_is31_leds[index];
g_pwm_buffer[led.driver][led.r] = red;
g_pwm_buffer[led.driver][led.g] = green;
@@ -173,9 +170,7 @@ void IS31FL3737_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
}
void IS31FL3737_set_led_control_register(uint8_t index, bool red, bool green, bool blue) {
- // copy the led config from progmem to SRAM
- is31_led led;
- memcpy_P(&led, (&g_is31_leds[index]), sizeof(led));
+ is31_led led = g_is31_leds[index];
uint8_t control_register_r = led.r / 8;
uint8_t control_register_g = led.g / 8;
diff --git a/drivers/led/issi/is31fl3737.h b/drivers/led/issi/is31fl3737.h
index a1d2281778..06886e9c9b 100644
--- a/drivers/led/issi/is31fl3737.h
+++ b/drivers/led/issi/is31fl3737.h
@@ -20,6 +20,7 @@
#include <stdint.h>
#include <stdbool.h>
+#include "progmem.h"
typedef struct is31_led {
uint8_t driver : 2;
@@ -28,7 +29,7 @@ typedef struct is31_led {
uint8_t b;
} __attribute__((packed)) is31_led;
-extern const is31_led g_is31_leds[DRIVER_LED_TOTAL];
+extern const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL];
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.h b/drivers/led/issi/is31fl3741.h
index 2df0c5b1a7..cea6761ca8 100644
--- a/drivers/led/issi/is31fl3741.h
+++ b/drivers/led/issi/is31fl3741.h
@@ -21,6 +21,7 @@
#include <stdint.h>
#include <stdbool.h>
+#include "progmem.h"
typedef struct is31_led {
uint32_t driver : 2;
@@ -29,7 +30,7 @@ typedef struct is31_led {
uint32_t b : 10;
} __attribute__((packed)) is31_led;
-extern const is31_led g_is31_leds[DRIVER_LED_TOTAL];
+extern const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL];
void IS31FL3741_init(uint8_t addr);
void IS31FL3741_write_register(uint8_t addr, uint8_t reg, uint8_t data);