mirror of
https://github.com/qmk/qmk_firmware
synced 2024-12-22 08:26:21 +00:00
VIA V3 - The Custom UI Update (#18222)
This commit is contained in:
parent
575b0e33fa
commit
bc6f8dc8b0
@ -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.
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
// 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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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 */
|
||||
|
@ -3,5 +3,4 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#define VIA_CUSTOM_LIGHTING_ENABLE
|
||||
#define DYNAMIC_KEYMAP_LAYER_COUNT 2
|
||||
|
@ -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)
|
||||
};
|
@ -1,2 +0,0 @@
|
||||
#define DYNAMIC_KEYMAP_LAYER_COUNT 4
|
||||
#define VIA_QMK_RGBLIGHT_ENABLE
|
@ -17,7 +17,3 @@
|
||||
#pragma once
|
||||
|
||||
#define DYNAMIC_KEYMAP_LAYER_COUNT 3
|
||||
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
#define VIA_QMK_RGBLIGHT_ENABLE
|
||||
#endif
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -133,6 +133,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
|
||||
|
@ -1,3 +1,4 @@
|
||||
VIA_ENABLE = yes
|
||||
LTO_ENABLE = yes
|
||||
ENCODER_MAP_ENABLE = yes
|
||||
CONSOLE_ENABLE = no
|
||||
|
@ -133,6 +133,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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
|
||||
#define VIA_QMK_RGBLIGHT_ENABLE
|
||||
|
||||
#endif
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#define DYNAMIC_KEYMAP_LAYER_COUNT 2
|
||||
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
#define VIA_QMK_RGBLIGHT_ENABLE
|
||||
#endif
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#define VIA_QMK_RGBLIGHT_ENABLE
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#define VIA_QMK_RGBLIGHT_ENABLE
|
@ -18,7 +18,3 @@
|
||||
#pragma once
|
||||
|
||||
#define DYNAMIC_KEYMAP_LAYER_COUNT 2
|
||||
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
#define VIA_QMK_RGBLIGHT_ENABLE
|
||||
#endif
|
||||
|
@ -134,9 +134,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
// 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.
|
||||
|
@ -134,6 +134,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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -174,7 +174,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
|
||||
#define VIA_QMK_RGBLIGHT_ENABLE
|
||||
|
@ -158,7 +158,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
|
||||
#define VIA_QMK_RGBLIGHT_ENABLE
|
||||
|
@ -122,6 +122,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#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
|
||||
|
@ -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
|
||||
|
@ -114,6 +114,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
// 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
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user