Skip to content

Commit

Permalink
rotary_pad: fix layout and enable encoder mapping
Browse files Browse the repository at this point in the history
* also updated readme with new diagram
  • Loading branch information
RABijl committed Aug 14, 2023
1 parent 1de66f2 commit 9030281
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 58 deletions.
3 changes: 2 additions & 1 deletion keyboards/rotary_numpad/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"extrakey": true,
"mousekey": true,
"nkro": true,
"encoder": true
"encoder": true,
"encoder_map": true
},
"development_board": "promicro",
"diode_direction": "COL2ROW",
Expand Down
88 changes: 48 additions & 40 deletions keyboards/rotary_numpad/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,55 +5,62 @@
#include QMK_KEYBOARD_H

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/*
* ┌───┬───┬───┬───┐
* │Esc│Tab│MO1│Bsp│
* ├───┼───┼───┼───┤
* │Num│ / │ * │ - │
* ├───┼───┼───┼───┤
* │ 7 │ 8 │ 9 │ +
* ──────┼───┼───┤
* │ 4 │ 5 │ 6 │ r2
* ├───┼───┼───┼───┤
* │ 1 │ 2 │ 3 │Ent
* ──────┼───┼───┤
* │ r3│ 0 │ . │ r1
* └───┴───┴───┴───┘
/*
* ┌───┐┌───┬───┬───┬───┐
* │Ply││Esc│Tab│MO1│Bsp│
* └───┘├───┼───┼───┼───┤
* │Num│ / │ * │ - │
* ├───┼───┼───┼───┤
* │ 7 │ 8 │ 9 │
* ───┐├───┼───┼───┤ + │
* │Esc││ 4 │ 5 │ 6 │
* └───┘├───┼───┼───┼───┤
* │ 1 │ 2 │ 3 │
* ───┐├───┼───┼───┤Ent│
* │ENT││ 0 │ . │
* └───┘└───┴───┴───┴───┘
*/
[0] = LAYOUT(
KC_ESC, KC_TAB, MO(1), KC_BSPC,
KC_NUM, KC_PSLS, KC_PAST, KC_PMNS,
KC_P7, KC_P8, KC_P9, KC_PPLS,
KC_P4, KC_P5, KC_P6, KC_ESC,
KC_P1, KC_P2, KC_P3, KC_PENT,
KC_MPLY, KC_P0, KC_PDOT, KC_ENT
KC_MPLY, KC_ESC, KC_TAB, MO(1), KC_BSPC,
KC_NUM, KC_PSLS, KC_PAST, KC_PMNS,
KC_P7, KC_P8, KC_P9, KC_PPLS,
KC_ESC, KC_P4, KC_P5, KC_P6,
KC_P1, KC_P2, KC_P3, KC_PENT,
KC_ENT, KC_P0, KC_PDOT
),

/*
* ┌───┐───┬───┬───┐
* │Rst│Tab│MO1│Bsp│
* └───┘───┼───┼───┤
* │Num│ / │ * │ - │
* ────────────┤
* │Hom│ ↑ │PgU│ │
* ├───┼───┼───┤ + │
* │ ← │ │ → │ │
* ├───┼───┼──────┤
* │End│ ↓ │PgD│ │
* ├───┴───┼───┤Ent│
* │Insert │Del│ │
* └───────┴───┘───┘
* ┌───┐┌───┬───┬───┬───┐
* │Ply││Rst│Tab│MO1│Bsp│
* └───┘├───┼───┼───┼───┤
* │Num│ / │ * │ - │
* ────────────┤
* │Hom│ ↑ │PgU│ │
* ┌───┐├───┼───┼───┤ + │
* │Esc││ ← │ │ → │ │
* └───┘├───┼───┼──────┤
* │End│ ↓ │PgD│ │
* ┌───┐├───┴───┼───┤Ent│
* │ENT││Insert │Del│ │
* └───┘└───────┴───┘───┘
*/
[1] = LAYOUT(
QK_BOOT, _______, _______, _______,
_______, _______, _______, _______,
KC_HOME, KC_UP, KC_PGUP, _______,
KC_LEFT, XXXXXXX, KC_RGHT, _______,
KC_END, KC_DOWN, KC_PGDN, _______,
_______, KC_INS, KC_DEL, _______
_______, QK_BOOT, _______, _______, _______,
_______, _______, _______, _______,
KC_HOME, KC_UP, KC_PGUP, _______,
_______, KC_LEFT, KC_NO, KC_RGHT,
KC_END, KC_DOWN, KC_PGDN, _______,
_______, KC_INS, KC_DEL
)
};

#if defined(ENCODER_MAP_ENABLE)

const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
[0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(KC_DOWN, KC_UP), ENCODER_CCW_CW(KC_LEFT, KC_RIGHT) },
[1] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(KC_LEFT, KC_RIGHT), ENCODER_CCW_CW(_______, _______) },
};
#else

bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!encoder_update_user(index, clockwise)) {
return false; /* Don't process further events if user function exists and returns false */
Expand All @@ -79,3 +86,4 @@ bool encoder_update_kb(uint8_t index, bool clockwise) {
}
return true;
}
#endif
34 changes: 17 additions & 17 deletions keyboards/rotary_numpad/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,23 @@ to be very useful to identify different pins. You can find useful information on

### matrix

Due to the three rotary encoders, I had to use most of the available pins. \
I therefore fit their buttons into 6 x 4 matrix at strange positions. See the diagram below. \
In this matrix r1, r2 and r3 are the buttons for each respective encoder.
\
┌───┬───┬───┬───┐ \
│Esc│Tab│MO1│Bsp│ \
├───┼───┼───┼───┤ \
│Num│\/ │ * │ - │ \
├───┼───┼───┼───┤ \
│ 7 │ 8 │ 9 │ + │ \
├───┼───┼───┼───┤ \
│ 4 │ 5 │ 6 │ r2│ \
├───┼───┼───┼───┤ \
│ 1 │ 2 │ 3 │Ent│ \
├───┼───┼───┼───┤ \
│ r3│ 0 │ . │ r1│ \
└───┴───┴───┴───┘
Due to the three rotary encoders, I had to use most of the available pins. Fortunately, all the buttons still fit in a 6x4 matrix. Looking at the diagram below, the three buttons in the first column correspond to each encoder button.

```
┌───┐┌───┬───┬───┬───┐
│Ply││Esc│Tab│MO1│Bsp│
└───┘├───┼───┼───┼───┤
│Num│ / │ * │ - │
├───┼───┼───┼───┤
│ 7 │ 8 │ 9 │ │
┌───┐├───┼───┼───┤ + │
│Esc││ 4 │ 5 │ 6 │ │
└───┘├───┼───┼───┼───┤
│ 1 │ 2 │ 3 │ │
┌───┐├───┼───┼───┤Ent│
│Ent││ 0 │ . │ │
└───┘└───┴───┴───┴───┘
```

## Flashing

Expand Down

0 comments on commit 9030281

Please sign in to comment.