diff options
| author | Joel Challis <git@zvecr.com> | 2021-07-31 14:35:30 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-31 14:35:30 +0100 |
| commit | 70fb3e1aaf406cbbd5137916a93ed814d6891ef2 (patch) | |
| tree | 822d9ec1df59c75f07f886fdf3f77002e8b2c926 /drivers/led | |
| parent | 206a995ccd53b0843e72da606abebe06f39c9c28 (diff) | |
| download | qmk_firmware-70fb3e1aaf406cbbd5137916a93ed814d6891ef2.tar.gz qmk_firmware-70fb3e1aaf406cbbd5137916a93ed814d6891ef2.zip | |
__flash? (#13799)
Diffstat (limited to 'drivers/led')
| -rw-r--r-- | drivers/led/aw20216.h | 3 | ||||
| -rw-r--r-- | drivers/led/issi/is31fl3731-simple.h | 3 | ||||
| -rw-r--r-- | drivers/led/issi/is31fl3731.h | 3 | ||||
| -rw-r--r-- | drivers/led/issi/is31fl3733.h | 3 | ||||
| -rw-r--r-- | drivers/led/issi/is31fl3736.h | 3 | ||||
| -rw-r--r-- | drivers/led/issi/is31fl3737.c | 9 | ||||
| -rw-r--r-- | drivers/led/issi/is31fl3737.h | 3 | ||||
| -rw-r--r-- | drivers/led/issi/is31fl3741.h | 3 |
8 files changed, 16 insertions, 14 deletions
diff --git a/drivers/led/aw20216.h b/drivers/led/aw20216.h index c55d9605f..97ac6dc5b 100644 --- a/drivers/led/aw20216.h +++ b/drivers/led/aw20216.h | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | 18 | ||
| 19 | #include <stdint.h> | 19 | #include <stdint.h> |
| 20 | #include <stdbool.h> | 20 | #include <stdbool.h> |
| 21 | #include "progmem.h" | ||
| 21 | #include "gpio.h" | 22 | #include "gpio.h" |
| 22 | 23 | ||
| 23 | typedef struct aw_led { | 24 | typedef struct aw_led { |
| @@ -27,7 +28,7 @@ typedef struct aw_led { | |||
| 27 | uint8_t b; | 28 | uint8_t b; |
| 28 | } aw_led; | 29 | } aw_led; |
| 29 | 30 | ||
| 30 | extern const aw_led g_aw_leds[DRIVER_LED_TOTAL]; | 31 | extern const aw_led __flash g_aw_leds[DRIVER_LED_TOTAL]; |
| 31 | 32 | ||
| 32 | void AW20216_init(pin_t cs_pin, pin_t en_pin); | 33 | void AW20216_init(pin_t cs_pin, pin_t en_pin); |
| 33 | void AW20216_set_color(int index, uint8_t red, uint8_t green, uint8_t blue); | 34 | 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 9665d6ed3..ecde31eed 100644 --- a/drivers/led/issi/is31fl3731-simple.h +++ b/drivers/led/issi/is31fl3731-simple.h | |||
| @@ -20,13 +20,14 @@ | |||
| 20 | 20 | ||
| 21 | #include <stdint.h> | 21 | #include <stdint.h> |
| 22 | #include <stdbool.h> | 22 | #include <stdbool.h> |
| 23 | #include "progmem.h" | ||
| 23 | 24 | ||
| 24 | typedef struct is31_led { | 25 | typedef struct is31_led { |
| 25 | uint8_t driver : 2; | 26 | uint8_t driver : 2; |
| 26 | uint8_t v; | 27 | uint8_t v; |
| 27 | } __attribute__((packed)) is31_led; | 28 | } __attribute__((packed)) is31_led; |
| 28 | 29 | ||
| 29 | extern const is31_led g_is31_leds[DRIVER_LED_TOTAL]; | 30 | extern const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL]; |
| 30 | 31 | ||
| 31 | void IS31FL3731_init(uint8_t addr); | 32 | void IS31FL3731_init(uint8_t addr); |
| 32 | void IS31FL3731_write_register(uint8_t addr, uint8_t reg, uint8_t data); | 33 | 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 19e8e6251..803ea3ea1 100644 --- a/drivers/led/issi/is31fl3731.h +++ b/drivers/led/issi/is31fl3731.h | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | 19 | ||
| 20 | #include <stdint.h> | 20 | #include <stdint.h> |
| 21 | #include <stdbool.h> | 21 | #include <stdbool.h> |
| 22 | #include "progmem.h" | ||
| 22 | 23 | ||
| 23 | typedef struct is31_led { | 24 | typedef struct is31_led { |
| 24 | uint8_t driver : 2; | 25 | uint8_t driver : 2; |
| @@ -27,7 +28,7 @@ typedef struct is31_led { | |||
| 27 | uint8_t b; | 28 | uint8_t b; |
| 28 | } __attribute__((packed)) is31_led; | 29 | } __attribute__((packed)) is31_led; |
| 29 | 30 | ||
| 30 | extern const is31_led g_is31_leds[DRIVER_LED_TOTAL]; | 31 | extern const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL]; |
| 31 | 32 | ||
| 32 | void IS31FL3731_init(uint8_t addr); | 33 | void IS31FL3731_init(uint8_t addr); |
| 33 | void IS31FL3731_write_register(uint8_t addr, uint8_t reg, uint8_t data); | 34 | 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 603d505a1..64fd38eb1 100644 --- a/drivers/led/issi/is31fl3733.h +++ b/drivers/led/issi/is31fl3733.h | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | 20 | ||
| 21 | #include <stdint.h> | 21 | #include <stdint.h> |
| 22 | #include <stdbool.h> | 22 | #include <stdbool.h> |
| 23 | #include "progmem.h" | ||
| 23 | 24 | ||
| 24 | typedef struct is31_led { | 25 | typedef struct is31_led { |
| 25 | uint8_t driver : 2; | 26 | uint8_t driver : 2; |
| @@ -28,7 +29,7 @@ typedef struct is31_led { | |||
| 28 | uint8_t b; | 29 | uint8_t b; |
| 29 | } __attribute__((packed)) is31_led; | 30 | } __attribute__((packed)) is31_led; |
| 30 | 31 | ||
| 31 | extern const is31_led g_is31_leds[DRIVER_LED_TOTAL]; | 32 | extern const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL]; |
| 32 | 33 | ||
| 33 | void IS31FL3733_init(uint8_t addr, uint8_t sync); | 34 | void IS31FL3733_init(uint8_t addr, uint8_t sync); |
| 34 | bool IS31FL3733_write_register(uint8_t addr, uint8_t reg, uint8_t data); | 35 | 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 e48e31c27..c956c87f7 100644 --- a/drivers/led/issi/is31fl3736.h +++ b/drivers/led/issi/is31fl3736.h | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | 18 | ||
| 19 | #include <stdint.h> | 19 | #include <stdint.h> |
| 20 | #include <stdbool.h> | 20 | #include <stdbool.h> |
| 21 | #include "progmem.h" | ||
| 21 | 22 | ||
| 22 | // Simple interface option. | 23 | // Simple interface option. |
| 23 | // If these aren't defined, just define them to make it compile | 24 | // If these aren't defined, just define them to make it compile |
| @@ -37,7 +38,7 @@ typedef struct is31_led { | |||
| 37 | uint8_t b; | 38 | uint8_t b; |
| 38 | } __attribute__((packed)) is31_led; | 39 | } __attribute__((packed)) is31_led; |
| 39 | 40 | ||
| 40 | extern const is31_led g_is31_leds[DRIVER_LED_TOTAL]; | 41 | extern const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL]; |
| 41 | 42 | ||
| 42 | void IS31FL3736_init(uint8_t addr); | 43 | void IS31FL3736_init(uint8_t addr); |
| 43 | void IS31FL3736_write_register(uint8_t addr, uint8_t reg, uint8_t data); | 44 | 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 30906b484..0bb4ddd42 100644 --- a/drivers/led/issi/is31fl3737.c +++ b/drivers/led/issi/is31fl3737.c | |||
| @@ -19,7 +19,6 @@ | |||
| 19 | #include "is31fl3737.h" | 19 | #include "is31fl3737.h" |
| 20 | #include "i2c_master.h" | 20 | #include "i2c_master.h" |
| 21 | #include "wait.h" | 21 | #include "wait.h" |
| 22 | #include "progmem.h" | ||
| 23 | 22 | ||
| 24 | // This is a 7-bit address, that gets left-shifted and bit 0 | 23 | // This is a 7-bit address, that gets left-shifted and bit 0 |
| 25 | // set to 0 for write, 1 for read (as per I2C protocol) | 24 | // set to 0 for write, 1 for read (as per I2C protocol) |
| @@ -155,9 +154,7 @@ void IS31FL3737_init(uint8_t addr) { | |||
| 155 | 154 | ||
| 156 | void IS31FL3737_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { | 155 | void IS31FL3737_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { |
| 157 | if (index >= 0 && index < DRIVER_LED_TOTAL) { | 156 | if (index >= 0 && index < DRIVER_LED_TOTAL) { |
| 158 | // copy the led config from progmem to SRAM | 157 | is31_led led = g_is31_leds[index]; |
| 159 | is31_led led; | ||
| 160 | memcpy_P(&led, (&g_is31_leds[index]), sizeof(led)); | ||
| 161 | 158 | ||
| 162 | g_pwm_buffer[led.driver][led.r] = red; | 159 | g_pwm_buffer[led.driver][led.r] = red; |
| 163 | g_pwm_buffer[led.driver][led.g] = green; | 160 | 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) { | |||
| 173 | } | 170 | } |
| 174 | 171 | ||
| 175 | void IS31FL3737_set_led_control_register(uint8_t index, bool red, bool green, bool blue) { | 172 | void IS31FL3737_set_led_control_register(uint8_t index, bool red, bool green, bool blue) { |
| 176 | // copy the led config from progmem to SRAM | 173 | is31_led led = g_is31_leds[index]; |
| 177 | is31_led led; | ||
| 178 | memcpy_P(&led, (&g_is31_leds[index]), sizeof(led)); | ||
| 179 | 174 | ||
| 180 | uint8_t control_register_r = led.r / 8; | 175 | uint8_t control_register_r = led.r / 8; |
| 181 | uint8_t control_register_g = led.g / 8; | 176 | uint8_t control_register_g = led.g / 8; |
diff --git a/drivers/led/issi/is31fl3737.h b/drivers/led/issi/is31fl3737.h index a1d228177..06886e9c9 100644 --- a/drivers/led/issi/is31fl3737.h +++ b/drivers/led/issi/is31fl3737.h | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | 20 | ||
| 21 | #include <stdint.h> | 21 | #include <stdint.h> |
| 22 | #include <stdbool.h> | 22 | #include <stdbool.h> |
| 23 | #include "progmem.h" | ||
| 23 | 24 | ||
| 24 | typedef struct is31_led { | 25 | typedef struct is31_led { |
| 25 | uint8_t driver : 2; | 26 | uint8_t driver : 2; |
| @@ -28,7 +29,7 @@ typedef struct is31_led { | |||
| 28 | uint8_t b; | 29 | uint8_t b; |
| 29 | } __attribute__((packed)) is31_led; | 30 | } __attribute__((packed)) is31_led; |
| 30 | 31 | ||
| 31 | extern const is31_led g_is31_leds[DRIVER_LED_TOTAL]; | 32 | extern const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL]; |
| 32 | 33 | ||
| 33 | void IS31FL3737_init(uint8_t addr); | 34 | void IS31FL3737_init(uint8_t addr); |
| 34 | void IS31FL3737_write_register(uint8_t addr, uint8_t reg, uint8_t data); | 35 | 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 2df0c5b1a..cea6761ca 100644 --- a/drivers/led/issi/is31fl3741.h +++ b/drivers/led/issi/is31fl3741.h | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | 21 | ||
| 22 | #include <stdint.h> | 22 | #include <stdint.h> |
| 23 | #include <stdbool.h> | 23 | #include <stdbool.h> |
| 24 | #include "progmem.h" | ||
| 24 | 25 | ||
| 25 | typedef struct is31_led { | 26 | typedef struct is31_led { |
| 26 | uint32_t driver : 2; | 27 | uint32_t driver : 2; |
| @@ -29,7 +30,7 @@ typedef struct is31_led { | |||
| 29 | uint32_t b : 10; | 30 | uint32_t b : 10; |
| 30 | } __attribute__((packed)) is31_led; | 31 | } __attribute__((packed)) is31_led; |
| 31 | 32 | ||
| 32 | extern const is31_led g_is31_leds[DRIVER_LED_TOTAL]; | 33 | extern const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL]; |
| 33 | 34 | ||
| 34 | void IS31FL3741_init(uint8_t addr); | 35 | void IS31FL3741_init(uint8_t addr); |
| 35 | void IS31FL3741_write_register(uint8_t addr, uint8_t reg, uint8_t data); | 36 | void IS31FL3741_write_register(uint8_t addr, uint8_t reg, uint8_t data); |
