Remove encoder in-matrix workaround code (#20389)

This commit is contained in:
jack 2023-06-19 09:46:27 -06:00 committed by GitHub
parent 74fbd5a031
commit c4a67d3f33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
241 changed files with 1106 additions and 5235 deletions

View File

@ -16,9 +16,6 @@
#pragma once
#define ENCODERS_CCW_KEY { { 4, 5 } } // Note: array is { col, row )
#define ENCODERS_CW_KEY { { 3, 5 } } // Note: array is { col, row )
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE

View File

@ -16,54 +16,47 @@
#include QMK_KEYBOARD_H
#define LAYOUT_via( \
K000, K001, K002, K003, K004, K005, K006, K007, K008, K010, K011, K012, K013, K014, \
K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K113, K114, \
K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, K214, \
K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K312, K314, \
K400, K401, K402, K403, K404, K405, K406, K407, K408, K409, K410, K411, K413, K414, \
K500, K501, K502, K503, K504, K506, K510, K511, K512, K513, K514 \
) { \
{ K000, K001, K002, K003, K004, K005, K006, K007, K008, KC_NO, K010, K011, K012, K013, K014 }, \
{ K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K113, K114 }, \
{ K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, K214 }, \
{ K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K312, KC_NO, K314 }, \
{ K400, K401, K402, K403, K404, K405, K406, K407, K408, K409, K410, K411, KC_NO, K413, K414 }, \
{ K500, K501, K502, K503, K504, KC_NO, K506, KC_NO, KC_NO, KC_NO, K510, K511, K512, K513, K514 } \
}
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_via(
[0] = LAYOUT(
KC_ESC, 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_DEL,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_HOME,
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_BSLS, 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_ENT, KC_PGDN,
KC_LSFT, 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_END,
KC_LCTL, KC_LGUI, KC_LALT, KC_VOLU, KC_VOLD, KC_SPC, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT),
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT),
[1] = LAYOUT_via(
[1] = LAYOUT(
KC_SYSTEM_SLEEP, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, RGB_TOG,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_SPI,
_______, _______, _______, _______, QK_BOOT, _______, _______, _______, _______, _______, KC_PSCR, _______, _______, _______, RGB_VAI,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAD,
_______, _______, _______, KC_CALC, _______, _______, _______, KC_MUTE, _______, _______, _______, _______, RGB_HUI, RGB_SPD,
_______, _______, _______, RGB_MOD, RGB_RMOD, _______, _______, _______, RGB_SAD, RGB_HUD, RGB_SAI),
_______, _______, _______, _______, _______, _______, RGB_SAD, RGB_HUD, RGB_SAI),
[2] = LAYOUT_via(
[2] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
_______, _______, _______, _______, _______, _______, _______, _______, _______),
[3] = LAYOUT_via(
[3] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______)
_______, _______, _______, _______, _______, _______, _______, _______, _______)
};
#ifdef ENCODER_MAP_ENABLE
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
[0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[1] = { ENCODER_CCW_CW(RGB_RMOD, RGB_MOD) },
[2] = { ENCODER_CCW_CW(_______, _______) },
[3] = { ENCODER_CCW_CW(_______, _______) },
};
#endif

View File

@ -1,3 +1,2 @@
VIA_ENABLE = yes
SRC += encoder_actions.c
ENCODER_MAP_ENABLE = yes

View File

