Skip to content

Commit

Permalink
f58: fix encoders (thanks .dasky and elpekenin at qmk discord!)
Browse files Browse the repository at this point in the history
  • Loading branch information
markjoshwel committed Sep 20, 2023
1 parent 2cdde51 commit 60a407f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 38 deletions.
8 changes: 3 additions & 5 deletions lily58/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

/* Select hand configuration */

//#define MASTER_LEFT
//#define MASTER_RIGHT
// #define MASTER_LEFT
// #define MASTER_RIGHT
#define EE_HANDS

#define USE_SERIAL_PD2

#define TAPPING_FORCE_HOLD
#define TAPPING_TERM 100

/* Encoder support */
#define ENCODERS_PAD_A { F5 }
#define ENCODERS_PAD_B { F4 }
#define ENCODER_RESOLUTION 2
#define ENCODERS_PAD_A_RIGHT { F4 }
#define ENCODERS_PAD_B_RIGHT { F5 }
#define ENCODER_RESOLUTION 4
#define ENCODER_DIRECTION_RIGHT 4
#define ENCODER_DIRECTION_FLIP
38 changes: 5 additions & 33 deletions lily58/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,37 +68,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
)
};

// encoder functionality modified from https://github.com/ergohaven/qmk_firmware/blob/master/keyboards/lily58/keymaps/eh/keymap.c
/* Copyright 2020 Naoki Katahira
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef ENCODER_ENABLE
bool encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) { /* First encoder */
if (clockwise) {
tap_code(KC_WH_D);
} else {
tap_code(KC_WH_U);
}
} else if (index == 1) { /* Second encoder */
if (clockwise) {
tap_code(KC_VOLD);
} else {
tap_code(KC_VOLU);
}
}
return true;
}
#if defined(ENCODER_MAP_ENABLE)
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
[_QWERTY] = { ENCODER_CCW_CW(KC_MS_WH_UP, KC_MS_WH_DOWN), ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[_LOWER] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS ), ENCODER_CCW_CW(KC_TRNS, KC_TRNS) },
};
#endif
2 changes: 2 additions & 0 deletions lily58/rules.mk
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
ENCODER_ENABLE = yes
ENCODER_MAP_ENABLE = yes
MOUSEKEY_ENABLE = yes
EXTRAKEY_ENABLE = yes
EXTRAFLAGS += -flto

0 comments on commit 60a407f

Please sign in to comment.