LED drivers: use PACKED define from util.h (#22380)

This commit is contained in:
Ryan 2023-11-02 14:31:09 +11:00 committed by GitHub
parent 8ea955c72f
commit 5d58534a8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 41 additions and 25 deletions

View File

@ -20,6 +20,7 @@
#include <stdbool.h> #include <stdbool.h>
#include "progmem.h" #include "progmem.h"
#include "gpio.h" #include "gpio.h"
#include "util.h"
// ======== DEPRECATED DEFINES - DO NOT USE ======== // ======== DEPRECATED DEFINES - DO NOT USE ========
#ifdef DRIVER_COUNT #ifdef DRIVER_COUNT
@ -63,7 +64,7 @@ typedef struct aw20216s_led_t {
uint8_t r; uint8_t r;
uint8_t g; uint8_t g;
uint8_t b; uint8_t b;
} aw20216s_led_t; } PACKED aw20216s_led_t;
extern const aw20216s_led_t PROGMEM g_aw20216s_leds[AW20216S_LED_COUNT]; extern const aw20216s_led_t PROGMEM g_aw20216s_leds[AW20216S_LED_COUNT];

View File

@ -19,6 +19,7 @@
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include "progmem.h" #include "progmem.h"
#include "util.h"
#define IS31FL3218_I2C_ADDRESS 0x54 #define IS31FL3218_I2C_ADDRESS 0x54
@ -28,7 +29,7 @@
typedef struct is31fl3218_led_t { typedef struct is31fl3218_led_t {
uint8_t v; uint8_t v;
} __attribute__((packed)) is31fl3218_led_t; } PACKED is31fl3218_led_t;
extern const is31fl3218_led_t PROGMEM g_is31fl3218_leds[IS31FL3218_LED_COUNT]; extern const is31fl3218_led_t PROGMEM g_is31fl3218_leds[IS31FL3218_LED_COUNT];

View File

@ -19,6 +19,7 @@
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include "progmem.h" #include "progmem.h"
#include "util.h"
#define IS31FL3218_I2C_ADDRESS 0x54 #define IS31FL3218_I2C_ADDRESS 0x54
@ -30,7 +31,7 @@ typedef struct is31fl3218_led_t {
uint8_t r; uint8_t r;
uint8_t g; uint8_t g;
uint8_t b; uint8_t b;
} __attribute__((packed)) is31fl3218_led_t; } PACKED is31fl3218_led_t;
extern const is31fl3218_led_t PROGMEM g_is31fl3218_leds[IS31FL3218_LED_COUNT]; extern const is31fl3218_led_t PROGMEM g_is31fl3218_leds[IS31FL3218_LED_COUNT];

View File

@ -21,6 +21,7 @@
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include "progmem.h" #include "progmem.h"
#include "util.h"
// ======== DEPRECATED DEFINES - DO NOT USE ======== // ======== DEPRECATED DEFINES - DO NOT USE ========
#ifdef LED_DRIVER_ADDR_1 #ifdef LED_DRIVER_ADDR_1
@ -64,7 +65,7 @@
typedef struct is31fl3731_led_t { typedef struct is31fl3731_led_t {
uint8_t driver : 2; uint8_t driver : 2;
uint8_t v; uint8_t v;
} __attribute__((packed)) is31fl3731_led_t; } PACKED is31fl3731_led_t;
extern const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT]; extern const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT];

View File

@ -20,6 +20,7 @@
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include "progmem.h" #include "progmem.h"
#include "util.h"
// ======== DEPRECATED DEFINES - DO NOT USE ======== // ======== DEPRECATED DEFINES - DO NOT USE ========
#ifdef DRIVER_ADDR_1 #ifdef DRIVER_ADDR_1
@ -65,7 +66,7 @@ typedef struct is31fl3731_led_t {
uint8_t r; uint8_t r;
uint8_t g; uint8_t g;
uint8_t b; uint8_t b;
} __attribute__((packed)) is31fl3731_led_t; } PACKED is31fl3731_led_t;
extern const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT]; extern const is31fl3731_led_t PROGMEM g_is31fl3731_leds[IS31FL3731_LED_COUNT];

View File

@ -23,6 +23,7 @@
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include "progmem.h" #include "progmem.h"
#include "util.h"
// ======== DEPRECATED DEFINES - DO NOT USE ======== // ======== DEPRECATED DEFINES - DO NOT USE ========
#ifdef LED_DRIVER_COUNT #ifdef LED_DRIVER_COUNT
@ -83,7 +84,7 @@
typedef struct is31fl3733_led_t { typedef struct is31fl3733_led_t {
uint8_t driver : 2; uint8_t driver : 2;
uint8_t v; uint8_t v;
} __attribute__((packed)) is31fl3733_led_t; } PACKED is31fl3733_led_t;
extern const is31fl3733_led_t PROGMEM g_is31fl3733_leds[IS31FL3733_LED_COUNT]; extern const is31fl3733_led_t PROGMEM g_is31fl3733_leds[IS31FL3733_LED_COUNT];