@ -1,63 +0,0 @@
/* Copyright 2020 Neil Brian Ramirez
* Copyright 2021 drashna jael're (@drashna)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "encoder_actions.h"
#if defined(VIA_ENABLE) && defined(ENCODER_ENABLE)
static uint8_t encoder_state[NUM_ENCODERS] = {0};
static keypos_t encoder_cw[NUM_ENCODERS] = ENCODERS_CW_KEY;
static keypos_t encoder_ccw[NUM_ENCODERS] = ENCODERS_CCW_KEY;
void encoder_action_unregister(void) {
for (int index = 0; index < NUM_ENCODERS; ++index) {
if (encoder_state[index]) {
keyevent_t encoder_event = (keyevent_t) {
.key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index],
.pressed = false,
.time = timer_read(),
.type = KEY_EVENT
};
encoder_state[index] = 0;
action_exec(encoder_event);
}
}
}
void encoder_action_register(uint8_t index, bool clockwise) {
keyevent_t encoder_event = (keyevent_t) {
.key = clockwise ? encoder_cw[index] : encoder_ccw[index],
.pressed = true,
.time = timer_read(),
.type = KEY_EVENT
};
encoder_state[index] = (clockwise ^ 1) | (clockwise << 1);
action_exec(encoder_event);
}
void matrix_scan_kb(void) {
encoder_action_unregister();
matrix_scan_user();
}
bool encoder_update_kb(uint8_t index, bool clockwise) {
encoder_action_register(index, clockwise);
// don't return user actions, because they are in the keymap
// encoder_update_user(index, clockwise);
return true;
};
#endif

View File

@ -1,23 +0,0 @@
/* Copyright 2020 Neil Brian Ramirez
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "quantum.h"
void encoder_action_unregister(void);
void encoder_action_register(uint8_t index, bool clockwise);

View File

@ -143,13 +143,9 @@
{"matrix": [5, 6], "x": 0.5, "y": 1.1},
{"matrix": [4, 7], "x": 0, "y": 0},
{"matrix": [4, 8], "x": 12.5, "y": 5.1, "w": 1.25},
{"matrix": [4, 9], "x": 13.75, "y": 5.1, "w": 1.25},
{"matrix": [4, 10], "x": 1, "y": 0},
{"matrix": [4, 11], "x": 15.5, "y": 5.1},
{"matrix": [4, 12], "x": 16.5, "y": 5.1},
{"matrix": [4, 13], "x": 17.5, "y": 5.1}

View File

@ -23,7 +23,7 @@ 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_BSLS, KC_PGUP,
KC_F1, KC_F2, 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_ENT, KC_PGDN,
KC_F3, KC_F4, KC_LSFT, 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_END,
KC_F5, KC_F6, KC_LCTL, KC_LWIN, KC_LALT, KC_SPACE, KC_NO, KC_VOLD, KC_RALT, KC_RCTL, KC_VOLU, KC_LEFT, KC_DOWN, KC_RGHT
KC_F5, KC_F6, KC_LCTL, KC_LWIN, KC_LALT, KC_SPACE, KC_NO, KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
),
[1] = LAYOUT(
@ -31,6 +31,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TRNS, KC_TRNS, KC_BSLS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_F7, KC_F8, KC_TRNS, BL_TOGG, BL_STEP, BL_BRTG, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_F9, KC_F10, KC_TRNS, RGB_TOG, RGB_MOD, RGB_RMOD, RGB_VAI, RGB_VAD, RGB_HUI, RGB_HUD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_F11, KC_F12, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
),
KC_F11, KC_F12, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
)
};

View File

@ -23,7 +23,7 @@ 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_BSLS, KC_PGUP,
KC_F1, KC_F2, 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_ENT, KC_PGDN,
KC_F3, KC_F4, KC_LSFT, 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_END,
KC_F5, KC_F6, KC_LCTL, KC_LWIN, KC_LALT, KC_SPACE, KC_NO, KC_VOLD, KC_RALT, KC_RCTL, KC_VOLU, KC_LEFT, KC_DOWN, KC_RGHT
KC_F5, KC_F6, KC_LCTL, KC_LWIN, KC_LALT, KC_SPACE, KC_NO, KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
),
[1] = LAYOUT(
@ -31,57 +31,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TRNS, KC_TRNS, KC_BSLS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_F7, KC_F8, KC_TRNS, BL_TOGG, BL_STEP, BL_BRTG, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_F9, KC_F10, KC_TRNS, RGB_TOG, RGB_MOD, RGB_RMOD, RGB_VAI, RGB_VAD, RGB_HUI, RGB_HUD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_F11, KC_F12, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
KC_F11, KC_F12, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
),
};
static bool custom_encoder_mode = false;
void set_custom_encoder_mode_user(bool custom_mode) {
custom_encoder_mode = custom_mode;
}
keyevent_t encoder_ccw = {
.key = (keypos_t){.row = 4, .col = 7},
.pressed = false,
.type = KEY_EVENT
#ifdef ENCODER_MAP_ENABLE
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
[0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[1] = { ENCODER_CCW_CW(_______, _______) },
};
keyevent_t encoder_cw = {
.key = (keypos_t){.row = 4, .col = 10},
.pressed = false,
.type = KEY_EVENT
};
bool encoder_update_user(uint8_t index, bool clockwise) {
if (custom_encoder_mode) {
if (clockwise) {
encoder_cw.pressed = true;
encoder_cw.time = timer_read();
action_exec(encoder_cw);
}
else {
encoder_ccw.pressed = true;
encoder_ccw.time = timer_read();
action_exec(encoder_ccw);
}
return false;
}
return true;
}
void matrix_scan_user(void) {
if (encoder_ccw.pressed) {
encoder_ccw.pressed = false;
encoder_ccw.time = timer_read();
action_exec(encoder_ccw);
}
if (encoder_cw.pressed) {
encoder_cw.pressed = false;
encoder_cw.time = timer_read();
action_exec(encoder_cw);
}
}
#endif

View File

@ -1 +1,2 @@
VIA_ENABLE = yes
ENCODER_MAP_ENABLE = yes

View File

@ -81,39 +81,6 @@
{"matrix": [4, 2], "x": 0, "y": 4, "w": 2},
{"matrix": [4, 3], "x": 2, "y": 4}
]
},
"LAYOUT_via_6x4": {
"layout": [
{"matrix": [5, 0], "x": 0, "y": 0},
{"matrix": [5, 1], "x": 1, "y": 0},
{"matrix": [5, 2], "x": 3, "y": 0},
{"matrix": [5, 3], "x": 4, "y": 0},
{"matrix": [0, 0], "x": 0.5, "y": 1.1},
{"matrix": [0, 1], "x": 1.5, "y": 1.1},
{"matrix": [0, 2], "x": 2.5, "y": 1.1},
{"matrix": [0, 3], "x": 3.5, "y": 1.1},
{"matrix": [1, 0], "x": 0.5, "y": 2.1},
{"matrix": [1, 1], "x": 1.5, "y": 2.1},
{"matrix": [1, 2], "x": 2.5, "y": 2.1},
{"matrix": [1, 3], "x": 3.5, "y": 2.1},
{"matrix": [2, 0], "x": 0.5, "y": 3.1},
{"matrix": [2, 1], "x": 1.5, "y": 3.1},
{"matrix": [2, 2], "x": 2.5, "y": 3.1},
{"matrix": [2, 3], "x": 3.5, "y": 3.1},
{"matrix": [3, 0], "x": 0.5, "y": 4.1},
{"matrix": [3, 1], "x": 1.5, "y": 4.1},
{"matrix": [3, 2], "x": 2.5, "y": 4.1},
{"matrix": [3, 3], "x": 3.5, "y": 4.1},
{"matrix": [4, 0], "x": 0.5, "y": 5.1},
{"matrix": [4, 1], "x": 1.5, "y": 5.1},
{"matrix": [4, 2], "x": 2.5, "y": 5.1},
{"matrix": [4, 3], "x": 3.5, "y": 5.1}
]
}
}
}

View File

@ -24,32 +24,28 @@
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_via_6x4(
KC_VOLD, KC_VOLU, KC_VOLD, KC_VOLU,
[0] = LAYOUT_ortho_5x4(
MO(1), KC_PSLS, KC_PAST, KC_PMNS,
KC_P7, KC_P8, KC_P9, KC_PGUP,
KC_P4, KC_P5, KC_P6, KC_PPLS,
KC_P1, KC_P2, KC_P3, KC_PGDN,
KC_P0, KC_SPC, KC_PDOT, KC_PENT),
[1] = LAYOUT_via_6x4(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
[1] = LAYOUT_ortho_5x4(
KC_TRNS, RGB_TOG, RGB_MOD, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
RGB_VAI, RGB_VAD, RGB_SPI, RGB_SPD,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
RGB_HUI, RGB_HUD, KC_TRNS, KC_TRNS),
[2] = LAYOUT_via_6x4(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
[2] = LAYOUT_ortho_5x4(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
[3] = LAYOUT_via_6x4(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
[3] = LAYOUT_ortho_5x4(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
@ -92,80 +88,11 @@ void keyboard_post_init_user(void) {
}
#endif
keyevent_t encoder_left_ccw = {
.key = (keypos_t){.row = 5, .col = 0},
.pressed = false,
.type = KEY_EVENT
#ifdef ENCODER_MAP_ENABLE
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
[0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[1] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) },
[2] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) },
[3] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) }
};
keyevent_t encoder_left_cw = {
.key = (keypos_t){.row = 5, .col = 1},
.pressed = false,
.type = KEY_EVENT
};
keyevent_t encoder_right_ccw = {
.key = (keypos_t){.row = 5, .col = 2},
.pressed = false,
.type = KEY_EVENT
};
keyevent_t encoder_right_cw = {
.key = (keypos_t){.row = 5, .col = 3},
.pressed = false,
.type = KEY_EVENT
};
void matrix_scan_user(void) {
if (encoder_left_ccw.pressed) {
encoder_left_ccw.pressed = false;
encoder_left_ccw.time = timer_read();
action_exec(encoder_left_ccw);
}
if (encoder_left_cw.pressed) {
encoder_left_cw.pressed = false;
encoder_left_cw.time = timer_read();
action_exec(encoder_left_cw);
}
if (encoder_right_ccw.pressed) {
encoder_right_ccw.pressed = false;
encoder_right_ccw.time = timer_read();
action_exec(encoder_right_ccw);
}
if (encoder_right_cw.pressed) {
encoder_right_cw.pressed = false;
encoder_right_cw.time = timer_read();
action_exec(encoder_right_cw);
}
}
bool encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) {
if (clockwise) {
encoder_left_cw.pressed = true;
encoder_left_cw.time = timer_read();
action_exec(encoder_left_cw);
} else {
encoder_left_ccw.pressed = true;
encoder_left_ccw.time = timer_read();
action_exec(encoder_left_ccw);
}
} else {
if (clockwise) {
encoder_right_cw.pressed = true;
encoder_right_cw.time = timer_read();
action_exec(encoder_right_cw);
} else {
encoder_right_ccw.pressed = true;
encoder_right_ccw.time = timer_read();
action_exec(encoder_right_ccw);
}
}
return false;
}
#endif

View File

@ -1,2 +1,3 @@
VIA_ENABLE = yes
LTO_ENABLE = yes
ENCODER_MAP_ENABLE = yes

View File

@ -18,17 +18,12 @@
"bootloader": "atmel-dfu",
"matrix_pins": {
"direct": [
["F4", "F7", "B3", "B6", "F5", "F6", "B1", "B2", "D4", "C6", "D7", "E6", null, null, null, null]
["F4", "F7", "B3", "B6", "F5", "F6", "B1", "B2", "D4", "C6", "D7", "E6"]
]
},
"layouts": {
"LAYOUT": {
"layout": [
{"x": 0, "y": 0, "matrix": [0, 12]},
{"x": 1, "y": 0, "matrix": [0, 13]},
{"x": 2, "y": 0, "matrix": [0, 14]},
{"x": 3, "y": 0, "matrix": [0, 15]},
{"x":0, "y":1.25, "matrix": [0, 8]},
{"x":1, "y":1.25, "matrix": [0, 9]},
{"x":2, "y":1.25, "matrix": [0, 10]},

View File

@ -25,25 +25,21 @@ enum layer_names {
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_BASE] = LAYOUT(
KC_NO, KC_NO, KC_NO, KC_NO, // for encoders
KC_NO, KC_NO, KC_NO, KC_NO, // for ext keys
MO(1), KC_BSPC, KC_SPC, KC_ENT,
KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
),
[_FN1] = LAYOUT(
KC_NO, KC_NO, KC_NO, KC_NO,
KC_NO, KC_NO, KC_NO, KC_NO,
KC_1, KC_2, KC_3, KC_4,
KC_5, KC_6, KC_7, KC_8
),
[_FN2] = LAYOUT(
KC_NO, KC_NO, KC_NO, KC_NO,
KC_NO, KC_NO, KC_NO, KC_NO,
KC_1, KC_2, KC_3, KC_4,
KC_5, KC_6, KC_7, KC_8
),
[_FN3] = LAYOUT(
KC_NO, KC_NO, KC_NO, KC_NO,
KC_NO, KC_NO, KC_NO, KC_NO,
KC_1, KC_2, KC_3, KC_4,
KC_5, KC_6, KC_7, KC_8
@ -64,5 +60,5 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
tap_code(KC_UP);
}
}
return true;
return false;
}

View File

@ -25,103 +25,32 @@ enum layer_names {
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_BASE] = LAYOUT(
KC_NO, KC_NO, KC_NO, KC_NO, // for encoders
KC_NO, KC_NO, KC_NO, KC_NO, // for ext keys
MO(1), KC_BSPC, KC_SPC, KC_ENT,
KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
),
[_FN1] = LAYOUT(
KC_NO, KC_NO, KC_NO, KC_NO,
KC_NO, KC_NO, KC_NO, KC_NO,
KC_1, KC_2, KC_3, KC_4,
KC_5, KC_6, KC_7, KC_8
),
[_FN2] = LAYOUT(
KC_NO, KC_NO, KC_NO, KC_NO,
KC_NO, KC_NO, KC_NO, KC_NO,
KC_1, KC_2, KC_3, KC_4,
KC_5, KC_6, KC_7, KC_8
),
[_FN3] = LAYOUT(
KC_NO, KC_NO, KC_NO, KC_NO,
KC_NO, KC_NO, KC_NO, KC_NO,
KC_1, KC_2, KC_3, KC_4,
KC_5, KC_6, KC_7, KC_8
)
};
keyevent_t encoder1_ccw = {
.key = (keypos_t){.row = 0, .col = 12},
.pressed = false,
.type = KEY_EVENT
#ifdef ENCODER_MAP_ENABLE
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
[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 = 13},
.pressed = false,
.type = KEY_EVENT
};
keyevent_t encoder2_ccw = {
.key = (keypos_t){.row = 0, .col = 14},
.pressed = false,
.type = KEY_EVENT
};
keyevent_t encoder2_cw = {
.key = (keypos_t){.row = 0, .col = 15},
.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

View File

@ -1 +1,2 @@
VIA_ENABLE = yes
ENCODER_MAP_ENABLE = yes

View File

@ -18,7 +18,7 @@
"bootloader": "atmel-dfu",
"matrix_pins": {
"direct": [
["D4", "C6", "D7", "E6", null, null, null, null]
["D4", "C6", "D7", "E6"]
]
},
"layouts": {
@ -27,12 +27,7 @@
{"x": 0, "y": 0, "matrix": [0, 0]},
{"x": 1, "y": 0, "matrix": [0, 1]},
{"x": 2, "y": 0, "matrix": [0, 2]},
{"x": 3, "y": 0, "matrix": [0, 3]},
{"label": "Encoder 1 CCW", "x": 0, "y": 1, "matrix": [0, 4]},
{"label": "Encoder 1 CW", "x": 1, "y": 1, "matrix": [0, 5]},
{"label": "Encoder 2 CCW", "x": 2, "y": 1, "matrix": [0, 6]},
{"label": "Encoder 2 CW", "x": 3, "y": 1, "matrix": [0, 7]}
{"x": 3, "y": 0, "matrix": [0, 3]}
]
}
}

View File

@ -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
)
};

View File

@ -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][2] = {
[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

View File

@ -1 +1,2 @@
VIA_ENABLE = yes
ENCODER_MAP_ENABLE = yes

View File

@ -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},

View File

@ -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] = {
//,--------+--------+--------+--------+--------+--------. ,--------+--------+--------+--------+--------+--------.
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
//`--------+--------+--------+--------+--------+--------/ \--------+--------+--------+--------+--------+--------'
_______, _______, _______, _______, _______, _______
// `+--------+--------+--------' `--------+--------+--------+'

View File

@ -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
#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 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
};
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

View File

@ -1,2 +1,2 @@
ENCODER_ENABLE = yes
VIA_ENABLE = yes
ENCODER_MAP_ENABLE = yes

View File

@ -86,64 +86,6 @@
{"matrix": [7, 5], "x": 14.75, "y": 3},
{"matrix": [7, 6], "x": 15.75, "y": 3}
]
},
"LAYOUT_rotary_layer": {
"layout": [
{"matrix": [0, 0], "x": 0, "y": 0},
{"matrix": [0, 1], "x": 1, "y": 0},
{"matrix": [0, 2], "x": 2, "y": 0},
{"matrix": [0, 3], "x": 3, "y": 0},
{"matrix": [0, 4], "x": 4, "y": 0},
{"matrix": [0, 5], "x": 5, "y": 0},
{"matrix": [0, 6], "x": 6, "y": 0},
{"matrix": [4, 0], "x": 7, "y": 0},
{"matrix": [4, 1], "x": 8, "y": 0},
{"matrix": [4, 2], "x": 9, "y": 0},
{"matrix": [4, 3], "x": 10, "y": 0},
{"matrix": [4, 4], "x": 11, "y": 0},
{"matrix": [4, 5], "x": 12, "y": 0},
{"matrix": [4, 6], "x": 13, "y": 0},
{"matrix": [1, 1], "x": 14, "y": 0},
{"matrix": [1, 2], "x": 15, "y": 0},
{"matrix": [1, 3], "x": 16, "y": 0},
{"matrix": [1, 4], "x": 17, "y": 0},
{"matrix": [1, 5], "x": 18, "y": 0},
{"matrix": [1, 6], "x": 19, "y": 0},
{"matrix": [1, 0], "x": 20, "y": 0},
{"matrix": [5, 0], "x": 21, "y": 0},
{"matrix": [5, 1], "x": 22, "y": 0},
{"matrix": [5, 2], "x": 23, "y": 0},
{"matrix": [5, 3], "x": 24, "y": 0},
{"matrix": [5, 4], "x": 25, "y": 0},
{"matrix": [5, 5], "x": 26, "y": 0},
{"matrix": [5, 6], "x": 27, "y": 0},
{"matrix": [2, 1], "x": 28, "y": 0},
{"matrix": [2, 2], "x": 29, "y": 0},
{"matrix": [2, 3], "x": 30, "y": 0},
{"matrix": [2, 4], "x": 31, "y": 0},
{"matrix": [2, 5], "x": 32, "y": 0},
{"matrix": [2, 6], "x": 33, "y": 0},
{"matrix": [2, 0], "x": 34, "y": 0},
{"matrix": [6, 0], "x": 35, "y": 0},
{"matrix": [6, 1], "x": 36, "y": 0},
{"matrix": [6, 2], "x": 37, "y": 0},
{"matrix": [6, 3], "x": 38, "y": 0},
{"matrix": [6, 4], "x": 39, "y": 0},
{"matrix": [6, 5], "x": 40, "y": 0},
{"matrix": [6, 6], "x": 41, "y": 0},
{"matrix": [3, 1], "x": 42, "y": 0},
{"matrix": [3, 2], "x": 43, "y": 0},
{"matrix": [3, 4], "x": 44, "y": 0},
{"matrix": [3, 5], "x": 45, "y": 0},
{"matrix": [3, 6], "x": 46, "y": 0},
{"matrix": [3, 0], "x": 47, "y": 0},
{"matrix": [7, 0], "x": 48, "y": 0},
{"matrix": [7, 1], "x": 49, "y": 0},
{"matrix": [7, 2], "x": 50, "y": 0},
{"matrix": [7, 4], "x": 51, "y": 0},
{"matrix": [7, 5], "x": 52, "y": 0},
{"matrix": [7, 6], "x": 53, "y": 0}
]
}
}
}

View File

@ -1,22 +0,0 @@
/* Copyright 2021 Salicylic_acid3
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
/* Select hand configuration */
#define QUICK_TAP_TERM 0
#define TAPPING_TERM 180

