Clean up RGBController.h

This commit is contained in:
Adam Honse 2022-02-21 12:08:59 -06:00
parent 06f4851ddc
commit 8b5a23148a

View file

@ -16,6 +16,9 @@
#include <chrono>
#include <mutex>
/*------------------------------------------------------------------*\
| RGB Color Type and Conversion Macros |
\*------------------------------------------------------------------*/
typedef unsigned int RGBColor;
#define RGBGetRValue(rgb) (rgb & 0x000000FF)
@ -54,6 +57,9 @@ enum
MODE_DIRECTION_VERTICAL = 5, /* Mode direction vertical */
};
/*------------------------------------------------------------------*\
| Mode Color Types |
\*------------------------------------------------------------------*/
enum
{
MODE_COLORS_NONE = 0, /* Mode has no colors */
@ -98,12 +104,18 @@ public:
~mode();
};
/*------------------------------------------------------------------*\
| LED Struct |
\*------------------------------------------------------------------*/
typedef struct
{
std::string name; /* LED name */
unsigned int value; /* Device-specific LED value */
} led;
/*------------------------------------------------------------------*\
| Zone Types |
\*------------------------------------------------------------------*/
typedef int zone_type;
enum
@ -113,6 +125,35 @@ enum
ZONE_TYPE_MATRIX
};
/*------------------------------------------------------------------*\
| Matrix Map Struct |
\*------------------------------------------------------------------*/
typedef struct
{
unsigned int height;
unsigned int width;
unsigned int * map;
} matrix_map_type;
/*------------------------------------------------------------------*\
| Zone Struct |
\*------------------------------------------------------------------*/
typedef struct
{
std::string name; /* Zone name */
zone_type type; /* Zone type */
led * leds; /* List of LEDs in zone */
RGBColor * colors; /* Colors of LEDs in zone */
unsigned int start_idx; /* Start index of led/color */
unsigned int leds_count; /* Number of LEDs in zone */
unsigned int leds_min; /* Minimum number of LEDs */
unsigned int leds_max; /* Maximum number of LEDs */
matrix_map_type * matrix_map; /* Matrix map pointer */
} zone;
/*------------------------------------------------------------------*\
| Device Types |
\*------------------------------------------------------------------*/
typedef int device_type;
enum
@ -135,30 +176,13 @@ enum
DEVICE_TYPE_UNKNOWN
};
std::string device_type_to_str(device_type type);
typedef struct
{
unsigned int height;
unsigned int width;
unsigned int * map;
} matrix_map_type;
typedef struct
{
std::string name; /* Zone name */
zone_type type; /* Zone type */
led * leds; /* List of LEDs in zone */
RGBColor * colors; /* Colors of LEDs in zone */
unsigned int start_idx; /* Start index of led/color */
unsigned int leds_count; /* Number of LEDs in zone */
unsigned int leds_min; /* Minimum number of LEDs */
unsigned int leds_max; /* Maximum number of LEDs */
matrix_map_type * matrix_map; /* Matrix map pointer */
} zone;
/*------------------------------------------------------------------*\
| RGBController Callback Types |
\*------------------------------------------------------------------*/
typedef void (*RGBControllerCallback)(void *);
std::string device_type_to_str(device_type type);
class RGBControllerInterface
{
public: