diff --git a/data/xap/xap_0.3.0.hjson b/data/xap/xap_0.3.0.hjson
index 6cb13f9455e..81f881bb077 100644
--- a/data/xap/xap_0.3.0.hjson
+++ b/data/xap/xap_0.3.0.hjson
@@ -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
+ }
}
}
}
diff --git a/docs/xap_0.3.0.md b/docs/xap_0.3.0.md
index 0b0954a160a..8cc05485916 100644
--- a/docs/xap_0.3.0.md
+++ b/docs/xap_0.3.0.md
@@ -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:__
* enable: `u8`
* mode: `u8`
* val: `u8`| Query the current config.|
+| Set Config | `0x06 0x02 0x04` | |__Request:__
* enable: `u8`
* mode: `u8`
* 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:__
* enable: `u8`
* mode: `u8`
* hue: `u8`
* sat: `u8`
* val: `u8`
* speed: `u8`| Query the current config.|
+| Set Config | `0x06 0x03 0x04` | |__Request:__
* enable: `u8`
* mode: `u8`
* hue: `u8`
* sat: `u8`
* val: `u8`
* 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:__
* enable: `u8`
* mode: `u8`
* hue: `u8`
* sat: `u8`
* val: `u8`
* speed: `u8`
* flags: `u8`| Query the current config.|
+| Set Config | `0x06 0x04 0x04` | |__Request:__
* enable: `u8`
* mode: `u8`
* hue: `u8`
* sat: `u8`
* val: `u8`
* speed: `u8`
* flags: `u8`| Set the current config.|
+| Save Config | `0x06 0x04 0x05` | || Save the current config.|
## Broadcast messages
diff --git a/lib/python/xap_client/routes.py b/lib/python/xap_client/routes.py
index a278d29ee40..cace9b1591a 100644
--- a/lib/python/xap_client/routes.py
+++ b/lib/python/xap_client/routes.py
@@ -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'
diff --git a/lib/python/xap_client/types.py b/lib/python/xap_client/types.py
index 60416795ce2..7ad25fc0d12 100644
--- a/lib/python/xap_client/types.py
+++ b/lib/python/xap_client/types.py
@@ -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):
diff --git a/quantum/xap/xap_handlers.c b/quantum/xap/xap_handlers.c
index 38a50c95b89..2938892d508 100644
--- a/quantum/xap/xap_handlers.c
+++ b/quantum/xap/xap_handlers.c
@@ -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