View File

@ -1,117 +0,0 @@
/*
Copyright 2021 Salicylic_Acid
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
#include "keymap_japanese.h"
// Each layer gets a name for readability, which is then used in the keymap matrix below.
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
// Layer names don't all need to be of the same length, obviously, and you can also skip them
// entirely and just use numbers.
enum layer_number {
_QWERTY = 0,
_LOWER,
_RAISE,
_ADJUST,
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_QWERTY] = LAYOUT_rotary_layer(
//,--------------------------------------------------------------| |--------------------------------------------------------------.
KC_ESC, 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_BSPC,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_VOLU, KC_H, KC_J, KC_K, KC_L, JP_MINS, JP_BSLS, KC_ENT,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_MUTE, KC_N, KC_M, KC_COMM, KC_DOT, JP_SLSH, KC_UP, KC_RSFT,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
JP_ZKHK, KC_LALT,LGUI_T(JP_MHEN),LT(_LOWER,KC_ENT),KC_BSPC, KC_VOLD, KC_DEL,LT(_RAISE,KC_SPC),ALT_T(JP_HENK),KC_LEFT, KC_DOWN, KC_RGHT
//|--------------------------------------------------------------| |--------------------------------------------------------------'
),
[_LOWER] = LAYOUT_rotary_layer(
//,--------------------------------------------------------------| |--------------------------------------------------------------.
_______, _______, JP_EXLM, JP_QUES, JP_LBRC, JP_RBRC, JP_TILD, KC_6, KC_7, KC_8, KC_9, JP_ASTR, JP_SLSH, KC_BSPC,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
JP_QUOT, JP_HASH, JP_DQT, JP_LPRN, JP_RPRN, JP_AT, KC_WH_U, XXXXXXX, KC_4, KC_5, KC_6, JP_MINS, JP_EQL, _______,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
JP_CIRC, JP_PERC, JP_AMPR, JP_SCLN, JP_COLN, JP_PIPE, KC_BTN3, KC_0, KC_1, KC_2, KC_3, JP_PLUS, _______, _______,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
_______, _______, JP_MHEN, MO(_LOWER), _______, KC_WH_D, _______, MO(_RAISE), JP_DOT, _______, _______, _______
//|--------------------------------------------------------------| |--------------------------------------------------------------'
),
[_RAISE] = LAYOUT_rotary_layer(
//,--------------------------------------------------------------| |--------------------------------------------------------------.
_______, _______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, XXXXXXX, KC_UP, XXXXXXX, KC_PGUP,LALT(KC_PSCR),KC_PSCR,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
LCTL_T(KC_F11), KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_WH_L, XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, XXXXXXX, XXXXXXX, _______,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
KC_LSFT, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_PGDN, _______, _______,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
_______, _______, _______, _______, _______, KC_WH_R, _______, _______, JP_HENK, _______, _______, _______
//|--------------------------------------------------------------| |--------------------------------------------------------------'
),
[_ADJUST] = LAYOUT_rotary_layer(
//,--------------------------------------------------------------| |--------------------------------------------------------------.
QK_BOOT, KC_TAB, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,LALT(KC_PSCR),KC_PSCR,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
KC_LCTL, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RGB_MOD, RGB_TOG, RGB_MOD, RGB_SAD, RGB_SAI, XXXXXXX, XXXXXXX, _______,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
SFT_T(KC_F12), XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RGB_TOG, RGB_VAD, RGB_VAI, RGB_HUD, RGB_HUI, XXXXXXX, _______, _______,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
_______, _______, _______, _______, _______,RGB_RMOD, _______, _______, _______, _______, _______, _______
//|--------------------------------------------------------------| |--------------------------------------------------------------'
)
};
//A description for expressing the layer position in LED mode.
layer_state_t layer_state_set_user(layer_state_t state) {
state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST);
#ifdef RGBLIGHT_ENABLE
switch (get_highest_layer(state)) {
case _LOWER:
rgblight_sethsv_at(HSV_BLUE, 0);
break;
case _RAISE:
rgblight_sethsv_at(HSV_RED, 0);
break;
case _ADJUST:
rgblight_sethsv_at(HSV_PURPLE, 0);
break;
default: // for any other layers, or the default layer
rgblight_sethsv_at( 0, 0, 0, 0);
break;
}
rgblight_set_effect_range( 1, 14);
#endif
return state;
}
bool encoder_update_user(uint8_t index, bool clockwise) {
keypos_t key;
if (clockwise) {
key.row = 3;
key.col = 0;
} else {
key.row = 1;
key.col = 0;
}
action_exec(MAKE_KEYEVENT(key.row, key.col, true));
action_exec(MAKE_KEYEVENT(key.row, key.col, false));
return true;
}

View File

@ -18,48 +18,48 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include QMK_KEYBOARD_H
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_rotary_layer(
[0] = LAYOUT(
//,--------------------------------------------------------------| |--------------------------------------------------------------.
KC_ESC, 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_BSPC,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
LT(1,KC_CAPS), KC_A, KC_S, KC_D, KC_F, KC_G, KC_VOLU, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT,
LT(1,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_ENT,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_MUTE, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_UP, KC_RSFT,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_VOLD, KC_SPC, KC_SPC, KC_LALT, KC_LEFT, KC_DOWN, KC_RGHT
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_SPC, KC_LALT, KC_LEFT, KC_DOWN, KC_RGHT
//|--------------------------------------------------------------| |--------------------------------------------------------------'
),
[1] = LAYOUT_rotary_layer(
[1] = LAYOUT(
//,--------------------------------------------------------------| |--------------------------------------------------------------.
_______, QK_BOOT, 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_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, _______, _______,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
//|--------------------------------------------------------------| |--------------------------------------------------------------'
),
[2] = LAYOUT_rotary_layer(
[2] = LAYOUT(
//,--------------------------------------------------------------| |--------------------------------------------------------------.
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
//|--------------------------------------------------------------| |--------------------------------------------------------------'
),
[3] = LAYOUT_rotary_layer(
[3] = LAYOUT(
//,--------------------------------------------------------------| |--------------------------------------------------------------.
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
//|--------------------------------------------------------------| |--------------------------------------------------------------'
)
};
@ -87,16 +87,11 @@ layer_state_t layer_state_set_user(layer_state_t state) {
return state;
}
bool encoder_update_user(uint8_t index, bool clockwise) {
keypos_t key;
if (clockwise) {
key.row = 3;
key.col = 0;
} else {
key.row = 1;
key.col = 0;
}
action_exec(MAKE_KEYEVENT(key.row, key.col, true));
action_exec(MAKE_KEYEVENT(key.row, key.col, false));
return true;
}
#ifdef ENCODER_MAP_ENABLE
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
[0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[1] = { ENCODER_CCW_CW(_______, _______) },
[2] = { ENCODER_CCW_CW(_______, _______) },
[3] = { ENCODER_CCW_CW(_______, _______) },
};
#endif

View File

@ -1 +1,2 @@
VIA_ENABLE = yes
ENCODER_MAP_ENABLE = yes

View File

@ -107,13 +107,7 @@
{"label": "k93", "matrix": [9, 3], "x": 11, "y": 4, "w": 1.25},
{"label": "k47", "matrix": [4, 7], "x": 12.25, "y": 4, "w": 1.25},
{"label": "k91", "matrix": [9, 1], "x": 13.5, "y": 4},
{"label": "k41", "matrix": [4, 1], "x": 14.5, "y": 4},
{"label": "k85", "matrix": [8, 5], "x": 0, "y": 5},
{"label": "k86", "matrix": [8, 6], "x": 1, "y": 5},
{"label": "k95", "matrix": [9, 5], "x": 14, "y": 5},
{"label": "k96", "matrix": [9, 6], "x": 15, "y": 5}
{"label": "k41", "matrix": [4, 1], "x": 14.5, "y": 4}
]
}
}

View File

@ -34,31 +34,27 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_LBRC, KC_RBRC, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_SCLN, KC_QUOT, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT,
KC_LSFT, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_LEFT, KC_RGHT, KC_N, KC_M, KC_COMM, KC_DOT, KC_UP, KC_SLSH,
KC_MUTE, KC_LNG2, KC_LGUI, KC_LALT, SP_LOW, SP_RAI, KC_BSPC, SP_RAI,KC_RALT, KC_RALT, KC_LEFT, KC_DOWN, KC_RGHT,
KC_VOLD, KC_VOLU, KC_VOLD, KC_VOLU
KC_MUTE, KC_LNG2, KC_LGUI, KC_LALT, SP_LOW, SP_RAI, KC_BSPC, SP_RAI,KC_RALT, KC_RALT, KC_LEFT, KC_DOWN, KC_RGHT
),
[_LOWER] = LAYOUT(
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, _______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,
KC_ESC, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, _______, _______, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_INS,
_______, _______, _______, _______, _______, _______, _______, _______, KC_GRV, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS,
_______, _______, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, _______, KC_TILD, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE,
_______, _______, _______, _______, _______, _______, _______, SP_ADJ,_______, _______, _______, _______, _______,
_______, _______, _______, _______
_______, _______, _______, _______, _______, _______, _______, SP_ADJ,_______, _______, _______, _______, _______
),
[_RAISE] = LAYOUT(
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, _______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, _______, _______, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL,
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_SCLN, KC_QUOT,
_______, _______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END, KC_F11, KC_F12,
_______, _______, _______, _______, SP_ADJ, _______, _______, _______,_______, _______, _______, KC_DOWN, KC_UP,
_______, _______, _______, _______
_______, _______, _______, _______, SP_ADJ, _______, _______, _______,_______, _______, _______, KC_DOWN, KC_UP
),
[_ADJUST] = LAYOUT(
_______, RGB_HUI, RGB_SAI, RGB_VAI, _______, _______, _______, _______, _______, _______, _______, _______, KC_PSCR, KC_SCRL, KC_PAUS,
_______, _______, _______, _______, _______, _______, _______, _______, RGB_HUI, RGB_SAI, RGB_VAI, _______, RGB_RMOD, _______,
_______, AU_TOGG, CK_TOGG, MU_TOGG, MU_NEXT, _______, _______, _______, RGB_HUD, RGB_SAD, RGB_VAD, RGB_TOG, RGB_MOD, _______,
KC_CAPS, KC_CAPS, CK_RST, CK_DOWN, CK_UP, AU_PREV, AU_NEXT, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______,_______, _______, _______, _______, _______,
_______, _______, _______, _______
_______, _______, _______, _______, _______, _______, _______, _______,_______, _______, _______, _______, _______
)
};

View File

@ -1,31 +0,0 @@
/*
Copyright 2021 Takeshi Nishio
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
//------------------------------------------------------------------------------
// Rotary Encoder
//------------------------------------------------------------------------------
// Encoder triggers specific key matrix position,
// when turn knob clockwise or counterclockwise.
// This is handy to assign key codes by VIA.
// Mappings of encoder rotation to key position in key matrix.
// First encoder, Left side : k85, k86
// Second encoder, Right side : k95, k96
#define ENCODERS_CW_KEY { { 6, 8 }, { 6, 9 } }
#define ENCODERS_CCW_KEY { { 5, 8 }, { 5, 9 } }

View File

@ -37,48 +37,42 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TAB, JP_Q, JP_W, JP_E, JP_R, JP_T, JP_AT, JP_LBRC, JP_Y, JP_U, JP_I, JP_O, JP_P, KC_BSPC,
KC_LCTL, JP_A, JP_S, JP_D, JP_F, JP_G, JP_COLN, JP_RBRC, JP_H, JP_J, JP_K, JP_L, JP_SCLN, KC_ENT,
KC_LSFT, KC_LSFT, JP_Z, JP_X, JP_C, JP_V, JP_B, JP_SLSH, JP_BSLS, JP_N, JP_M, JP_COMM, JP_DOT, KC_DOWN, KC_UP,
KC_MUTE, KC_LGUI, KC_LALT, JP_MHEN, SP_LOW, SP_RAI, KC_BSPC, SP_RAI,SP_RAI, JP_HENK, JP_KANA, KC_LEFT, KC_RGHT,
KC_VOLD, KC_VOLU, KC_VOLD, KC_VOLU
KC_MUTE, KC_LGUI, KC_LALT, JP_MHEN, SP_LOW, SP_RAI, KC_BSPC, SP_RAI,SP_RAI, JP_HENK, JP_KANA, KC_LEFT, KC_RGHT
),
[_BASE2] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PSLS, KC_PAST, KC_PMNS, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P7, KC_P8, KC_P9, KC_PPLS, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6, KC_PPLS, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P1, KC_P2, KC_P3, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______,_______, KC_P0, KC_PDOT, _______, _______,
_______, _______, _______, _______
_______, _______, _______, _______, _______, _______, _______, _______,_______, KC_P0, KC_PDOT, _______, _______
),
[_BASE3] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______,_______, _______, _______, _______, _______,
_______, _______, _______, _______
_______, _______, _______, _______, _______, _______, _______, _______,_______, _______, _______, _______, _______
),
[_LOWER] = LAYOUT(
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, _______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,
_______, JP_EXLM, JP_DQUO, JP_HASH, JP_DLR, JP_PERC, JP_TILD, JP_PIPE, JP_AMPR, JP_QUOT, JP_LPRN, JP_RPRN, JP_EQL, KC_INS,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, SP_ADJ, _______, SP_ADJ,SP_ADJ, _______, _______, _______, _______,
_______, _______, _______, _______
_______, _______, _______, _______, _______, SP_ADJ, _______, SP_ADJ,SP_ADJ, _______, _______, _______, _______
),
[_RAISE] = LAYOUT(
KC_GRV, 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_ESC, JP_1, JP_2, JP_3, JP_4, JP_5, JP_CIRC, JP_YEN, JP_6, JP_7, JP_8, JP_9, JP_0, KC_DEL,
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, _______,
_______, _______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_HOME, KC_PGDN, KC_PGUP, KC_END, _______, _______,
_______, _______, _______, _______, SP_ADJ, _______, _______, _______,_______, _______, _______, KC_DOWN, KC_UP,
_______, _______, _______, _______
_______, _______, _______, _______, SP_ADJ, _______, _______, _______,_______, _______, _______, KC_DOWN, KC_UP
),
[_ADJUST] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PSCR, KC_SCRL, KC_PAUS,
_______, DF(_BASE1),DF(_BASE2),DF(_BASE3),_______, _______, _______, _______, RGB_HUI, RGB_SAI, RGB_VAI, _______, RGB_RMOD, _______,
_______, AU_TOGG, CK_TOGG, MU_TOGG, MU_NEXT, _______, _______, _______, RGB_HUD, RGB_SAD, RGB_VAD, RGB_TOG, RGB_MOD, _______,
KC_CAPS, KC_CAPS, CK_RST, CK_DOWN, CK_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______,_______, _______, _______, _______, _______,
_______, _______, _______, _______
_______, _______, _______, _______, _______, _______, _______, _______,_______, _______, _______, _______, _______
),
};
@ -164,50 +158,16 @@ bool led_update_user(led_t led_state) {
}
#endif
//------------------------------------------------------------------------------
// Rotary Encoder
//------------------------------------------------------------------------------
static uint8_t encoder_state[NUM_ENCODERS] = {0};
static keypos_t encoder_cw[NUM_ENCODERS] = ENCODERS_CW_KEY;
static keypos_t encoder_ccw[NUM_ENCODERS] = ENCODERS_CCW_KEY;
void encoder_action_unregister(void) {
for (int index = 0; index < NUM_ENCODERS; ++index) {
if (encoder_state[index]) {
keyevent_t encoder_event = (keyevent_t) {
.key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index],
.pressed = false,
.time = timer_read(),
.type = KEY_EVENT
#ifdef ENCODER_MAP_ENABLE
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
[0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[1] = { ENCODER_CCW_CW(_______, _______) },
[2] = { ENCODER_CCW_CW(_______, _______) },
[3] = { ENCODER_CCW_CW(_______, _______) },
[4] = { ENCODER_CCW_CW(_______, _______) },
[5] = { ENCODER_CCW_CW(_______, _______) },
};
encoder_state[index] = 0;
action_exec(encoder_event);
}
}
}
void encoder_action_register(uint8_t index, bool clockwise) {
keyevent_t encoder_event = (keyevent_t) {
.key = clockwise ? encoder_cw[index] : encoder_ccw[index],
.pressed = true,
.time = timer_read(),
.type = KEY_EVENT
};
encoder_state[index] = (clockwise ^ 1) | (clockwise << 1);
action_exec(encoder_event);
}
void matrix_scan_kb(void) {
encoder_action_unregister();
matrix_scan_user();
}
bool encoder_update_user(uint8_t index, bool clockwise) {
encoder_action_register(index, clockwise);
return true;
};
#endif
//------------------------------------------------------------------------------
// Keyboard Initialization

View File

@ -1,2 +1,2 @@
# Use VIA
VIA_ENABLE = yes
ENCODER_MAP_ENABLE = yes

View File

@ -36,7 +36,4 @@
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE
#define ENCODERS_CW_KEY { { 0, 0 },{ 2, 0 } }
#define ENCODERS_CCW_KEY { { 6, 0 },{ 8, 0 } }
#define DYNAMIC_KEYMAP_LAYER_COUNT 3

View File

@ -53,13 +53,9 @@
{"matrix": [1, 7], "x": 14, "y": 0.5},
{"matrix": [5, 7], "x": 15.5, "y": 0.5},
{"matrix": [0, 0], "x": 16.9, "y": 0, "w": 0.6, "h": 0.5},
{"matrix": [4, 8], "x": 17, "y": 0.5},
{"matrix": [2, 0], "x": 17.5, "y": 0, "w": 0.6, "h": 0.5},
{"matrix": [6, 0], "x": 18.4, "y": 0, "w": 0.6, "h": 0.5},
{"matrix": [4, 0], "x": 18.5, "y": 0.5},
{"matrix": [8, 0], "x": 19, "y": 0, "w": 0.6, "h": 0.5},
{"matrix": [3, 0], "x": 0, "y": 1.75},
{"matrix": [2, 1], "x": 1, "y": 1.75},

View File

@ -1,57 +0,0 @@
/* Copyright 2021 KDon<370490639@qq.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "quantum.h"
static uint8_t encoder_state[NUM_ENCODERS] = {0};
static keypos_t encoder_cw[NUM_ENCODERS] = ENCODERS_CW_KEY;
static keypos_t encoder_ccw[NUM_ENCODERS] = ENCODERS_CCW_KEY;
void encoder_action_unregister(void) {
for (int index = 0; index < NUM_ENCODERS; ++index) {
if (encoder_state[index]) {
keyevent_t encoder_event = (keyevent_t) {
.key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index],
.pressed = false,
.time = timer_read(),
.type = KEY_EVENT
};
encoder_state[index] = 0;
action_exec(encoder_event);
}
}
}
void encoder_action_register(uint8_t index, bool clockwise) {
keyevent_t encoder_event = (keyevent_t) {
.key = clockwise ? encoder_cw[index] : encoder_ccw[index],
.pressed = true,
.time = timer_read(),
.type = KEY_EVENT
};
encoder_state[index] = (clockwise ^ 1) | (clockwise << 1);
action_exec(encoder_event);
}
void matrix_scan_kb(void) {
encoder_action_unregister();
matrix_scan_user();
}
bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!encoder_update_user(index, clockwise)) { return false; }
encoder_action_register(index, clockwise);
return true;
};

View File

@ -45,7 +45,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/
[_BASE] = LAYOUT(
KC_ESC, 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_DEL, KC_HOME, KC_INS, KC_END, KC_PGUP, KC_MUTE, KC_PGDN,
KC_ESC, 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_DEL, KC_INS, KC_MUTE,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS,
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_BSLS, KC_P7, KC_P8, KC_P9,
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_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS,
@ -53,19 +53,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_LCTL, KC_LGUI, KC_LALT, MO(1), KC_SPC, KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT),
[_FN] = LAYOUT(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_VAI, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_TOG, RGB_MOD, RGB_HUI, RGB_VAD, RGB_HUD, KC_TRNS, KC_TRNS, KC_TRNS),
[_FN1] = LAYOUT(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS)
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_TOG, RGB_MOD, RGB_HUI, RGB_VAD, RGB_HUD, KC_TRNS, KC_TRNS, KC_TRNS)
};
#ifdef ENCODER_MAP_ENABLE
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
[0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[1] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) },
};
#endif

View File

@ -0,0 +1 @@
ENCODER_MAP_ENABLE = yes

View File

@ -45,7 +45,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/
[_BASE] = LAYOUT(
KC_ESC, 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_DEL, KC_HOME, KC_INS, KC_END, KC_PGUP, KC_MUTE, KC_PGDN,
KC_ESC, 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_DEL, KC_INS, KC_MUTE,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS,
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_BSLS, KC_P7, KC_P8, KC_P9,
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_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS,
@ -53,7 +53,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_LCTL, KC_LGUI, KC_LALT, MO(1), KC_SPC, KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT),
[_FN] = LAYOUT(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
@ -61,7 +61,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_TOG, RGB_MOD, RGB_HUI, RGB_VAD, RGB_HUD, KC_TRNS, KC_TRNS, KC_TRNS),
[_FN1] = LAYOUT(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
@ -69,3 +69,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS)
};
#ifdef ENCODER_MAP_ENABLE
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
[0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[1] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) },
[2] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) },
};
#endif

View File

@ -1 +1,2 @@
VIA_ENABLE = yes
ENCODER_MAP_ENABLE = yes

View File

@ -8,9 +8,7 @@
# define STARTUP_SONG SONG(STARTUP_SOUND)
#endif
#define ENCODERS_CW_KEY { { 1, 1 }, { 3, 1 } }
#define ENCODERS_CCW_KEY { { 0, 1 }, { 2, 1 } }
# define RGBLED_NUM 16
# define RGBLIGHT_HUE_STEP 8
# define RGBLIGHT_SAT_STEP 8
# define RGBLIGHT_VAL_STEP 8

View File

@ -25,8 +25,7 @@
"bootloader": "atmel-dfu",
"matrix_pins": {
"direct": [
["E6", "B6", "D6", null],
[null, null, null, null]
["E6", "B6", "D6"]
]
},
"layouts": {
@ -34,12 +33,7 @@
"layout": [
{"x": 1.5, "y": 0, "h": 2, "w": 2, "matrix": [0, 0]},
{"x": 0.5, "y": 2.25, "matrix": [0, 1]},
{"x": 3.5, "y": 2.25, "matrix": [0, 2]},
{"x": 0, "y": 3.5, "matrix": [1, 0]},
{"x": 1, "y": 3.5, "matrix": [1, 1]},
{"x": 3, "y": 3.5, "matrix": [1, 2]},
{"x": 4, "y": 3.5, "matrix": [1, 3]}
{"x": 3.5, "y": 2.25, "matrix": [0, 2]}
]
}
}

View File

@ -13,27 +13,28 @@ enum layer_names {
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_MAIN] = LAYOUT(
KC_A, // Big Switch
MO(1), KC_MUTE, // Encoder presses
KC_DOWN, KC_UP, // Left encoder turns
KC_VOLD, KC_VOLU // Right encoder turns
RGB_MOD, // Big Switch
TL_LOWR, KC_MUTE // Encoder presses
),
[_FN1] = LAYOUT(
KC_B, // Big Switch
_______, KC_C, // Encoder presses
KC_PGDN, KC_PGUP, // Left encoder turns
KC_VOLU, KC_VOLD // Right encoder turns
_______, KC_C // Encoder presses
),
[_FN2] = LAYOUT(
_______, // Big Switch
_______, _______, // Encoder presses
_______, _______, // Left encoder turns
_______, _______ // Right encoder turns
_______, _______ // Encoder presses
),
[_FN3] = LAYOUT(
_______, // Big Switch
_______, _______, // Encoder presses
_______, _______, // Left encoder turns
_______, _______ // Right encoder turns
_______, _______ // Encoder presses
)
};
#ifdef ENCODER_MAP_ENABLE
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
[0] = { ENCODER_CCW_CW(KC_DOWN, KC_UP), ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[1] = { ENCODER_CCW_CW(KC_PGDN, KC_PGUP), ENCODER_CCW_CW(_______, _______) },
[2] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) },
[3] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) }
};
#endif

View File

@ -0,0 +1 @@
ENCODER_MAP_ENABLE = yes

View File

@ -14,26 +14,27 @@ enum layer_names {
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_MAIN] = LAYOUT(
RGB_MOD, // Big Switch
TL_LOWR, KC_MUTE, // Encoder presses
KC_DOWN, KC_UP, // Left encoder turns
KC_VOLD, KC_VOLU // Right encoder turns
TL_LOWR, KC_MUTE // Encoder presses
),
[_FN1] = LAYOUT(
KC_B, // Big Switch
_______, KC_C, // Encoder presses
KC_PGDN, KC_PGUP, // Left encoder turns
KC_VOLU, KC_VOLD // Right encoder turns
_______, KC_C // Encoder presses
),
[_FN2] = LAYOUT(
_______, // Big Switch
_______, _______, // Encoder presses
_______, _______, // Left encoder turns
_______, _______ // Right encoder turns
_______, _______ // Encoder presses
),
[_FN3] = LAYOUT(
_______, // Big Switch
_______, _______, // Encoder presses
_______, _______, // Left encoder turns
_______, _______ // Right encoder turns
_______, _______ // Encoder presses
)
};
#ifdef ENCODER_MAP_ENABLE
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
[0] = { ENCODER_CCW_CW(KC_DOWN, KC_UP), ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[1] = { ENCODER_CCW_CW(KC_PGDN, KC_PGUP), ENCODER_CCW_CW(_______, _______) },
[2] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) },
[3] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) }
};
#endif

View File

@ -1,2 +1,3 @@
VIA_ENABLE = yes
LTO_ENABLE = yes
ENCODER_MAP_ENABLE = yes

View File

@ -12,5 +12,3 @@ RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
AUDIO_ENABLE = yes # Audio output
ENCODER_ENABLE = yes
LTO_ENABLE = yes
SRC += encoder_actions.c

View File

@ -1,63 +0,0 @@
/* Copyright 2020 Neil Brian Ramirez
* Copyright 2021 drashna jael're (@drashna)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "encoder_actions.h"
#if defined(ENCODER_ENABLE)
static uint8_t encoder_state[NUM_ENCODERS] = {0};
static keypos_t encoder_cw[NUM_ENCODERS] = ENCODERS_CW_KEY;
static keypos_t encoder_ccw[NUM_ENCODERS] = ENCODERS_CCW_KEY;
void encoder_action_unregister(void) {
for (int index = 0; index < NUM_ENCODERS; ++index) {
if (encoder_state[index]) {
keyevent_t encoder_event = (keyevent_t) {
.key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index],
.pressed = false,
.time = timer_read(),
.type = KEY_EVENT
};
encoder_state[index] = 0;
action_exec(encoder_event);
}
}
}
void encoder_action_register(uint8_t index, bool clockwise) {
keyevent_t encoder_event = (keyevent_t) {
.key = clockwise ? encoder_cw[index] : encoder_ccw[index],
.pressed = true,
.time = timer_read(),
.type = KEY_EVENT
};
encoder_state[index] = (clockwise ^ 1) | (clockwise << 1);
action_exec(encoder_event);
}
void matrix_scan_kb(void) {
encoder_action_unregister();
matrix_scan_user();
}
bool encoder_update_kb(uint8_t index, bool clockwise) {
encoder_action_register(index, clockwise);
// don't return user actions, because they are in the keymap
// encoder_update_user(index, clockwise);
return true;
};
#endif

View File

@ -1,23 +0,0 @@
/* Copyright 2020 Neil Brian Ramirez
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "quantum.h"
void encoder_action_unregister(void);
void encoder_action_register(uint8_t index, bool clockwise);

View File

@ -43,9 +43,7 @@
{"matrix": [0, 12], "x": 12, "y": 0},
{"matrix": [0, 13], "x": 13, "y": 0},
{"matrix": [2, 13], "x": 14, "y": 0},
{"matrix": [4, 3], "x": 15, "y": 0, "w": 0.5},
{"matrix": [0, 14], "x": 15.5, "y": 0},
{"matrix": [4, 5], "x": 16.5, "y": 0, "w": 0.5},
{"matrix": [1, 0], "x": 0, "y": 1, "w": 1.5},
{"matrix": [1, 1], "x": 1.5, "y": 1},

View File

@ -18,14 +18,14 @@
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_all(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_BSPC, KC_VOLD, KC_MUTE, KC_VOLU,
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_BSPC, KC_MUTE,
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_BSLS, KC_DEL,
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_ENT, KC_PGUP,
KC_LSFT, KC_LSFT, 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_END,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT
),
[1] = LAYOUT_all(
KC_GRV, 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_MPRV, KC_MPLY, KC_MNXT,
KC_GRV, 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_MPLY,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, QK_BOOT,

View File

@ -18,31 +18,40 @@
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_all(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_BSPC, KC_VOLD, KC_MUTE, KC_VOLU,
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_BSPC, KC_MUTE,
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_BSLS, KC_DEL,
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_ENT, KC_PGUP,
KC_LSFT, KC_LSFT, 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_END,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT
),
[1] = LAYOUT_all(
KC_GRV, 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_MPRV, KC_MPLY, KC_MNXT,
KC_GRV, 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_MPLY,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, QK_BOOT,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
[2] = LAYOUT_all(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
[3] = LAYOUT_all(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
};
#ifdef ENCODER_MAP_ENABLE
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
[0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[1] = { ENCODER_CCW_CW(KC_MPRV, KC_MNXT) },
[2] = { ENCODER_CCW_CW(_______, _______) },
[3] = { ENCODER_CCW_CW(_______, _______) },
};
#endif

View File

@ -1,2 +1,3 @@
VIA_ENABLE = yes
LTO_ENABLE = yes
ENCODER_MAP_ENABLE = yes

View File

@ -1,64 +0,0 @@
/* Copyright 2021 meletrix
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "quantum.h"
#ifdef VIA_ENABLE
static uint8_t encoder_state[NUM_ENCODERS] = {0};
static keypos_t encoder_cw[NUM_ENCODERS] = ENCODERS_CW_KEY;
static keypos_t encoder_ccw[NUM_ENCODERS] = ENCODERS_CCW_KEY;
void encoder_action_unregister(void)
{
for (int index = 0; index < NUM_ENCODERS; ++index)
{
if (encoder_state[index])
{
keyevent_t encoder_event = (keyevent_t){
.key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index],
.pressed = false,
.time = timer_read(),
.type = KEY_EVENT
};
encoder_state[index] = 0;
action_exec(encoder_event);
}
}
}
void encoder_action_register(uint8_t index, bool clockwise)
{
keyevent_t encoder_event = (keyevent_t){
.key = clockwise ? encoder_cw[index] : encoder_ccw[index],
.pressed = true,
.time = timer_read(),
.type = KEY_EVENT
};
encoder_state[index] = (clockwise ^ 1) | (clockwise << 1);
action_exec(encoder_event);
}
void matrix_scan_kb(void)
{
encoder_action_unregister();
matrix_scan_user();
}
bool encoder_update_kb(uint8_t index, bool clockwise)
{
encoder_action_register(index, clockwise);
return true;
};
#endif

View File

@ -1,21 +0,0 @@
/* Copyright 2021 meletrix
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
// Note: array is { col, row )
#define ENCODERS_CW_KEY { { 5, 4 } }
#define ENCODERS_CCW_KEY { { 3, 4 } }

View File

@ -43,9 +43,7 @@
{"matrix": [0, 12], "x": 12, "y": 0},
{"matrix": [0, 13], "x": 13, "y": 0},
{"matrix": [2, 13], "x": 14, "y": 0},
{"matrix": [4, 3], "x": 15, "y": 0, "w": 0.5},
{"matrix": [0, 14], "x": 15.5, "y": 0},
{"matrix": [4, 5], "x": 16.5, "y": 0, "w": 0.5},
{"matrix": [1, 0], "x": 0, "y": 1, "w": 1.5},
{"matrix": [1, 1], "x": 1.5, "y": 1},

View File

@ -18,14 +18,14 @@
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_all(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_BSPC, KC_VOLU, KC_MUTE, KC_VOLD,
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_BSPC, KC_MUTE,
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_BSLS, KC_DEL,
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_ENT, KC_PGUP,
KC_LSFT, KC_LSFT, 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_END,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT
),
[1] = LAYOUT_all(
KC_GRV, 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_MNXT, KC_MPLY, KC_MPRV,
KC_GRV, 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_MPLY,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, QK_BOOT,

View File

@ -16,78 +16,42 @@
#include QMK_KEYBOARD_H
static uint8_t encoder_state[NUM_ENCODERS] = {0};
static keypos_t encoder_cw[NUM_ENCODERS] = ENCODERS_CW_KEY;
static keypos_t encoder_ccw[NUM_ENCODERS] = ENCODERS_CCW_KEY;
void encoder_action_unregister(void)
{
for (int index = 0; index < NUM_ENCODERS; ++index)
{
if (encoder_state[index])
{
keyevent_t encoder_event = (keyevent_t){
.key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index],
.pressed = false,
.time = timer_read(),
.type = KEY_EVENT
};
encoder_state[index] = 0;
action_exec(encoder_event);
}
}
}
void encoder_action_register(uint8_t index, bool clockwise)
{
keyevent_t encoder_event = (keyevent_t){
.key = clockwise ? encoder_cw[index] : encoder_ccw[index],
.pressed = true,
.time = timer_read(),
.type = KEY_EVENT
};
encoder_state[index] = (clockwise ^ 1) | (clockwise << 1);
action_exec(encoder_event);
}
void matrix_scan_kb(void)
{
encoder_action_unregister();
matrix_scan_user();
}
bool encoder_update_kb(uint8_t index, bool clockwise)
{
encoder_action_register(index, clockwise);
return true;
}
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_all(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_BSPC, KC_VOLU, KC_MUTE, KC_VOLD,
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_BSPC, KC_MUTE,
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_BSLS, KC_DEL,
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_ENT, KC_PGUP,
KC_LSFT, KC_LSFT, 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_END,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT
),
[1] = LAYOUT_all(
KC_GRV, 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_MNXT, KC_MPLY, KC_MPRV,
KC_GRV, 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_MPLY,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, QK_BOOT,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
[2] = LAYOUT_all(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
[3] = LAYOUT_all(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
};
#ifdef ENCODER_MAP_ENABLE
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
[0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[1] = { ENCODER_CCW_CW(KC_MPRV, KC_MNXT) },
[2] = { ENCODER_CCW_CW(_______, _______) },
[3] = { ENCODER_CCW_CW(_______, _______) },
};
#endif

View File

@ -1,2 +1,3 @@
VIA_ENABLE = yes
LTO_ENABLE = yes
ENCODER_MAP_ENABLE = yes

View File

@ -49,9 +49,7 @@
{"matrix": [0, 13], "x": 14, "y": 0},
{"matrix": [5, 4], "x": 15, "y": 0, "w": 0.5},
{"matrix": [0, 14], "x": 15.5, "y": 0},
{"matrix": [5, 3], "x": 16.5, "y": 0, "w": 0.5},
{"matrix": [1, 0], "x": 0, "y": 1.25},
{"matrix": [1, 1], "x": 1, "y": 1.25},

View File

@ -83,7 +83,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/
/* Row: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 */
[_BASE] = LAYOUT(
KC_ESC, 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_DEL, _______, KC_MUTE, _______,
KC_ESC, 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_DEL, KC_MUTE,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_HOME,
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_BSLS, 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_ENT, KC_PGDN,
@ -110,7 +110,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/
/* Row: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 */
[_FN] = LAYOUT(
QK_BOOT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, _______,
QK_BOOT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_HUI,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_HUD,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
@ -158,25 +158,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
}
#ifdef ENCODER_ENABLE
bool encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) {
if (layer_state_is(_BASE)) {
if (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
} else if (layer_state_is(_FN)) {
if (clockwise) {
rgb_matrix_step();
} else {
rgb_matrix_step_reverse();
}
}
}
return true;
}
#ifdef ENCODER_MAP_ENABLE
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
[0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[1] = { ENCODER_CCW_CW(RGB_RMOD, RGB_MOD) },
};
#endif
bool rgb_matrix_indicators_user(void) {

View File

@ -83,7 +83,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/
/* Row: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 */
[_BASE] = LAYOUT(
KC_ESC, 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_DEL, KC_VOLD, KC_MUTE, KC_VOLU,
KC_ESC, 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_DEL, KC_MUTE,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_HOME,
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_BSLS, 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_ENT, KC_PGDN,
@ -110,7 +110,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/
/* Row: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 */
[_FN] = LAYOUT(
QK_BOOT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_TOG, RGB_MOD,
QK_BOOT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_HUI,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_HUD,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
@ -158,45 +158,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
}
#ifdef ENCODER_ENABLE
static uint8_t encoder_state[NUM_ENCODERS] = {0};
static keypos_t encoder_cw[NUM_ENCODERS] = {{3, 5}};
static keypos_t encoder_ccw[NUM_ENCODERS] = {{4, 5}};
void encoder_action_unregister(void) {
for (int index = 0; index < NUM_ENCODERS; ++index) {
if (encoder_state[index]) {
keyevent_t encoder_event = (keyevent_t) {
.key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index],
.pressed = false,
.time = timer_read(),
.type = KEY_EVENT
#ifdef ENCODER_MAP_ENABLE
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
[0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[1] = { ENCODER_CCW_CW(RGB_RMOD, RGB_MOD) },
};
encoder_state[index] = 0;
action_exec(encoder_event);
}
}
}
void encoder_action_register(uint8_t index, bool clockwise) {
keyevent_t encoder_event = (keyevent_t) {
.key = clockwise ? encoder_cw[index] : encoder_ccw[index],
.pressed = true,
.time = timer_read(),
.type = KEY_EVENT
};
encoder_state[index] = (clockwise ^ 1) | (clockwise << 1);
action_exec(encoder_event);
}
void matrix_scan_user(void) {
encoder_action_unregister();
}
bool encoder_update_user(uint8_t index, bool clockwise) {
encoder_action_register(index, clockwise);
return false;
}
#endif
bool rgb_matrix_indicators_user(void) {

View File

@ -1,2 +1,3 @@
VIA_ENABLE = yes
LTO_ENABLE = yes
ENCODER_MAP_ENABLE = yes

View File

@ -262,10 +262,7 @@
{"matrix": [4, 13], "x": 13.25, "y": 4.25},
{"matrix": [4, 14], "x": 14.25, "y": 4.25},
{"matrix": [4, 15], "x": 15.25, "y": 4.25},
{"matrix": [5, 0], "x": 0, "y": 5},
{"matrix": [5, 1], "x": 1, "y": 5}
{"matrix": [4, 15], "x": 15.25, "y": 4.25}
]
}
}

