Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VIA V3 - The Custom UI Update #18222

Merged
merged 31 commits into from
Nov 9, 2022
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
054de5b
VIA V3
wilba Aug 30, 2022
65a6419
remove lib/ugfx
wilba Aug 30, 2022
a63c932
Formatting changes
wilba Aug 30, 2022
35fc1f1
Fix qmk lint
wilba Aug 30, 2022
ac6417a
Refactoring the command handlers, formatting
wilba Oct 10, 2022
87b79b9
Reduce the muddiness factor of the diffs
wilba Oct 10, 2022
be7aaf0
More reduction of muddiness
wilba Oct 10, 2022
24feae9
Merge branch 'develop' into via_v3_pr
wilba Oct 10, 2022
9a00599
Fix rebase
wilba Oct 10, 2022
739228a
Remove QMK_KEYS_PER_SCAN
wilba Oct 11, 2022
f9a8ead
Fix broken users code
wilba Oct 22, 2022
cac1e1e
Fix broken users code
wilba Oct 22, 2022
5249774
Fix broken keymap introspection
wilba Oct 22, 2022
3762883
Fix broken users code
wilba Oct 22, 2022
95707e0
Fix Iris firmware size
wilba Oct 22, 2022
eeeb16b
Merge branch 'develop' into via_v3_pr
wilba Oct 22, 2022
b844900
Merge branch 'develop' into via_v3_pr
wilba Oct 22, 2022
dfbc8cc
Fix broken users code
wilba Oct 22, 2022
ed847e4
Merge branch 'develop' into via_v3_pr
wilba Oct 28, 2022
2965ffa
Fix build error
wilba Oct 28, 2022
d87366a
Fix firmware size
wilba Oct 28, 2022
d71959d
Fix firmware size
wilba Oct 28, 2022
f39fe55
Fix firmware size
wilba Oct 28, 2022
0894924
Fix build error
wilba Oct 29, 2022
0f4b77a
Merge branch 'develop' into via_v3_pr
wilba Oct 29, 2022
8105f96
Fix build error
wilba Oct 29, 2022
dcb4c78
Revert changes to Work Louder Micro and Work Board
wilba Nov 2, 2022
fb17546
Merge branch 'develop' into via_v3_pr
wilba Nov 5, 2022
0ea8612
Rollback the build error fixes
wilba Nov 8, 2022
94b7efb
Review changes
wilba Nov 8, 2022
c8ca3ce
Merge branch 'develop' into via_v3_pr
wilba Nov 8, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions keyboards/cannonkeys/satisfaction75/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
16 changes: 8 additions & 8 deletions keyboards/cannonkeys/satisfaction75/keymaps/boy_314/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include QMK_KEYBOARD_H

const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_2x2(
[0] = LAYOUT_all(
wilba marked this conversation as resolved.
Show resolved Hide resolved
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_NO, ENC_PRESS,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_HOME,
KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENTER, KC_END,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_DEL,
KC_LCTL, KC_LALT, KC_SPC, KC_LGUI, MO(1), KC_LEFT, KC_DOWN, KC_RGHT
KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NO, KC_ENTER, KC_END,
KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_DEL,
KC_LCTL, KC_LALT, KC_NO, KC_NO, KC_SPC, KC_NO, KC_LGUI, KC_NO, MO(1), KC_LEFT, KC_DOWN, KC_RGHT
),
[1] = LAYOUT_2x2(
[1] = LAYOUT_all(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
NK_TOGG, _______, _______, _______, _______, _______, _______, _______, KC_PSCR, KC_SCRL, KC_PAUS, _______, _______, _______, _______, OLED_TOGG,
_______, _______, _______, _______, _______, _______, _______, _______, KC_INS, KC_HOME, KC_PGUP, _______, _______, QK_BOOT, CLOCK_SET,
KC_CAPS, _______, _______, _______, _______, _______, _______, _______, KC_DEL, KC_END, KC_PGDN, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_VOLU, _______,
_______, _______, _______, _______, _______, KC_MPRV, KC_VOLD, KC_MNXT
KC_CAPS, _______, _______, _______, _______, _______, _______, _______, KC_DEL, KC_END, KC_PGDN, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_VOLU, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPRV, KC_VOLD, KC_MNXT
)
};
211 changes: 120 additions & 91 deletions keyboards/cannonkeys/satisfaction75/satisfaction75.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 5 additions & 5 deletions keyboards/cannonkeys/satisfaction75/satisfaction75.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ enum my_keycodes {
OLED_TOGG
};

enum s75_keyboard_value_id {
id_encoder_modes = 0x80,
id_oled_default_mode,
id_encoder_custom,
id_oled_mode
enum s75_custom_value_id {
id_encoder_modes = 1,
id_oled_default_mode = 2,
id_encoder_custom = 3,
id_oled_mode = 4
wilba marked this conversation as resolved.
Show resolved Hide resolved
};

enum encoder_modes {
Expand Down
2 changes: 2 additions & 0 deletions keyboards/custommk/evo70/keymaps/via/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#pragma once
wilba marked this conversation as resolved.
Show resolved Hide resolved
#define DYNAMIC_KEYMAP_LAYER_COUNT 3
7 changes: 0 additions & 7 deletions keyboards/custommk/evo70/keymaps/via/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,6 @@ 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, 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, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),

[3] = LAYOUT(
wilba marked this conversation as resolved.
Show resolved Hide resolved
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, 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, 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, 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, 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, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),

};

static bool custom_encoder_mode = false;
Expand Down
3 changes: 0 additions & 3 deletions keyboards/durgod/dgk6x/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
1 change: 0 additions & 1 deletion keyboards/frooastboard/walnut/keymaps/via/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@

#pragma once

#define VIA_CUSTOM_LIGHTING_ENABLE
#define DYNAMIC_KEYMAP_LAYER_COUNT 2
Loading