~ruther/qmk_firmware

ee6c86d8e91437f47f904b5af49a63b749b57bf0 — Tom Swartz 4 years ago 0a69225
[Keyboard] LeftyNumpad Keyboard (#10500)

* Clean LeftyNumpad code

* Fix typo in recently renamed file

* Fix issues with keymap layout

* Initial PR Feedback fixes

* Update keyboards/handwired/leftynumpad/config.h

Co-authored-by: Joel Challis <git@zvecr.com>

* Update keyboards/handwired/leftynumpad/config.h

Co-authored-by: Joel Challis <git@zvecr.com>

* Apply suggestions from code review

Co-authored-by: Joel Challis <git@zvecr.com>

* Apply suggestions from code review

Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com>
Co-authored-by: Ryan <fauxpark@gmail.com>

* Add fixes based on PR feedback

* Update keyboards/handwired/leftynumpad/readme.md

Co-authored-by: Ryan <fauxpark@gmail.com>

Co-authored-by: Joel Challis <git@zvecr.com>
Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
A keyboards/handwired/leftynumpad/config.h => keyboards/handwired/leftynumpad/config.h +102 -0
@@ 0,0 1,102 @@
/*
Copyright 2020 Tom Swartz

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once

#include "config_common.h"

/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0xBEEF
#define DEVICE_VER 0x0001
#define MANUFACTURER Tom Swartz
#define PRODUCT LeftyNumpad
/* key matrix size */
#define MATRIX_ROWS 5
#define MATRIX_COLS 5

/*
 * Keyboard Matrix Assignments
 *
 * Change this to how you wired your keyboard
 * COLS: AVR pins used for columns, left to right
 * ROWS: AVR pins used for rows, top to bottom
 * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
 *                  ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
 *
 */
#define MATRIX_ROW_PINS { D1, D0, D4, C6, D7 }
#define MATRIX_COL_PINS { E6, B4, B5, B6, B2 }
#define UNUSED_PINS {D3, D2, B0, D5, B3, B1, F7, F6, F5, F4 }

/* COL2ROW, ROW2COL*/
#define DIODE_DIRECTION COL2ROW
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCE 10

/* define if matrix has ghost (lacks anti-ghosting diodes) */
//#define MATRIX_HAS_GHOST

/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE

/* If defined, GRAVE_ESC will always act as ESC when CTRL is held.
 * This is userful for the Windows task manager shortcut (ctrl+shift+esc).
 */
// #define GRAVE_ESC_CTRL_OVERRIDE

/*
 * Force NKRO
 *
 * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved
 * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the
 * makefile for this to work.)
 *
 * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N)
 * until the next keyboard reset.
 *
 * NKRO may prevent your keystrokes from being detected in the BIOS, but it is
 * fully operational during normal computer usage.
 *
 * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N)
 * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by
 * bootmagic, NKRO mode will always be enabled until it is toggled again during a
 * power-up.
 *
 */
//#define FORCE_NKRO
/*
 * Feature disable options
 *  These options are also useful to firmware size reduction.
 */

/* disable debug print */
//#define NO_DEBUG

/* disable print */
//#define NO_PRINT

/* disable action features */
//#define NO_ACTION_LAYER
//#define NO_ACTION_TAPPING
//#define NO_ACTION_ONESHOT

/* disable these deprecated features by default */
#define NO_ACTION_MACRO
#define NO_ACTION_FUNCTION

A keyboards/handwired/leftynumpad/info.json => keyboards/handwired/leftynumpad/info.json +36 -0
@@ 0,0 1,36 @@
{
    "keyboard_name": "LeftyNumpad",
    "url": "https://github.com/tomswartz07",
    "maintainer": "Tom Swartz",
    "width": 5,
    "height": 5,
    "layouts": {
        "LAYOUT": {
            "layout": [
                    {"label":"0,0", "x":0, "y":0},
                    {"label":"1,0", "x":1, "y":0},
                    {"label":"2,0", "x":2, "y":0},
                    {"label":"3,0", "x":3, "y":0},
                    {"label":"4,0", "x":4, "y":0},
                    {"label":"0,1", "x":0, "y":1},
                    {"label":"1,1", "x":1, "y":1},
                    {"label":"2,1", "x":2, "y":1},
                    {"label":"3,1", "x":3, "y":1},
                    {"label":"0,2", "x":0, "y":2},
                    {"label":"1,2", "x":1, "y":2},
                    {"label":"2,2", "x":2, "y":2},
                    {"label":"3,2", "x":3, "y":2},
                    {"label":"5,1", "x":4, "y":1, "h":2},
                    {"label":"0,3", "x":0, "y":3},
                    {"label":"1,3", "x":1, "y":3},
                    {"label":"2,3", "x":2, "y":3},
                    {"label":"3,3", "x":3, "y":3},
                    {"label":"0,4", "x":0, "y":4},
                    {"label":"1,4", "x":1, "y":4},
                    {"label":"2,4", "x":2, "y":4},
                    {"label":"3,4", "x":3, "y":4},
                    {"label":"4,3", "x":4, "y":3, "h":2}
            ]
        }
    }
}

A keyboards/handwired/leftynumpad/keymaps/default/keymap.c => keyboards/handwired/leftynumpad/keymaps/default/keymap.c +92 -0
@@ 0,0 1,92 @@
/* Copyright 2020 Tom Swartz
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#include QMK_KEYBOARD_H

// Defines names for use in layer keycodes and the keymap
enum layer_names {
    _NP,
    _FN
};

// Defines the keycodes used by our macros in process_record_user
enum custom_keycodes {
    KC_00 = SAFE_RANGE,
};

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* NumberPad Layer
    ,---------------------------------------.
    | Back  | Num   | /     | *     | -     |
    | Space | Lock  |       |       |       |
    |-------+-------+-------+-------+-------|
    | Tab   | 7     | 8     | 9     | +     |
    |       | Home  | Up    | PgUp  |       |
    |-------+-------+-------+-------|       |
    | Layer | 4     | 5     | 6     |       |
    | Toggle| Left  |       | Right |       |
    |-------+-------+-------+-------+-------|
    | Page  | 1     | 2     | 3     | Enter |
    | Up    | End   | Down  | PgDn  |       |
    |-------+-------+-------+-------|       |
    | Page  | 00    | 0     | .     |       |
    | Down  |       |       |       |       |
    `---------------------------------------'
*/
    [_NP] = LAYOUT(
        KC_BSPC,   KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS,
        KC_TAB,    KC_7,    KC_8,   KC_9,
        TG(_NP),   KC_4,    KC_5,   KC_6,    KC_PPLS,
        KC_PGUP,   KC_1,    KC_2,   KC_3,
        KC_PGDOWN, KC_00,   KC_0,   KC_PDOT, KC_PENT
    ),
/* Macropad/Function Layer
    ,---------------------------------------.
    | `~    | Play  | F13   | Prev  | Next  |
    |       | Pause |       |       |       |
    |-------+-------+-------+-------+-------|
    | Tab   | F14   | F15   | 9     | +     |
    |       |       |       | PgUp  |       |
    |-------+-------+-------+-------|       |
    | Layer | 4     | 5     | 6     |       |
    | Toggle| Left  |       | Right |       |
    |-------+-------+-------+-------+-------|
    | U     | B     | 2     | 3     | Enter |
    |       |       | Down  | PgDn  |       |
    |-------+-------+-------+-------|       |
    | D     | F     | 0     | .     |       |
    |       |       |       |       |       |
    `---------------------------------------'
*/
    [_FN] = LAYOUT(
        KC_GRV,  KC_MPLY, KC_F13,  KC_MPRV, KC_MNXT,
        _______, KC_F14,  KC_F15,  _______,
        _______, _______, _______, _______, _______,
        KC_U,    KC_B,    _______, _______,
        KC_D,    KC_F,    _______, _______, _______
    ),
};

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
    switch (keycode) {
        case KC_00:
            if (record->event.pressed) {
                // when keycode DOUBLEZERO is pressed
                SEND_STRING("00");
            }
            break;
    }
    return true;
}

