Browse Source

Move `PACKED` define to util.h (#22074)

pull/22084/head
Ryan 7 months ago
committed by GitHub
parent
commit
2aacda3235
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 42 deletions
  1. +1
    -14
      quantum/color.h
  2. +1
    -14
      quantum/led_matrix/led_matrix_types.h
  3. +1
    -14
      quantum/rgb_matrix/rgb_matrix_types.h
  4. +4
    -0
      quantum/util.h

+ 1
- 14
quantum/color.h View File

@ -18,6 +18,7 @@
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include "util.h"
// clang-format off // clang-format off
@ -73,16 +74,6 @@
// clang-format on // clang-format on
#if defined(__GNUC__)
# define PACKED __attribute__((__packed__))
#else
# define PACKED
#endif
#if defined(_MSC_VER)
# pragma pack(push, 1)
#endif
#define WS2812_BYTE_ORDER_RGB 0 #define WS2812_BYTE_ORDER_RGB 0
#define WS2812_BYTE_ORDER_GRB 1 #define WS2812_BYTE_ORDER_GRB 1
#define WS2812_BYTE_ORDER_BGR 2 #define WS2812_BYTE_ORDER_BGR 2
@ -118,10 +109,6 @@ typedef struct PACKED HSV {
uint8_t v; uint8_t v;
} HSV; } HSV;
#if defined(_MSC_VER)
# pragma pack(pop)
#endif
RGB hsv_to_rgb(HSV hsv); RGB hsv_to_rgb(HSV hsv);
RGB hsv_to_rgb_nocie(HSV hsv); RGB hsv_to_rgb_nocie(HSV hsv);
#ifdef RGBW #ifdef RGBW


+ 1
- 14
quantum/led_matrix/led_matrix_types.h View File

@ -18,16 +18,7 @@
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#if defined(__GNUC__)
# define PACKED __attribute__((__packed__))
#else
# define PACKED
#endif
#if defined(_MSC_VER)
# pragma pack(push, 1)
#endif
#include "util.h"
#if defined(LED_MATRIX_KEYPRESSES) || defined(LED_MATRIX_KEYRELEASES) #if defined(LED_MATRIX_KEYPRESSES) || defined(LED_MATRIX_KEYRELEASES)
# define LED_MATRIX_KEYREACTIVE_ENABLED # define LED_MATRIX_KEYREACTIVE_ENABLED
@ -92,7 +83,3 @@ typedef union {
} led_eeconfig_t; } led_eeconfig_t;
_Static_assert(sizeof(led_eeconfig_t) == sizeof(uint32_t), "LED Matrix EECONFIG out of spec."); _Static_assert(sizeof(led_eeconfig_t) == sizeof(uint32_t), "LED Matrix EECONFIG out of spec.");
#if defined(_MSC_VER)
# pragma pack(pop)
#endif

+ 1
- 14
quantum/rgb_matrix/rgb_matrix_types.h View File

@ -19,16 +19,7 @@
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include "color.h" #include "color.h"
#if defined(__GNUC__)
# define PACKED __attribute__((__packed__))
#else
# define PACKED
#endif
#if defined(_MSC_VER)
# pragma pack(push, 1)
#endif
#include "util.h"
#if defined(RGB_MATRIX_KEYPRESSES) || defined(RGB_MATRIX_KEYRELEASES) #if defined(RGB_MATRIX_KEYPRESSES) || defined(RGB_MATRIX_KEYRELEASES)
# define RGB_MATRIX_KEYREACTIVE_ENABLED # define RGB_MATRIX_KEYREACTIVE_ENABLED
@ -94,7 +85,3 @@ typedef union {
} rgb_config_t; } rgb_config_t;
_Static_assert(sizeof(rgb_config_t) == sizeof(uint64_t), "RGB Matrix EECONFIG out of spec."); _Static_assert(sizeof(rgb_config_t) == sizeof(uint64_t), "RGB Matrix EECONFIG out of spec.");
#if defined(_MSC_VER)
# pragma pack(pop)
#endif

+ 4
- 0
quantum/util.h View File

@ -46,3 +46,7 @@
*/ */
# define ARRAY_SIZE(array) (__builtin_choose_expr(IS_ARRAY((array)), sizeof((array)) / sizeof((array)[0]), (void)0)) # define ARRAY_SIZE(array) (__builtin_choose_expr(IS_ARRAY((array)), sizeof((array)) / sizeof((array)[0]), (void)0))
#endif #endif
#if !defined(PACKED)
# define PACKED __attribute__((__packed__))
#endif

Loading…
Cancel
Save