summaryrefslogtreecommitdiff
path: root/keyboards/wilba_tech/wt_main.c
diff options
context:
space:
mode:
authorWilba <wilba@wilba.tech>2022-11-10 07:46:44 +1100
committerGitHub <noreply@github.com>2022-11-10 07:46:44 +1100
commitbc6f8dc8b0822e5e03893eacffa42a7badb4c2fa (patch)
treeb1e8a219803f30b7347e479734a5c6e7352a5f30 /keyboards/wilba_tech/wt_main.c
parent575b0e33fa47034f5cfaf6f7cd98570268efa0a2 (diff)
VIA V3 - The Custom UI Update (#18222)
Diffstat (limited to 'keyboards/wilba_tech/wt_main.c')
-rw-r--r--keyboards/wilba_tech/wt_main.c61
1 files changed, 35 insertions, 26 deletions
diff --git a/keyboards/wilba_tech/wt_main.c b/keyboards/wilba_tech/wt_main.c
index bc1a1d3c87..3f89066a6c 100644
--- a/keyboards/wilba_tech/wt_main.c
+++ b/keyboards/wilba_tech/wt_main.c
@@ -132,36 +132,45 @@ void suspend_wakeup_init_kb(void)
// Moving this to the bottom of this source file is a workaround
// for an intermittent compiler error for Atmel compiler.
#ifdef VIA_ENABLE
-void raw_hid_receive_kb(uint8_t *data, uint8_t length) {
- uint8_t *command_id = &(data[0]);
- uint8_t *command_data = &(data[1]);
- switch ( *command_id )
- {
+void via_custom_value_command_kb(uint8_t *data, uint8_t length) {
+ uint8_t *command_id = &(data[0]);
+ uint8_t *channel_id = &(data[1]);
+ uint8_t *value_id_and_data = &(data[2]);
+
#if RGB_BACKLIGHT_ENABLED || MONO_BACKLIGHT_ENABLED
- case id_lighting_set_value:
- {
- backlight_config_set_value(command_data);
- break;
- }
- case id_lighting_get_value:
- {
- backlight_config_get_value(command_data);
- break;
- }
- case id_lighting_save:
- {
- backlight_config_save();
- break;
- }
-#endif // RGB_BACKLIGHT_ENABLED || MONO_BACKLIGHT_ENABLED
- default:
+ if ( *channel_id == id_custom_channel ) {
+ switch ( *command_id )
{
- // Unhandled message.
- *command_id = id_unhandled;
- *command_data = *command_data; // force use of variable
- break;
+ case id_custom_set_value:
+ {
+ backlight_config_set_value(value_id_and_data);
+ break;
+ }
+ case id_custom_get_value:
+ {
+ backlight_config_get_value(value_id_and_data);
+ break;
+ }
+ case id_custom_save:
+ {
+ backlight_config_save();
+ break;
+ }
+ default:
+ {
+ // Unhandled message.
+ *command_id = id_unhandled;
+ break;
+ }
}
+ return;
}
+#else
+ *command_id = id_unhandled;
+ *channel_id = *channel_id; // force use of variable
+ *value_id_and_data = *value_id_and_data; // force use of variable
+#endif // RGB_BACKLIGHT_ENABLED || MONO_BACKLIGHT_ENABLED
+
// DO NOT call raw_hid_send(data,length) here, let caller do this
}
#endif // VIA_ENABLE