Browse Source

Update Encoder Logic

Update encoder logic to act more consistently.
pull/13109/head
RinoSolutions 3 years ago
committed by GitHub
parent
commit
6f340be4cd
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 38 additions and 7 deletions
  1. +38
    -7
      keyboards/monarch/keymaps/iso/keymap.c

+ 38
- 7
keyboards/monarch/keymaps/iso/keymap.c View File

@ -23,22 +23,53 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_ENT, KC_PGUP,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_PGDN,
KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(1), KC_LEFT, KC_DOWN, KC_RGHT
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(1), KC_LEFT, KC_DOWN, KC_RGHT,
_______, _______
),
[1] = LAYOUT_iso(
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, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, BL_ON,
_______, _______, _______, BL_TOGG, _______, BL_DEC, BL_OFF, BL_INC
_______, _______, _______, BL_TOGG, _______, BL_DEC, BL_OFF, BL_INC,
_______, _______
)
};
bool encoder_update_user(uint8_t index, bool clockwise) {
void encoder_update_user(uint8_t index, bool clockwise) {
if (clockwise) {
tap_code(KC_VOLU);
//encoder_cw.pressed = true;
//encoder_cw.time = (timer_read() | 1);
//action_exec(encoder_cw);
keyevent_t pressed;
// get keycode mapped to key at row 5, col 1
pressed = (keyevent_t){ .key = (keypos_t){.row = 5, .col = 1}, .pressed = true, .time = (timer_read() | 1)};
uint16_t keycode = get_event_keycode(pressed, false);
if (keycode > 0) {
uint16_t held_keycode_timer = timer_read();
register_code16(keycode);
while (timer_elapsed(held_keycode_timer) < MEDIA_KEY_DELAY){
// nothing
}
unregister_code16(keycode);
}
} else {
tap_code(KC_VOLD);
}
return true;
//encoder_ccw.pressed = true;
//encoder_ccw.time = (timer_read() | 1);
//action_exec(encoder_ccw);
keyevent_t pressed;
// get keycode mapped to key at row 5, col 0
pressed = (keyevent_t){ .key = (keypos_t){.row = 5, .col = 0}, .pressed = true, .time = (timer_read() | 1)};
uint16_t keycode = get_event_keycode(pressed, false);
if (keycode > 0) {
uint16_t held_keycode_timer = timer_read();
register_code16(keycode);
while (timer_elapsed(held_keycode_timer) < MEDIA_KEY_DELAY){
// nothing
}
unregister_code16(keycode);
}
}
}

Loading…
Cancel
Save