From 7b29c41d0ec664bd3884afca119529b435dd4bdf Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 12 Jun 2020 16:13:15 -0400 Subject: [PATCH 1/3] Add flipped and discrete encoder support default mappings --- .../plaid_pad/keymaps/default/keymap.c | 4 +- .../plaid_pad/keymaps/default/readme.md | 9 ++-- .../keymaps/default_flipped/config.h | 5 +++ .../keymaps/default_flipped/keymap.c | 44 +++++++++++++++++++ .../keymaps/default_flipped/readme.md | 13 ++++++ 5 files changed, 70 insertions(+), 5 deletions(-) create mode 100644 keyboards/keycapsss/plaid_pad/keymaps/default_flipped/config.h create mode 100644 keyboards/keycapsss/plaid_pad/keymaps/default_flipped/keymap.c create mode 100644 keyboards/keycapsss/plaid_pad/keymaps/default_flipped/readme.md diff --git a/keyboards/keycapsss/plaid_pad/keymaps/default/keymap.c b/keyboards/keycapsss/plaid_pad/keymaps/default/keymap.c index bdfd7fb780bc..7de3be5bd3d5 100644 --- a/keyboards/keycapsss/plaid_pad/keymaps/default/keymap.c +++ b/keyboards/keycapsss/plaid_pad/keymaps/default/keymap.c @@ -30,9 +30,9 @@ void keyboard_post_init_user(void) { void encoder_update_user(uint8_t index, bool clockwise) { if (index == 0) { // First encoder - top left if (clockwise) { - tap_code(KC_UP); + tap_code(KC_RIGHT); } else { - tap_code(KC_DOWN); + tap_code(KC_LEFT); } } else if (index == 1) { // Second encoder - top right if (clockwise) { diff --git a/keyboards/keycapsss/plaid_pad/keymaps/default/readme.md b/keyboards/keycapsss/plaid_pad/keymaps/default/readme.md index 1c1b1513dd1a..cdf996d62002 100644 --- a/keyboards/keycapsss/plaid_pad/keymaps/default/readme.md +++ b/keyboards/keycapsss/plaid_pad/keymaps/default/readme.md @@ -3,9 +3,12 @@ # Default Plaid-Pad Layout -This is the default layout that comes flashed on every Plaid-Pad. +This is the default layout for the plaid pad. The upper left (7) and right (/) switch, can be replaced by a rotary encoder. -They do "Up Arrow" (KC_UP) and "Down Arrow" (KC_DOWN). -Encoder with build-in switch are supported. +Encoders with built-in switches are supported on this layout and map to the kety +The upper left encoder performs a tap on "Left Arrow" (KC_LEFT) and "Right Arrow" (KC_RIGHT) when rotated in the respective direction for each step of the encoder. +The upper right encoder performs a tap on "Up Arrow" (KC_UP) and "Down Arrow" (KC_DOWN) when rotated in the respective direction for each step of the encoder. + +If your encoder's rotation is backwards, try using the `default_flipped` keymap. diff --git a/keyboards/keycapsss/plaid_pad/keymaps/default_flipped/config.h b/keyboards/keycapsss/plaid_pad/keymaps/default_flipped/config.h new file mode 100644 index 000000000000..55f0e70a73fd --- /dev/null +++ b/keyboards/keycapsss/plaid_pad/keymaps/default_flipped/config.h @@ -0,0 +1,5 @@ +#pragma once + +// place overrides here +#define ENCODER_DIRECTION_FLIP + diff --git a/keyboards/keycapsss/plaid_pad/keymaps/default_flipped/keymap.c b/keyboards/keycapsss/plaid_pad/keymaps/default_flipped/keymap.c new file mode 100644 index 000000000000..7de3be5bd3d5 --- /dev/null +++ b/keyboards/keycapsss/plaid_pad/keymaps/default_flipped/keymap.c @@ -0,0 +1,44 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* + * ,-----------------------, + * | 7 | 8 | 9 | / | + * |-----+-----+-----+-----| + * | 4 | 5 | 6 | * | + * |-----+-----+-----+-----| + * | 1 | 2 | 3 | - | + * |-----+-----+-----+-----| + * | 0 | . | = | + | + * `-----------------------' + */ +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 +) + +}; + +// Set led state during powerup +void keyboard_post_init_user(void) { + writePinHigh(LED_RED); +} + +void encoder_update_user(uint8_t index, bool clockwise) { + if (index == 0) { // First encoder - top left + if (clockwise) { + tap_code(KC_RIGHT); + } else { + tap_code(KC_LEFT); + } + } else if (index == 1) { // Second encoder - top right + if (clockwise) { + tap_code(KC_UP); + } else { + tap_code(KC_DOWN); + } + } +} diff --git a/keyboards/keycapsss/plaid_pad/keymaps/default_flipped/readme.md b/keyboards/keycapsss/plaid_pad/keymaps/default_flipped/readme.md new file mode 100644 index 000000000000..dacd1a084190 --- /dev/null +++ b/keyboards/keycapsss/plaid_pad/keymaps/default_flipped/readme.md @@ -0,0 +1,13 @@ + + + +# Default Flipped Plaid-Pad Layout + +This is the same as the `default` keymap but the rotary encoder directions are flipped. +The upper left (7) and right (/) switch, can be replaced by a rotary encoder. Encoders with built-in switch are supported and map to the original keys (7) and (/). + +The upper left encoder performs a tap on "Left Arrow" (KC_LEFT) and "Right Arrow" (KC_RIGHT) when rotated in the respective direction for each step of the encoder. + +The upper right encoder performs a tap on "Up Arrow" (KC_UP) and "Down Arrow" (KC_DOWN) when rotated in the respective direction for each step of the encoder. + + From 8e3d233e294f690594c87987d44b6820c62fe8fc Mon Sep 17 00:00:00 2001 From: matt Date: Wed, 17 Jun 2020 11:06:18 -0400 Subject: [PATCH 2/3] Fixed typo in readme --- keyboards/keycapsss/plaid_pad/keymaps/default/readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/keyboards/keycapsss/plaid_pad/keymaps/default/readme.md b/keyboards/keycapsss/plaid_pad/keymaps/default/readme.md index cdf996d62002..74d8a33b5feb 100644 --- a/keyboards/keycapsss/plaid_pad/keymaps/default/readme.md +++ b/keyboards/keycapsss/plaid_pad/keymaps/default/readme.md @@ -5,9 +5,9 @@ This is the default layout for the plaid pad. The upper left (7) and right (/) switch, can be replaced by a rotary encoder. -Encoders with built-in switches are supported on this layout and map to the kety +Encoders with built-in switch are supported and map to the original keys (7) and (/). -The upper left encoder performs a tap on "Left Arrow" (KC_LEFT) and "Right Arrow" (KC_RIGHT) when rotated in the respective direction for each step of the encoder. +The upper left encoder performs a tap on "Left Arrow" (KC_LEFT) and "Right Arrow" (KC_RIGHT) when rotated in the respective direction for each step of the encoder. The upper right encoder performs a tap on "Up Arrow" (KC_UP) and "Down Arrow" (KC_DOWN) when rotated in the respective direction for each step of the encoder. From 1921bb0d7787d7cc005d4ae11d2b6992340e0ec9 Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 19 Jun 2020 10:52:05 -0400 Subject: [PATCH 3/3] Removed flipped layout, fix config.h encoder pin mapping, update readme --- keyboards/keycapsss/plaid_pad/config.h | 6 ++- .../plaid_pad/keymaps/default/readme.md | 5 +-- .../keymaps/default_flipped/config.h | 5 --- .../keymaps/default_flipped/keymap.c | 44 ------------------- .../keymaps/default_flipped/readme.md | 13 ------ 5 files changed, 6 insertions(+), 67 deletions(-) delete mode 100644 keyboards/keycapsss/plaid_pad/keymaps/default_flipped/config.h delete mode 100644 keyboards/keycapsss/plaid_pad/keymaps/default_flipped/keymap.c delete mode 100644 keyboards/keycapsss/plaid_pad/keymaps/default_flipped/readme.md diff --git a/keyboards/keycapsss/plaid_pad/config.h b/keyboards/keycapsss/plaid_pad/config.h index 1d0b31a40146..f456bf84410d 100644 --- a/keyboards/keycapsss/plaid_pad/config.h +++ b/keyboards/keycapsss/plaid_pad/config.h @@ -18,8 +18,10 @@ #define MATRIX_COL_PINS { B0, D7, D6, D5 } #define UNUSED_PINS { B3, B4, B5, D4} -#define ENCODERS_PAD_A { D0, B1 } -#define ENCODERS_PAD_B { D1, B2 } +#define ENCODERS_PAD_A { D1, B2 } +#define ENCODERS_PAD_B { D0, B1 } + + #define ENCODER_RESOLUTION 4 /* COL2ROW, ROW2COL*/ diff --git a/keyboards/keycapsss/plaid_pad/keymaps/default/readme.md b/keyboards/keycapsss/plaid_pad/keymaps/default/readme.md index 74d8a33b5feb..ccbea5f86521 100644 --- a/keyboards/keycapsss/plaid_pad/keymaps/default/readme.md +++ b/keyboards/keycapsss/plaid_pad/keymaps/default/readme.md @@ -7,8 +7,7 @@ This is the default layout for the plaid pad. The upper left (7) and right (/) switch, can be replaced by a rotary encoder. Encoders with built-in switch are supported and map to the original keys (7) and (/). -The upper left encoder performs a tap on "Left Arrow" (KC_LEFT) and "Right Arrow" (KC_RIGHT) when rotated in the respective direction for each step of the encoder. +The upper left encoder performs a tap on "Right Arrow" (KC_RIGHT) and "Left Arrow" (KC_LEFT) when rotated clockwise and counter-clockwise in the respective direction for each step of the encoder. -The upper right encoder performs a tap on "Up Arrow" (KC_UP) and "Down Arrow" (KC_DOWN) when rotated in the respective direction for each step of the encoder. +The upper right encoder performs a tap on "Up Arrow" (KC_UP) and "Down Arrow" (KC_DOWN) when rotated clockwise and counter-clockwise in the respective direction for each step of the encoder. -If your encoder's rotation is backwards, try using the `default_flipped` keymap. diff --git a/keyboards/keycapsss/plaid_pad/keymaps/default_flipped/config.h b/keyboards/keycapsss/plaid_pad/keymaps/default_flipped/config.h deleted file mode 100644 index 55f0e70a73fd..000000000000 --- a/keyboards/keycapsss/plaid_pad/keymaps/default_flipped/config.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -// place overrides here -#define ENCODER_DIRECTION_FLIP - diff --git a/keyboards/keycapsss/plaid_pad/keymaps/default_flipped/keymap.c b/keyboards/keycapsss/plaid_pad/keymaps/default_flipped/keymap.c deleted file mode 100644 index 7de3be5bd3d5..000000000000 --- a/keyboards/keycapsss/plaid_pad/keymaps/default_flipped/keymap.c +++ /dev/null @@ -1,44 +0,0 @@ -#include QMK_KEYBOARD_H - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - -/* - * ,-----------------------, - * | 7 | 8 | 9 | / | - * |-----+-----+-----+-----| - * | 4 | 5 | 6 | * | - * |-----+-----+-----+-----| - * | 1 | 2 | 3 | - | - * |-----+-----+-----+-----| - * | 0 | . | = | + | - * `-----------------------' - */ -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 -) - -}; - -// Set led state during powerup -void keyboard_post_init_user(void) { - writePinHigh(LED_RED); -} - -void encoder_update_user(uint8_t index, bool clockwise) { - if (index == 0) { // First encoder - top left - if (clockwise) { - tap_code(KC_RIGHT); - } else { - tap_code(KC_LEFT); - } - } else if (index == 1) { // Second encoder - top right - if (clockwise) { - tap_code(KC_UP); - } else { - tap_code(KC_DOWN); - } - } -} diff --git a/keyboards/keycapsss/plaid_pad/keymaps/default_flipped/readme.md b/keyboards/keycapsss/plaid_pad/keymaps/default_flipped/readme.md deleted file mode 100644 index dacd1a084190..000000000000 --- a/keyboards/keycapsss/plaid_pad/keymaps/default_flipped/readme.md +++ /dev/null @@ -1,13 +0,0 @@ - - - -# Default Flipped Plaid-Pad Layout - -This is the same as the `default` keymap but the rotary encoder directions are flipped. -The upper left (7) and right (/) switch, can be replaced by a rotary encoder. Encoders with built-in switch are supported and map to the original keys (7) and (/). - -The upper left encoder performs a tap on "Left Arrow" (KC_LEFT) and "Right Arrow" (KC_RIGHT) when rotated in the respective direction for each step of the encoder. - -The upper right encoder performs a tap on "Up Arrow" (KC_UP) and "Down Arrow" (KC_DOWN) when rotated in the respective direction for each step of the encoder. - -