diff options
| author | Joel Challis <git@zvecr.com> | 2024-06-29 04:16:52 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-29 04:16:52 +0100 |
| commit | 9ca1f35333e3fef675096c3ba6d149f9164af2e0 (patch) | |
| tree | c6d5ebecdaf1ae655e83078ebe7253a504aea41d /keyboards/winry | |
| parent | 2998d20a009b57ff242e1e7d77571be82c7bc3f6 (diff) | |
Relocate winry315 VIA logic (#24008)
Diffstat (limited to 'keyboards/winry')
| -rw-r--r-- | keyboards/winry/winry315/keymaps/via/keymap.c | 5 | ||||
| -rw-r--r-- | keyboards/winry/winry315/winry315.c | 12 | ||||
| -rw-r--r-- | keyboards/winry/winry315/winry315.h | 14 |
3 files changed, 13 insertions, 18 deletions
diff --git a/keyboards/winry/winry315/keymaps/via/keymap.c b/keyboards/winry/winry315/keymaps/via/keymap.c index 0641fbfd03..4585f46fb6 100644 --- a/keyboards/winry/winry315/keymaps/via/keymap.c +++ b/keyboards/winry/winry315/keymaps/via/keymap.c | |||
| @@ -37,3 +37,8 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { | |||
| 37 | [2 ... 7] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) } | 37 | [2 ... 7] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) } |
| 38 | }; | 38 | }; |
| 39 | #endif | 39 | #endif |
| 40 | |||
| 41 | // The enum values are assumed to match the layout option values used by VIA. | ||
| 42 | void via_set_layout_options_kb(uint32_t value) { | ||
| 43 | winry315_set_orientation(value & 0x03); | ||
| 44 | } | ||
diff --git a/keyboards/winry/winry315/winry315.c b/keyboards/winry/winry315/winry315.c index e7901a2e00..03621d3e3f 100644 --- a/keyboards/winry/winry315/winry315.c +++ b/keyboards/winry/winry315/winry315.c | |||
| @@ -3,13 +3,11 @@ | |||
| 3 | 3 | ||
| 4 | #include "winry315.h" | 4 | #include "winry315.h" |
| 5 | 5 | ||
| 6 | #include "via.h" | ||
| 7 | |||
| 8 | #if !defined(WINRY315_DEFAULT_ORIENTATION) | 6 | #if !defined(WINRY315_DEFAULT_ORIENTATION) |
| 9 | # define WINRY315_DEFAULT_ORIENTATION WINRY315_ORIENTATION_TOP | 7 | # define WINRY315_DEFAULT_ORIENTATION WINRY315_ORIENTATION_TOP |
| 10 | #endif | 8 | #endif |
| 11 | 9 | ||
| 12 | #if !defined(VIA_ENABLE) && defined(ENCODER_ENABLE) | 10 | #if defined(ENCODER_ENABLE) && !defined(ENCODER_MAP_ENABLE) |
| 13 | # ifndef MEDIA_KEY_DELAY | 11 | # ifndef MEDIA_KEY_DELAY |
| 14 | # define MEDIA_KEY_DELAY 10 | 12 | # define MEDIA_KEY_DELAY 10 |
| 15 | # endif | 13 | # endif |
| @@ -41,7 +39,7 @@ bool encoder_update_kb(uint8_t index, bool clockwise) { | |||
| 41 | } | 39 | } |
| 42 | return true; | 40 | return true; |
| 43 | } | 41 | } |
| 44 | #endif // !defined(VIA_ENABLE) && defined(ENCODER_ENABLE) | 42 | #endif // defined(ENCODER_ENABLE) && !defined(ENCODER_MAP_ENABLE) |
| 45 | 43 | ||
| 46 | #if defined(RGB_MATRIX_ENABLE) | 44 | #if defined(RGB_MATRIX_ENABLE) |
| 47 | 45 | ||
| @@ -200,9 +198,3 @@ void winry315_set_orientation(uint8_t orientation) { | |||
| 200 | } | 198 | } |
| 201 | #endif // defined(RGB_MATRIX_ENABLE) | 199 | #endif // defined(RGB_MATRIX_ENABLE) |
| 202 | } | 200 | } |
| 203 | |||
| 204 | #if defined(VIA_ENABLE) | ||
| 205 | void via_set_layout_options_kb(uint32_t value) { | ||
| 206 | winry315_set_orientation(value & 0x03); | ||
| 207 | } | ||
| 208 | #endif // defined(VIA_ENABLE) | ||
diff --git a/keyboards/winry/winry315/winry315.h b/keyboards/winry/winry315/winry315.h index 8129c9d6e0..ea7b4120e2 100644 --- a/keyboards/winry/winry315/winry315.h +++ b/keyboards/winry/winry315/winry315.h | |||
| @@ -5,8 +5,7 @@ | |||
| 5 | 5 | ||
| 6 | #include "quantum.h" | 6 | #include "quantum.h" |
| 7 | 7 | ||
| 8 | // Supported orientations of the board. The enum values must match the layout | 8 | // Supported orientations of the board. |
| 9 | // option values used by VIA. | ||
| 10 | enum winry315_orientation { | 9 | enum winry315_orientation { |
| 11 | WINRY315_ORIENTATION_TOP, // Encoders at the top side (default) | 10 | WINRY315_ORIENTATION_TOP, // Encoders at the top side (default) |
| 12 | WINRY315_ORIENTATION_LEFT, // Encoders at the left side | 11 | WINRY315_ORIENTATION_LEFT, // Encoders at the left side |
| @@ -17,10 +16,9 @@ enum winry315_orientation { | |||
| 17 | // Set the orientation of the board (changes the RGB Matrix effect behavior to | 16 | // Set the orientation of the board (changes the RGB Matrix effect behavior to |
| 18 | // match the new orientation). | 17 | // match the new orientation). |
| 19 | // | 18 | // |
| 20 | // This function is intended to be used in the `via` keymap, where the board | 19 | // This function is intended to be used to configure the orientation |
| 21 | // orientation is configured dynamically using a VIA layout option. If you are | 20 | // dynamically. If you are making a custom keymap for one specific orientation, |
| 22 | // making a custom keymap for one specific orientation, it is better to set the | 21 | // it is better to set the orientation in config.h |
| 23 | // orientation in config.h (e.g., `#define WINRY315_DEFAULT_ORIENTATION | 22 | // (e.g., `#define WINRY315_DEFAULT_ORIENTATION WINRY315_ORIENTATION_LEFT`) |
| 24 | // WINRY315_ORIENTATION_LEFT`) instead of adding custom code that calls this | 23 | // instead of adding custom code that calls this function. |
| 25 | // function. | ||
| 26 | void winry315_set_orientation(uint8_t orientation); | 24 | void winry315_set_orientation(uint8_t orientation); |
