Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Helix] enable encoder map #22488

Merged
merged 3 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
4 changes: 2 additions & 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,7 @@ 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);
// oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false);
MakotoKurauchi marked this conversation as resolved.
Show resolved Hide resolved
}


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