~ruther/qmk_firmware

4e7e824a73c81187cca5cc56cb0b3b51a09b75c4 — RABijl 1 year, 7 months ago fb18ac2
Rotary numpad (#21744)

Co-authored-by: Duncan Sutherland <dunk2k_2000@hotmail.com>
Co-authored-by: Drashna Jaelre <drashna@live.com>
A keyboards/handwired/rabijl/rotary_numpad/info.json => keyboards/handwired/rabijl/rotary_numpad/info.json +66 -0
@@ 0,0 1,66 @@
{
    "manufacturer": "rabijl",
    "keyboard_name": "rotary_numpad",
    "maintainer": "rabijl",
    "url": "https://github.com/RABijl/",
    "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
    },
    "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": 3},
            {"pin_a": "D4", "pin_b": "C6", "resolution": 3},
            {"pin_a": "D7", "pin_b": "E6", "resolution": 3}
         ]
    },
    "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},
                {"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}
            ]
        }
    }
}

A keyboards/handwired/rabijl/rotary_numpad/keymaps/default/keymap.c => keyboards/handwired/rabijl/rotary_numpad/keymaps/default/keymap.c +62 -0
@@ 0,0 1,62 @@
// 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   │ . │   │
     * └───┘└───────┴───┴───┘
     */
    [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(_______, _______) },
};
#endif

A keyboards/handwired/rabijl/rotary_numpad/keymaps/default/rules.mk => keyboards/handwired/rabijl/rotary_numpad/keymaps/default/rules.mk +2 -0
@@ 0,0 1,2 @@

ENCODER_MAP_ENABLE = yes

A keyboards/handwired/rabijl/rotary_numpad/readme.md => keyboards/handwired/rabijl/rotary_numpad/readme.md +67 -0
@@ 0,0 1,67 @@
# Rotary Numpad


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

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.

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

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

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.

```
        ┌──┐┌──┐┌──┐┌──┐
        │0A││0B││0C││0D│
┌──┐    └──┘└──┘└──┘└──┘
│5A│
└──┘    ┌──┐┌──┐┌──┐┌──┐
        │1A││1B││1C││1D│
        └──┘└──┘└──┘└──┘
        ┌──┐┌──┐┌──┐┌──┐
        │2A││2B││2C││2D│
┌──┐    └──┘└──┘└──┘│  │
│3D│    ┌──┐┌──┐┌──┐│  │
└──┘    │3A││3B││3C││  │
        └──┘└──┘└──┘└──┘
        ┌──┐┌──┐┌──┐┌──┐
        │4A││4B││4C││4D│
        └──┘└──┘└──┘│  │
┌──┐    ┌──────┐┌──┐│  │
│5D│    │5B    ││5C││  │
└──┘    └──────┘└──┘└──┘

```

## Flashing

Make example for this keyboard (after setting up your build environment):

    qmk compile -kb handwired/rabijl/rotary_numpad -km default

Flashing example for this keyboard:

    qmk flash -kb handwired/rabijl/rotary_numpad -km default

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:

* **Short reset leads**: tap the reset lead to ground twice quickly after qmk is in flash mode
* **Keycode in layout**: double tap the key mapped to `QK_BOOT`. On the default keymap this can be found by holding in key (0,C) and tapping key (0,A), see the matrix section for the positions of these keys. 
* **Bootmagic reset**: Hold down the key at (0,A) in the matrix (see matrix section) and plug in the keyboard

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

A keyboards/handwired/rabijl/rotary_numpad/rules.mk => keyboards/handwired/rabijl/rotary_numpad/rules.mk +1 -0
@@ 0,0 1,1 @@
# file intentionally left blank

Do not follow this link