diff options
Diffstat (limited to 'keyboards/dailycraft/stickey4/keymaps')
-rw-r--r-- | keyboards/dailycraft/stickey4/keymaps/default/keymap.c | 15 | ||||
-rw-r--r-- | keyboards/dailycraft/stickey4/keymaps/via/keymap.c | 87 | ||||
-rw-r--r-- | keyboards/dailycraft/stickey4/keymaps/via/rules.mk | 1 |
3 files changed, 10 insertions, 93 deletions
diff --git a/keyboards/dailycraft/stickey4/keymaps/default/keymap.c b/keyboards/dailycraft/stickey4/keymaps/default/keymap.c index 70de5dca44..40cfc22a0f 100644 --- a/keyboards/dailycraft/stickey4/keymaps/default/keymap.c +++ b/keyboards/dailycraft/stickey4/keymaps/default/keymap.c @@ -25,19 +25,6 @@ enum layer_names { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_BASE] = LAYOUT( - KC_A, KC_B, KC_C, KC_D, - KC_NO, KC_NO, KC_NO, KC_NO // for encoders - ), - [_FN1] = LAYOUT( - KC_NO, KC_NO, KC_NO, KC_NO, - KC_NO, KC_NO, KC_NO, KC_NO - ), - [_FN2] = LAYOUT( - KC_NO, KC_NO, KC_NO, KC_NO, - KC_NO, KC_NO, KC_NO, KC_NO - ), - [_FN3] = LAYOUT( - KC_NO, KC_NO, KC_NO, KC_NO, - KC_NO, KC_NO, KC_NO, KC_NO + KC_A, KC_B, KC_C, KC_D ) }; diff --git a/keyboards/dailycraft/stickey4/keymaps/via/keymap.c b/keyboards/dailycraft/stickey4/keymaps/via/keymap.c index 30de32fa60..0e577fcf62 100644 --- a/keyboards/dailycraft/stickey4/keymaps/via/keymap.c +++ b/keyboards/dailycraft/stickey4/keymaps/via/keymap.c @@ -25,95 +25,24 @@ enum layer_names { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_BASE] = LAYOUT( - KC_A, KC_B, KC_C, KC_D, - KC_NO, KC_NO, KC_NO, KC_NO // for encoders + KC_A, KC_B, KC_C, KC_D ), [_FN1] = LAYOUT( - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO ), [_FN2] = LAYOUT( - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO ), [_FN3] = LAYOUT( - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO ) }; -keyevent_t encoder1_ccw = { - .key = (keypos_t){.row = 0, .col = 4}, - .pressed = false, - .type = KEY_EVENT +#ifdef ENCODER_MAP_ENABLE +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { + [0] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) }, + [1] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) }, + [2] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) }, + [3] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) } }; - -keyevent_t encoder1_cw = { - .key = (keypos_t){.row = 0, .col = 5}, - .pressed = false, - .type = KEY_EVENT -}; - -keyevent_t encoder2_ccw = { - .key = (keypos_t){.row = 0, .col = 6}, - .pressed = false, - .type = KEY_EVENT -}; - -keyevent_t encoder2_cw = { - .key = (keypos_t){.row = 0, .col = 7}, - .pressed = false, - .type = KEY_EVENT -}; - -void matrix_scan_user(void) { - if (encoder1_ccw.pressed) { - encoder1_ccw.pressed = false; - encoder1_ccw.time = timer_read(); - action_exec(encoder1_ccw); - } - - if (encoder1_cw.pressed) { - encoder1_cw.pressed = false; - encoder1_cw.time = timer_read(); - action_exec(encoder1_cw); - } - - if (encoder2_ccw.pressed) { - encoder2_ccw.pressed = false; - encoder2_ccw.time = timer_read(); - action_exec(encoder2_ccw); - } - - if (encoder2_cw.pressed) { - encoder2_cw.pressed = false; - encoder2_cw.time = timer_read(); - action_exec(encoder2_cw); - } -} - -bool encoder_update_user(uint8_t index, bool clockwise) { - if (index == 0) { /* First encoder */ - if (clockwise) { - encoder1_cw.pressed = true; - encoder1_cw.time = timer_read(); - action_exec(encoder1_cw); - } else { - encoder1_ccw.pressed = true; - encoder1_ccw.time = timer_read(); - action_exec(encoder1_ccw); - } - } else if (index == 1) { - if (clockwise) { - encoder2_cw.pressed = true; - encoder2_cw.time = timer_read(); - action_exec(encoder2_cw); - } else { - encoder2_ccw.pressed = true; - encoder2_ccw.time = timer_read(); - action_exec(encoder2_ccw); - } - } - - return true; -} +#endif diff --git a/keyboards/dailycraft/stickey4/keymaps/via/rules.mk b/keyboards/dailycraft/stickey4/keymaps/via/rules.mk index 1e5b99807c..f1adcab005 100644 --- a/keyboards/dailycraft/stickey4/keymaps/via/rules.mk +++ b/keyboards/dailycraft/stickey4/keymaps/via/rules.mk @@ -1 +1,2 @@ VIA_ENABLE = yes +ENCODER_MAP_ENABLE = yes |