View File

@ -33,12 +33,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, _______, _______, BL_TOGG, _______, BL_DOWN, BL_OFF, BL_UP
)
};
bool encoder_update_user(uint8_t index, bool clockwise) {
if (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
return true;
}

View File

@ -33,12 +33,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, _______, _______, BL_TOGG, _______, BL_DOWN, BL_OFF, BL_UP
)
};
bool encoder_update_user(uint8_t index, bool clockwise) {
if (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
return true;
}

View File

@ -23,70 +23,35 @@ 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_BSLS, 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_ENT, KC_PGDN,
KC_LSFT, KC_NO, 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_VOLD, KC_VOLU
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(1), KC_LEFT, KC_DOWN, KC_RGHT
),
[1] = LAYOUT_all(
QK_BOOT, 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_DEL, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, BL_ON,
_______, _______, _______, BL_TOGG, _______, BL_DOWN, BL_OFF, BL_UP,
_______, _______
_______, _______, _______, BL_TOGG, _______, BL_DOWN, BL_OFF, BL_UP
),
[2] = LAYOUT_all(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______,
_______, _______
_______, _______, _______, _______, _______, _______, _______, _______
),
[3] = LAYOUT_all(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______,
_______, _______
_______, _______, _______, _______, _______, _______, _______, _______
)
};
keyevent_t encoder_ccw = {
.key = (keypos_t){.row = 5, .col = 0},
.pressed = false,
.type = KEY_EVENT
#ifdef ENCODER_MAP_ENABLE
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
[0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[1] = { ENCODER_CCW_CW(_______, _______) },
[2] = { ENCODER_CCW_CW(_______, _______) },
[3] = { ENCODER_CCW_CW(_______, _______) },
};
keyevent_t encoder_cw = {
.key = (keypos_t){.row = 5, .col = 1},
.pressed = false,
.type = KEY_EVENT
};
void matrix_scan_user(void) {
if (encoder_ccw.pressed) {
encoder_ccw.pressed = false;
encoder_ccw.time = timer_read();
action_exec(encoder_ccw);
}
if (encoder_cw.pressed) {
encoder_cw.pressed = false;
encoder_cw.time = timer_read();
action_exec(encoder_cw);
}
}
bool encoder_update_user(uint8_t index, bool clockwise) {
if (clockwise) {
encoder_cw.pressed = true;
encoder_cw.time = timer_read();
action_exec(encoder_cw);
} else {
encoder_ccw.pressed = true;
encoder_ccw.time = timer_read();
action_exec(encoder_ccw);
}
return true;
}
#endif

View File

@ -1 +1,2 @@
VIA_ENABLE = yes
ENCODER_MAP_ENABLE = yes

View File

@ -51,44 +51,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),
};
#ifdef ENCODER_ENABLE
static uint8_t encoder_state[NUM_ENCODERS] = {0};
static keypos_t encoder_cw[NUM_ENCODERS] = {{6, 4}};
static keypos_t encoder_ccw[NUM_ENCODERS] = {{7, 4}};
void encoder_action_unregister(void) {
for (uint8_t index = 0; index < NUM_ENCODERS; ++index) {
if (encoder_state[index]) {
keyevent_t encoder_event = (keyevent_t) {
.key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index],
.pressed = false,
.time = timer_read(),
.type = KEY_EVENT
};
encoder_state[index] = 0;
action_exec(encoder_event);
}
}
}
void encoder_action_register(uint8_t index, bool clockwise) {
keyevent_t encoder_event = (keyevent_t) {
.key = clockwise ? encoder_cw[index] : encoder_ccw[index],
.pressed = true,
.time = timer_read(),
.type = KEY_EVENT
};
encoder_state[index] = (clockwise ^ 1) | (clockwise << 1);
action_exec(encoder_event);
}
void matrix_scan_user(void) {
encoder_action_unregister();
}
bool encoder_update_user(uint8_t index, bool clockwise) {
encoder_action_register(index, clockwise);
return false;
#ifdef ENCODER_MAP_ENABLE
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
[0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[1] = { ENCODER_CCW_CW(_______, _______) },
[2] = { ENCODER_CCW_CW(_______, _______) },
[3] = { ENCODER_CCW_CW(_______, _______) },
};
#endif

View File

@ -1,2 +1,2 @@
VIA_ENABLE = yes
LTO_ENABLE = no
ENCODER_MAP_ENABLE = yes

View File

@ -43,10 +43,7 @@
{"matrix": [0, 11], "x": 11, "y": 0},
{"matrix": [0, 12], "x": 12, "y": 0},
{"matrix": [0, 13], "x": 13, "y": 0, "w": 2},
{"matrix": [4, 4], "x": 15, "y": 0, "w": 0.5},
{"matrix": [0, 14], "x": 15.5, "y": 0},
{"matrix": [4, 3], "x": 16.5, "y": 0, "w": 0.5},
{"matrix": [1, 0], "x": 0, "y": 1, "w": 1.5},
{"matrix": [1, 1], "x": 1.5, "y": 1},

View File

@ -18,7 +18,7 @@
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_VOLD, KC_DEL, KC_VOLU,
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL,
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_BSLS, 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_ENT, KC_PGDN,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, RGB_TOG,
@ -26,7 +26,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),
[1] = LAYOUT(
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, RGB_HUI, _______,
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, RGB_HUI,
RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_HUD,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_SAI,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAI, RGB_SAD,

View File

@ -48,7 +48,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/
/* Row: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 */
[_BASE] = LAYOUT(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_VOLD, KC_HOME, KC_VOLU,
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_HOME,
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_BSLS, KC_END,
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_ENT, KC_PGUP,
KC_LSFT, 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_PGDN,
@ -71,7 +71,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/
/* Row: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 */
[_FN] = LAYOUT(
KC_GRV, 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_GRV, 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_PAUSE, KC_INS,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PSCR, KC_DEL,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,

View File

@ -273,19 +273,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
}
#ifdef ENCODER_ENABLE
bool encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) {
if (clockwise) {
tap_code(dynamic_keymap_get_keycode(biton32(layer_state), 4, 3));
} else {
tap_code(dynamic_keymap_get_keycode(biton32(layer_state), 4, 4));
}
}
return true;
}
#endif
bool rgb_matrix_indicators_user(void) {
switch (biton32(layer_state)) {
case _FN:

View File

@ -79,7 +79,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/
/* Row: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 */
[_BASE] = LAYOUT(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_VOLD, KC_HOME, KC_VOLU,
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_HOME,
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_BSLS, KC_END,
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_ENT, KC_PGUP,
KC_LSFT, 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_PGDN,
@ -101,7 +101,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/
/* Row: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 */
[_FN] = LAYOUT(
KC_GRV, 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_GRV, 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, _______,
QK_BOOT, _______, _______, _______, _______, _______, _______, _______, RGB_HUD, RGB_HUI, _______, _______, _______, KC_PAUSE, KC_INS,
_______, _______, _______, _______, _______, _______, _______, _______, RGB_SAD, RGB_SAI, _______, _______, KC_PSCR, KC_DEL,
_______, _______, _______, _______, _______, _______, _______, RGB_SPD, RGB_SPI, _______, _______, _______, RGB_VAI, RGB_TOG,
@ -168,19 +168,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
}
#ifdef ENCODER_ENABLE
bool encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) {
if (clockwise) {
tap_code(dynamic_keymap_get_keycode(biton32(layer_state), 4, 3));
} else {
tap_code(dynamic_keymap_get_keycode(biton32(layer_state), 4, 4));
}
}
return true;
}
#endif
bool rgb_matrix_indicators_user(void) {
HSV hsv = rgb_matrix_config.hsv;
uint8_t time = scale16by8(g_rgb_timer, qadd8(32, 1));

View File

@ -34,7 +34,7 @@ enum custom_keycodes {
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_VOLD, KC_DEL, KC_VOLU,
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL,
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_BSLS, 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_ENT, KC_PGDN,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, RGB_TOG,
@ -42,7 +42,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),
[1] = LAYOUT(
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, RGB_HUI, _______,
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, RGB_HUI,
RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_HUD,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, USER00, RGB_SAI,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, USER01, RGB_VAI, RGB_SAD,
@ -50,7 +50,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),
[2] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
@ -58,7 +58,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),
[3] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
@ -96,17 +96,13 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
}
#ifdef ENCODER_ENABLE
bool encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) {
if (clockwise) {
tap_code(dynamic_keymap_get_keycode(get_highest_layer(layer_state), 4, 3));
} else {
tap_code(dynamic_keymap_get_keycode(get_highest_layer(layer_state), 4, 4));
}
}
return true;
}
#ifdef ENCODER_MAP_ENABLE
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
[0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[1] = { ENCODER_CCW_CW(_______, _______) },
[2] = { ENCODER_CCW_CW(_______, _______) },
[3] = { ENCODER_CCW_CW(_______, _______) },
};
#endif
bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {

View File

@ -1,2 +1,3 @@
VIA_ENABLE = yes
LTO_ENABLE = yes
ENCODER_MAP_ENABLE = yes

View File

@ -104,48 +104,15 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
}
#ifdef ENCODER_ENABLE
static uint8_t encoder_state[NUM_ENCODERS] = {0};
static keypos_t encoder_cw[NUM_ENCODERS] = {{3, 5}};
static keypos_t encoder_ccw[NUM_ENCODERS] = {{4, 5}};
void encoder_action_unregister(void) {
for (uint8_t index = 0; index < NUM_ENCODERS; ++index) {
if (encoder_state[index]) {
keyevent_t encoder_event = (keyevent_t) {
.key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index],
.pressed = false,
.time = timer_read(),
.type = KEY_EVENT
};
encoder_state[index] = 0;
action_exec(encoder_event);
}
}
}
void encoder_action_register(uint8_t index, bool clockwise) {
keyevent_t encoder_event = (keyevent_t) {
.key = clockwise ? encoder_cw[index] : encoder_ccw[index],
.pressed = true,
.time = timer_read(),
.type = KEY_EVENT
};
encoder_state[index] = (clockwise ^ 1) | (clockwise << 1);
action_exec(encoder_event);
}
void matrix_scan_user(void) {
encoder_action_unregister();
}
bool encoder_update_user(uint8_t index, bool clockwise) {
encoder_action_register(index, clockwise);
return true;
#ifdef ENCODER_MAP_ENABLE
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
[0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[1] = { ENCODER_CCW_CW(_______, _______) },
[2] = { ENCODER_CCW_CW(_______, _______) },
[3] = { ENCODER_CCW_CW(_______, _______) },
};
#endif
bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
if (user_config.top_rgb_change)

View File

@ -1,2 +1,3 @@
VIA_ENABLE = yes
LTO_ENABLE = yes
ENCODER_MAP_ENABLE = yes

View File

@ -1,28 +0,0 @@
/* Copyright 2020 Neil Brian Ramirez
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "adellein.h"
void matrix_scan_kb(void) {
encoder_action_unregister();
matrix_scan_user();
}
bool encoder_update_kb(uint8_t index, bool clockwise) {
// if (!encoder_update_user(index, clockwise)) return false;
encoder_action_register(index, clockwise);
return true;
};

View File

@ -1,20 +0,0 @@
/* Copyright 2020 Neil Brian Ramirez
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "quantum.h"
#include "encoder_action.h"

View File

@ -28,10 +28,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define RGBLIGHT_EFFECT_ALTERNATING
#define RGBLIGHT_EFFECT_TWINKLE
/* Encoders */
#define ENCODERS_CW_KEY { { 3, 3 } }
#define ENCODERS_CCW_KEY { { 1, 3 } }
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */

View File

@ -1,47 +0,0 @@
/* Copyright 2020 Neil Brian Ramirez
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "encoder_action.h"
static uint8_t encoder_state[NUM_ENCODERS] = {0};
static keypos_t encoder_cw[NUM_ENCODERS] = ENCODERS_CW_KEY;
static keypos_t encoder_ccw[NUM_ENCODERS] = ENCODERS_CCW_KEY;
void encoder_action_unregister(void) {
for (int index = 0; index < NUM_ENCODERS; ++index) {
if (encoder_state[index]) {
keyevent_t encoder_event = (keyevent_t) {
.key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index],
.pressed = false,
.time = timer_read(),
.type = KEY_EVENT
};
encoder_state[index] = 0;
action_exec(encoder_event);
}
}
}
void encoder_action_register(uint8_t index, bool clockwise) {
keyevent_t encoder_event = (keyevent_t) {
.key = clockwise ? encoder_cw[index] : encoder_ccw[index],
.pressed = true,
.time = timer_read(),
.type = KEY_EVENT
};
encoder_state[index] = (clockwise ^ 1) | (clockwise << 1);
action_exec(encoder_event);
}

View File

@ -1,23 +0,0 @@
/* Copyright 2020 Neil Brian Ramirez
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "quantum.h"
void encoder_action_unregister(void);
void encoder_action_register(uint8_t index, bool clockwise);

View File

@ -83,66 +83,6 @@
{"matrix": [3, 9], "x": 10.75, "y": 3, "w": 1.25},
{"matrix": [3, 12], "x": 14.75, "y": 3, "w": 1.25}
]
},
"LAYOUT_40ergo_split_ent_encoder": {
"layout": [
{"matrix": [0, 0], "x": 0.5, "y": 0},
{"matrix": [0, 1], "x": 1.5, "y": 0},
{"matrix": [0, 2], "x": 2.5, "y": 0},
{"matrix": [0, 3], "x": 3.5, "y": 0},
{"matrix": [0, 4], "x": 4.5, "y": 0},
{"matrix": [0, 5], "x": 5.5, "y": 0},
{"matrix": [0, 6], "x": 8.25, "y": 0},
{"matrix": [0, 7], "x": 9.25, "y": 0},
{"matrix": [0, 8], "x": 10.25, "y": 0},
{"matrix": [0, 9], "x": 11.25, "y": 0},
{"matrix": [0, 10], "x": 12.25, "y": 0},
{"matrix": [0, 11], "x": 13.25, "y": 0},
{"matrix": [0, 12], "x": 14.25, "y": 0, "w": 1.5},
{"matrix": [1, 0], "x": 0.25, "y": 1, "w": 1.25},
{"matrix": [1, 1], "x": 1.5, "y": 1},
{"matrix": [1, 2], "x": 2.5, "y": 1},
{"matrix": [1, 3], "x": 3.5, "y": 1},
{"matrix": [1, 4], "x": 4.5, "y": 1},
{"matrix": [1, 5], "x": 5.5, "y": 1},
{"matrix": [1, 6], "x": 8.75, "y": 1},
{"matrix": [1, 7], "x": 9.75, "y": 1},
{"matrix": [1, 8], "x": 10.75, "y": 1},
{"matrix": [1, 9], "x": 11.75, "y": 1},
{"matrix": [1, 10], "x": 12.75, "y": 1},
{"matrix": [1, 11], "x": 13.75, "y": 1},
{"matrix": [1, 12], "x": 14.75, "y": 1, "w": 1.25},
{"matrix": [2, 0], "x": 0, "y": 2, "w": 1.75},
{"matrix": [2, 1], "x": 1.75, "y": 2},
{"matrix": [2, 2], "x": 2.75, "y": 2},
{"matrix": [2, 3], "x": 3.75, "y": 2},
{"matrix": [2, 4], "x": 4.75, "y": 2},
{"matrix": [2, 5], "x": 5.75, "y": 2},
{"matrix": [2, 6], "x": 8.5, "y": 2},
{"matrix": [2, 7], "x": 9.5, "y": 2},
{"matrix": [2, 8], "x": 10.5, "y": 2},
{"matrix": [2, 9], "x": 11.5, "y": 2},
{"matrix": [2, 10], "x": 12.5, "y": 2},
{"matrix": [2, 11], "x": 13.5, "y": 2},
{"matrix": [2, 12], "x": 14.5, "y": 2, "w": 1.75},
{"matrix": [3, 0], "x": 0.25, "y": 3, "w": 1.25},
{"matrix": [3, 2], "x": 2.75, "y": 3, "w": 1.25},
{"matrix": [3, 4], "x": 4, "y": 3, "w": 2.25},
{"matrix": [3, 5], "x": 6.25, "y": 3},
{"matrix": [3, 7], "x": 8, "y": 3, "w": 2.75},
{"matrix": [3, 9], "x": 10.75, "y": 3, "w": 1.25},
{"matrix": [3, 12], "x": 14.75, "y": 3, "w": 1.25},
{"matrix": [3, 1], "x": 5.75, "y": 4},
{"matrix": [3, 3], "x": 6.75, "y": 4}
]
}
}
}

View File

@ -15,35 +15,39 @@
*/
#include QMK_KEYBOARD_H
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_40ergo_split_ent_encoder(
[0] = LAYOUT_40ergo_split_ent(
KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_BSPC,
KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,
KC_LCTL, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_RALT, KC_RCTL,
KC_VOLD, KC_VOLU
KC_LCTL, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_RALT, KC_RCTL
),
[1] = LAYOUT_40ergo_split_ent_encoder(
[1] = LAYOUT_40ergo_split_ent(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
),
[2] = LAYOUT_40ergo_split_ent_encoder(
[2] = LAYOUT_40ergo_split_ent(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
),
[3] = LAYOUT_40ergo_split_ent_encoder(
[3] = LAYOUT_40ergo_split_ent(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
),
};
#ifdef ENCODER_MAP_ENABLE
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
[0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[1] = { ENCODER_CCW_CW(_______, _______) },
[2] = { ENCODER_CCW_CW(_______, _______) },
[3] = { ENCODER_CCW_CW(_______, _______) },
};
#endif

View File

@ -1,2 +1,3 @@
VIA_ENABLE = yes
LTO_ENABLE = yes
ENCODER_MAP_ENABLE = yes

View File

@ -11,6 +11,3 @@ BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
ENCODER_ENABLE = yes # Enable Rotary Encoders
LTO_ENABLE = yes
# Added encoder Action
SRC += encoder_action.c

View File

@ -28,10 +28,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define RGBLIGHT_EFFECT_ALTERNATING
#define RGBLIGHT_EFFECT_TWINKLE
/* Encoders */
#define ENCODERS_CW_KEY { { 2, 4 },{ 4, 4 },{ 6, 4 } }
#define ENCODERS_CCW_KEY { { 1, 4 },{ 3, 4 },{ 5, 4 } }
/* Audio */
#define AUDIO_PIN B7

View File

@ -1,47 +0,0 @@
/* Copyright 2020 Neil Brian Ramirez
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "encoder_action.h"
static uint8_t encoder_state[NUM_ENCODERS] = {0};
static keypos_t encoder_cw[NUM_ENCODERS] = ENCODERS_CW_KEY;
static keypos_t encoder_ccw[NUM_ENCODERS] = ENCODERS_CCW_KEY;
void encoder_action_unregister(void) {
for (int index = 0; index < NUM_ENCODERS; ++index) {
if (encoder_state[index]) {
keyevent_t encoder_event = (keyevent_t) {
.key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index],
.pressed = false,
.time = timer_read(),
.type = KEY_EVENT
};
encoder_state[index] = 0;
action_exec(encoder_event);
}
}
}
void encoder_action_register(uint8_t index, bool clockwise) {
keyevent_t encoder_event = (keyevent_t) {
.key = clockwise ? encoder_cw[index] : encoder_ccw[index],
.pressed = true,
.time = timer_read(),
.type = KEY_EVENT
};
encoder_state[index] = (clockwise ^ 1) | (clockwise << 1);
action_exec(encoder_event);
}

View File

@ -1,23 +0,0 @@
/* Copyright 2020 Neil Brian Ramirez
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "quantum.h"
void encoder_action_unregister(void);
void encoder_action_register(uint8_t index, bool clockwise);

View File

@ -10,7 +10,7 @@
},
"matrix_pins": {
"cols": ["B5", "C7", "D6", "D4", "B3", "B2", "B1", "B0", "D5", "D3", "D2", "D1", "D0"],
"rows": ["E6", "F0", "F1", "D7", null]
"rows": ["E6", "F0", "F1", "D7"]
},
"diode_direction": "COL2ROW",
"encoder": {
@ -29,71 +29,6 @@
"processor": "atmega32u4",
"bootloader": "atmel-dfu",
"layouts": {
"LAYOUT_ortho_4x13_encoders": {
"layout": [
{"matrix": [4, 1], "x": 0, "y": 0},
{"matrix": [4, 2], "x": 1, "y": 0},
{"matrix": [0, 0], "x": 2.25, "y": 0},
{"matrix": [0, 1], "x": 3.5, "y": 0},
{"matrix": [0, 2], "x": 4.5, "y": 0},
{"matrix": [0, 3], "x": 5.5, "y": 0},
{"matrix": [0, 4], "x": 6.5, "y": 0},
{"matrix": [0, 5], "x": 7.5, "y": 0},
{"matrix": [0, 6], "x": 8.5, "y": 0},
{"matrix": [0, 7], "x": 9.5, "y": 0},
{"matrix": [0, 8], "x": 10.5, "y": 0},
{"matrix": [0, 9], "x": 11.5, "y": 0},
{"matrix": [0, 10], "x": 12.5, "y": 0},
{"matrix": [0, 11], "x": 13.5, "y": 0},
{"matrix": [0, 12], "x": 14.5, "y": 0},
{"matrix": [4, 3], "x": 0, "y": 1},
{"matrix": [4, 4], "x": 1, "y": 1},
{"matrix": [1, 0], "x": 2.25, "y": 1},
{"matrix": [1, 1], "x": 3.5, "y": 1},
{"matrix": [1, 2], "x": 4.5, "y": 1},
{"matrix": [1, 3], "x": 5.5, "y": 1},
{"matrix": [1, 4], "x": 6.5, "y": 1},
{"matrix": [1, 5], "x": 7.5, "y": 1},
{"matrix": [1, 6], "x": 8.5, "y": 1},
{"matrix": [1, 7], "x": 9.5, "y": 1},
{"matrix": [1, 8], "x": 10.5, "y": 1},
{"matrix": [1, 9], "x": 11.5, "y": 1},
{"matrix": [1, 10], "x": 12.5, "y": 1},
{"matrix": [1, 11], "x": 13.5, "y": 1},
{"matrix": [1, 12], "x": 14.5, "y": 1},
{"matrix": [4, 5], "x": 0, "y": 2},
{"matrix": [4, 6], "x": 1, "y": 2},
{"matrix": [2, 0], "x": 2.25, "y": 2},
{"matrix": [2, 1], "x": 3.5, "y": 2},
{"matrix": [2, 2], "x": 4.5, "y": 2},
{"matrix": [2, 3], "x": 5.5, "y": 2},
{"matrix": [2, 4], "x": 6.5, "y": 2},
{"matrix": [2, 5], "x": 7.5, "y": 2},
{"matrix": [2, 6], "x": 8.5, "y": 2},
{"matrix": [2, 7], "x": 9.5, "y": 2},
{"matrix": [2, 8], "x": 10.5, "y": 2},
{"matrix": [2, 9], "x": 11.5, "y": 2},
{"matrix": [2, 10], "x": 12.5, "y": 2},
{"matrix": [2, 11], "x": 13.5, "y": 2},
{"matrix": [2, 12], "x": 14.5, "y": 2},
{"matrix": [3, 0], "x": 2.25, "y": 3},
{"matrix": [3, 1], "x": 3.5, "y": 3},
{"matrix": [3, 2], "x": 4.5, "y": 3},
{"matrix": [3, 3], "x": 5.5, "y": 3},
{"matrix": [3, 4], "x": 6.5, "y": 3},
{"matrix": [3, 5], "x": 7.5, "y": 3},
{"matrix": [3, 6], "x": 8.5, "y": 3},
{"matrix": [3, 7], "x": 9.5, "y": 3},
{"matrix": [3, 8], "x": 10.5, "y": 3},
{"matrix": [3, 9], "x": 11.5, "y": 3},
{"matrix": [3, 10], "x": 12.5, "y": 3},
{"matrix": [3, 11], "x": 13.5, "y": 3},
{"matrix": [3, 12], "x": 14.5, "y": 3}
]
},
"LAYOUT_ortho_4x13": {
"layout": [
{"matrix": [0, 0], "x": 0, "y": 0},

View File

@ -17,32 +17,38 @@
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_ortho_4x13_encoders(
KC_SPC, KC_SPC, KC_SPC, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
KC_SPC, KC_SPC, KC_SPC, KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
KC_SPC, KC_SPC, KC_SPC, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT,
[0] = LAYOUT_ortho_4x13(
KC_SPC, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
KC_SPC, KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
KC_SPC, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT,
KC_SPC, KC_SPC, KC_LCTL, KC_LALT, KC_LGUI, MO(1), KC_SPC, KC_SPC, MO(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
),
[1] = LAYOUT_ortho_4x13_encoders(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
[1] = LAYOUT_ortho_4x13(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
),
[2] = LAYOUT_ortho_4x13_encoders(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
[2] = LAYOUT_ortho_4x13(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
),
[3] = LAYOUT_ortho_4x13_encoders(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
[3] = LAYOUT_ortho_4x13(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
),
)
};
#ifdef ENCODER_MAP_ENABLE
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
[0] = { ENCODER_CCW_CW(KC_PGUP, KC_PGDN), ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(KC_MPRV, KC_MNXT) },
[1] = { ENCODER_CCW_CW(RGB_HUD, RGB_HUI), ENCODER_CCW_CW(RGB_SAD, RGB_SAI), ENCODER_CCW_CW(RGB_VAD, RGB_VAI) },
[2] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) },
[3] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) }
};
#endif

View File

@ -1,2 +1,3 @@
VIA_ENABLE = yes
LTO_ENABLE = yes
ENCODER_MAP_ENABLE = yes

View File

@ -1,29 +0,0 @@
/* Copyright 2020 Neil Brian Ramirez
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "quantum.h"
#include "encoder_action.h"
void matrix_scan_kb(void) {
encoder_action_unregister();
matrix_scan_user();
}
bool encoder_update_kb(uint8_t index, bool clockwise) {
// if (!encoder_update_user(index, clockwise)) return false;
encoder_action_register(index, clockwise);
return true;
};

View File

@ -12,6 +12,3 @@ RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
AUDIO_ENABLE = yes # Audio output
ENCODER_ENABLE = yes # Enable Rotary Encoders
LTO_ENABLE = yes
# Added encoder Action
SRC += encoder_action.c

View File

@ -17,10 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once
/* Encoders */
#define ENCODERS_CW_KEY { { 1, 5 } }
#define ENCODERS_CCW_KEY { { 0, 5 } }
/* Audio */
#define B7_AUDIO

View File

@ -1,47 +0,0 @@
/* Copyright 2020 Neil Brian Ramirez
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "encoder_action.h"
static uint8_t encoder_state[NUM_ENCODERS] = {0};
static keypos_t encoder_cw[NUM_ENCODERS] = ENCODERS_CW_KEY;
static keypos_t encoder_ccw[NUM_ENCODERS] = ENCODERS_CCW_KEY;
void encoder_action_unregister(void) {
for (int index = 0; index < NUM_ENCODERS; ++index) {
if (encoder_state[index]) {
keyevent_t encoder_event = (keyevent_t) {
.key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index],
.pressed = false,
.time = timer_read(),
.type = KEY_EVENT
};
encoder_state[index] = 0;
action_exec(encoder_event);
}
}
}
void encoder_action_register(uint8_t index, bool clockwise) {
keyevent_t encoder_event = (keyevent_t) {
.key = clockwise ? encoder_cw[index] : encoder_ccw[index],
.pressed = true,
.time = timer_read(),
.type = KEY_EVENT
};
encoder_state[index] = (clockwise ^ 1) | (clockwise << 1);
action_exec(encoder_event);
}

View File

@ -1,23 +0,0 @@
/* Copyright 2020 Neil Brian Ramirez
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "quantum.h"
void encoder_action_unregister(void);
void encoder_action_register(uint8_t index, bool clockwise);

Some files were not shown because too many files have changed in this diff Show More