summary refs log tree commit diff
path: root/quantum/via.h
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 /quantum/via.h
parent575b0e33fa47034f5cfaf6f7cd98570268efa0a2 (diff)
VIA V3 - The Custom UI Update (#18222)
Diffstat (limited to 'quantum/via.h')
-rw-r--r--quantum/via.h94
1 files changed, 80 insertions, 14 deletions
diff --git a/quantum/via.h b/quantum/via.h
index 84b264903f..eca0733525 100644
--- a/quantum/via.h
+++ b/quantum/via.h
@@ -60,6 +60,16 @@
 // so VIA Configurator can detect compatible firmware.
 #define VIA_PROTOCOL_VERSION 0x000B
 
+// This is a version number for the firmware for the keyboard.
+// It can be used to ensure the VIA keyboard definition and the firmware
+// have the same version, especially if there are changes to custom values.
+// Define this in config.h to override and bump this number.
+// This is *not* required if the keyboard is only using basic functionality
+// and not using custom values for lighting, rotary encoders, etc.
+#ifndef VIA_FIRMWARE_VERSION
+#    define VIA_FIRMWARE_VERSION 0x00000000
+#endif
+
 enum via_command_id {
     id_get_protocol_version                 = 0x01, // always 0x01
     id_get_keyboard_value                   = 0x02,
@@ -67,9 +77,9 @@ enum via_command_id {
     id_dynamic_keymap_get_keycode           = 0x04,
     id_dynamic_keymap_set_keycode           = 0x05,
     id_dynamic_keymap_reset                 = 0x06,
-    id_lighting_set_value                   = 0x07,
-    id_lighting_get_value                   = 0x08,
-    id_lighting_save                        = 0x09,
+    id_custom_set_value                     = 0x07,
+    id_custom_get_value                     = 0x08,
+    id_custom_save                          = 0x09,
     id_eeprom_reset                         = 0x0A,
     id_bootloader_jump                      = 0x0B,
     id_dynamic_keymap_macro_get_count       = 0x0C,
@@ -86,21 +96,43 @@ enum via_command_id {
 };
 
 enum via_keyboard_value_id {
-    id_uptime              = 0x01, //
+    id_uptime              = 0x01,
     id_layout_options      = 0x02,
-    id_switch_matrix_state = 0x03
+    id_switch_matrix_state = 0x03,
+    id_firmware_version    = 0x04,
+    id_device_indication   = 0x05,
 };
 
-enum via_lighting_value {
-    // QMK BACKLIGHT
-    id_qmk_backlight_brightness = 0x09,
-    id_qmk_backlight_effect     = 0x0A,
+enum via_channel_id {
+    id_custom_channel         = 0,
+    id_qmk_backlight_channel  = 1,
+    id_qmk_rgblight_channel   = 2,
+    id_qmk_rgb_matrix_channel = 3,
+    id_qmk_audio_channel      = 4,
+};
+
+enum via_qmk_backlight_value {
+    id_qmk_backlight_brightness = 1,
+    id_qmk_backlight_effect     = 2,
+};
+
+enum via_qmk_rgblight_value {
+    id_qmk_rgblight_brightness   = 1,
+    id_qmk_rgblight_effect       = 2,
+    id_qmk_rgblight_effect_speed = 3,
+    id_qmk_rgblight_color        = 4,
+};
+
+enum via_qmk_rgb_matrix_value {
+    id_qmk_rgb_matrix_brightness   = 1,
+    id_qmk_rgb_matrix_effect       = 2,
+    id_qmk_rgb_matrix_effect_speed = 3,
+    id_qmk_rgb_matrix_color        = 4,
+};
 
-    // QMK RGBLIGHT
-    id_qmk_rgblight_brightness   = 0x80,
-    id_qmk_rgblight_effect       = 0x81,
-    id_qmk_rgblight_effect_speed = 0x82,
-    id_qmk_rgblight_color        = 0x83,
+enum via_qmk_audio_value {
+    id_qmk_audio_enable        = 1,
+    id_qmk_audio_clicky_enable = 2,
 };
 
 enum via_keycodes {
@@ -160,5 +192,39 @@ uint32_t via_get_layout_options(void);
 void     via_set_layout_options(uint32_t value);
 void     via_set_layout_options_kb(uint32_t value);
 
+// Used by VIA to tell a device to flash LEDs (or do something else) when that
+// device becomes the active device being configured, on startup or switching
+// between devices.
+void via_set_device_indication(uint8_t value);
+
 // Called by QMK core to process VIA-specific keycodes.
 bool process_record_via(uint16_t keycode, keyrecord_t *record);
+
+// These are made external so that keyboard level custom value handlers can use them.
+#if defined(BACKLIGHT_ENABLE)
+void via_qmk_backlight_command(uint8_t *data, uint8_t length);
+void via_qmk_backlight_set_value(uint8_t *data);
+void via_qmk_backlight_get_value(uint8_t *data);
+void via_qmk_backlight_save(void);
+#endif
+
+#if defined(RGBLIGHT_ENABLE)
+void via_qmk_rgblight_command(uint8_t *data, uint8_t length);
+void via_qmk_rgblight_set_value(uint8_t *data);
+void via_qmk_rgblight_get_value(uint8_t *data);
+void via_qmk_rgblight_save(void);
+#endif
+
+#if defined(RGB_MATRIX_ENABLE)
+void via_qmk_rgb_matrix_command(uint8_t *data, uint8_t length);
+void via_qmk_rgb_matrix_set_value(uint8_t *data);
+void via_qmk_rgb_matrix_get_value(uint8_t *data);
+void via_qmk_rgb_matrix_save(void);
+#endif
+
+#if defined(AUDIO_ENABLE)
+void via_qmk_audio_command(uint8_t *data, uint8_t length);
+void via_qmk_audio_set_value(uint8_t *data);
+void via_qmk_audio_get_value(uint8_t *data);
+void via_qmk_audio_save(void);
+#endif
\ No newline at end of file