flesh out dip and encoder support

This commit is contained in:
Jack Humbert
2018-04-03 20:57:11 -04:00
parent ddee61c9ba
commit bb71a988c2
4 changed files with 66 additions and 22 deletions

View File

@@ -75,7 +75,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC,
KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT ,
KC_SPC, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
),
/* Dvorak
@@ -266,3 +266,31 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
return true;
}
void encoder_update(bool direction) {
if (direction) {
register_code(KC_PGUP);
unregister_code(KC_PGUP);
} else {
register_code(KC_PGDN);
unregister_code(KC_PGDN);
}
}
void dip_update(uint8_t index, bool value) {
switch (index) {
case 0:
if (value) {
#ifdef AUDIO_ENABLE
PLAY_SONG(plover_song);
#endif
layer_on(_ADJUST);
} else {
#ifdef AUDIO_ENABLE
PLAY_SONG(plover_gb_song);
#endif
layer_off(_ADJUST);
}
break;
}
}