From 6125f7bf4d15b4ab9403186a5282bb75bc00bd07 Mon Sep 17 00:00:00 2001 From: Joshua Barber Date: Sun, 20 Mar 2022 17:02:46 +0000 Subject: [PATCH] Add MutePad keyboard (Handwired) (#16590) * Add MutePad keyboard * Update info.json and readme * Move mutepad to handwired folder * Address PR comments --- keyboards/handwired/mutepad/config.h | 90 +++++++++++++++++++ keyboards/handwired/mutepad/info.json | 15 ++++ .../mutepad/keymaps/default/keymap.c | 43 +++++++++ .../mutepad/keymaps/default/readme.md | 1 + keyboards/handwired/mutepad/mutepad.c | 4 + keyboards/handwired/mutepad/mutepad.h | 19 ++++ keyboards/handwired/mutepad/readme.md | 33 +++++++ keyboards/handwired/mutepad/rules.mk | 19 ++++ 8 files changed, 224 insertions(+) create mode 100644 keyboards/handwired/mutepad/config.h create mode 100644 keyboards/handwired/mutepad/info.json create mode 100644 keyboards/handwired/mutepad/keymaps/default/keymap.c create mode 100644 keyboards/handwired/mutepad/keymaps/default/readme.md create mode 100644 keyboards/handwired/mutepad/mutepad.c create mode 100644 keyboards/handwired/mutepad/mutepad.h create mode 100644 keyboards/handwired/mutepad/readme.md create mode 100644 keyboards/handwired/mutepad/rules.mk diff --git a/keyboards/handwired/mutepad/config.h b/keyboards/handwired/mutepad/config.h new file mode 100644 index 0000000000..7113063223 --- /dev/null +++ b/keyboards/handwired/mutepad/config.h @@ -0,0 +1,90 @@ +// Copyright 2022 JoshwJB (@JoshwJB) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x0000 +#define DEVICE_VER 0x0001 +#define MANUFACTURER JoshwJB +#define PRODUCT MutePad + +/* key matrix size */ +#define MATRIX_ROWS 1 +#define MATRIX_COLS 4 + +/* + * 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 \ + { F6 } +#define MATRIX_COL_PINS \ + { B1, B3, B2, B6 } +#define UNUSED_PINS + +/* encoder support */ +#define ENCODERS_PAD_A \ + { F4 } +#define ENCODERS_PAD_B \ + { F5 } + +#define ENCODER_RESOLUTION 2 + +#define TAP_CODE_DELAY 10 + +/* COL2ROW, ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCE 5 + +/* 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 + +/* + * 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 + +/* Bootmagic Lite key configuration */ +#define BOOTMAGIC_LITE_ROW 0 +#define BOOTMAGIC_LITE_COLUMN 0 diff --git a/keyboards/handwired/mutepad/info.json b/keyboards/handwired/mutepad/info.json new file mode 100644 index 0000000000..b4a75a10e2 --- /dev/null +++ b/keyboards/handwired/mutepad/info.json @@ -0,0 +1,15 @@ +{ + "keyboard_name": "MutePad", + "url": "https://github.com/JoshwJB/MutePad", + "maintainer": "JoshwJB", + "layouts": { + "LAYOUT": { + "layout": [ + {"label": "k00", "x": 0, "y": 0}, + {"label": "k01", "x": 1, "y": 0}, + {"label": "k02", "x": 2, "y": 0}, + {"label": "k03", "x": 3, "y": 0}, + ] + } + } +} diff --git a/keyboards/handwired/mutepad/keymaps/default/keymap.c b/keyboards/handwired/mutepad/keymaps/default/keymap.c new file mode 100644 index 0000000000..d26e230e53 --- /dev/null +++ b/keyboards/handwired/mutepad/keymaps/default/keymap.c @@ -0,0 +1,43 @@ +// Copyright 2022 Joshua Barber (@JoshwJB) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include QMK_KEYBOARD_H + +// Defines names for use in layer keycodes and the keymap +enum layer_names { _BASE }; + +enum custom_keycodes { MUTE_GOOGLE_MEET = 0, MUTE_TEAMS = 1 }; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case MUTE_GOOGLE_MEET: + if (record->event.pressed) { + tap_code16(G(KC_D)); + } + break; + case MUTE_TEAMS: + if (record->event.pressed) { + tap_code16(C(S(KC_M))); + } + break; + } + + return true; +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Base */ + [_BASE] = LAYOUT(MUTE_TEAMS, KC_F23, KC_F24, KC_MPLY)}; + +#ifdef ENCODER_ENABLE + +bool encoder_update_user(uint8_t index, bool clockwise) { + if (clockwise) { + tap_code(KC_VOLU); + } else { + tap_code(KC_VOLD); + } + return true; +} + +#endif diff --git a/keyboards/handwired/mutepad/keymaps/default/readme.md b/keyboards/handwired/mutepad/keymaps/default/readme.md new file mode 100644 index 0000000000..c3c9ec6aec --- /dev/null +++ b/keyboards/handwired/mutepad/keymaps/default/readme.md @@ -0,0 +1 @@ +# The default keymap for MutePad diff --git a/keyboards/handwired/mutepad/mutepad.c b/keyboards/handwired/mutepad/mutepad.c new file mode 100644 index 0000000000..09210c3f4f --- /dev/null +++ b/keyboards/handwired/mutepad/mutepad.c @@ -0,0 +1,4 @@ +// Copyright 2022 JoshwJB (@JoshwJB) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "mutepad.h" diff --git a/keyboards/handwired/mutepad/mutepad.h b/keyboards/handwired/mutepad/mutepad.h new file mode 100644 index 0000000000..57c317cb60 --- /dev/null +++ b/keyboards/handwired/mutepad/mutepad.h @@ -0,0 +1,19 @@ +// Copyright 2022 JoshwJB (@JoshwJB) +// SPDX-License-Identifier: GPL-2.0-or-later + +#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(K00, K01, K02, K03) \ + { \ + { K00, K01, K02, K03 } \ + } diff --git a/keyboards/handwired/mutepad/readme.md b/keyboards/handwired/mutepad/readme.md new file mode 100644 index 0000000000..cbd1c9f316 --- /dev/null +++ b/keyboards/handwired/mutepad/readme.md @@ -0,0 +1,33 @@ +# MutePad + +[MutePad Repo](https://github.com/JoshwJB/MutePad) + +A 3D printed under desk mounted keypad with rotary encoder, for muting applications (discord, zoom etc.) and adjusting volume. + +* Keyboard Maintainer: [JoshwJB](https://github.com/JoshwJB) +* Hardware Supported: ProMicro +* Hardware Availability: Handwired - see [MutePad Repo](https://github.com/JoshwJB/MutePad) + +Make example for this keyboard (after setting up your build environment): + + make handwired/mutepad:default + +Flashing example for this keyboard: + + make handwired/mutepad:default:flash + +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 2 ways: + +* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard +* **Physical reset button**: Briefly short the ground and reset on the ProMicro + +## Images +![image](https://user-images.githubusercontent.com/15612025/157335123-a76ce059-86b4-4484-9bb2-0abff8a13cc8.png) + +### Wiring +![image](https://user-images.githubusercontent.com/15612025/157336673-ad348e3d-4314-4703-afe0-a43a6f73b892.png) +![image](https://user-images.githubusercontent.com/15612025/157335150-8491553f-a7dc-462a-a6af-bc4be223b703.png) diff --git a/keyboards/handwired/mutepad/rules.mk b/keyboards/handwired/mutepad/rules.mk new file mode 100644 index 0000000000..1a63bd74b1 --- /dev/null +++ b/keyboards/handwired/mutepad/rules.mk @@ -0,0 +1,19 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +BOOTLOADER = caterina + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite +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 +NKRO_ENABLE = yes # Enable N-Key Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +AUDIO_ENABLE = no # Audio output +ENCODER_ENABLE = yes