View File

@ -22,6 +22,7 @@
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include "progmem.h" #include "progmem.h"
#include "util.h"
// ======== DEPRECATED DEFINES - DO NOT USE ======== // ======== DEPRECATED DEFINES - DO NOT USE ========
#ifdef DRIVER_ADDR_1 #ifdef DRIVER_ADDR_1
@ -108,7 +109,7 @@ typedef struct is31fl3733_led_t {
uint8_t r; uint8_t r;
uint8_t g; uint8_t g;
uint8_t b; uint8_t b;
} __attribute__((packed)) is31fl3733_led_t; } PACKED is31fl3733_led_t;
extern const is31fl3733_led_t PROGMEM g_is31fl3733_leds[IS31FL3733_LED_COUNT]; extern const is31fl3733_led_t PROGMEM g_is31fl3733_leds[IS31FL3733_LED_COUNT];

View File

@ -20,6 +20,7 @@
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include "progmem.h" #include "progmem.h"
#include "util.h"
// ======== DEPRECATED DEFINES - DO NOT USE ======== // ======== DEPRECATED DEFINES - DO NOT USE ========
#ifdef DRIVER_COUNT #ifdef DRIVER_COUNT
@ -78,7 +79,7 @@
typedef struct is31fl3736_led_t { typedef struct is31fl3736_led_t {
uint8_t driver : 2; uint8_t driver : 2;
uint8_t v; uint8_t v;
} __attribute__((packed)) is31fl3736_led_t; } PACKED is31fl3736_led_t;
extern const is31fl3736_led_t PROGMEM g_is31fl3736_leds[IS31FL3736_LED_COUNT]; extern const is31fl3736_led_t PROGMEM g_is31fl3736_leds[IS31FL3736_LED_COUNT];

View File

@ -20,6 +20,7 @@
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include "progmem.h" #include "progmem.h"
#include "util.h"
// ======== DEPRECATED DEFINES - DO NOT USE ======== // ======== DEPRECATED DEFINES - DO NOT USE ========
#ifdef DRIVER_ADDR_1 #ifdef DRIVER_ADDR_1
@ -92,7 +93,7 @@ typedef struct is31fl3736_led_t {
uint8_t r; uint8_t r;
uint8_t g; uint8_t g;
uint8_t b; uint8_t b;
} __attribute__((packed)) is31fl3736_led_t; } PACKED is31fl3736_led_t;
extern const is31fl3736_led_t PROGMEM g_is31fl3736_leds[IS31FL3736_LED_COUNT]; extern const is31fl3736_led_t PROGMEM g_is31fl3736_leds[IS31FL3736_LED_COUNT];

View File

@ -22,6 +22,7 @@
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include "progmem.h" #include "progmem.h"
#include "util.h"
// ======== DEPRECATED DEFINES - DO NOT USE ======== // ======== DEPRECATED DEFINES - DO NOT USE ========
#ifdef DRIVER_COUNT #ifdef DRIVER_COUNT
@ -68,7 +69,7 @@
typedef struct is31fl3737_led_t { typedef struct is31fl3737_led_t {
uint8_t driver : 2; uint8_t driver : 2;
uint8_t v; uint8_t v;
} __attribute__((packed)) is31fl3737_led_t; } PACKED is31fl3737_led_t;
extern const is31fl3737_led_t PROGMEM g_is31fl3737_leds[IS31FL3737_LED_COUNT]; extern const is31fl3737_led_t PROGMEM g_is31fl3737_leds[IS31FL3737_LED_COUNT];

View File

@ -22,6 +22,7 @@
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include "progmem.h" #include "progmem.h"
#include "util.h"
// ======== DEPRECATED DEFINES - DO NOT USE ======== // ======== DEPRECATED DEFINES - DO NOT USE ========
#ifdef DRIVER_ADDR_1 #ifdef DRIVER_ADDR_1
@ -85,7 +86,7 @@ typedef struct is31fl3737_led_t {
uint8_t r; uint8_t r;
uint8_t g; uint8_t g;
uint8_t b; uint8_t b;
} __attribute__((packed)) is31fl3737_led_t; } PACKED is31fl3737_led_t;
extern const is31fl3737_led_t PROGMEM g_is31fl3737_leds[IS31FL3737_LED_COUNT]; extern const is31fl3737_led_t PROGMEM g_is31fl3737_leds[IS31FL3737_LED_COUNT];

View File

