diff options
| author | Wilba <wilba@wilba.tech> | 2022-11-10 07:46:44 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-10 07:46:44 +1100 |
| commit | bc6f8dc8b0822e5e03893eacffa42a7badb4c2fa (patch) | |
| tree | b1e8a219803f30b7347e479734a5c6e7352a5f30 /keyboards/winry | |
| parent | 575b0e33fa47034f5cfaf6f7cd98570268efa0a2 (diff) | |
VIA V3 - The Custom UI Update (#18222)
Diffstat (limited to 'keyboards/winry')
| -rw-r--r-- | keyboards/winry/winry315/keymaps/via/config.h | 9 | ||||
| -rw-r--r-- | keyboards/winry/winry315/winry315.c | 54 |
2 files changed, 0 insertions, 63 deletions
diff --git a/keyboards/winry/winry315/keymaps/via/config.h b/keyboards/winry/winry315/keymaps/via/config.h index 5fc0e02531..de1f70c160 100644 --- a/keyboards/winry/winry315/keymaps/via/config.h +++ b/keyboards/winry/winry315/keymaps/via/config.h | |||
| @@ -4,12 +4,3 @@ | |||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #define DYNAMIC_KEYMAP_LAYER_COUNT 8 | 6 | #define DYNAMIC_KEYMAP_LAYER_COUNT 8 |
| 7 | |||
| 8 | // Enable a limited form of RGB Matrix support in VIA (requires redefining the | ||
| 9 | // effect list in the VIA JSON, which then becomes not 100% compatible with the | ||
| 10 | // RGBLIGHT firmwares). | ||
| 11 | #define VIA_QMK_RGBLIGHT_ENABLE | ||
| 12 | |||
| 13 | // Enable the workaround for the speed parameter mismatch between RGBLIGHT and | ||
| 14 | // RGB Matrix, so that the speed slider in VIA behaves in a more useful way. | ||
| 15 | #define VIA_CUSTOM_LIGHTING_ENABLE | ||
diff --git a/keyboards/winry/winry315/winry315.c b/keyboards/winry/winry315/winry315.c index d8042606c0..e7901a2e00 100644 --- a/keyboards/winry/winry315/winry315.c +++ b/keyboards/winry/winry315/winry315.c | |||
| @@ -164,60 +164,6 @@ uint8_t rgb_matrix_map_row_column_to_led_kb(uint8_t row, uint8_t column, uint8_t | |||
| 164 | return 0; | 164 | return 0; |
| 165 | } | 165 | } |
| 166 | 166 | ||
| 167 | # if defined(VIA_ENABLE) && defined(VIA_CUSTOM_LIGHTING_ENABLE) | ||
| 168 | |||
| 169 | // VIA supports only 4 discrete values for effect speed; map these to some | ||
| 170 | // useful speed values for RGB Matrix. | ||
| 171 | enum speed_values { | ||
| 172 | RGBLIGHT_SPEED_0 = UINT8_MAX / 16, // not 0 to avoid really slow effects | ||
| 173 | RGBLIGHT_SPEED_1 = UINT8_MAX / 4, | ||
| 174 | RGBLIGHT_SPEED_2 = UINT8_MAX / 2, // matches the default value | ||
| 175 | RGBLIGHT_SPEED_3 = UINT8_MAX / 4 * 3, // UINT8_MAX is really fast | ||
| 176 | }; | ||
| 177 | |||
| 178 | static uint8_t speed_from_rgblight(uint8_t rgblight_speed) { | ||
| 179 | switch (rgblight_speed) { | ||
| 180 | case 0: | ||
| 181 | return RGBLIGHT_SPEED_0; | ||
| 182 | case 1: | ||
| 183 | return RGBLIGHT_SPEED_1; | ||
| 184 | case 2: | ||
| 185 | default: | ||
| 186 | return RGBLIGHT_SPEED_2; | ||
| 187 | case 3: | ||
| 188 | return RGBLIGHT_SPEED_3; | ||
| 189 | } | ||
| 190 | } | ||
| 191 | |||
| 192 | static uint8_t speed_to_rgblight(uint8_t rgb_matrix_speed) { | ||
| 193 | if (rgb_matrix_speed < ((RGBLIGHT_SPEED_0 + RGBLIGHT_SPEED_1) / 2)) { | ||
| 194 | return 0; | ||
| 195 | } else if (rgb_matrix_speed < ((RGBLIGHT_SPEED_1 + RGBLIGHT_SPEED_2) / 2)) { | ||
| 196 | return 1; | ||
| 197 | } else if (rgb_matrix_speed < ((RGBLIGHT_SPEED_2 + RGBLIGHT_SPEED_3) / 2)) { | ||
| 198 | return 2; | ||
| 199 | } else { | ||
| 200 | return 3; | ||
| 201 | } | ||
| 202 | } | ||
| 203 | |||
| 204 | void raw_hid_receive_kb(uint8_t *data, uint8_t length) { | ||
| 205 | switch (data[0]) { | ||
| 206 | case id_lighting_get_value: | ||
| 207 | if (data[1] == id_qmk_rgblight_effect_speed) { | ||
| 208 | data[2] = speed_to_rgblight(rgb_matrix_get_speed()); | ||
| 209 | } | ||
| 210 | break; | ||
| 211 | case id_lighting_set_value: | ||
| 212 | if (data[1] == id_qmk_rgblight_effect_speed) { | ||
| 213 | rgb_matrix_set_speed_noeeprom(speed_from_rgblight(data[2])); | ||
| 214 | } | ||
| 215 | break; | ||
| 216 | } | ||
| 217 | } | ||
| 218 | |||
| 219 | # endif // defined(VIA_ENABLE) && defined(VIA_CUSTOM_LIGHTING_ENABLE) | ||
| 220 | |||
| 221 | #endif // defined(RGB_MATRIX_ENABLE) | 167 | #endif // defined(RGB_MATRIX_ENABLE) |
| 222 | 168 | ||
| 223 | void winry315_set_orientation(uint8_t orientation) { | 169 | void winry315_set_orientation(uint8_t orientation) { |
