Skip to content

Commit

Permalink
[Keyboard][Helix] enable encoder map (qmk#22488)
Browse files Browse the repository at this point in the history
Co-authored-by: Drashna Jaelre <[email protected]>
  • Loading branch information
2 people authored and Nathan committed Feb 11, 2024
1 parent 52fce58 commit a13a48f
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 34 deletions.
24 changes: 8 additions & 16 deletions keyboards/helix/rev3_5rows/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,22 +121,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

};

bool encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) { /* Left side encoder */
if (clockwise) {
tap_code(KC_PGDN);
} else {
tap_code(KC_PGUP);
}
} else if (index == 1) { /* Right side encoder */
if (clockwise) {
tap_code(KC_DOWN);
} else {
tap_code(KC_UP);
}
}
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_PGUP, KC_PGDN), ENCODER_CCW_CW(KC_HOME, KC_END) },
[_RAISE] = { ENCODER_CCW_CW(RGB_VAD, RGB_VAI), ENCODER_CCW_CW(RGB_SPD, RGB_SPI) },
[_ADJUST] = { ENCODER_CCW_CW(RGB_RMOD, RGB_MOD), ENCODER_CCW_CW(KC_RIGHT, KC_LEFT) },
};
#endif

layer_state_t layer_state_set_user(layer_state_t state) {
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
Expand Down
1 change: 1 addition & 0 deletions keyboards/helix/rev3_5rows/keymaps/default/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ENCODER_MAP_ENABLE = yes
26 changes: 10 additions & 16 deletions keyboards/helix/rev3_5rows/keymaps/via/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,22 +121,16 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

};

bool encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) { /* Left side encoder */
if (clockwise) {
tap_code(KC_PGDN);
} else {
tap_code(KC_PGUP);
}
} else if (index == 1) { /* Right side encoder */
if (clockwise) {
tap_code(KC_DOWN);
} else {
tap_code(KC_UP);
}
}
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_PGUP, KC_PGDN), ENCODER_CCW_CW(KC_HOME, KC_END) },
[_RAISE] = { ENCODER_CCW_CW(RGB_VAD, RGB_VAI), ENCODER_CCW_CW(RGB_SPD, RGB_SPI) },
[_ADJUST] = { ENCODER_CCW_CW(RGB_RMOD, RGB_MOD), ENCODER_CCW_CW(KC_RIGHT, KC_LEFT) },
};
#endif

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
Expand Down
3 changes: 1 addition & 2 deletions keyboards/helix/rev3_5rows/keymaps/via/oled_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void render_status(void) {
break;
default:
// Or use the write_ln shortcut over adding '\n' to the end of your string
oled_write_ln_P(PSTR("Undefined"), false);
oled_write_ln_P(PSTR("N/A"), false);
}

oled_write_P(PSTR("\n"), false);
Expand All @@ -71,7 +71,6 @@ void render_status(void) {
led_t led_state = host_keyboard_led_state();
oled_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false);
oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false);
oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false);
}


Expand Down
1 change: 1 addition & 0 deletions keyboards/helix/rev3_5rows/keymaps/via/rules.mk
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
ENCODER_MAP_ENABLE = yes
VIA_ENABLE = yes
1 change: 1 addition & 0 deletions keyboards/helix/rev3_5rows/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ RGB_MATRIX_ENABLE = no
OLED_ENABLE = yes
ENCODER_ENABLE = yes
DIP_SWITCH_ENABLE = no
MOUSEKEY_ENABLE = yes
LTO_ENABLE = yes

SRC += oled_display.c

0 comments on commit a13a48f

Please sign in to comment.