From ee6c86d8e91437f47f904b5af49a63b749b57bf0 Mon Sep 17 00:00:00 2001 From: Tom Swartz Date: Wed, 7 Oct 2020 18:35:42 -0400 Subject: [PATCH] [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 * Update keyboards/handwired/leftynumpad/config.h Co-authored-by: Joel Challis * Apply suggestions from code review Co-authored-by: Joel Challis * Apply suggestions from code review Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com> Co-authored-by: Ryan * Add fixes based on PR feedback * Update keyboards/handwired/leftynumpad/readme.md Co-authored-by: Ryan Co-authored-by: Joel Challis Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com> Co-authored-by: Ryan --- keyboards/handwired/leftynumpad/config.h | 102 ++++++++++++++++++ keyboards/handwired/leftynumpad/info.json | 36 +++++++ .../leftynumpad/keymaps/default/keymap.c | 92 ++++++++++++++++ .../leftynumpad/keymaps/default/readme.md | 21 ++++ keyboards/handwired/leftynumpad/leftynumpad.c | 17 +++ keyboards/handwired/leftynumpad/leftynumpad.h | 42 ++++++++ keyboards/handwired/leftynumpad/readme.md | 16 +++ keyboards/handwired/leftynumpad/rules.mk | 22 ++++ 8 files changed, 348 insertions(+) create mode 100644 keyboards/handwired/leftynumpad/config.h create mode 100644 keyboards/handwired/leftynumpad/info.json create mode 100644 keyboards/handwired/leftynumpad/keymaps/default/keymap.c create mode 100644 keyboards/handwired/leftynumpad/keymaps/default/readme.md create mode 100644 keyboards/handwired/leftynumpad/leftynumpad.c create mode 100644 keyboards/handwired/leftynumpad/leftynumpad.h create mode 100644 keyboards/handwired/leftynumpad/readme.md create mode 100644 keyboards/handwired/leftynumpad/rules.mk diff --git a/keyboards/handwired/leftynumpad/config.h b/keyboards/handwired/leftynumpad/config.h new file mode 100644 index 0000000000..9059bfe760 --- /dev/null +++ b/keyboards/handwired/leftynumpad/config.h @@ -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 . +*/ + +#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 diff --git a/keyboards/handwired/leftynumpad/info.json b/keyboards/handwired/leftynumpad/info.json new file mode 100644 index 0000000000..9dab764304 --- /dev/null +++ b/keyboards/handwired/leftynumpad/info.json @@ -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} + ] + } + } +} diff --git a/keyboards/handwired/leftynumpad/keymaps/default/keymap.c b/keyboards/handwired/leftynumpad/keymaps/default/keymap.c new file mode 100644 index 0000000000..d75e42211f --- /dev/null +++ b/keyboards/handwired/leftynumpad/keymaps/default/keymap.c @@ -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 . + */ +#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; +} diff --git a/keyboards/handwired/leftynumpad/keymaps/default/readme.md b/keyboards/handwired/leftynumpad/keymaps/default/readme.md new file mode 100644 index 0000000000..107395ebb0 --- /dev/null +++ b/keyboards/handwired/leftynumpad/keymaps/default/readme.md @@ -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 | | | | | + `---------------------------------------' +``` diff --git a/keyboards/handwired/leftynumpad/leftynumpad.c b/keyboards/handwired/leftynumpad/leftynumpad.c new file mode 100644 index 0000000000..195ec78289 --- /dev/null +++ b/keyboards/handwired/leftynumpad/leftynumpad.c @@ -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 . + */ + +#include "leftynumpad.h" diff --git a/keyboards/handwired/leftynumpad/leftynumpad.h b/keyboards/handwired/leftynumpad/leftynumpad.h new file mode 100644 index 0000000000..7f3ebb8441 --- /dev/null +++ b/keyboards/handwired/leftynumpad/leftynumpad.h @@ -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 . + */ + +#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 } \ +} diff --git a/keyboards/handwired/leftynumpad/readme.md b/keyboards/handwired/leftynumpad/readme.md new file mode 100644 index 0000000000..4446bf2964 --- /dev/null +++ b/keyboards/handwired/leftynumpad/readme.md @@ -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). diff --git a/keyboards/handwired/leftynumpad/rules.mk b/keyboards/handwired/leftynumpad/rules.mk new file mode 100644 index 0000000000..5c0d8f307c --- /dev/null +++ b/keyboards/handwired/leftynumpad/rules.mk @@ -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