keycapsss/plaid_pad
: switch to encoder map (#22474)
This commit is contained in:
parent
7cc90c234f
commit
2886c335a0
6 changed files with 35 additions and 175 deletions
|
@ -42,9 +42,8 @@ bool oled_task_user(void) {
|
|||
#endif
|
||||
|
||||
|
||||
#ifdef ENCODER_ENABLE
|
||||
#ifdef ENCODER_MAP_ENABLE
|
||||
|
||||
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||
/*
|
||||
Rev1.1 Rev1
|
||||
,-----------------------, ,-----------------------,
|
||||
|
@ -57,37 +56,12 @@ Rev1.1 Rev1
|
|||
| | | | E1 | | | | | |
|
||||
`-----------------------' `-----------------------'
|
||||
*/
|
||||
|
||||
// First encoder (E1)
|
||||
if (index == 0) {
|
||||
if (clockwise) {
|
||||
tap_code(KC_F17);
|
||||
} else {
|
||||
tap_code(KC_F18);
|
||||
}
|
||||
// Second encoder (E2)
|
||||
} else if (index == 1) {
|
||||
if (clockwise) {
|
||||
tap_code(KC_F19);
|
||||
} else {
|
||||
tap_code(KC_F20);
|
||||
}
|
||||
// Third encoder (E3)
|
||||
} else if (index == 2) {
|
||||
if (clockwise) {
|
||||
tap_code(KC_F21);
|
||||
} else {
|
||||
tap_code(KC_F22);
|
||||
}
|
||||
// Forth encoder (E4)
|
||||
} else if (index == 3) {
|
||||
if (clockwise) {
|
||||
tap_code(KC_F23);
|
||||
} else {
|
||||
tap_code(KC_F24);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
|
||||
#ifdef KEYBOARD_keycapsss_plaid_pad_rev1
|
||||
{ ENCODER_CCW_CW(KC_F18, KC_F17), ENCODER_CCW_CW(KC_F20, KC_F19) }
|
||||
#else
|
||||
{ ENCODER_CCW_CW(KC_F18, KC_F17), ENCODER_CCW_CW(KC_F20, KC_F19), ENCODER_CCW_CW(KC_F22, KC_F21), ENCODER_CCW_CW(KC_F24, KC_F23) }
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
1
keyboards/keycapsss/plaid_pad/keymaps/default/rules.mk
Normal file
1
keyboards/keycapsss/plaid_pad/keymaps/default/rules.mk
Normal file
|
@ -0,0 +1 @@
|
|||
ENCODER_MAP_ENABLE = yes
|
|
@ -125,8 +125,7 @@ bool oled_task_user(void) {
|
|||
|
||||
#endif
|
||||
|
||||
#ifdef ENCODER_ENABLE
|
||||
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||
#ifdef ENCODER_MAP_ENABLE
|
||||
/*
|
||||
,-----------------------,
|
||||
| E1 | E2 | E3 | E4 |
|
||||
|
@ -138,93 +137,16 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
|
|||
| | | | E1 |
|
||||
`-----------------------'
|
||||
*/
|
||||
|
||||
// First encoder (E1)
|
||||
if (index == 0) {
|
||||
switch (get_highest_layer(layer_state)) {
|
||||
case _NAVIGATION:
|
||||
// Browser tab switching
|
||||
if (clockwise) {
|
||||
tap_code16(LCTL(KC_TAB));
|
||||
} else {
|
||||
tap_code16(LCTL(LSFT(KC_TAB)));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (clockwise) {
|
||||
tap_code(KC_F17);
|
||||
} else {
|
||||
tap_code(KC_F18);
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Second encoder (E2)
|
||||
} else if (index == 1) {
|
||||
switch (get_highest_layer(layer_state)) {
|
||||
case _NAVIGATION:
|
||||
// Page Down/Up
|
||||
if (clockwise) {
|
||||
tap_code16(KC_PGDN);
|
||||
} else {
|
||||
tap_code16(KC_PGUP);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (clockwise) {
|
||||
tap_code(KC_F19);
|
||||
} else {
|
||||
tap_code(KC_F20);
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Third encoder (E3)
|
||||
} else if (index == 2) {
|
||||
switch (get_highest_layer(layer_state)) {
|
||||
case _NAVIGATION:
|
||||
// Mouse wheel up/down
|
||||
if (clockwise) {
|
||||
tap_code(KC_MS_WH_DOWN);
|
||||
} else {
|
||||
tap_code(KC_MS_WH_UP);
|
||||
}
|
||||
break;
|
||||
case _MEDIA:
|
||||
// BRIGHTNESS Up/Down
|
||||
if (clockwise) {
|
||||
tap_code16(KC_BRIGHTNESS_UP);
|
||||
} else {
|
||||
tap_code16(KC_BRIGHTNESS_DOWN);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (clockwise) {
|
||||
tap_code(KC_F21);
|
||||
} else {
|
||||
tap_code(KC_F22);
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Forth encoder (E4)
|
||||
} else if (index == 3) {
|
||||
switch (get_highest_layer(layer_state)) {
|
||||
case _NAVIGATION:
|
||||
case _MEDIA:
|
||||
// Volume Up/Down
|
||||
if (clockwise) {
|
||||
tap_code16(KC_AUDIO_VOL_UP);
|
||||
} else {
|
||||
tap_code16(KC_AUDIO_VOL_DOWN);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (clockwise) {
|
||||
tap_code(KC_F23);
|
||||
} else {
|
||||
tap_code(KC_F24);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
|
||||
#ifdef KEYBOARD_keycapsss_plaid_pad_rev1
|
||||
[_NUMPAD] = { ENCODER_CCW_CW(KC_F18, KC_F17), ENCODER_CCW_CW(KC_F20, KC_F19) },
|
||||
[_NAVIGATION] = { ENCODER_CCW_CW(C(S(KC_TAB)), C(KC_TAB)), ENCODER_CCW_CW(KC_PGUP, KC_PGDN) },
|
||||
[_MEDIA] = { ENCODER_CCW_CW(KC_F18, KC_F17), ENCODER_CCW_CW(KC_F20, KC_F19) }
|
||||
#else
|
||||
[_NUMPAD] = { ENCODER_CCW_CW(KC_F18, KC_F17), ENCODER_CCW_CW(KC_F20, KC_F19), ENCODER_CCW_CW(KC_F22, KC_F21), ENCODER_CCW_CW(KC_F24, KC_F23) },
|
||||
[_NAVIGATION] = { ENCODER_CCW_CW(C(S(KC_TAB)), C(KC_TAB)), ENCODER_CCW_CW(KC_PGUP, KC_PGDN), ENCODER_CCW_CW(KC_WH_U, KC_WH_D), ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
|
||||
[_MEDIA] = { ENCODER_CCW_CW(KC_F18, KC_F17), ENCODER_CCW_CW(KC_F20, KC_F19), ENCODER_CCW_CW(KC_BRID, KC_BRIU), ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
OLED_ENABLE = yes
|
||||
COMBO_ENABLE = yes
|
||||
ENCODER_MAP_ENABLE = yes
|
||||
|
|
|
@ -27,26 +27,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
* | 0 | . | = | + |
|
||||
* `-----------------------'
|
||||
*/
|
||||
[0] = LAYOUT_ortho_4x4(
|
||||
LAYOUT_ortho_4x4(
|
||||
KC_P7, KC_P8, KC_P9, KC_PSLS,
|
||||
KC_P4, KC_P5, KC_P6, KC_PAST,
|
||||
KC_P1, KC_P2, KC_P3, KC_PMNS,
|
||||
KC_P0, KC_PDOT, KC_PEQL, KC_PPLS ),
|
||||
[1] = LAYOUT_ortho_4x4(
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
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_4x4(
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
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_4x4(
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS ),
|
||||
KC_P0, KC_PDOT, KC_PEQL, KC_PPLS
|
||||
),
|
||||
};
|
||||
|
||||
|
||||
|
@ -69,8 +55,7 @@ bool oled_task_user(void) {
|
|||
#endif
|
||||
|
||||
|
||||
#ifdef ENCODER_ENABLE
|
||||
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||
#ifdef ENCODER_MAP_ENABLE
|
||||
/*
|
||||
Rev1.1 Rev1
|
||||
,-----------------------, ,-----------------------,
|
||||
|
@ -84,35 +69,11 @@ Rev1.1 Rev1
|
|||
`-----------------------' `-----------------------'
|
||||
*/
|
||||
|
||||
// First encoder (E1)
|
||||
if (index == 0) {
|
||||
if (clockwise) {
|
||||
tap_code(KC_F17);
|
||||
} else {
|
||||
tap_code(KC_F18);
|
||||
}
|
||||
// Second encoder (E2)
|
||||
} else if (index == 1) {
|
||||
if (clockwise) {
|
||||
tap_code(KC_F19);
|
||||
} else {
|
||||
tap_code(KC_F20);
|
||||
}
|
||||
// Third encoder (E3)
|
||||
} else if (index == 2) {
|
||||
if (clockwise) {
|
||||
tap_code(KC_F21);
|
||||
} else {
|
||||
tap_code(KC_F22);
|
||||
}
|
||||
// Forth encoder (E4)
|
||||
} else if (index == 3) {
|
||||
if (clockwise) {
|
||||
tap_code(KC_F23);
|
||||
} else {
|
||||
tap_code(KC_F24);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
|
||||
#ifdef KEYBOARD_keycapsss_plaid_pad_rev1
|
||||
{ ENCODER_CCW_CW(KC_F18, KC_F17), ENCODER_CCW_CW(KC_F20, KC_F19) }
|
||||
#else
|
||||
{ ENCODER_CCW_CW(KC_F18, KC_F17), ENCODER_CCW_CW(KC_F20, KC_F19), ENCODER_CCW_CW(KC_F22, KC_F21), ENCODER_CCW_CW(KC_F24, KC_F23) }
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
VIA_ENABLE = yes
|
||||
LTO_ENABLE = yes
|
||||
ENCODER_MAP_ENABLE = yes
|
||||
|
|
Loading…
Reference in a new issue