diff options
Diffstat (limited to 'keyboards/dailycraft/wings42')
4 files changed, 33 insertions, 164 deletions
diff --git a/keyboards/dailycraft/wings42/rev2/info.json b/keyboards/dailycraft/wings42/rev2/info.json index 09cf423e93..261157627a 100644 --- a/keyboards/dailycraft/wings42/rev2/info.json +++ b/keyboards/dailycraft/wings42/rev2/info.json @@ -16,6 +16,15 @@ "split": { "soft_serial_pin": "D2" }, + "features": { + "encoder": true + }, + "encoder": { + "rotary": [ + { "pin_a": "B5", "pin_b": "B4" }, + { "pin_a": "B6", "pin_b": "B2" } + ] + }, "processor": "atmega32u4", "bootloader": "caterina", "layouts": { @@ -41,9 +50,7 @@ {"matrix": [1, 3], "x": 3, "y": 1}, {"matrix": [1, 4], "x": 4, "y": 1}, {"matrix": [1, 5], "x": 5, "y": 1.125}, - {"matrix": [3, 1], "x": 6, "y": 1.625}, - {"matrix": [8, 2], "x": 8, "y": 1.625}, {"matrix": [6, 5], "x": 9, "y": 1.125}, {"matrix": [6, 4], "x": 10, "y": 1}, {"matrix": [6, 3], "x": 11, "y": 1}, @@ -57,9 +64,7 @@ {"matrix": [2, 3], "x": 3, "y": 2}, {"matrix": [2, 4], "x": 4, "y": 2}, {"matrix": [2, 5], "x": 5, "y": 2.125}, - {"matrix": [3, 2], "x": 6, "y": 2.625}, - {"matrix": [8, 1], "x": 8, "y": 2.625}, {"matrix": [7, 5], "x": 9, "y": 2.125}, {"matrix": [7, 4], "x": 10, "y": 2}, {"matrix": [7, 3], "x": 11, "y": 2}, diff --git a/keyboards/dailycraft/wings42/rev2/keymaps/default/keymap.c b/keyboards/dailycraft/wings42/rev2/keymaps/default/keymap.c index 501b5d2e12..d809d59f4c 100644 --- a/keyboards/dailycraft/wings42/rev2/keymaps/default/keymap.c +++ b/keyboards/dailycraft/wings42/rev2/keymaps/default/keymap.c @@ -35,9 +35,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { //,--------+--------+--------+--------+--------+--------. ,--------+---------+--------+---------+--------+--------. KC_ESC , KC_Q , KC_W , KC_E , KC_R , KC_T , KC_Y , KC_U , KC_I , KC_O , KC_P , KC_MINS, //|--------+--------+--------+--------+--------+--------| |--------+---------+--------+---------+--------+--------| - KC_G_TAB, KC_A , KC_S , KC_D , KC_F , KC_G , KC_BSPC, KC_BSPC, KC_H , KC_J , KC_K , KC_L , KC_SCLN, KC_G_BS, + KC_G_TAB, KC_A , KC_S , KC_D , KC_F , KC_G , KC_H , KC_J , KC_K , KC_L , KC_SCLN, KC_G_BS, //|--------+--------+--------+--------+--------+--------| |--------+---------+--------+---------+--------+--------| - KC_LCTL, KC_Z , KC_X , KC_C , KC_V , KC_B , KC_DEL , KC_DEL , KC_N , KC_M , KC_COMM, KC_DOT , KC_SLSH, KC_RCTL, + KC_LCTL, KC_Z , KC_X , KC_C , KC_V , KC_B , KC_N , KC_M , KC_COMM, KC_DOT , KC_SLSH, KC_RCTL, //`--------+--------+--------+--------+--------+--------/ \--------+---------+--------+---------+--------+--------' KC_A_DEL,KC_S_EN ,KC_L_SPC, KC_R_ENT, KC_S_JA , KC_A_DEL // `+--------+--------+--------' `--------+---------+--------+' @@ -47,9 +47,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { //,--------+--------+--------+--------+--------+--------. ,--------+--------+--------+--------+--------+--------. _______, KC_BSLS, KC_CIRC, KC_EXLM, KC_AMPR, KC_PIPE, KC_AT , KC_EQL , KC_PLUS, KC_ASTR, KC_PERC, KC_MINS, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - KC_LPRN, KC_HASH, KC_DLR , KC_DQT , KC_QUOT, KC_TILD, _______, _______, KC_LEFT, KC_DOWN, KC_UP , KC_RGHT, KC_GRV , KC_RPRN, + KC_LPRN, KC_HASH, KC_DLR , KC_DQT , KC_QUOT, KC_TILD, KC_LEFT, KC_DOWN, KC_UP , KC_RGHT, KC_GRV , KC_RPRN, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - _______, _______, _______, _______, KC_LCBR, KC_LBRC, _______, _______, KC_RBRC, KC_RCBR, _______, _______, _______, _______, + _______, _______, _______, _______, KC_LCBR, KC_LBRC, KC_RBRC, KC_RCBR, _______, _______, _______, _______, //`--------+--------+--------+--------+--------+--------/ \--------+--------+--------+--------+--------+--------' _______, _______, _______, _______, _______, QK_BOOT // `+--------+--------+--------' `--------+-------+--------+' @@ -59,9 +59,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { //,--------+--------+--------+--------+--------+--------. ,--------+--------+--------+--------+--------+--------. KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_F5 , KC_F6 , _______, KC_EQL , KC_PLUS, KC_ASTR, KC_PERC, KC_MINS, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - _______, KC_1 , KC_2 , KC_3 , KC_4 , KC_5 , _______, _______, KC_6 , KC_7 , KC_8 , KC_9 , KC_0 , _______, + _______, KC_1 , KC_2 , KC_3 , KC_4 , KC_5 , KC_6 , KC_7 , KC_8 , KC_9 , KC_0 , _______, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - KC_F7 , KC_F8 , KC_F9 , KC_F10 , KC_F11 , KC_F12 , _______, _______, _______, _______, KC_COMM, KC_DOT , KC_SLSH, _______, + KC_F7 , KC_F8 , KC_F9 , KC_F10 , KC_F11 , KC_F12 , _______, _______, KC_COMM, KC_DOT , KC_SLSH, _______, //`--------+--------+--------+--------+--------+--------/ \--------+--------+--------+--------+--------+--------' QK_BOOT , _______, _______, _______, _______, _______ // `+--------+--------+--------' `--------+--------+--------+' @@ -71,9 +71,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { //,--------+--------+--------+--------+--------+--------. ,--------+--------+--------+--------+--------+--------. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, //`--------+--------+--------+--------+--------+--------/ \--------+--------+--------+--------+--------+--------' _______, _______, _______, _______, _______, _______ // `+--------+--------+--------' `--------+--------+--------+' diff --git a/keyboards/dailycraft/wings42/rev2/keymaps/via/keymap.c b/keyboards/dailycraft/wings42/rev2/keymaps/via/keymap.c index 7349bf2411..b52b054881 100644 --- a/keyboards/dailycraft/wings42/rev2/keymaps/via/keymap.c +++ b/keyboards/dailycraft/wings42/rev2/keymaps/via/keymap.c @@ -35,9 +35,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { //,--------+--------+--------+--------+--------+--------. ,--------+---------+--------+---------+--------+--------. KC_ESC , KC_Q , KC_W , KC_E , KC_R , KC_T , KC_Y , KC_U , KC_I , KC_O , KC_P , KC_MINS, //|--------+--------+--------+--------+--------+--------| |--------+---------+--------+---------+--------+--------| - KC_G_TAB, KC_A , KC_S , KC_D , KC_F , KC_G , KC_BSPC, KC_BSPC, KC_H , KC_J , KC_K , KC_L , KC_SCLN, KC_G_BS, + KC_G_TAB, KC_A , KC_S , KC_D , KC_F , KC_G , KC_H , KC_J , KC_K , KC_L , KC_SCLN, KC_G_BS, //|--------+--------+--------+--------+--------+--------| |--------+---------+--------+---------+--------+--------| - KC_LCTL, KC_Z , KC_X , KC_C , KC_V , KC_B , KC_DEL , KC_DEL , KC_N , KC_M , KC_COMM, KC_DOT , KC_SLSH, KC_RCTL, + KC_LCTL, KC_Z , KC_X , KC_C , KC_V , KC_B , KC_N , KC_M , KC_COMM, KC_DOT , KC_SLSH, KC_RCTL, //`--------+--------+--------+--------+--------+--------/ \--------+---------+--------+---------+--------+--------' KC_A_DEL,KC_S_EN ,KC_L_SPC, KC_R_ENT, KC_S_JA , KC_A_DEL // `+--------+--------+--------' `--------+---------+--------+' @@ -47,9 +47,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { //,--------+--------+--------+--------+--------+--------. ,--------+--------+--------+--------+--------+--------. _______, KC_BSLS, KC_CIRC, KC_EXLM, KC_AMPR, KC_PIPE, KC_AT , KC_EQL , KC_PLUS, KC_ASTR, KC_PERC, KC_MINS, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - KC_LPRN, KC_HASH, KC_DLR , KC_DQT , KC_QUOT, KC_TILD, _______, _______, KC_LEFT, KC_DOWN, KC_UP , KC_RGHT, KC_GRV , KC_RPRN, + KC_LPRN, KC_HASH, KC_DLR , KC_DQT , KC_QUOT, KC_TILD, KC_LEFT, KC_DOWN, KC_UP , KC_RGHT, KC_GRV , KC_RPRN, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - _______, _______, _______, _______, KC_LCBR, KC_LBRC, _______, _______, KC_RBRC, KC_RCBR, _______, _______, _______, _______, + _______, _______, _______, _______, KC_LCBR, KC_LBRC, KC_RBRC, KC_RCBR, _______, _______, _______, _______, //`--------+--------+--------+--------+--------+--------/ \--------+--------+--------+--------+--------+--------' _______, _______, _______, _______, _______, QK_BOOT // `+--------+--------+--------' `--------+-------+--------+' @@ -59,9 +59,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { //,--------+--------+--------+--------+--------+--------. ,--------+--------+--------+--------+--------+--------. KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_F5 , KC_F6 , _______, KC_EQL , KC_PLUS, KC_ASTR, KC_PERC, KC_MINS, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - _______, KC_1 , KC_2 , KC_3 , KC_4 , KC_5 , _______, _______, KC_6 , KC_7 , KC_8 , KC_9 , KC_0 , _______, + _______, KC_1 , KC_2 , KC_3 , KC_4 , KC_5 , KC_6 , KC_7 , KC_8 , KC_9 , KC_0 , _______, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - KC_F7 , KC_F8 , KC_F9 , KC_F10 , KC_F11 , KC_F12 , _______, _______, _______, _______, KC_COMM, KC_DOT , KC_SLSH, _______, + KC_F7 , KC_F8 , KC_F9 , KC_F10 , KC_F11 , KC_F12 , _______, _______, KC_COMM, KC_DOT , KC_SLSH, _______, //`--------+--------+--------+--------+--------+--------/ \--------+--------+--------+--------+--------+--------' QK_BOOT , _______, _______, _______, _______, _______ // `+--------+--------+--------' `--------+--------+--------+' @@ -71,156 +71,20 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { //,--------+--------+--------+--------+--------+--------. ,--------+--------+--------+--------+--------+--------. _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, //`--------+--------+--------+--------+--------+--------/ \--------+--------+--------+--------+--------+--------' _______, _______, _______, _______, _______, _______ // `+--------+--------+--------' `--------+--------+--------+' ), }; -keyevent_t encoder1_ccw = { - .key = (keypos_t){.row = 4, .col = 0}, - .pressed = false, - .type = KEY_EVENT -}; - -keyevent_t encoder1_cw = { - .key = (keypos_t){.row = 4, .col = 1}, - .pressed = false, - .type = KEY_EVENT -}; - -keyevent_t encoder2_ccw = { - .key = (keypos_t){.row = 4, .col = 2}, - .pressed = false, - .type = KEY_EVENT -}; - -keyevent_t encoder2_cw = { - .key = (keypos_t){.row = 4, .col = 3}, - .pressed = false, - .type = KEY_EVENT -}; - -keyevent_t encoder3_ccw = { - .key = (keypos_t){.row = 9, .col = 1}, - .pressed = false, - .type = KEY_EVENT -}; - -keyevent_t encoder3_cw = { - .key = (keypos_t){.row = 9, .col = 0}, - .pressed = false, - .type = KEY_EVENT -}; - -keyevent_t encoder4_ccw = { - .key = (keypos_t){.row = 9, .col = 3}, - .pressed = false, - .type = KEY_EVENT +#ifdef ENCODER_MAP_ENABLE +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { + [0] = { ENCODER_CCW_CW(KC_BSPC, KC_DEL), ENCODER_CCW_CW(KC_BSPC, KC_DEL) }, + [1] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) }, + [2] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) }, + [3] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) } }; - -keyevent_t encoder4_cw = { - .key = (keypos_t){.row = 9, .col = 2}, - .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); - } - - if (encoder3_ccw.pressed) { - encoder3_ccw.pressed = false; - encoder3_ccw.time = timer_read(); - action_exec(encoder3_ccw); - } - - if (encoder3_cw.pressed) { - encoder3_cw.pressed = false; - encoder3_cw.time = timer_read(); - action_exec(encoder3_cw); - } - - if (encoder4_ccw.pressed) { - encoder4_ccw.pressed = false; - encoder4_ccw.time = timer_read(); - action_exec(encoder4_ccw); - } - - if (encoder4_cw.pressed) { - encoder4_cw.pressed = false; - encoder4_cw.time = timer_read(); - action_exec(encoder4_cw); - } -} - -bool encoder_update_user(uint8_t index, bool clockwise) { - if (index == 0) { - 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); - } - } else if (index == 2) { - if (clockwise) { - encoder3_cw.pressed = true; - encoder3_cw.time = timer_read(); - action_exec(encoder3_cw); - } else { - encoder3_ccw.pressed = true; - encoder3_ccw.time = timer_read(); - action_exec(encoder3_ccw); - } - } else if (index == 3) { - if (clockwise) { - encoder4_cw.pressed = true; - encoder4_cw.time = timer_read(); - action_exec(encoder4_cw); - } else { - encoder4_ccw.pressed = true; - encoder4_ccw.time = timer_read(); - action_exec(encoder4_ccw); - } - } - - return true; -} +#endif diff --git a/keyboards/dailycraft/wings42/rev2/keymaps/via/rules.mk b/keyboards/dailycraft/wings42/rev2/keymaps/via/rules.mk index eea5e1e2a2..f1adcab005 100644 --- a/keyboards/dailycraft/wings42/rev2/keymaps/via/rules.mk +++ b/keyboards/dailycraft/wings42/rev2/keymaps/via/rules.mk @@ -1,2 +1,2 @@ -ENCODER_ENABLE = yes VIA_ENABLE = yes +ENCODER_MAP_ENABLE = yes |