Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flipped and discrete encoder support to PlaidPad default mappings #9396

Merged
merged 3 commits into from
Jul 24, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions keyboards/keycapsss/plaid_pad/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
9 changes: 6 additions & 3 deletions keyboards/keycapsss/plaid_pad/keymaps/default/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
fauxpark marked this conversation as resolved.
Show resolved Hide resolved

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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#pragma once

// place overrides here
#define ENCODER_DIRECTION_FLIP

44 changes: 44 additions & 0 deletions keyboards/keycapsss/plaid_pad/keymaps/default_flipped/keymap.c
Original file line number Diff line number Diff line change
@@ -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);
fauxpark marked this conversation as resolved.
Show resolved Hide resolved
} else {
tap_code(KC_LEFT);
fauxpark marked this conversation as resolved.
Show resolved Hide resolved
}
} else if (index == 1) { // Second encoder - top right
if (clockwise) {
tap_code(KC_UP);
} else {
tap_code(KC_DOWN);
}
}
}
13 changes: 13 additions & 0 deletions keyboards/keycapsss/plaid_pad/keymaps/default_flipped/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

<img src="https://i.imgur.com/V82cMqq.png" width="200">

# 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.