Skip to content

Commit

Permalink
Add rotary encoder support
Browse files Browse the repository at this point in the history
  • Loading branch information
BlankSourceCode committed Jun 11, 2019
1 parent a60eb82 commit 34c0a30
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions keyboards/lily58/keymaps/blanksourcecode/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define PERMISSIVE_HOLD
#define IGNORE_MOD_TAP_INTERRUPT

#define NUMBER_OF_ENCODERS 1
#define ENCODERS_PAD_A { F5 }
#define ENCODERS_PAD_B { F4 }

#define LAYOUT_kc( \
L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \
L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \
Expand Down
15 changes: 15 additions & 0 deletions keyboards/lily58/keymaps/blanksourcecode/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,21 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
}

// Rotary Encoder
void encoder_update_user(uint8_t index, bool clockwise) {
switch (biton32(layer_state)) {
default: {
// Page up and Page down on all layers
if (clockwise) {
tap_code(KC_PGDN);
} else {
tap_code(KC_PGUP);
}
break;
}
}
}

// Tap Dance
int cur_dance (qk_tap_dance_state_t *state) {
if (state->count == 1) {
Expand Down
1 change: 1 addition & 0 deletions keyboards/lily58/keymaps/blanksourcecode/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight.
SWAP_HANDS_ENABLE = no # Enable one-hand typing
ENCODER_ENABLE = yes # Enable rotary encoder

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

0 comments on commit 34c0a30

Please sign in to comment.