A keyboards/handwired/leftynumpad/keymaps/default/readme.md => keyboards/handwired/leftynumpad/keymaps/default/readme.md +21 -0
@@ 0,0 1,21 @@
# The default keymap for LeftyNumpad

## Base Layer
```
    ,---------------------------------------.
    | Back  | Num   | /     | *     | -     |
    | Space | Lock  |       |       |       |
    |-------+-------+-------+-------+-------|
    | Layer | 7     | 8     | 9     | +     |
    | Up    | Home  | Up    | PgUp  |       |
    |-------+-------+-------+-------|       |
    | Layer | 4     | 5     | 6     |       |
    | Down  | Left  |       | Right |       |
    |-------+-------+-------+-------+-------|
    | Page  | 1     | 2     | 3     | Enter |
    | Up    | End   | Down  | PgDn  |       |
    |-------+-------+-------+-------|       |
    | Page  | 00    | 0     | .     |       |
    | Down  |       |       |       |       |
    `---------------------------------------'
```

A keyboards/handwired/leftynumpad/leftynumpad.c => keyboards/handwired/leftynumpad/leftynumpad.c +17 -0
@@ 0,0 1,17 @@
/* Copyright 2020 Tom Swartz
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include "leftynumpad.h"

A keyboards/handwired/leftynumpad/leftynumpad.h => keyboards/handwired/leftynumpad/leftynumpad.h +42 -0
@@ 0,0 1,42 @@
/* Copyright 2020 Tom Swartz
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#pragma once

#include "quantum.h"

/* This is a shortcut to help you visually see your layout.
 *
 * The first section contains all of the arguments representing the physical
 * layout of the board and position of the keys.
 *
 * The second converts the arguments into a two-dimensional array which
 * represents the switch matrix.
 */
#define LAYOUT( \
   K05,  K15,  K25,  K35,  K45,  \
   K04,  K14,  K24,  K34,        \
   K03,  K13,  K23,  K33,  K43,  \
   K02,  K12,  K22,  K32,        \
   K01,  K11,  K21,  K31,  K41   \
) \
{ \
 { K05,  K15,  K25,  K35,  K45 }, \
 { K04,  K14,  K24,  K34       }, \
 { K03,  K13,  K23,  K33,  K43 }, \
 { K02,  K12,  K22,  K32       }, \
 { K01,  K11,  K21,  K31,  K41 }  \
}

A keyboards/handwired/leftynumpad/readme.md => keyboards/handwired/leftynumpad/readme.md +16 -0
@@ 0,0 1,16 @@
# LeftyNumpad

![Image of LeftyNumpad](https://i.imgur.com/kkSPIxpl.png)

A small numberpad/macropad intended to be placed southpaw-style on the left
side of a keyboard.

* Keyboard Maintainer: [Tom Swartz](https://github.com/tomswartz07)
* Hardware Supported: Handwired, Uses Arudino Micro.
* Hardware Availability: Handwired hardware.

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

    make handwired/leftynumpad: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).

A keyboards/handwired/leftynumpad/rules.mk => keyboards/handwired/leftynumpad/rules.mk +22 -0
@@ 0,0 1,22 @@
# MCU name
MCU = atmega32u4

# Bootloader selection
BOOTLOADER = atmel-dfu

# Build Options
#   change yes to no to disable
#
BOOTMAGIC_ENABLE = lite     # Virtual DIP switch configuration
MOUSEKEY_ENABLE = yes       # Mouse keys
EXTRAKEY_ENABLE = yes       # Audio control and System control
CONSOLE_ENABLE = no         # Console for debug
COMMAND_ENABLE = no         # Commands for debug and configuration
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no       # Breathing sleep LED during USB suspend
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
NKRO_ENABLE = no            # USB Nkey Rollover
BACKLIGHT_ENABLE = no       # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no        # Enable keyboard RGB underglow
BLUETOOTH_ENABLE = no       # Enable Bluetooth
AUDIO_ENABLE = no           # Audio output