Simplify NIBBLE encoder code and clean up keymaps (#11808)

* Simplify encoder code and clean up keymaps.

-Removed overly complex VIA encoder code. It wasn't adding any value and was confusing users who were trying to customize encoder functionality on VIA keymaps.
-Replaced KC_TILDE with KC_HOME in all keymaps, as KC_TILDE sends a left shift, which was confusing some folks as they tested their build.
-Move layer names to enum

* Change encoder_update_kb to encoder_update_user per PR feedback
This commit is contained in:
Jay Greco 2021-02-09 06:50:16 -08:00 committed by GitHub
parent 81d487e162
commit 0d0f3e2086
7 changed files with 21 additions and 386 deletions

View file

@ -14,12 +14,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
#include "via_extras.h"
#define _BASE 0
#define _VIA1 1
#define _VIA2 2
#define _VIA3 3
enum layer_names {
_BASE,
_VIA1,
_VIA2,
_VIA3
};
#define KC_DISC_MUTE KC_F23
#define KC_DISC_DEAF KC_F24
@ -50,7 +51,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),
[_VIA1] = LAYOUT_all(
RESET, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_HOME, KC_INS,
RESET, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, KC_END,
RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
@ -100,7 +101,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
tap_code(KC_DISC_MUTE);
if (!rgblight_is_enabled()) break;
if (muted) {
rgblight_enable_noeeprom();
} else {
@ -133,7 +134,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (!is_alt_tab_active) {
is_alt_tab_active = true;
register_code(KC_LALT);
}
}
alt_tab_timer = timer_read();
register_code(KC_TAB);
} else {
@ -142,11 +143,20 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
break;
default:
break;
break;
}
return true;
}
void encoder_update_user(uint8_t index, bool clockwise) {
// Encoder is mapped to volume functions by default
if (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
}
void matrix_init_user(void) {
// Initialize remote keyboard, if connected (see readme)
matrix_init_remote_kb();
@ -161,4 +171,4 @@ void matrix_scan_user(void) {
is_alt_tab_active = false;
}
}
}
}