Relocate winry315 VIA logic (#24008)
This commit is contained in:
parent
2998d20a00
commit
9ca1f35333
3 changed files with 13 additions and 18 deletions
|
@ -37,3 +37,8 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
|
||||||
[2 ... 7] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) }
|
[2 ... 7] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) }
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// The enum values are assumed to match the layout option values used by VIA.
|
||||||
|
void via_set_layout_options_kb(uint32_t value) {
|
||||||
|
winry315_set_orientation(value & 0x03);
|
||||||
|
}
|
||||||
|
|
|
@ -3,13 +3,11 @@
|
||||||
|
|
||||||
#include "winry315.h"
|
#include "winry315.h"
|
||||||
|
|
||||||
#include "via.h"
|
|
||||||
|
|
||||||
#if !defined(WINRY315_DEFAULT_ORIENTATION)
|
#if !defined(WINRY315_DEFAULT_ORIENTATION)
|
||||||
# define WINRY315_DEFAULT_ORIENTATION WINRY315_ORIENTATION_TOP
|
# define WINRY315_DEFAULT_ORIENTATION WINRY315_ORIENTATION_TOP
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(VIA_ENABLE) && defined(ENCODER_ENABLE)
|
#if defined(ENCODER_ENABLE) && !defined(ENCODER_MAP_ENABLE)
|
||||||
# ifndef MEDIA_KEY_DELAY
|
# ifndef MEDIA_KEY_DELAY
|
||||||
# define MEDIA_KEY_DELAY 10
|
# define MEDIA_KEY_DELAY 10
|
||||||
# endif
|
# endif
|
||||||
|
@ -41,7 +39,7 @@ bool encoder_update_kb(uint8_t index, bool clockwise) {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif // !defined(VIA_ENABLE) && defined(ENCODER_ENABLE)
|
#endif // defined(ENCODER_ENABLE) && !defined(ENCODER_MAP_ENABLE)
|
||||||
|
|
||||||
#if defined(RGB_MATRIX_ENABLE)
|
#if defined(RGB_MATRIX_ENABLE)
|
||||||
|
|
||||||
|
@ -200,9 +198,3 @@ void winry315_set_orientation(uint8_t orientation) {
|
||||||
}
|
}
|
||||||
#endif // defined(RGB_MATRIX_ENABLE)
|
#endif // defined(RGB_MATRIX_ENABLE)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(VIA_ENABLE)
|
|
||||||
void via_set_layout_options_kb(uint32_t value) {
|
|
||||||
winry315_set_orientation(value & 0x03);
|
|
||||||
}
|
|
||||||
#endif // defined(VIA_ENABLE)
|
|
||||||
|
|
|
@ -5,8 +5,7 @@
|
||||||
|
|
||||||
#include "quantum.h"
|
#include "quantum.h"
|
||||||
|
|
||||||
// Supported orientations of the board. The enum values must match the layout
|
// Supported orientations of the board.
|
||||||
// option values used by VIA.
|
|
||||||
enum winry315_orientation {
|
enum winry315_orientation {
|
||||||
WINRY315_ORIENTATION_TOP, // Encoders at the top side (default)
|
WINRY315_ORIENTATION_TOP, // Encoders at the top side (default)
|
||||||
WINRY315_ORIENTATION_LEFT, // Encoders at the left side
|
WINRY315_ORIENTATION_LEFT, // Encoders at the left side
|
||||||
|
@ -17,10 +16,9 @@ enum winry315_orientation {
|
||||||
// Set the orientation of the board (changes the RGB Matrix effect behavior to
|
// Set the orientation of the board (changes the RGB Matrix effect behavior to
|
||||||
// match the new orientation).
|
// match the new orientation).
|
||||||
//
|
//
|
||||||
// This function is intended to be used in the `via` keymap, where the board
|
// This function is intended to be used to configure the orientation
|
||||||
// orientation is configured dynamically using a VIA layout option. If you are
|
// dynamically. If you are making a custom keymap for one specific orientation,
|
||||||
// making a custom keymap for one specific orientation, it is better to set the
|
// it is better to set the orientation in config.h
|
||||||
// orientation in config.h (e.g., `#define WINRY315_DEFAULT_ORIENTATION
|
// (e.g., `#define WINRY315_DEFAULT_ORIENTATION WINRY315_ORIENTATION_LEFT`)
|
||||||
// WINRY315_ORIENTATION_LEFT`) instead of adding custom code that calls this
|
// instead of adding custom code that calls this function.
|
||||||
// function.
|
|
||||||
void winry315_set_orientation(uint8_t orientation);
|
void winry315_set_orientation(uint8_t orientation);
|
||||||
|
|
Loading…
Reference in a new issue