From bc6f8dc8b0822e5e03893eacffa42a7badb4c2fa Mon Sep 17 00:00:00 2001 From: Wilba Date: Thu, 10 Nov 2022 07:46:44 +1100 Subject: VIA V3 - The Custom UI Update (#18222) --- keyboards/cannonkeys/satisfaction75/config.h | 3 - .../cannonkeys/satisfaction75/satisfaction75.c | 211 ++++++++++++--------- .../cannonkeys/satisfaction75/satisfaction75.h | 4 +- keyboards/durgod/dgk6x/config.h | 3 - keyboards/frooastboard/walnut/keymaps/via/config.h | 1 - keyboards/frooastboard/walnut/keymaps/via/keymap.c | 113 +---------- .../geekboards/macropad_v2/keymaps/via/config.h | 2 - .../handwired_k552/keymaps/via/config.h | 4 - keyboards/hs60/v2/ansi/config.h | 3 - keyboards/hs60/v2/hhkb/config.h | 3 - keyboards/hs60/v2/iso/config.h | 3 - keyboards/keebio/iris/keymaps/via/rules.mk | 1 + keyboards/keebwerk/mega/ansi/config.h | 3 - keyboards/keychron/q1/config.h | 10 - keyboards/keychron/q2/config.h | 5 - .../mechlovin/infinity875/keymaps/via/config.h | 24 --- keyboards/ml/gas75/keymaps/via/config.h | 23 --- .../monstargear/xo87/rgb/keymaps/via/config.h | 17 -- .../xo87/solderable/keymaps/via/config.h | 18 -- keyboards/mss_studio/m63_rgb/keymaps/via/config.h | 4 - keyboards/novelkeys/nk65/config.h | 3 - keyboards/novelkeys/nk87/config.h | 3 - keyboards/rgbkb/mun/keymaps/via/config.h | 2 - keyboards/rgbkb/sol3/keymaps/kageurufu/config.h | 2 - keyboards/rgbkb/sol3/keymaps/via/config.h | 2 - keyboards/spaceholdings/nebula12/config.h | 4 - keyboards/spaceholdings/nebula68/config.h | 4 - keyboards/spaceholdings/nebula68b/config.h | 3 - keyboards/spaceholdings/nebula68b/nebula68b.c | 69 ------- keyboards/tkc/portico/config.h | 2 - keyboards/tkc/portico68v2/keymaps/via/config.h | 19 -- keyboards/tkc/portico68v2/keymaps/via/keymap.c | 72 ------- keyboards/tkc/portico75/config.h | 3 - keyboards/wilba_tech/rama_works_kara/config.h | 3 - keyboards/wilba_tech/rama_works_koyu/config.h | 3 - keyboards/wilba_tech/rama_works_m10_c/config.h | 3 - keyboards/wilba_tech/rama_works_m50_a/config.h | 3 - keyboards/wilba_tech/rama_works_m60_a/config.h | 3 - keyboards/wilba_tech/rama_works_m65_b/config.h | 3 - keyboards/wilba_tech/rama_works_m65_bx/config.h | 3 - keyboards/wilba_tech/rama_works_m6_a/config.h | 3 - keyboards/wilba_tech/rama_works_m6_b/config.h | 3 - keyboards/wilba_tech/rama_works_u80_a/config.h | 3 - keyboards/wilba_tech/via_test.c | 133 +++++++++++++ keyboards/wilba_tech/wt60_a/config.h | 3 - keyboards/wilba_tech/wt60_b/config.h | 3 - keyboards/wilba_tech/wt60_bx/config.h | 3 - keyboards/wilba_tech/wt60_c/config.h | 3 - keyboards/wilba_tech/wt60_xt/wt60_xt.c | 7 + keyboards/wilba_tech/wt65_a/config.h | 3 - keyboards/wilba_tech/wt65_b/config.h | 3 - keyboards/wilba_tech/wt75_a/config.h | 3 - keyboards/wilba_tech/wt75_b/config.h | 3 - keyboards/wilba_tech/wt75_c/config.h | 3 - keyboards/wilba_tech/wt80_a/config.h | 3 - keyboards/wilba_tech/wt_main.c | 61 +++--- keyboards/wilba_tech/zeal60/config.h | 3 - keyboards/wilba_tech/zeal65/config.h | 3 - keyboards/winry/winry315/keymaps/via/config.h | 9 - keyboards/winry/winry315/winry315.c | 54 ------ keyboards/xelus/dawn60/rev1/config.h | 3 - keyboards/xelus/la_plus/keymaps/via/config.h | 20 -- keyboards/xelus/pachi/rgb/keymaps/via/config.h | 3 - keyboards/xelus/valor/rev2/keymaps/via/config.h | 3 - 64 files changed, 299 insertions(+), 703 deletions(-) delete mode 100644 keyboards/geekboards/macropad_v2/keymaps/via/config.h delete mode 100644 keyboards/mechlovin/infinity875/keymaps/via/config.h delete mode 100644 keyboards/ml/gas75/keymaps/via/config.h delete mode 100644 keyboards/monstargear/xo87/rgb/keymaps/via/config.h delete mode 100644 keyboards/monstargear/xo87/solderable/keymaps/via/config.h delete mode 100644 keyboards/tkc/portico68v2/keymaps/via/config.h create mode 100644 keyboards/wilba_tech/via_test.c delete mode 100644 keyboards/xelus/la_plus/keymaps/via/config.h (limited to 'keyboards') diff --git a/keyboards/cannonkeys/satisfaction75/config.h b/keyboards/cannonkeys/satisfaction75/config.h index 615ad1d056..a650a362c0 100644 --- a/keyboards/cannonkeys/satisfaction75/config.h +++ b/keyboards/cannonkeys/satisfaction75/config.h @@ -82,9 +82,6 @@ along with this program. If not, see . // 6 for 3x custom encoder settings, left, right, and press (18 bytes) #define VIA_EEPROM_CUSTOM_CONFIG_SIZE 21 -// VIA lighting is handled by the keyboard-level code -#define VIA_CUSTOM_LIGHTING_ENABLE - /* * Feature disable options * These options are also useful to firmware size reduction. diff --git a/keyboards/cannonkeys/satisfaction75/satisfaction75.c b/keyboards/cannonkeys/satisfaction75/satisfaction75.c index 3cd52d5f23..13b44b85db 100644 --- a/keyboards/cannonkeys/satisfaction75/satisfaction75.c +++ b/keyboards/cannonkeys/satisfaction75/satisfaction75.c @@ -102,113 +102,142 @@ void backlight_set_value( uint8_t *data ) } } -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 ) - { - case id_get_keyboard_value: - { - switch( command_data[0]) - { - case id_oled_default_mode: - { - uint8_t default_oled = eeprom_read_byte((uint8_t*)EEPROM_DEFAULT_OLED); - command_data[1] = default_oled; - break; - } - case id_oled_mode: - { - command_data[1] = oled_mode; - break; - } - case id_encoder_modes: - { - command_data[1] = enabled_encoder_modes; - break; - } - case id_encoder_custom: - { - uint8_t custom_encoder_idx = command_data[1]; - uint16_t keycode = retrieve_custom_encoder_config(custom_encoder_idx, ENC_CUSTOM_CW); - command_data[2] = keycode >> 8; - command_data[3] = keycode & 0xFF; - keycode = retrieve_custom_encoder_config(custom_encoder_idx, ENC_CUSTOM_CCW); - command_data[4] = keycode >> 8; - command_data[5] = keycode & 0xFF; - keycode = retrieve_custom_encoder_config(custom_encoder_idx, ENC_CUSTOM_PRESS); - command_data[6] = keycode >> 8; - command_data[7] = keycode & 0xFF; - break; - } - default: - { - *command_id = id_unhandled; - break; - } - } - break; - } - case id_set_keyboard_value: - { - switch(command_data[0]){ +void custom_set_value(uint8_t *data) { + uint8_t *value_id = &(data[0]); + uint8_t *value_data = &(data[1]); + + switch ( *value_id ) { case id_oled_default_mode: { - eeprom_update_byte((uint8_t*)EEPROM_DEFAULT_OLED, command_data[1]); - break; + eeprom_update_byte((uint8_t*)EEPROM_DEFAULT_OLED, value_data[0]); + break; } case id_oled_mode: { - oled_mode = command_data[1]; - oled_request_wakeup(); - break; + oled_mode = value_data[0]; + oled_request_wakeup(); + break; } case id_encoder_modes: { - enabled_encoder_modes = command_data[1]; - eeprom_update_byte((uint8_t*)EEPROM_ENABLED_ENCODER_MODES, enabled_encoder_modes); - break; + uint8_t index = value_data[0]; + uint8_t enable = value_data[1]; + enabled_encoder_modes = (enabled_encoder_modes & ~(1<> 8; + value_data[3] = keycode & 0xFF; + break; } - } - break; - } - case id_lighting_set_value: - { - backlight_set_value(command_data); - break; - } - case id_lighting_get_value: - { - backlight_get_value(command_data); - break; - } - case id_lighting_save: - { - backlight_config_save(); - break; } - default: - { - // Unhandled message. - *command_id = id_unhandled; - break; +} + +// TODO +// Refactor so this keyboard uses QMK Core backlight code, +// then change this to via_custom_value_command_kb() so it +// only handles the custom values not the backlight +// (i.e. use QMK Core default handler for backlight values). +// +void via_custom_value_command(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 ( *channel_id == id_qmk_backlight_channel ) { + switch ( *command_id ) + { + case id_custom_set_value: + { + backlight_set_value(value_id_and_data); + break; + } + case id_custom_get_value: + { + backlight_get_value(value_id_and_data); + break; + } + case id_custom_save: + { + backlight_config_save(); + break; + } + default: + { + // Unhandled message. + *command_id = id_unhandled; + break; + } + } + } else if ( *channel_id == id_custom_channel ) { + switch ( *command_id ) + { + case id_custom_set_value: + { + custom_set_value(value_id_and_data); + break; + } + case id_custom_get_value: + { + custom_get_value(value_id_and_data); + break; + } + case id_custom_save: + { + // values are saved in custom_set_value() + break; + } + default: + { + // Unhandled message. + *command_id = id_unhandled; + break; + } + } + return; } - } - // DO NOT call raw_hid_send(data,length) here, let caller do this + + *command_id = id_unhandled; + + // DO NOT call raw_hid_send(data,length) here, let caller do this } #endif diff --git a/keyboards/cannonkeys/satisfaction75/satisfaction75.h b/keyboards/cannonkeys/satisfaction75/satisfaction75.h index ea71345a38..ec852eef6c 100644 --- a/keyboards/cannonkeys/satisfaction75/satisfaction75.h +++ b/keyboards/cannonkeys/satisfaction75/satisfaction75.h @@ -30,8 +30,8 @@ enum my_keycodes { OLED_TOGG }; -enum s75_keyboard_value_id { - id_encoder_modes = 0x80, +enum s75_custom_value_id { + id_encoder_modes = 1, id_oled_default_mode, id_encoder_custom, id_oled_mode diff --git a/keyboards/durgod/dgk6x/config.h b/keyboards/durgod/dgk6x/config.h index 70247fd745..fe4ca58072 100644 --- a/keyboards/durgod/dgk6x/config.h +++ b/keyboards/durgod/dgk6x/config.h @@ -130,7 +130,4 @@ # define ENABLE_RGB_MATRIX_SOLID_SPLASH # define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH -// This allows VIA to control RGB Matrix settings in the 'Lighting' section. -#define VIA_QMK_RGBLIGHT_ENABLE - #endif /* RGB_MATRIX_ENABLE */ diff --git a/keyboards/frooastboard/walnut/keymaps/via/config.h b/keyboards/frooastboard/walnut/keymaps/via/config.h index 0ef255fb51..e1f0fc0db6 100644 --- a/keyboards/frooastboard/walnut/keymaps/via/config.h +++ b/keyboards/frooastboard/walnut/keymaps/via/config.h @@ -3,5 +3,4 @@ #pragma once -#define VIA_CUSTOM_LIGHTING_ENABLE #define DYNAMIC_KEYMAP_LAYER_COUNT 2 diff --git a/keyboards/frooastboard/walnut/keymaps/via/keymap.c b/keyboards/frooastboard/walnut/keymaps/via/keymap.c index 84b73e2186..f502205761 100644 --- a/keyboards/frooastboard/walnut/keymaps/via/keymap.c +++ b/keyboards/frooastboard/walnut/keymaps/via/keymap.c @@ -17,115 +17,4 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_TOG, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_VAI, KC_TRNS, GUI_TOG, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_RMOD,RGB_VAD, RGB_MOD) -}; - -#if defined(RGB_MATRIX_ENABLE) && defined(VIA_CUSTOM_LIGHTING_ENABLE) - -// VIA supports only 4 discrete values for effect speed; map these to some -// useful speed values for RGB Matrix. -enum speed_values { - RGBLIGHT_SPEED_0 = UINT8_MAX / 16, // not 0 to avoid really slow effects - RGBLIGHT_SPEED_1 = UINT8_MAX / 4, - RGBLIGHT_SPEED_2 = UINT8_MAX / 2, // matches the default value - RGBLIGHT_SPEED_3 = UINT8_MAX / 4 * 3, // UINT8_MAX is really fast -}; - -static uint8_t speed_from_rgblight(uint8_t rgblight_speed) { - switch (rgblight_speed) { - case 0: - return RGBLIGHT_SPEED_0; - case 1: - return RGBLIGHT_SPEED_1; - case 2: - default: - return RGBLIGHT_SPEED_2; - case 3: - return RGBLIGHT_SPEED_3; - } -} - -static uint8_t speed_to_rgblight(uint8_t rgb_matrix_speed) { - if (rgb_matrix_speed < ((RGBLIGHT_SPEED_0 + RGBLIGHT_SPEED_1) / 2)) { - return 0; - } else if (rgb_matrix_speed < ((RGBLIGHT_SPEED_1 + RGBLIGHT_SPEED_2) / 2)) { - return 1; - } else if (rgb_matrix_speed < ((RGBLIGHT_SPEED_2 + RGBLIGHT_SPEED_3) / 2)) { - return 2; - } else { - return 3; - } -} - -void via_qmk_rgblight_get_value(uint8_t *data) { - uint8_t *value_id = &(data[0]); - uint8_t *value_data = &(data[1]); - switch (*value_id) { - case id_qmk_rgblight_brightness: { - value_data[0] = rgb_matrix_get_val(); - break; - } - case id_qmk_rgblight_effect: { - value_data[0] = rgb_matrix_is_enabled() ? rgb_matrix_get_mode() : 0; - break; - } - case id_qmk_rgblight_effect_speed: { - value_data[0] = speed_to_rgblight(rgb_matrix_get_speed()); - break; - } - case id_qmk_rgblight_color: { - value_data[0] = rgb_matrix_get_hue(); - value_data[1] = rgb_matrix_get_sat(); - break; - } - } -} - -void via_qmk_rgblight_set_value(uint8_t *data) { - uint8_t *value_id = &(data[0]); - uint8_t *value_data = &(data[1]); - switch (*value_id) { - case id_qmk_rgblight_brightness: { - rgb_matrix_sethsv_noeeprom(rgblight_get_hue(), rgblight_get_sat(), value_data[0]); - break; - } - case id_qmk_rgblight_effect: { - if (value_data[0] == 0) { - rgb_matrix_disable_noeeprom(); - } else { - rgb_matrix_enable_noeeprom(); - rgb_matrix_mode_noeeprom(value_data[0]); - } - break; - } - case id_qmk_rgblight_effect_speed: { - rgb_matrix_set_speed_noeeprom(speed_from_rgblight(value_data[0])); - break; - } - case id_qmk_rgblight_color: { - rgb_matrix_sethsv_noeeprom(value_data[0], value_data[1], rgblight_get_val()); - break; - } - } -} - -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) { - case id_lighting_set_value: - via_qmk_rgblight_set_value(command_data); - break; - case id_lighting_get_value: - via_qmk_rgblight_get_value(command_data); - break; - case id_lighting_save: - eeconfig_update_rgb_matrix(); - break; - default: - // Unhandled message. - *command_id = id_unhandled; - break; - } -} - -#endif // defined(RGB_MATRIX_ENABLE) && defined(VIA_CUSTOM_LIGHTING_ENABLE) +}; \ No newline at end of file diff --git a/keyboards/geekboards/macropad_v2/keymaps/via/config.h b/keyboards/geekboards/macropad_v2/keymaps/via/config.h deleted file mode 100644 index 9d75edbe74..0000000000 --- a/keyboards/geekboards/macropad_v2/keymaps/via/config.h +++ /dev/null @@ -1,2 +0,0 @@ -#define DYNAMIC_KEYMAP_LAYER_COUNT 4 -#define VIA_QMK_RGBLIGHT_ENABLE diff --git a/keyboards/horrortroll/handwired_k552/keymaps/via/config.h b/keyboards/horrortroll/handwired_k552/keymaps/via/config.h index ba3e8e9a03..a36ce468bc 100644 --- a/keyboards/horrortroll/handwired_k552/keymaps/via/config.h +++ b/keyboards/horrortroll/handwired_k552/keymaps/via/config.h @@ -17,7 +17,3 @@ #pragma once #define DYNAMIC_KEYMAP_LAYER_COUNT 3 - -#ifdef RGB_MATRIX_ENABLE - #define VIA_QMK_RGBLIGHT_ENABLE -#endif diff --git a/keyboards/hs60/v2/ansi/config.h b/keyboards/hs60/v2/ansi/config.h index 509661db8d..4211e7ce94 100644 --- a/keyboards/hs60/v2/ansi/config.h +++ b/keyboards/hs60/v2/ansi/config.h @@ -135,6 +135,3 @@ along with this program. If not, see . // Backlight config starts after VIA's EEPROM usage, // dynamic keymaps start after this. #define VIA_EEPROM_CUSTOM_CONFIG_SIZE 32 - -// VIA lighting is handled by the keyboard-level code -#define VIA_CUSTOM_LIGHTING_ENABLE diff --git a/keyboards/hs60/v2/hhkb/config.h b/keyboards/hs60/v2/hhkb/config.h index 46090673db..ac1e9aa012 100644 --- a/keyboards/hs60/v2/hhkb/config.h +++ b/keyboards/hs60/v2/hhkb/config.h @@ -135,6 +135,3 @@ along with this program. If not, see . // Backlight config starts after VIA's EEPROM usage, // dynamic keymaps start after this. #define VIA_EEPROM_CUSTOM_CONFIG_SIZE 32 - -// VIA lighting is handled by the keyboard-level code -#define VIA_CUSTOM_LIGHTING_ENABLE diff --git a/keyboards/hs60/v2/iso/config.h b/keyboards/hs60/v2/iso/config.h index cf43e3dd94..22e2c3fbfe 100644 --- a/keyboards/hs60/v2/iso/config.h +++ b/keyboards/hs60/v2/iso/config.h @@ -133,6 +133,3 @@ along with this program. If not, see . // Backlight config starts after VIA's EEPROM usage, // dynamic keymaps start after this. #define VIA_EEPROM_CUSTOM_CONFIG_SIZE 32 - -// VIA lighting is handled by the keyboard-level code -#define VIA_CUSTOM_LIGHTING_ENABLE diff --git a/keyboards/keebio/iris/keymaps/via/rules.mk b/keyboards/keebio/iris/keymaps/via/rules.mk index 1189f4ad19..873ff6cdfc 100644 --- a/keyboards/keebio/iris/keymaps/via/rules.mk +++ b/keyboards/keebio/iris/keymaps/via/rules.mk @@ -1,3 +1,4 @@ VIA_ENABLE = yes LTO_ENABLE = yes ENCODER_MAP_ENABLE = yes +CONSOLE_ENABLE = no diff --git a/keyboards/keebwerk/mega/ansi/config.h b/keyboards/keebwerk/mega/ansi/config.h index 43bc368925..0322bf3e64 100755 --- a/keyboards/keebwerk/mega/ansi/config.h +++ b/keyboards/keebwerk/mega/ansi/config.h @@ -133,6 +133,3 @@ along with this program. If not, see . // Backlight config starts after VIA's EEPROM usage, // dynamic keymaps start after this. #define VIA_EEPROM_CUSTOM_CONFIG_SIZE 32 - -// VIA lighting is handled by the keyboard-level code -#define VIA_CUSTOM_LIGHTING_ENABLE diff --git a/keyboards/keychron/q1/config.h b/keyboards/keychron/q1/config.h index cda8799a79..669e9ef7ba 100644 --- a/keyboards/keychron/q1/config.h +++ b/keyboards/keychron/q1/config.h @@ -43,11 +43,6 @@ /* Disable RGB lighting when PC is in suspend */ #define RGB_DISABLE_WHEN_USB_SUSPENDED -/* Allow VIA to edit lighting */ -#ifdef VIA_ENABLE -#define VIA_QMK_RGBLIGHT_ENABLE -#endif - // RGB Matrix Animation modes. Explicitly enabled // For full list of effects, see: // https://docs.qmk.fm/#/feature_rgb_matrix?id=rgb-matrix-effects @@ -96,8 +91,3 @@ #define ENABLE_RGB_MATRIX_MULTISPLASH #define ENABLE_RGB_MATRIX_SOLID_SPLASH #define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH - -/* Allow VIA to edit lighting */ -#ifdef VIA_ENABLE -#define VIA_QMK_RGBLIGHT_ENABLE -#endif diff --git a/keyboards/keychron/q2/config.h b/keyboards/keychron/q2/config.h index 511cc4f5ac..5961b62929 100644 --- a/keyboards/keychron/q2/config.h +++ b/keyboards/keychron/q2/config.h @@ -110,8 +110,3 @@ #define ENABLE_RGB_MATRIX_MULTISPLASH #define ENABLE_RGB_MATRIX_SOLID_SPLASH #define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH - -/* Allow VIA to edit lighting */ -#ifdef VIA_ENABLE -# define VIA_QMK_RGBLIGHT_ENABLE -#endif diff --git a/keyboards/mechlovin/infinity875/keymaps/via/config.h b/keyboards/mechlovin/infinity875/keymaps/via/config.h deleted file mode 100644 index 74ee03f3f9..0000000000 --- a/keyboards/mechlovin/infinity875/keymaps/via/config.h +++ /dev/null @@ -1,24 +0,0 @@ -/* -Copyright 2021 Mechlovin' Studio - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#pragma once - -#ifdef RGB_MATRIX_ENABLE - -#define VIA_QMK_RGBLIGHT_ENABLE - -#endif diff --git a/keyboards/ml/gas75/keymaps/via/config.h b/keyboards/ml/gas75/keymaps/via/config.h deleted file mode 100644 index 18d8c180ba..0000000000 --- a/keyboards/ml/gas75/keymaps/via/config.h +++ /dev/null @@ -1,23 +0,0 @@ -/* Copyright 2022 ML - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#pragma once - -#define DYNAMIC_KEYMAP_LAYER_COUNT 2 - -#ifdef RGB_MATRIX_ENABLE - #define VIA_QMK_RGBLIGHT_ENABLE -#endif diff --git a/keyboards/monstargear/xo87/rgb/keymaps/via/config.h b/keyboards/monstargear/xo87/rgb/keymaps/via/config.h deleted file mode 100644 index 45b4ab9d22..0000000000 --- a/keyboards/monstargear/xo87/rgb/keymaps/via/config.h +++ /dev/null @@ -1,17 +0,0 @@ -/* Copyright 2021 datafx - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -#pragma once -#define VIA_QMK_RGBLIGHT_ENABLE diff --git a/keyboards/monstargear/xo87/solderable/keymaps/via/config.h b/keyboards/monstargear/xo87/solderable/keymaps/via/config.h deleted file mode 100644 index 54dda96c49..0000000000 --- a/keyboards/monstargear/xo87/solderable/keymaps/via/config.h +++ /dev/null @@ -1,18 +0,0 @@ -/* Copyright 2021 datafx - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#pragma once -#define VIA_QMK_RGBLIGHT_ENABLE diff --git a/keyboards/mss_studio/m63_rgb/keymaps/via/config.h b/keyboards/mss_studio/m63_rgb/keymaps/via/config.h index db20f3b87b..188407396a 100644 --- a/keyboards/mss_studio/m63_rgb/keymaps/via/config.h +++ b/keyboards/mss_studio/m63_rgb/keymaps/via/config.h @@ -18,7 +18,3 @@ #pragma once #define DYNAMIC_KEYMAP_LAYER_COUNT 2 - -#ifdef RGB_MATRIX_ENABLE - #define VIA_QMK_RGBLIGHT_ENABLE -#endif diff --git a/keyboards/novelkeys/nk65/config.h b/keyboards/novelkeys/nk65/config.h index 9640704b48..e1597c9da6 100755 --- a/keyboards/novelkeys/nk65/config.h +++ b/keyboards/novelkeys/nk65/config.h @@ -134,9 +134,6 @@ along with this program. If not, see . // dynamic keymaps start after this. #define VIA_EEPROM_CUSTOM_CONFIG_SIZE 32 -// VIA lighting is handled by the keyboard-level code -#define VIA_CUSTOM_LIGHTING_ENABLE - /* Custom EEPROM start addressing. This is to support * both 128kb and 256kb versions of F303. * Register 0x1FFFF7CC holds the size of the flash memory. diff --git a/keyboards/novelkeys/nk87/config.h b/keyboards/novelkeys/nk87/config.h index 0320f35d84..4481f6283f 100755 --- a/keyboards/novelkeys/nk87/config.h +++ b/keyboards/novelkeys/nk87/config.h @@ -134,6 +134,3 @@ along with this program. If not, see . // Backlight config starts after VIA's EEPROM usage, // dynamic keymaps start after this. #define VIA_EEPROM_CUSTOM_CONFIG_SIZE 32 - -// VIA lighting is handled by the keyboard-level code -#define VIA_CUSTOM_LIGHTING_ENABLE diff --git a/keyboards/rgbkb/mun/keymaps/via/config.h b/keyboards/rgbkb/mun/keymaps/via/config.h index 01dc6f1c7d..002081a1c8 100644 --- a/keyboards/rgbkb/mun/keymaps/via/config.h +++ b/keyboards/rgbkb/mun/keymaps/via/config.h @@ -25,6 +25,4 @@ #define DYNAMIC_KEYMAP_LAYER_COUNT 8 #define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 2047 -#define VIA_QMK_RGBLIGHT_ENABLE - #define STM32_ONBOARD_EEPROM_SIZE 2048 diff --git a/keyboards/rgbkb/sol3/keymaps/kageurufu/config.h b/keyboards/rgbkb/sol3/keymaps/kageurufu/config.h index b1a8fce865..b6416d9bf8 100644 --- a/keyboards/rgbkb/sol3/keymaps/kageurufu/config.h +++ b/keyboards/rgbkb/sol3/keymaps/kageurufu/config.h @@ -26,7 +26,5 @@ #define DYNAMIC_KEYMAP_LAYER_COUNT 8 #define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 2047 -#define VIA_QMK_RGBLIGHT_ENABLE - #define STM32_ONBOARD_EEPROM_SIZE 2048 diff --git a/keyboards/rgbkb/sol3/keymaps/via/config.h b/keyboards/rgbkb/sol3/keymaps/via/config.h index e6aa2bd87b..ff1ff77472 100644 --- a/keyboards/rgbkb/sol3/keymaps/via/config.h +++ b/keyboards/rgbkb/sol3/keymaps/via/config.h @@ -26,7 +26,5 @@ #define DYNAMIC_KEYMAP_LAYER_COUNT 8 #define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 2047 -#define VIA_QMK_RGBLIGHT_ENABLE - #define STM32_ONBOARD_EEPROM_SIZE 2048 diff --git a/keyboards/spaceholdings/nebula12/config.h b/keyboards/spaceholdings/nebula12/config.h index 73cc391726..abda9af7af 100755 --- a/keyboards/spaceholdings/nebula12/config.h +++ b/keyboards/spaceholdings/nebula12/config.h @@ -174,7 +174,3 @@ along with this program. If not, see . // Backlight config starts after VIA's EEPROM usage, // dynamic keymaps start after this. #define VIA_EEPROM_CUSTOM_CONFIG_SIZE 32 - -// VIA lighting is handled by the keyboard-level code -#define VIA_CUSTOM_LIGHTING_ENABLE -#define VIA_QMK_RGBLIGHT_ENABLE diff --git a/keyboards/spaceholdings/nebula68/config.h b/keyboards/spaceholdings/nebula68/config.h index 8bae468783..14a4eedb90 100755 --- a/keyboards/spaceholdings/nebula68/config.h +++ b/keyboards/spaceholdings/nebula68/config.h @@ -158,7 +158,3 @@ along with this program. If not, see . // Backlight config starts after VIA's EEPROM usage, // dynamic keymaps start after this. #define VIA_EEPROM_CUSTOM_CONFIG_SIZE 32 - -// VIA lighting is handled by the keyboard-level code -#define VIA_CUSTOM_LIGHTING_ENABLE -#define VIA_QMK_RGBLIGHT_ENABLE diff --git a/keyboards/spaceholdings/nebula68b/config.h b/keyboards/spaceholdings/nebula68b/config.h index b95adb0508..30bf59e7dc 100755 --- a/keyboards/spaceholdings/nebula68b/config.h +++ b/keyboards/spaceholdings/nebula68b/config.h @@ -122,6 +122,3 @@ along with this program. If not, see . #define ENABLE_RGB_MATRIX_MULTISPLASH #define ENABLE_RGB_MATRIX_SOLID_SPLASH #define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH - -// // VIA lighting is handled by the keyboard-level code -#define VIA_CUSTOM_LIGHTING_ENABLE diff --git a/keyboards/spaceholdings/nebula68b/nebula68b.c b/keyboards/spaceholdings/nebula68b/nebula68b.c index 4d4f878c6b..f7b292ded9 100755 --- a/keyboards/spaceholdings/nebula68b/nebula68b.c +++ b/keyboards/spaceholdings/nebula68b/nebula68b.c @@ -42,72 +42,3 @@ led_config_t g_led_config = { { // clang-format on #endif #endif - -#if defined(RGB_MATRIX_ENABLE) && defined(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) { - case id_lighting_set_value: { - uint8_t *value_id = &(command_data[0]); - uint8_t *value_data = &(command_data[1]); - switch (*value_id) { - case id_qmk_rgblight_brightness: { - rgb_matrix_sethsv_noeeprom(rgb_matrix_get_hue(), rgb_matrix_get_sat(), scale8(value_data[0], RGB_MATRIX_MAXIMUM_BRIGHTNESS)); - break; - } - case id_qmk_rgblight_effect: { - rgb_matrix_mode_noeeprom(value_data[0]); - if (value_data[0] == 0) { - rgb_matrix_disable_noeeprom(); - } else { - rgb_matrix_enable_noeeprom(); - } - break; - } - case id_qmk_rgblight_effect_speed: { - rgb_matrix_set_speed_noeeprom(value_data[0] * 85); - break; - } - case id_qmk_rgblight_color: { - rgb_matrix_sethsv_noeeprom(value_data[0], value_data[1], rgb_matrix_get_val()); - break; - } - } - break; - } - case id_lighting_get_value: { - uint8_t *value_id = &(command_data[0]); - uint8_t *value_data = &(command_data[1]); - switch (*value_id) { - case id_qmk_rgblight_brightness: { - value_data[0] = ((uint16_t)rgb_matrix_get_val() * 255) / RGB_MATRIX_MAXIMUM_BRIGHTNESS; - break; - } - case id_qmk_rgblight_effect: { - value_data[0] = rgb_matrix_get_mode(); - break; - } - case id_qmk_rgblight_effect_speed: { - value_data[0] = rgb_matrix_get_speed() / 85; - break; - } - case id_qmk_rgblight_color: { - value_data[0] = rgb_matrix_get_hue(); - value_data[1] = rgb_matrix_get_sat(); - break; - } - } - break; - } - case id_lighting_save: { - eeconfig_update_rgb_matrix(); - break; - } - default: { - *command_id = id_unhandled; - break; - } - } -} -#endif diff --git a/keyboards/tkc/portico/config.h b/keyboards/tkc/portico/config.h index a0ad0c1652..3268b3511b 100644 --- a/keyboards/tkc/portico/config.h +++ b/keyboards/tkc/portico/config.h @@ -114,6 +114,4 @@ along with this program. If not, see . // dynamic keymaps start after this. #define VIA_EEPROM_CUSTOM_CONFIG_SIZE 31 -// VIA lighting is handled by the keyboard-level code -#define VIA_CUSTOM_LIGHTING_ENABLE #endif diff --git a/keyboards/tkc/portico68v2/keymaps/via/config.h b/keyboards/tkc/portico68v2/keymaps/via/config.h deleted file mode 100644 index 39b11550cf..0000000000 --- a/keyboards/tkc/portico68v2/keymaps/via/config.h +++ /dev/null @@ -1,19 +0,0 @@ -/* -Copyright 2022 Terry Mathews - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#pragma once -#define VIA_CUSTOM_LIGHTING_ENABLE diff --git a/keyboards/tkc/portico68v2/keymaps/via/keymap.c b/keyboards/tkc/portico68v2/keymaps/via/keymap.c index 1b3cfa0f99..9ab3d016ca 100644 --- a/keyboards/tkc/portico68v2/keymaps/via/keymap.c +++ b/keyboards/tkc/portico68v2/keymaps/via/keymap.c @@ -47,75 +47,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, _______, _______ ) }; - -void via_qmk_rgblight_get_value(uint8_t *data) { - uint8_t *value_id = &(data[0]); - uint8_t *value_data = &(data[1]); - switch (*value_id) { - case id_qmk_rgblight_brightness: { - value_data[0] = rgb_matrix_get_val(); - break; - } - case id_qmk_rgblight_effect: { - value_data[0] = rgb_matrix_get_flags() ? rgb_matrix_get_mode() : 0; - break; - } - case id_qmk_rgblight_effect_speed: { - value_data[0] = rgb_matrix_get_speed(); - break; - } - case id_qmk_rgblight_color: { - value_data[0] = rgb_matrix_get_hue(); - value_data[1] = rgb_matrix_get_sat(); - break; - } - } -} - -void via_qmk_rgblight_set_value(uint8_t *data) { - uint8_t *value_id = &(data[0]); - uint8_t *value_data = &(data[1]); - switch (*value_id) { - case id_qmk_rgblight_brightness: { - rgb_matrix_sethsv_noeeprom(rgblight_get_hue(), rgblight_get_sat(), value_data[0]); - break; - } - case id_qmk_rgblight_effect: { - if (value_data[0] == 0) { - rgb_matrix_set_flags(LED_FLAG_NONE); - } else { - rgb_matrix_mode_noeeprom(value_data[0]); - rgb_matrix_set_flags(LED_FLAG_MODIFIER|LED_FLAG_UNDERGLOW|LED_FLAG_KEYLIGHT); - } - break; - } - case id_qmk_rgblight_effect_speed: { - rgb_matrix_set_speed_noeeprom(value_data[0]); - break; - } - case id_qmk_rgblight_color: { - rgb_matrix_sethsv_noeeprom(value_data[0], value_data[1], rgblight_get_val()); - break; - } - } -} - -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) { - case id_lighting_set_value: - via_qmk_rgblight_set_value(command_data); - break; - case id_lighting_get_value: - via_qmk_rgblight_get_value(command_data); - break; - case id_lighting_save: - eeconfig_update_rgb_matrix(); - break; - default: - // Unhandled message. - *command_id = id_unhandled; - break; - } -} diff --git a/keyboards/tkc/portico75/config.h b/keyboards/tkc/portico75/config.h index 36bd7b3ed5..57089653e1 100644 --- a/keyboards/tkc/portico75/config.h +++ b/keyboards/tkc/portico75/config.h @@ -161,7 +161,4 @@ along with this program. If not, see . // Backlight config starts after VIA's EEPROM usage, // dynamic keymaps start after this. # define VIA_EEPROM_CUSTOM_CONFIG_SIZE 31 - -// VIA lighting is handled by the keyboard-level code -# define VIA_CUSTOM_LIGHTING_ENABLE #endif diff --git a/keyboards/wilba_tech/rama_works_kara/config.h b/keyboards/wilba_tech/rama_works_kara/config.h index 7c9489e922..d713c41bb9 100644 --- a/keyboards/wilba_tech/rama_works_kara/config.h +++ b/keyboards/wilba_tech/rama_works_kara/config.h @@ -108,6 +108,3 @@ // Backlight config starts after VIA's EEPROM usage, // dynamic keymaps start after this. #define VIA_EEPROM_CUSTOM_CONFIG_SIZE 31 - -// VIA lighting is handled by the keyboard-level code -#define VIA_CUSTOM_LIGHTING_ENABLE diff --git a/keyboards/wilba_tech/rama_works_koyu/config.h b/keyboards/wilba_tech/rama_works_koyu/config.h index 9b5048d11a..de2d4aafba 100644 --- a/keyboards/wilba_tech/rama_works_koyu/config.h +++ b/keyboards/wilba_tech/rama_works_koyu/config.h @@ -109,6 +109,3 @@ // Backlight config starts after VIA's EEPROM usage, // dynamic keymaps start after this. #define VIA_EEPROM_CUSTOM_CONFIG_SIZE 31 - -// VIA lighting is handled by the keyboard-level code -#define VIA_CUSTOM_LIGHTING_ENABLE diff --git a/keyboards/wilba_tech/rama_works_m10_c/config.h b/keyboards/wilba_tech/rama_works_m10_c/config.h index 456023d414..9c893ac1b3 100644 --- a/keyboards/wilba_tech/rama_works_m10_c/config.h +++ b/keyboards/wilba_tech/rama_works_m10_c/config.h @@ -103,6 +103,3 @@ // Backlight config starts after VIA's EEPROM usage, // dynamic keymaps start after this. #define VIA_EEPROM_CUSTOM_CONFIG_SIZE 51 - -// VIA lighting is handled by the keyboard-level code -#define VIA_CUSTOM_LIGHTING_ENABLE diff --git a/keyboards/wilba_tech/rama_works_m50_a/config.h b/keyboards/wilba_tech/rama_works_m50_a/config.h index 6284a4027a..47d47fae18 100644 --- a/keyboards/wilba_tech/rama_works_m50_a/config.h +++ b/keyboards/wilba_tech/rama_works_m50_a/config.h @@ -101,6 +101,3 @@ // Backlight config starts after VIA's EEPROM usage, // dynamic keymaps start after this. #define VIA_EEPROM_CUSTOM_CONFIG_SIZE 31 - -// VIA lighting is handled by the keyboard-level code -#define VIA_CUSTOM_LIGHTING_ENABLE diff --git a/keyboards/wilba_tech/rama_works_m60_a/config.h b/keyboards/wilba_tech/rama_works_m60_a/config.h index 22abe6ee60..05f12caaf2 100644 --- a/keyboards/wilba_tech/rama_works_m60_a/config.h +++ b/keyboards/wilba_tech/rama_works_m60_a/config.h @@ -108,6 +108,3 @@ // Backlight config starts after VIA's EEPROM usage, // dynamic keymaps start after this. #define VIA_EEPROM_CUSTOM_CONFIG_SIZE 31 - -// VIA lighting is handled by the keyboard-level code -#define VIA_CUSTOM_LIGHTING_ENABLE diff --git a/keyboards/wilba_tech/rama_works_m65_b/config.h b/keyboards/wilba_tech/rama_works_m65_b/config.h index 1982b2e8e1..ba99a20f97 100644 --- a/keyboards/wilba_tech/rama_works_m65_b/config.h +++ b/keyboards/wilba_tech/rama_works_m65_b/config.h @@ -101,6 +101,3 @@ // Backlight config starts after VIA's EEPROM usage, // dynamic keymaps start after this. #define VIA_EEPROM_CUSTOM_CONFIG_SIZE 31 - -// VIA lighting is handled by the keyboard-level code -#define VIA_CUSTOM_LIGHTING_ENABLE diff --git a/keyboards/wilba_tech/rama_works_m65_bx/config.h b/keyboards/wilba_tech/rama_works_m65_bx/config.h index 83c2be2001..7e2a0ce122 100644 --- a/keyboards/wilba_tech/rama_works_m65_bx/config.h +++ b/keyboards/wilba_tech/rama_works_m65_bx/config.h @@ -101,6 +101,3 @@ // Backlight config starts after VIA's EEPROM usage, // dynamic keymaps start after this. #define VIA_EEPROM_CUSTOM_CONFIG_SIZE 31 - -// VIA lighting is handled by the keyboard-level code -#define VIA_CUSTOM_LIGHTING_ENABLE diff --git a/keyboards/wilba_tech/rama_works_m6_a/config.h b/keyboards/wilba_tech/rama_works_m6_a/config.h index d77613628e..e964bcf21b 100644 --- a/keyboards/wilba_tech/rama_works_m6_a/config.h +++ b/keyboards/wilba_tech/rama_works_m6_a/config.h @@ -100,6 +100,3 @@ // Backlight config starts after VIA's EEPROM usage, // dynamic keymaps start after this. #define VIA_EEPROM_CUSTOM_CONFIG_SIZE 43 - -// VIA lighting is handled by the keyboard-level code -#define VIA_CUSTOM_LIGHTING_ENABLE diff --git a/keyboards/wilba_tech/rama_works_m6_b/config.h b/keyboards/wilba_tech/rama_works_m6_b/config.h index d6978c8a16..9f29bcb38a 100644 --- a/keyboards/wilba_tech/rama_works_m6_b/config.h +++ b/keyboards/wilba_tech/rama_works_m6_b/config.h @@ -143,6 +143,3 @@ // Backlight config starts after VIA's EEPROM usage, // dynamic keymaps start after this. #define VIA_EEPROM_CUSTOM_CONFIG_SIZE 43 - -// VIA lighting is handled by the keyboard-level code -#define VIA_CUSTOM_LIGHTING_ENABLE diff --git a/keyboards/wilba_tech/rama_works_u80_a/config.h b/keyboards/wilba_tech/rama_works_u80_a/config.h index 4653556190..9cfc23c8f8 100644 --- a/keyboards/wilba_tech/rama_works_u80_a/config.h +++ b/keyboards/wilba_tech/rama_works_u80_a/config.h @@ -153,6 +153,3 @@ // Backlight config starts after VIA's EEPROM usage, // dynamic keymaps start after this. #define VIA_EEPROM_CUSTOM_CONFIG_SIZE 31 - -// VIA lighting is handled by the keyboard-level code -#define VIA_CUSTOM_LIGHTING_ENABLE diff --git a/keyboards/wilba_tech/via_test.c b/keyboards/wilba_tech/via_test.c new file mode 100644 index 0000000000..6a74df5164 --- /dev/null +++ b/keyboards/wilba_tech/via_test.c @@ -0,0 +1,133 @@ +// Copyright 2022 Jason Williams (@wilba) +// SPDX-License-Identifier: GPL-2.0-or-later + +// This is a test harness for VIA custom UI. +// +// It handles channel IDs 0-7, value IDs 0-7. +// +// It's useful for testing custom UI on a PCB without compiling in +// features, especially features that will cause firmware to freeze +// if the PCB doesn't have support. +// +// To use: +// - add `SRC = keyboards/wilba_tech/via_test.c` to rules.mk +// - add `#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 128` to config.h +// (or change to match CHANNELS*VALUES*2) + +#include "quantum.h" +#include "via.h" + +#ifdef VIA_ENABLE + +#define CHANNELS 8 +#define VALUES 8 +uint8_t g_value[CHANNELS][VALUES][2]; + +void values_init(void) +{ + for ( uint8_t channel_id = 0; channel_id < CHANNELS; channel_id++ ) { + for ( uint8_t value_id = 0; value_id < VALUES; value_id++ ) { + g_value[channel_id][value_id][0] = 0x00; + g_value[channel_id][value_id][1] = 0x00; + } + } +} + +void values_load(void) +{ + eeprom_read_block( g_value, ((void*)VIA_EEPROM_CUSTOM_CONFIG_ADDR), VIA_EEPROM_CUSTOM_CONFIG_SIZE ); +} + +void values_save(void) +{ + eeprom_update_block( g_value, ((void*)VIA_EEPROM_CUSTOM_CONFIG_ADDR), VIA_EEPROM_CUSTOM_CONFIG_SIZE ); +} + +// We do this to test if VIA is sending save commands per channel +// Not relevant for real situations +void values_save_on_channel(uint8_t channel_id) +{ + uint16_t offset = channel_id * VALUES * 2; + eeprom_update_block( ((void*)g_value) + offset, + ((void*)VIA_EEPROM_CUSTOM_CONFIG_ADDR) + offset, + VALUES * 2 ); +} + +void via_init_kb(void) +{ + values_init(); + + // If the EEPROM has the magic, the data is good. + // OK to load from EEPROM + if (via_eeprom_is_valid()) { + values_load(); + } else { + values_save(); + // DO NOT set EEPROM valid here, let caller do this + } +} + +void set_value( uint8_t channel_id, uint8_t *data ) +{ + // data = [ value_id, value_data ] + uint8_t *value_id = &(data[0]); + uint8_t *value_data = &(data[1]); + if ( *value_id >= 0 && *value_id < VALUES ) { + g_value[channel_id][*value_id][0] = value_data[0]; + g_value[channel_id][*value_id][1] = value_data[1]; + } +} + +void get_value( uint8_t channel_id, uint8_t *data ) +{ + // data = [ value_id, value_data ] + uint8_t *value_id = &(data[0]); + uint8_t *value_data = &(data[1]); + if ( *value_id >= 0 && *value_id < VALUES ) { + value_data[0] = g_value[channel_id][*value_id][0]; + value_data[1] = g_value[channel_id][*value_id][1]; + } +} + +void via_custom_value_command(uint8_t *data, uint8_t length) { + // data = [ command_id, channel_id, value_id, value_data ] + uint8_t *command_id = &(data[0]); + uint8_t *channel_id = &(data[1]); + uint8_t *value_id_and_data = &(data[2]); + + if ( *channel_id >= 0 && *channel_id < CHANNELS ) { + switch ( *command_id ) + { + case id_custom_set_value: + { + set_value(*channel_id,value_id_and_data); + break; + } + case id_custom_get_value: + { + get_value(*channel_id,value_id_and_data); + break; + } + case id_custom_save: + { + //for ( uint8_t i=0; i. - */ - -#pragma once - -// Enable RGB Matrix -#define VIA_QMK_RGBLIGHT_ENABLE diff --git a/keyboards/xelus/pachi/rgb/keymaps/via/config.h b/keyboards/xelus/pachi/rgb/keymaps/via/config.h index 0e34ad2c1a..47bbf2bf81 100644 --- a/keyboards/xelus/pachi/rgb/keymaps/via/config.h +++ b/keyboards/xelus/pachi/rgb/keymaps/via/config.h @@ -18,6 +18,3 @@ // 3 layers or else it will not fit in EEPROM #define DYNAMIC_KEYMAP_LAYER_COUNT 3 - -// Enable RGB Matrix -#define VIA_QMK_RGBLIGHT_ENABLE diff --git a/keyboards/xelus/valor/rev2/keymaps/via/config.h b/keyboards/xelus/valor/rev2/keymaps/via/config.h index e7fb31cb23..8c0ed0c6e3 100644 --- a/keyboards/xelus/valor/rev2/keymaps/via/config.h +++ b/keyboards/xelus/valor/rev2/keymaps/via/config.h @@ -15,8 +15,5 @@ */ #pragma once -// RGB Matrix -#define VIA_QMK_RGBLIGHT_ENABLE - // More layers #define DYNAMIC_KEYMAP_LAYER_COUNT 8 -- cgit v1.2.3