Skip to content

Commit

Permalink
Merge pull request #108 from MatejKocourek/attribute_fix
Browse files Browse the repository at this point in the history
Added packed attributes to cRGB structs
  • Loading branch information
cpldcpu authored Sep 11, 2024
2 parents b300eda + bea241c commit 0a44f05
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions light_apa102_AVR/Light_apa102/light_apa102.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
///////////////////////////////////////////////////////////////////////

#if defined(APA102_BYTE_ORDER_GBR)
struct cRGB { uint8_t g; uint8_t b; uint8_t r; }; // GBR
struct __attribute__ ((__packed__)) cRGB { uint8_t g; uint8_t b; uint8_t r; }; // GBR
#else
struct cRGB { uint8_t b; uint8_t g; uint8_t r; }; // BGR (APA102 Standard)
struct __attribute__ ((__packed__)) cRGB { uint8_t b; uint8_t g; uint8_t r; }; // BGR (APA102 Standard)
#endif

/* User Interface
Expand Down
4 changes: 2 additions & 2 deletions light_apa102_AVR/apa102_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
// Define color byte order
///////////////////////////////////////////////////////////////////////

struct cRGB { uint8_t b; uint8_t g; uint8_t r; }; // BGR (APA102 Standard)
//struct cRGB { uint8_t g; uint8_t b; uint8_t r; }; // GBR
struct __attribute__ ((__packed__)) cRGB { uint8_t b; uint8_t g; uint8_t r; }; // BGR (APA102 Standard)
//struct __attribute__ ((__packed__)) cRGB { uint8_t g; uint8_t b; uint8_t r; }; // GBR



Expand Down
4 changes: 2 additions & 2 deletions light_ws2812_AVR/Light_WS2812/light_ws2812.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
* cRGBW: RGBW for SK6812RGBW
*/

struct cRGB { uint8_t g; uint8_t r; uint8_t b; };
struct cRGBW { uint8_t g; uint8_t r; uint8_t b; uint8_t w;};
struct __attribute__ ((__packed__)) cRGB { uint8_t g; uint8_t r; uint8_t b; };
struct __attribute__ ((__packed__)) cRGBW { uint8_t g; uint8_t r; uint8_t b; uint8_t w;};



Expand Down
Binary file modified light_ws2812_Arduino/light_WS2812.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion light_ws2812_Arduino/light_WS2812/cRGB.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const byte dim_curve[] = {
};
#endif

struct cRGB {
struct __attribute__ ((__packed__)) cRGB {
uint8_t g;
uint8_t r;
uint8_t b;
Expand Down

0 comments on commit 0a44f05

Please sign in to comment.