mirror of
https://github.com/qmk/qmk_firmware.git
synced 2024-11-26 21:26:46 +00:00
Stub out lighting sets
This commit is contained in:
parent
c540893ddb
commit
986534ea95
@ -65,6 +65,36 @@
|
||||
]
|
||||
return_execute: get_backlight_config
|
||||
}
|
||||
0x04: {
|
||||
type: command
|
||||
name: Set Config
|
||||
define: SET_CONFIG
|
||||
description: Set the current config.
|
||||
request_type: struct
|
||||
request_struct_length: 3
|
||||
request_struct_members: [
|
||||
{
|
||||
type: u8
|
||||
name: enable
|
||||
},
|
||||
{
|
||||
type: u8
|
||||
name: mode
|
||||
},
|
||||
{
|
||||
type: u8
|
||||
name: val
|
||||
},
|
||||
]
|
||||
return_execute: set_backlight_config
|
||||
}
|
||||
0x05: {
|
||||
type: command
|
||||
name: Save Config
|
||||
define: SAVE_CONFIG
|
||||
description: Save the current config.
|
||||
return_execute: save_backlight_config
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -133,6 +163,48 @@
|
||||
]
|
||||
return_execute: get_rgblight_config
|
||||
}
|
||||
0x04: {
|
||||
type: command
|
||||
name: Set Config
|
||||
define: SET_CONFIG
|
||||
description: Set the current config.
|
||||
request_type: struct
|
||||
request_struct_length: 6
|
||||
request_struct_members: [
|
||||
{
|
||||
type: u8
|
||||
name: enable
|
||||
},
|
||||
{
|
||||
type: u8
|
||||
name: mode
|
||||
},
|
||||
{
|
||||
type: u8
|
||||
name: hue
|
||||
},
|
||||
{
|
||||
type: u8
|
||||
name: sat
|
||||
},
|
||||
{
|
||||
type: u8
|
||||
name: val
|
||||
},
|
||||
{
|
||||
type: u8
|
||||
name: speed
|
||||
},
|
||||
]
|
||||
return_execute: set_rgblight_config
|
||||
}
|
||||
0x05: {
|
||||
type: command
|
||||
name: Save Config
|
||||
define: SAVE_CONFIG
|
||||
description: Save the current config.
|
||||
return_execute: save_rgblight_config
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -205,6 +277,52 @@
|
||||
]
|
||||
return_execute: get_rgb_matrix_config
|
||||
}
|
||||
0x04: {
|
||||
type: command
|
||||
name: Set Config
|
||||
define: SET_CONFIG
|
||||
description: Set the current config.
|
||||
request_type: struct
|
||||
request_struct_length: 7
|
||||
request_struct_members: [
|
||||
{
|
||||
type: u8
|
||||
name: enable
|
||||
},
|
||||
{
|
||||
type: u8
|
||||
name: mode
|
||||
},
|
||||
{
|
||||
type: u8
|
||||
name: hue
|
||||
},
|
||||
{
|
||||
type: u8
|
||||
name: sat
|
||||
},
|
||||
{
|
||||
type: u8
|
||||
name: val
|
||||
},
|
||||
{
|
||||
type: u8
|
||||
name: speed
|
||||
},
|
||||
{
|
||||
type: u8
|
||||
name: flags
|
||||
},
|
||||
]
|
||||
return_execute: set_rgb_matrix_config
|
||||
}
|
||||
0x05: {
|
||||
type: command
|
||||
name: Save Config
|
||||
define: SAVE_CONFIG
|
||||
description: Save the current config.
|
||||
return_execute: save_rgb_matrix_config
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -161,6 +161,8 @@ This subsystem allows for control over the backlight subsystem.
|
||||
| Capabilities Query | `0x06 0x02 0x01` | |__Response:__ `u32`| backlight subsystem capabilities query. Each bit should be considered as a "usable" route within this subsystem.|
|
||||
| Get Enabled Effects | `0x06 0x02 0x02` | |__Response:__ `u8`| Each bit should be considered as a "usable" effect id|
|
||||
| Get Config | `0x06 0x02 0x03` | |__Response:__<br> * enable: `u8`<br> * mode: `u8`<br> * val: `u8`| Query the current config.|
|
||||
| Set Config | `0x06 0x02 0x04` | |__Request:__<br> * enable: `u8`<br> * mode: `u8`<br> * val: `u8`| Set the current config.|
|
||||
| Save Config | `0x06 0x02 0x05` | || Save the current config.|
|
||||
|
||||
#### rgblight - `0x06 0x03`
|
||||
This subsystem allows for control over the rgblight subsystem.
|
||||
@ -170,6 +172,8 @@ This subsystem allows for control over the rgblight subsystem.
|
||||
| Capabilities Query | `0x06 0x03 0x01` | |__Response:__ `u32`| rgblight subsystem capabilities query. Each bit should be considered as a "usable" route within this subsystem.|
|
||||
| Get Enabled Effects | `0x06 0x03 0x02` | |__Response:__ `u64`| Each bit should be considered as a "usable" effect id|
|
||||
| Get Config | `0x06 0x03 0x03` | |__Response:__<br> * enable: `u8`<br> * mode: `u8`<br> * hue: `u8`<br> * sat: `u8`<br> * val: `u8`<br> * speed: `u8`| Query the current config.|
|
||||
| Set Config | `0x06 0x03 0x04` | |__Request:__<br> * enable: `u8`<br> * mode: `u8`<br> * hue: `u8`<br> * sat: `u8`<br> * val: `u8`<br> * speed: `u8`| Set the current config.|
|
||||
| Save Config | `0x06 0x03 0x05` | || Save the current config.|
|
||||
|
||||
#### rgbmatrix - `0x06 0x04`
|
||||
This subsystem allows for control over the rgb matrix subsystem.
|
||||
@ -179,6 +183,8 @@ This subsystem allows for control over the rgb matrix subsystem.
|
||||
| Capabilities Query | `0x06 0x04 0x01` | |__Response:__ `u32`| rgb matrix subsystem capabilities query. Each bit should be considered as a "usable" route within this subsystem.|
|
||||
| Get Enabled Effects | `0x06 0x04 0x02` | |__Response:__ `u64`| Each bit should be considered as a "usable" effect id|
|
||||
| Get Config | `0x06 0x04 0x03` | |__Response:__<br> * enable: `u8`<br> * mode: `u8`<br> * hue: `u8`<br> * sat: `u8`<br> * val: `u8`<br> * speed: `u8`<br> * flags: `u8`| Query the current config.|
|
||||
| Set Config | `0x06 0x04 0x04` | |__Request:__<br> * enable: `u8`<br> * mode: `u8`<br> * hue: `u8`<br> * sat: `u8`<br> * val: `u8`<br> * speed: `u8`<br> * flags: `u8`| Set the current config.|
|
||||
| Save Config | `0x06 0x04 0x05` | || Save the current config.|
|
||||
|
||||
|
||||
## Broadcast messages
|
||||
|
@ -66,11 +66,17 @@ class XAPRoutes():
|
||||
LIGHTING_BACKLIGHT_CAPABILITIES_QUERY = b'\x06\x02\x01'
|
||||
LIGHTING_BACKLIGHT_GET_ENABLED_EFFECTS = b'\x06\x02\x02'
|
||||
LIGHTING_BACKLIGHT_GET_CONFIG = b'\x06\x02\x03'
|
||||
LIGHTING_BACKLIGHT_SET_CONFIG = b'\x06\x02\x04'
|
||||
LIGHTING_BACKLIGHT_SAVE_CONFIG = b'\x06\x02\x05'
|
||||
LIGHTING_RGBLIGHT = b'\x06\x03'
|
||||
LIGHTING_RGBLIGHT_CAPABILITIES_QUERY = b'\x06\x03\x01'
|
||||
LIGHTING_RGBLIGHT_GET_ENABLED_EFFECTS = b'\x06\x03\x02'
|
||||
LIGHTING_RGBLIGHT_GET_CONFIG = b'\x06\x03\x03'
|
||||
LIGHTING_RGBLIGHT_SET_CONFIG = b'\x06\x03\x04'
|
||||
LIGHTING_RGBLIGHT_SAVE_CONFIG = b'\x06\x03\x05'
|
||||
LIGHTING_RGB_MATRIX = b'\x06\x04'
|
||||
LIGHTING_RGB_MATRIX_CAPABILITIES_QUERY = b'\x06\x04\x01'
|
||||
LIGHTING_RGB_MATRIX_GET_ENABLED_EFFECTS = b'\x06\x04\x02'
|
||||
LIGHTING_RGB_MATRIX_GET_CONFIG = b'\x06\x04\x03'
|
||||
LIGHTING_RGB_MATRIX_SET_CONFIG = b'\x06\x04\x04'
|
||||
LIGHTING_RGB_MATRIX_SAVE_CONFIG = b'\x06\x04\x05'
|
||||
|
@ -108,8 +108,11 @@ class XAPConfigRgbMatrix(namedtuple('XAPConfigRgbMatrix', 'enable mode hue sat v
|
||||
# TODO: gen inbound object for set_keymap_keycode
|
||||
# TODO: gen inbound object for set_encoder_keycode
|
||||
# TODO: gen outbound object for get_config
|
||||
# TODO: gen inbound object for set_config
|
||||
# TODO: gen outbound object for get_config
|
||||
# TODO: gen inbound object for set_config
|
||||
# TODO: gen outbound object for get_config
|
||||
# TODO: gen inbound object for set_config
|
||||
|
||||
|
||||
class XAPSecureStatus(IntEnum):
|
||||
|
@ -211,6 +211,37 @@ bool xap_respond_get_backlight_config(xap_token_t token, const void *data, size_
|
||||
return xap_respond_data(token, &ret, sizeof(ret));
|
||||
}
|
||||
|
||||
bool xap_respond_set_backlight_config(xap_token_t token, const void *data, size_t length) {
|
||||
if (length != sizeof(xap_route_lighting_backlight_set_config_arg_t)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
xap_route_lighting_backlight_set_config_arg_t *arg = (xap_route_lighting_backlight_set_config_arg_t *)data;
|
||||
|
||||
if (arg->enable) {
|
||||
backlight_level_noeeprom(arg->val);
|
||||
} else {
|
||||
backlight_level_noeeprom(0);
|
||||
}
|
||||
|
||||
# ifdef BACKLIGHT_BREATHING
|
||||
if (arg->mode) {
|
||||
backlight_enable_breathing();
|
||||
} else {
|
||||
backlight_disable_breathing();
|
||||
}
|
||||
# endif
|
||||
|
||||
xap_respond_success(token);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool xap_respond_save_backlight_config(xap_token_t token, const void *data, size_t length) {
|
||||
eeconfig_update_backlight_current();
|
||||
|
||||
xap_respond_success(token);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ((defined(RGBLIGHT_ENABLE)))
|
||||
@ -219,6 +250,11 @@ bool xap_respond_get_backlight_config(xap_token_t token, const void *data, size_
|
||||
extern rgblight_config_t rgblight_config;
|
||||
|
||||
uint8_t rgblight2xap(uint8_t val);
|
||||
uint8_t xap2rgblight(uint8_t val);
|
||||
|
||||
void rgblight_enabled_noeeprom(bool val) {
|
||||
val ? rgblight_enable_noeeprom() : rgblight_disable_noeeprom();
|
||||
}
|
||||
|
||||
bool xap_respond_get_rgblight_config(xap_token_t token, const void *data, size_t length) {
|
||||
xap_route_lighting_rgblight_get_config_t ret;
|
||||
@ -232,6 +268,34 @@ bool xap_respond_get_rgblight_config(xap_token_t token, const void *data, size_t
|
||||
|
||||
return xap_respond_data(token, &ret, sizeof(ret));
|
||||
}
|
||||
|
||||
bool xap_respond_set_rgblight_config(xap_token_t token, const void *data, size_t length) {
|
||||
if (length != sizeof(xap_route_lighting_rgblight_set_config_arg_t)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
xap_route_lighting_rgblight_set_config_arg_t *arg = (xap_route_lighting_rgblight_set_config_arg_t *)data;
|
||||
|
||||
uint8_t mode = xap2rgblight(arg->mode);
|
||||
if (mode == INVALID_EFFECT) {
|
||||
return false;
|
||||
}
|
||||
|
||||
rgblight_enabled_noeeprom(arg->enable);
|
||||
rgblight_mode_noeeprom(mode);
|
||||
rgblight_sethsv_noeeprom(arg->hue, arg->sat, arg->val);
|
||||
rgblight_set_speed_noeeprom(arg->speed);
|
||||
|
||||
xap_respond_success(token);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool xap_respond_save_rgblight_config(xap_token_t token, const void *data, size_t length) {
|
||||
eeconfig_update_rgblight_current();
|
||||
|
||||
xap_respond_success(token);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ((defined(RGB_MATRIX_ENABLE)))
|
||||
@ -240,6 +304,11 @@ bool xap_respond_get_rgblight_config(xap_token_t token, const void *data, size_t
|
||||
extern rgb_config_t rgb_matrix_config;
|
||||
|
||||
uint8_t rgb_matrix2xap(uint8_t val);
|
||||
uint8_t xap2rgb_matrix(uint8_t val);
|
||||
|
||||
void rgb_matrix_enabled_noeeprom(bool val) {
|
||||
val ? rgb_matrix_enable_noeeprom() : rgb_matrix_disable_noeeprom();
|
||||
}
|
||||
|
||||
bool xap_respond_get_rgb_matrix_config(xap_token_t token, const void *data, size_t length) {
|
||||
xap_route_lighting_rgb_matrix_get_config_t ret;
|
||||
@ -254,4 +323,33 @@ bool xap_respond_get_rgb_matrix_config(xap_token_t token, const void *data, size
|
||||
|
||||
return xap_respond_data(token, &ret, sizeof(ret));
|
||||
}
|
||||
|
||||
bool xap_respond_set_rgb_matrix_config(xap_token_t token, const void *data, size_t length) {
|
||||
if (length != sizeof(xap_route_lighting_rgb_matrix_set_config_arg_t)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
xap_route_lighting_rgb_matrix_set_config_arg_t *arg = (xap_route_lighting_rgb_matrix_set_config_arg_t *)data;
|
||||
|
||||
uint8_t mode = xap2rgb_matrix(arg->mode);
|
||||
if (mode == INVALID_EFFECT) {
|
||||
return false;
|
||||
}
|
||||
|
||||
rgb_matrix_enabled_noeeprom(arg->enable);
|
||||
rgb_matrix_mode_noeeprom(mode);
|
||||
rgb_matrix_sethsv_noeeprom(arg->hue, arg->sat, arg->val);
|
||||
rgb_matrix_set_speed_noeeprom(arg->speed);
|
||||
rgb_matrix_set_flags(arg->flags);
|
||||
|
||||
xap_respond_success(token);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool xap_respond_save_rgb_matrix_config(xap_token_t token, const void *data, size_t length) {
|
||||
eeconfig_update_rgb_matrix();
|
||||
|
||||
xap_respond_success(token);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user