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

Rotary numpad #21744

Merged
merged 12 commits into from
Sep 25, 2023
67 changes: 67 additions & 0 deletions keyboards/rotary_numpad/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"manufacturer": "rabijl",
"keyboard_name": "rotary_numpad",
"maintainer": "rabijl",
"url": "",
"usb": {
"device_version": "1.0.0",
"pid": "0x0000",
"vid": "0xFEED"
},
"features": {
"bootmagic": true,
"command": false,
"console": false,
"extrakey": true,
"mousekey": true,
"nkro": true,
"encoder": true,
"encoder_map": true
RABijl marked this conversation as resolved.
Show resolved Hide resolved
},
"development_board": "promicro",
"diode_direction": "COL2ROW",
"matrix_pins": {
"cols": ["F5", "F4", "B5", "B4"],
"rows": ["F6", "F7", "B1", "B3", "B2", "B6"]
},
"encoder": {
"rotary": [
{"pin_a": "D1", "pin_b": "D0", "resolution": 1},
{"pin_a": "D4", "pin_b": "C6", "resolution": 1},
{"pin_a": "D7", "pin_b": "E6", "resolution": 1}
]
},
"layouts": {
"LAYOUT": {
"layout": [
{"matrix": [5, 0],"x":0, "y":0.4},
{"matrix": [0, 0], "x":2, "y":0},
{"matrix": [0, 1], "x":3, "y":0},
{"matrix": [0, 2], "x":4, "y":0},
{"matrix": [0, 3], "x":5, "y":0},
{"matrix": [1, 0], "x":2, "y":1.25},
{"matrix": [1, 1], "x":3, "y":1.25},
{"matrix": [1, 2], "x":4, "y":1.25},
{"matrix": [1, 3], "x":5, "y":1.25},
{"matrix": [2, 0], "x":2, "y":2.25},
RABijl marked this conversation as resolved.
Show resolved Hide resolved
{"matrix": [2, 1], "x":3, "y":2.25},
{"matrix": [2, 2], "x":4, "y":2.25},
{"matrix": [2, 3], "x":5, "y":2.25, "h":2},

{"matrix": [3, 3], "x":0, "y":2.75},
{"matrix": [3, 0], "x":2, "y":3.25},
{"matrix": [3, 1], "x":3, "y":3.25},
{"matrix": [3, 2], "x":4, "y":3.25},

{"matrix": [4, 0], "x":2, "y":4.25},
{"matrix": [4, 1], "x":3, "y":4.25},
{"matrix": [4, 2], "x":4, "y":4.25},
{"matrix": [4, 3], "x":5, "y":4.25, "h":2},

{"matrix": [5, 3], "x":0, "y":5.05},
{"matrix": [5, 1], "x":2, "y":5.25, "w":2},
{"matrix": [5, 2], "x":4, "y":5.25}
]
}
}
}
89 changes: 89 additions & 0 deletions keyboards/rotary_numpad/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
// Copyright 2023 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
//

#include QMK_KEYBOARD_H

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/*
* ┌───┐┌───┬───┬───┬───┐
* │Ply││Esc│Tab│MO1│Bsp│
* └───┘├───┼───┼───┼───┤
* │Num│ / │ * │ - │
* ├───┼───┼───┼───┤
* │ 7 │ 8 │ 9 │ │
* ┌───┐├───┼───┼───┤ + │
* │Esc││ 4 │ 5 │ 6 │ │
* └───┘├───┼───┼───┼───┤
* │ 1 │ 2 │ 3 │ │
* ┌───┐├───┼───┼───┤Ent│
* │ENT││ 0 │ . │ │
* └───┘└───┴───┴───┴───┘
RABijl marked this conversation as resolved.
Show resolved Hide resolved
*/
[0] = LAYOUT(
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
),
/*
* ┌───┐┌───┬───┬───┬───┐
* │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, 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 */
}
if (index == 0) { /* First encoder */
if (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
} else if (index == 1) { /* Second encoder */
if (clockwise) {
tap_code(KC_UP);
} else {
tap_code(KC_DOWN);
}
} else if (index == 2) { /* Third encoder */
if (clockwise) {
tap_code(KC_RIGHT);
} else {
tap_code(KC_LEFT);
}
}
return true;
}
RABijl marked this conversation as resolved.
Show resolved Hide resolved
#endif
68 changes: 68 additions & 0 deletions keyboards/rotary_numpad/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Rotary Numpad


![rotary_numpad](https://i.imgur.com/GwEH4WOh.jpeg)

*A short description of the keyboard/project*

* Keyboard Maintainer: [rabijl](https://github.com/rabijl)
* Hardware Supported: Sparkfun Pro Micro 5V (atmega32u4)
* Hardware Availability: https://www.sparkfun.com/products/12640

This is a personal project of mine where I wanted a number pad that I can put on the left \
side of keyboard that doesn't have a numberpad. I fell in love with the feel of rotary encoders \
on my 3d printer, so added three to be able to play around with.
RABijl marked this conversation as resolved.
Show resolved Hide resolved

## How to build from scratch

I handsoldered gateron blue switches to a 3D printed case. The design is modified from the [Ultipad](https://www.thingiverse.com/thing:4248565). \
I used a sparkfun Pro Micro as my microcontroller and the pinout can be found in the `info.json`. I found this [site](https://golem.hu/article/pro-micro-pinout/) \
to be very useful to identify different pins. You can find useful information on rotary encoders from the qmk docs [here](https://docs.qmk.fm/#/reference_info_json?id=encoders) and [here](https://docs.qmk.fm/#/feature_encoders).

### matrix
RABijl marked this conversation as resolved.
Show resolved Hide resolved

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 │ . │ │
└───┘└───┴───┴───┴───┘
RABijl marked this conversation as resolved.
Show resolved Hide resolved
```

## Flashing

Make example for this keyboard (after setting up your build environment): \
**note:** you may need to run this in the root of the repository for this to work

```
qmk compile -kb rotary_numpad -km default
```

Flashing example for this keyboard:

```
qmk flash -kb rotary_numpad -km default
```
RABijl marked this conversation as resolved.
Show resolved Hide resolved

See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).

## Bootloader

Enter the bootloader in 3 ways:
RABijl marked this conversation as resolved.
Show resolved Hide resolved

* **Short reset leads**: tab the reset lead to ground twice quickly after qmk is in flash mode
* **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available

**Note:** if the keyboard doesn't show up after putting the keyboard in reset mode, check that
your user is added to the `tty` and/or `uucp` groups. \
You may need to logout after adding these groups to your user, for the changes to take affect.
1 change: 1 addition & 0 deletions keyboards/rotary_numpad/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# file intentionally left blank