summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--keyboards/cannonkeys/satisfaction75/config.h3
-rw-r--r--keyboards/cannonkeys/satisfaction75/satisfaction75.c211
-rw-r--r--keyboards/cannonkeys/satisfaction75/satisfaction75.h4
-rw-r--r--keyboards/durgod/dgk6x/config.h3
-rw-r--r--keyboards/frooastboard/walnut/keymaps/via/config.h1
-rw-r--r--keyboards/frooastboard/walnut/keymaps/via/keymap.c113
-rw-r--r--keyboards/geekboards/macropad_v2/keymaps/via/config.h2
-rw-r--r--keyboards/horrortroll/handwired_k552/keymaps/via/config.h4
-rw-r--r--keyboards/hs60/v2/ansi/config.h3
-rw-r--r--keyboards/hs60/v2/hhkb/config.h3
-rw-r--r--keyboards/hs60/v2/iso/config.h3
-rw-r--r--keyboards/keebio/iris/keymaps/via/rules.mk1
-rwxr-xr-xkeyboards/keebwerk/mega/ansi/config.h3
-rw-r--r--keyboards/keychron/q1/config.h10
-rw-r--r--keyboards/keychron/q2/config.h5
-rw-r--r--keyboards/mechlovin/infinity875/keymaps/via/config.h24
-rw-r--r--keyboards/ml/gas75/keymaps/via/config.h23
-rw-r--r--keyboards/monstargear/xo87/rgb/keymaps/via/config.h17
-rw-r--r--keyboards/monstargear/xo87/solderable/keymaps/via/config.h18
-rw-r--r--keyboards/mss_studio/m63_rgb/keymaps/via/config.h4
-rwxr-xr-xkeyboards/novelkeys/nk65/config.h3
-rwxr-xr-xkeyboards/novelkeys/nk87/config.h3
-rw-r--r--keyboards/rgbkb/mun/keymaps/via/config.h2
-rw-r--r--keyboards/rgbkb/sol3/keymaps/kageurufu/config.h2
-rw-r--r--keyboards/rgbkb/sol3/keymaps/via/config.h2
-rwxr-xr-xkeyboards/spaceholdings/nebula12/config.h4
-rwxr-xr-xkeyboards/spaceholdings/nebula68/config.h4
-rwxr-xr-xkeyboards/spaceholdings/nebula68b/config.h3
-rwxr-xr-xkeyboards/spaceholdings/nebula68b/nebula68b.c69
-rw-r--r--keyboards/tkc/portico/config.h2
-rw-r--r--keyboards/tkc/portico68v2/keymaps/via/config.h19
-rw-r--r--keyboards/tkc/portico68v2/keymaps/via/keymap.c72
-rw-r--r--keyboards/tkc/portico75/config.h3
-rw-r--r--keyboards/wilba_tech/rama_works_kara/config.h3
-rw-r--r--keyboards/wilba_tech/rama_works_koyu/config.h3
-rw-r--r--keyboards/wilba_tech/rama_works_m10_c/config.h3
-rw-r--r--keyboards/wilba_tech/rama_works_m50_a/config.h3
-rw-r--r--keyboards/wilba_tech/rama_works_m60_a/config.h3
-rw-r--r--keyboards/wilba_tech/rama_works_m65_b/config.h3
-rw-r--r--keyboards/wilba_tech/rama_works_m65_bx/config.h3
-rw-r--r--keyboards/wilba_tech/rama_works_m6_a/config.h3
-rw-r--r--keyboards/wilba_tech/rama_works_m6_b/config.h3
-rw-r--r--keyboards/wilba_tech/rama_works_u80_a/config.h3
-rw-r--r--keyboards/wilba_tech/via_test.c133
-rw-r--r--keyboards/wilba_tech/wt60_a/config.h3
-rw-r--r--keyboards/wilba_tech/wt60_b/config.h3
-rw-r--r--keyboards/wilba_tech/wt60_bx/config.h3
-rw-r--r--keyboards/wilba_tech/wt60_c/config.h3
-rw-r--r--keyboards/wilba_tech/wt60_xt/wt60_xt.c7
-rw-r--r--keyboards/wilba_tech/wt65_a/config.h3
-rw-r--r--keyboards/wilba_tech/wt65_b/config.h3
-rw-r--r--keyboards/wilba_tech/wt75_a/config.h3
-rw-r--r--keyboards/wilba_tech/wt75_b/config.h3
-rw-r--r--keyboards/wilba_tech/wt75_c/config.h3
-rw-r--r--keyboards/wilba_tech/wt80_a/config.h3
-rw-r--r--keyboards/wilba_tech/wt_main.c61
-rw-r--r--keyboards/wilba_tech/zeal60/config.h3
-rw-r--r--keyboards/wilba_tech/zeal65/config.h3
-rw-r--r--keyboards/winry/winry315/keymaps/via/config.h9
-rw-r--r--keyboards/winry/winry315/winry315.c54
-rw-r--r--keyboards/xelus/dawn60/rev1/config.h3
-rw-r--r--keyboards/xelus/la_plus/keymaps/via/config.h20
-rw-r--r--keyboards/xelus/pachi/rgb/keymaps/via/config.h3
-rw-r--r--keyboards/xelus/valor/rev2/keymaps/via/config.h3
-rw-r--r--quantum/dynamic_keymap.c56
-rw-r--r--quantum/dynamic_keymap.h6
-rw-r--r--quantum/via.c479
-rw-r--r--quantum/via.h94
68 files changed, 751 insertions, 886 deletions
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 <http://www.gnu.org/licenses/>.
// 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<<index)) | (enable<<index);
+ eeprom_update_byte((uint8_t*)EEPROM_ENABLED_ENCODER_MODES, enabled_encoder_modes);
+ break;
}
case id_encoder_custom:
{
- uint8_t custom_encoder_idx = command_data[1];
- uint8_t encoder_behavior = command_data[2];
- uint16_t keycode = (command_data[3] << 8) | command_data[4];
- set_custom_encoder_config(custom_encoder_idx, encoder_behavior, keycode);
- break;
+ uint8_t custom_encoder_idx = value_data[0];
+ uint8_t encoder_behavior = value_data[1];
+ uint16_t keycode = (value_data[2] << 8) | value_data[3];
+ set_custom_encoder_config(custom_encoder_idx, encoder_behavior, keycode);
+ break;
}
- default:
+ }
+}
+
+void custom_get_value(uint8_t *data) {
+ uint8_t *value_id = &(data[0]);
+ uint8_t *value_data = &(data[1]);
+
+ switch ( *value_id ) {
+ case id_oled_default_mode:
{
- *command_id = id_unhandled;
- break;
+ uint8_t default_oled = eeprom_read_byte((uint8_t*)EEPROM_DEFAULT_OLED);
+ value_data[0] = default_oled;
+ break;
+ }
+ case id_oled_mode:
+ {
+ value_data[0] = oled_mode;
+ break;
+ }
+ case id_encoder_modes:
+ {
+ uint8_t index = value_data[0];
+ value_data[1] = (enabled_encoder_modes & (1<<index)) ? 1 : 0;
+ break;
+ }
+ case id_encoder_custom:
+ {
+ uint8_t custom_encoder_idx = value_data[0];
+ uint8_t encoder_behavior = value_data[1];
+ uint16_t keycode = retrieve_custom_encoder_config(custom_encoder_idx, encoder_behavior);
+ value_data[2] = keycode >> 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 <http://www.gnu.org/licenses/>.
// 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 <http://www.gnu.org/licenses/>.
// Backlight config starts after VIA's EEPROM usage,
// dynamic keymaps start after this.
#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 32