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 <chrono>
#include <mutex> #include <mutex>
/*------------------------------------------------------------------*\
| RGB Color Type and Conversion Macros |
\*------------------------------------------------------------------*/
typedef unsigned int RGBColor; typedef unsigned int RGBColor;
#define RGBGetRValue(rgb) (rgb & 0x000000FF) #define RGBGetRValue(rgb) (rgb & 0x000000FF)
@ -54,6 +57,9 @@ enum
MODE_DIRECTION_VERTICAL = 5, /* Mode direction vertical */ MODE_DIRECTION_VERTICAL = 5, /* Mode direction vertical */
}; };
/*------------------------------------------------------------------*\
| Mode Color Types |
\*------------------------------------------------------------------*/
enum enum
{ {
MODE_COLORS_NONE = 0, /* Mode has no colors */ MODE_COLORS_NONE = 0, /* Mode has no colors */
@ -98,12 +104,18 @@ public:
~mode(); ~mode();
}; };
/*------------------------------------------------------------------*\
| LED Struct |
\*------------------------------------------------------------------*/
typedef struct typedef struct
{ {
std::string name; /* LED name */ std::string name; /* LED name */
unsigned int value; /* Device-specific LED value */ unsigned int value; /* Device-specific LED value */
} led; } led;
/*------------------------------------------------------------------*\
| Zone Types |
\*------------------------------------------------------------------*/
typedef int zone_type; typedef int zone_type;
enum enum
@ -113,6 +125,35 @@ enum
ZONE_TYPE_MATRIX 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; typedef int device_type;
enum enum
@ -135,30 +176,13 @@ enum
DEVICE_TYPE_UNKNOWN DEVICE_TYPE_UNKNOWN
}; };
std::string device_type_to_str(device_type type); /*------------------------------------------------------------------*\
| RGBController Callback Types |
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;
typedef void (*RGBControllerCallback)(void *); typedef void (*RGBControllerCallback)(void *);
std::string device_type_to_str(device_type type);
class RGBControllerInterface class RGBControllerInterface
{ {
public: public: