summaryrefslogtreecommitdiff
path: root/keyboards/keycapsss/plaid_pad
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/keycapsss/plaid_pad')
-rw-r--r--keyboards/keycapsss/plaid_pad/keymaps/default/keymap.c42
-rw-r--r--keyboards/keycapsss/plaid_pad/keymaps/default/rules.mk1
-rw-r--r--keyboards/keycapsss/plaid_pad/keymaps/oled/keymap.c102
-rw-r--r--keyboards/keycapsss/plaid_pad/keymaps/oled/rules.mk1
-rw-r--r--keyboards/keycapsss/plaid_pad/keymaps/via/keymap.c61
-rw-r--r--keyboards/keycapsss/plaid_pad/keymaps/via/rules.mk1
6 files changed, 34 insertions, 174 deletions
diff --git a/keyboards/keycapsss/plaid_pad/keymaps/default/keymap.c b/keyboards/keycapsss/plaid_pad/keymaps/default/keymap.c
index 2382185362..789bb7af02 100644
--- a/keyboards/keycapsss/plaid_pad/keymaps/default/keymap.c
+++ b/keyboards/keycapsss/plaid_pad/keymaps/default/keymap.c
@@ -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
diff --git a/keyboards/keycapsss/plaid_pad/keymaps/default/rules.mk b/keyboards/keycapsss/plaid_pad/keymaps/default/rules.mk
new file mode 100644
index 0000000000..ee32568148
--- /dev/null
+++ b/keyboards/keycapsss/plaid_pad/keymaps/default/rules.mk
@@ -0,0 +1 @@
+ENCODER_MAP_ENABLE = yes
diff --git a/keyboards/keycapsss/plaid_pad/keymaps/oled/keymap.c b/keyboards/keycapsss/plaid_pad/keymaps/oled/keymap.c
index 371e8e9941..944f822fb3 100644
--- a/keyboards/keycapsss/plaid_pad/keymaps/oled/keymap.c
+++ b/keyboards/keycapsss/plaid_pad/keymaps/oled/keymap.c
@@ -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 |
`-----------------------'
*/
+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
+};
- // 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;
-}
#endif
diff --git a/keyboards/keycapsss/plaid_pad/keymaps/oled/rules.mk b/keyboards/keycapsss/plaid_pad/keymaps/oled/rules.mk
index dc3e29cf8b..33bd0c3611 100644
--- a/keyboards/keycapsss/plaid_pad/keymaps/oled/rules.mk
+++ b/keyboards/keycapsss/plaid_pad/keymaps/oled/rules.mk
@@ -1,2 +1,3 @@
OLED_ENABLE = yes
COMBO_ENABLE = yes
+ENCODER_MAP_ENABLE = yes
diff --git a/keyboards/keycapsss/plaid_pad/keymaps/via/keymap.c b/keyboards/keycapsss/plaid_pad/keymaps/via/keymap.c
index 7d48591cd2..4ca3fc944b 100644
--- a/keyboards/keycapsss/plaid_pad/keymaps/via/keymap.c
+++ b/keyboards/keycapsss/plaid_pad/keymaps/via/keymap.c
@@ -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
diff --git a/keyboards/keycapsss/plaid_pad/keymaps/via/rules.mk b/keyboards/keycapsss/plaid_pad/keymaps/via/rules.mk
index 36b7ba9cbc..1189f4ad19 100644
--- a/keyboards/keycapsss/plaid_pad/keymaps/via/rules.mk
+++ b/keyboards/keycapsss/plaid_pad/keymaps/via/rules.mk
@@ -1,2 +1,3 @@
VIA_ENABLE = yes
LTO_ENABLE = yes
+ENCODER_MAP_ENABLE = yes