vialrgb: add rgb info command
This commit is contained in:
parent
7ee6ddd9a7
commit
881c8027d2
2 changed files with 15 additions and 2 deletions
|
@ -6,6 +6,11 @@
|
||||||
#include "rgb_matrix.h"
|
#include "rgb_matrix.h"
|
||||||
#include "vial.h"
|
#include "vial.h"
|
||||||
|
|
||||||
|
#if !defined(RGB_MATRIX_MAXIMUM_BRIGHTNESS) || RGB_MATRIX_MAXIMUM_BRIGHTNESS > UINT8_MAX
|
||||||
|
# undef RGB_MATRIX_MAXIMUM_BRIGHTNESS
|
||||||
|
# define RGB_MATRIX_MAXIMUM_BRIGHTNESS UINT8_MAX
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Based on https://github.com/qmk/qmk_firmware/pull/13036 */
|
/* Based on https://github.com/qmk/qmk_firmware/pull/13036 */
|
||||||
|
|
||||||
void vialrgb_get_value(uint8_t *data, uint8_t length) {
|
void vialrgb_get_value(uint8_t *data, uint8_t length) {
|
||||||
|
@ -15,6 +20,11 @@ void vialrgb_get_value(uint8_t *data, uint8_t length) {
|
||||||
uint8_t cmd = data[1];
|
uint8_t cmd = data[1];
|
||||||
uint8_t *args = &data[2];
|
uint8_t *args = &data[2];
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
|
case vialrgb_get_info:
|
||||||
|
args[0] = VIALRGB_PROTOCOL_VERSION & 0xFF;
|
||||||
|
args[1] = VIALRGB_PROTOCOL_VERSION >> 8;
|
||||||
|
args[2] = RGB_MATRIX_MAXIMUM_BRIGHTNESS;
|
||||||
|
break;
|
||||||
case vialrgb_get_mode: {
|
case vialrgb_get_mode: {
|
||||||
args[0] = rgb_matrix_get_mode();
|
args[0] = rgb_matrix_get_mode();
|
||||||
args[1] = rgb_matrix_get_speed();
|
args[1] = rgb_matrix_get_speed();
|
||||||
|
|
|
@ -2,14 +2,17 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#define VIALRGB_PROTOCOL_VERSION 1
|
||||||
|
|
||||||
/* Start at 0x40 in order to not conflict with existing "enum via_lighting_value",
|
/* Start at 0x40 in order to not conflict with existing "enum via_lighting_value",
|
||||||
even though they likely wouldn't be enabled together with vialrgb */
|
even though they likely wouldn't be enabled together with vialrgb */
|
||||||
enum {
|
enum {
|
||||||
vialrgb_set_mode = 0x40,
|
vialrgb_set_mode = 0x41,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
vialrgb_get_mode = 0x40,
|
vialrgb_get_info = 0x40,
|
||||||
|
vialrgb_get_mode = 0x41,
|
||||||
};
|
};
|
||||||
|
|
||||||
void vialrgb_get_value(uint8_t *data, uint8_t length);
|
void vialrgb_get_value(uint8_t *data, uint8_t length);
|
||||||
|
|
Loading…
Add table
Reference in a new issue