hidpp20: define internal LED structure

This commit is contained in:
Ilya Guterman
2016-12-01 01:24:28 +02:00
committed by Peter Hutterer
parent 0568b4c39d
commit 45129b2bc8
2 changed files with 32 additions and 7 deletions

View File

@@ -1653,11 +1653,7 @@ union hidpp20_internal_profile {
uint8_t default_dpi;
uint8_t switched_dpi;
uint16_t dpi[5];
struct {
uint8_t red;
uint8_t green;
uint8_t blue;
} profile_color;
struct hidpp20_color profile_color;
uint8_t power_mode;
uint8_t angle_snapping;
uint8_t reserved[14];
@@ -1667,8 +1663,7 @@ union hidpp20_internal_profile {
char txt[16 * 3];
uint8_t raw[16 * 3];
} name;
uint8_t logo_effect[11]; /* G303 only */
uint8_t side_effects[11]; /* G303 only */
struct hidpp20_internal_led leds[2]; /* G303, g502, g900 only */
uint8_t free[24];
uint16_t crc;
} __attribute__((packed)) profile;

View File

@@ -317,6 +317,36 @@ union hidpp20_button_binding {
} __attribute__((packed));
_Static_assert(sizeof(union hidpp20_button_binding) == 4, "Invalid size");
struct hidpp20_color {
uint8_t red;
uint8_t green;
uint8_t blue;
} __attribute__((packed));
_Static_assert(sizeof(struct hidpp20_color) == 3, "Invalid size");
struct hidpp20_internal_led {
uint8_t mode; /* 00 - off; 01 - on; 03 - cycle; 0a - breath */
struct hidpp20_color color;
union {
struct hidpp20_led_cycle {
uint16_t pad_1;
uint16_t rate; /* 16000 - 20000Hz */
uint8_t brightness; /* 0 - 100 percent */
uint16_t pad_2;
} __attribute__((packed)) cycle;
struct hidpp20_led_breath {
uint16_t rate;
uint8_t pad_1;
uint8_t brightness;
uint8_t pad_2;
uint16_t pad_3;
} __attribute__((packed)) breath;
} __attribute__((packed)) effect;
};
_Static_assert(sizeof(struct hidpp20_led_cycle) == 7, "Invalid size");
_Static_assert(sizeof(struct hidpp20_led_breath) == 7, "Invalid size");
_Static_assert(sizeof(struct hidpp20_internal_led) == 11, "Invalid size");
#define HIDPP20_MACRO_NOOP 0x01
#define HIDPP20_MACRO_DELAY 0x40
#define HIDPP20_MACRO_KEY_PRESS 0x43