@ -22,6 +22,7 @@
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include "progmem.h" #include "progmem.h"
#include "util.h"
// ======== DEPRECATED DEFINES - DO NOT USE ======== // ======== DEPRECATED DEFINES - DO NOT USE ========
#ifdef DRIVER_COUNT #ifdef DRIVER_COUNT
@ -66,9 +67,9 @@
#endif #endif
typedef struct is31fl3741_led_t { typedef struct is31fl3741_led_t {
uint32_t driver : 2; uint8_t driver : 2;
uint32_t v : 10; uint16_t v : 9;
} __attribute__((packed)) is31fl3741_led_t; } PACKED is31fl3741_led_t;
extern const is31fl3741_led_t PROGMEM g_is31fl3741_leds[IS31FL3741_LED_COUNT]; extern const is31fl3741_led_t PROGMEM g_is31fl3741_leds[IS31FL3741_LED_COUNT];

View File

@ -22,6 +22,7 @@
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include "progmem.h" #include "progmem.h"
#include "util.h"
// ======== DEPRECATED DEFINES - DO NOT USE ======== // ======== DEPRECATED DEFINES - DO NOT USE ========
#ifdef DRIVER_ADDR_1 #ifdef DRIVER_ADDR_1
@ -81,11 +82,11 @@
#endif #endif
typedef struct is31fl3741_led_t { typedef struct is31fl3741_led_t {
uint32_t driver : 2; uint8_t driver : 2;
uint32_t r : 10; uint16_t r : 9;
uint32_t g : 10; uint16_t g : 9;
uint32_t b : 10; uint16_t b : 9;
} __attribute__((packed)) is31fl3741_led_t; } PACKED is31fl3741_led_t;
extern const is31fl3741_led_t PROGMEM g_is31fl3741_leds[IS31FL3741_LED_COUNT]; extern const is31fl3741_led_t PROGMEM g_is31fl3741_leds[IS31FL3741_LED_COUNT];

View File

@ -23,6 +23,7 @@
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include "progmem.h" #include "progmem.h"
#include "util.h"
// Which variant header file to use // Which variant header file to use
#if defined(LED_MATRIX_IS31FL3742A) || defined(RGB_MATRIX_IS31FL3742A) #if defined(LED_MATRIX_IS31FL3742A) || defined(RGB_MATRIX_IS31FL3742A)
@ -37,19 +38,19 @@
#ifdef RGB_MATRIX_ENABLE #ifdef RGB_MATRIX_ENABLE
typedef struct is31_led { typedef struct is31_led {
uint8_t driver; uint8_t driver : 2;
uint8_t r; uint8_t r;
uint8_t g; uint8_t g;
uint8_t b; uint8_t b;
} __attribute__((packed)) is31_led; } PACKED is31_led;
extern const is31_led PROGMEM g_is31_leds[RGB_MATRIX_LED_COUNT]; extern const is31_led PROGMEM g_is31_leds[RGB_MATRIX_LED_COUNT];
#elif defined(LED_MATRIX_ENABLE) #elif defined(LED_MATRIX_ENABLE)
typedef struct is31_led { typedef struct is31_led {
uint8_t driver; uint8_t driver : 2;
uint8_t v; uint8_t v;
} __attribute__((packed)) is31_led; } PACKED is31_led;
extern const is31_led PROGMEM g_is31_leds[LED_MATRIX_LED_COUNT]; extern const is31_led PROGMEM g_is31_leds[LED_MATRIX_LED_COUNT];
#endif #endif

View File

@ -19,6 +19,7 @@
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include "progmem.h" #include "progmem.h"
#include "util.h"
// ======== DEPRECATED DEFINES - DO NOT USE ======== // ======== DEPRECATED DEFINES - DO NOT USE ========
#ifdef DRIVER_COUNT #ifdef DRIVER_COUNT
@ -66,7 +67,7 @@
typedef struct snled27351_led_t { typedef struct snled27351_led_t {
uint8_t driver : 2; uint8_t driver : 2;
uint8_t v; uint8_t v;
} __attribute__((packed)) snled27351_led_t; } PACKED snled27351_led_t;
extern const snled27351_led_t PROGMEM g_snled27351_leds[SNLED27351_LED_COUNT]; extern const snled27351_led_t PROGMEM g_snled27351_leds[SNLED27351_LED_COUNT];

View File

@ -19,6 +19,7 @@
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include "progmem.h" #include "progmem.h"
#include "util.h"
// ======== DEPRECATED DEFINES - DO NOT USE ======== // ======== DEPRECATED DEFINES - DO NOT USE ========
#ifdef DRIVER_COUNT #ifdef DRIVER_COUNT
@ -80,7 +81,7 @@ typedef struct snled27351_led_t {
uint8_t r; uint8_t r;
uint8_t g; uint8_t g;
uint8_t b; uint8_t b;
} __attribute__((packed)) snled27351_led_t; } PACKED snled27351_led_t;
extern const snled27351_led_t PROGMEM g_snled27351_leds[SNLED27351_LED_COUNT]; extern const snled27351_led_t PROGMEM g_snled27351_leds[SNLED27351_LED_COUNT];