Skip to content

Commit 34c0a30

Browse files
Add rotary encoder support
1 parent a60eb82 commit 34c0a30

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

keyboards/lily58/keymaps/blanksourcecode/config.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
4040
#define PERMISSIVE_HOLD
4141
#define IGNORE_MOD_TAP_INTERRUPT
4242

43+
#define NUMBER_OF_ENCODERS 1
44+
#define ENCODERS_PAD_A { F5 }
45+
#define ENCODERS_PAD_B { F4 }
46+
4347
#define LAYOUT_kc( \
4448
L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \
4549
L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \

keyboards/lily58/keymaps/blanksourcecode/keymap.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,21 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
448448
return true;
449449
}
450450

451+
// Rotary Encoder
452+
void encoder_update_user(uint8_t index, bool clockwise) {
453+
switch (biton32(layer_state)) {
454+
default: {
455+
// Page up and Page down on all layers
456+
if (clockwise) {
457+
tap_code(KC_PGDN);
458+
} else {
459+
tap_code(KC_PGUP);
460+
}
461+
break;
462+
}
463+
}
464+
}
465+
451466
// Tap Dance
452467
int cur_dance (qk_tap_dance_state_t *state) {
453468
if (state->count == 1) {

keyboards/lily58/keymaps/blanksourcecode/rules.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ UNICODE_ENABLE = no # Unicode
1515
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
1616
RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight.
1717
SWAP_HANDS_ENABLE = no # Enable one-hand typing
18+
ENCODER_ENABLE = yes # Enable rotary encoder
1819

1920
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
2021
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend

0 commit comments

Comments
 (0)