1
0
Fork 0
This commit is contained in:
Joel Challis 2021-07-31 14:35:30 +01:00 committed by GitHub
parent 206a995ccd
commit 70fb3e1aaf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
76 changed files with 95 additions and 92 deletions

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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;

View file

@ -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);

View file

@ -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);