From 0420a74d4cbcde4881b2fa08862dad825a60d5e7 Mon Sep 17 00:00:00 2001 From: bwprobably Date: Sun, 20 Nov 2022 00:27:10 -0800 Subject: [Keyboard] Add hardwired Dactyl macropad (#18761) Co-authored-by: Drashna Jaelre Co-authored-by: Ryan --- keyboards/handwired/dactylmacropad/config.h | 25 +++++ keyboards/handwired/dactylmacropad/info.json | 45 ++++++++ .../dactylmacropad/keymaps/default/keymap.c | 123 +++++++++++++++++++++ keyboards/handwired/dactylmacropad/readme.md | 26 +++++ keyboards/handwired/dactylmacropad/rules.mk | 1 + 5 files changed, 220 insertions(+) create mode 100644 keyboards/handwired/dactylmacropad/config.h create mode 100644 keyboards/handwired/dactylmacropad/info.json create mode 100644 keyboards/handwired/dactylmacropad/keymaps/default/keymap.c create mode 100644 keyboards/handwired/dactylmacropad/readme.md create mode 100644 keyboards/handwired/dactylmacropad/rules.mk (limited to 'keyboards/handwired') diff --git a/keyboards/handwired/dactylmacropad/config.h b/keyboards/handwired/dactylmacropad/config.h new file mode 100644 index 0000000000..e69ceac331 --- /dev/null +++ b/keyboards/handwired/dactylmacropad/config.h @@ -0,0 +1,25 @@ +// Copyright 2022 bwprobably +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +/* + * 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 + +#define ENCODERS_PAD_A { D1 } +#define ENCODERS_PAD_B { D0 } +#define ENCODER_RESOLUTION 4 +#define TAP_CODE_DELAY 100 diff --git a/keyboards/handwired/dactylmacropad/info.json b/keyboards/handwired/dactylmacropad/info.json new file mode 100644 index 0000000000..b56174caa2 --- /dev/null +++ b/keyboards/handwired/dactylmacropad/info.json @@ -0,0 +1,45 @@ +{ + "manufacturer": "bwprobably", + "keyboard_name": "DactylMacropad", + "maintainer": "bwprobably", + "bootloader": "atmel-dfu", + "diode_direction": "COL2ROW", + "features": { + "bootmagic": true, + "command": false, + "console": false, + "extrakey": true, + "mousekey": true, + "nkro": true, + "encoder":true + }, + "matrix_pins": { + "cols": ["F7", "B1", "B3", "B2", "B6"], + "rows": ["F6", "B4", "B5"] + }, + "processor": "atmega32u4", + "usb": { + "device_version": "1.0.0", + "pid": "0x0000", + "vid": "0xFEED" + }, + "layouts": { + "LAYOUT": { + "layout": [ + { "matrix": [0, 0], "x": 0, "y": 0 }, + { "matrix": [0, 1], "x": 1, "y": 0 }, + { "matrix": [0, 2], "x": 2, "y": 0 }, + { "matrix": [0, 3], "x": 3, "y": 0 }, + { "matrix": [1, 0], "x": 0, "y": 1 }, + { "matrix": [1, 1], "x": 1, "y": 1 }, + { "matrix": [1, 2], "x": 2, "y": 1 }, + { "matrix": [1, 3], "x": 3, "y": 1 }, + { "matrix": [2, 0], "x": 0, "y": 2 }, + { "matrix": [2, 1], "x": 1, "y": 2 }, + { "matrix": [2, 2], "x": 2, "y": 2 }, + { "matrix": [2, 3], "x": 3, "y": 2 }, + { "matrix": [2, 4], "x": 4, "y": 2 } + ] + } + } +} diff --git a/keyboards/handwired/dactylmacropad/keymaps/default/keymap.c b/keyboards/handwired/dactylmacropad/keymaps/default/keymap.c new file mode 100644 index 0000000000..468d944935 --- /dev/null +++ b/keyboards/handwired/dactylmacropad/keymaps/default/keymap.c @@ -0,0 +1,123 @@ +// Copyright 2022 bwprobably +// SPDX-License-Identifier: GPL-2.0-or-later + +#include QMK_KEYBOARD_H + +bool is_alt_tab_active = false; +uint16_t alt_tab_timer = 0; + +enum layer_names { + _BASE, + _MTG, + _MAC +}; + +enum custom_keycodes { + pvt = SAFE_RANGE, + snap, + ALT_TAB +}; + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* + * ┌───┬───┬───┬───┐ + * │pvt│pst│ up│cpy│ + * ├───┼───┼───┤───│ + * │sft│ lf│ dn│rt │ + * ├───┼───┼───┼───┤───┤ + * │[1]│ctr│wtb│app│bt3│ + * ├───┴───┼───┤───│───│ + */ + [_BASE] = LAYOUT + (pvt, LCTL(KC_V), KC_UP, LCTL(KC_C), + LSFT_T(KC_ESC), KC_LEFT, KC_DOWN, KC_RGHT, + TO(1), KC_LCTL, ALT_TAB, KC_APP, KC_BTN3), + /* + * ┌────┬────┬────┬────┐ + * │mte │ BI │ up │pgu │ + * ├────┼────┼────┤────│ + * │snp │ lf │ dn │ rt │ + * ├────┼────┼────┼────┤───┤ + * │[1] │mut │min │pgd │ply│ + * ├────┴────┼────┤────│───│ + */ + [_MTG] = LAYOUT ( + LCTL(LSFT(KC_H)), LCTL(KC_F6), KC_TRNS, KC_PGUP, + snap, KC_TRNS, KC_TRNS, KC_TRNS, + TO(2), KC_MUTE, LGUI(KC_M), KC_PGDN, KC_MPLY), + /* + * ┌────┬────┬────┬────┐ + * │sdbr│past│ up │ cpy│ + * ├────┼────┼────┤────│ + * │snp │ lf │ dn │ rt │ + * ├────┼────┼────┤─────│────┤ + * │[1] |qkfl│ min│focus│ ply│ + * ├────┴────┼────┤─────│────│ + */ + [_MAC] = LAYOUT ( + LSFT(LGUI(KC_L)), LGUI(KC_V), KC_TRNS, LGUI(KC_C), + LGUI(LCTL(LSFT(KC_4))), KC_TRNS, KC_TRNS, KC_TRNS, + TO(0), LSFT(LGUI(KC_O)), LCTL(LALT(KC_F3)), LCTL(LSFT(KC_1)), KC_TRNS) +}; + + +bool encoder_update_user(uint8_t index, bool clockwise) { + if (IS_LAYER_ON(_MTG)) { + if (clockwise) { + tap_code(KC_VOLU); + } else { + tap_code16(S(KC_VOLD)); + } + } else { + if (clockwise) { + tap_code(KC_WH_D); + } else { + tap_code(KC_WH_U); + } + } + return false; + } + + + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case pvt: + if (record->event.pressed) { + // creates pivot table in excel + SEND_STRING(SS_LALT("nvt")); + } else { + // when keycode QMKBEST is released + } + break; + case snap: + if (record->event.pressed) { + SEND_STRING(SS_TAP(X_LGUI)SS_DELAY(500)"snip"SS_DELAY(500)SS_TAP(X_ENTER)SS_LALT("n")); // opens snipping and creates new snip + } + break; + + case ALT_TAB: + if (record->event.pressed) { + if (!is_alt_tab_active) { + is_alt_tab_active = true; + register_code(KC_LALT); + } + alt_tab_timer = timer_read(); + register_code(KC_TAB); + } else { + unregister_code(KC_TAB); + } + break; + } + return true; +} + +void housekeeping_task_user(void) { + if (is_alt_tab_active) { + if (timer_elapsed(alt_tab_timer) > 1000) { + unregister_code(KC_LALT); + is_alt_tab_active = false; + } + } +} diff --git a/keyboards/handwired/dactylmacropad/readme.md b/keyboards/handwired/dactylmacropad/readme.md new file mode 100644 index 0000000000..97c6fdebd7 --- /dev/null +++ b/keyboards/handwired/dactylmacropad/readme.md @@ -0,0 +1,26 @@ +# DactylMacropad + +[Glamour shot](https://i.imgur.com/ONvbIbmh.jpg) + +* Keyboard Maintainer: [bwprobably](https://github.com/bwprobably) +* Hardware Supported: ProMicro (Atmega32U4), EC11 Rotary Encoder +* Hardware Availability: [Example Encoder](https://www.amazon.com/dp/B07D3DF8TK/) +[ProMicro](https://www.sparkfun.com/products/12640) + +Make example for this keyboard (after setting up your build environment): + + make default:default + +Flashing example for this keyboard: + + make default: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 3 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 press the button on the back of the PCB - some may have pads you must short instead +* **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available diff --git a/keyboards/handwired/dactylmacropad/rules.mk b/keyboards/handwired/dactylmacropad/rules.mk new file mode 100644 index 0000000000..6e7633bfe0 --- /dev/null +++ b/keyboards/handwired/dactylmacropad/rules.mk @@ -0,0 +1 @@ +# This file intentionally left blank -- cgit v1.2.3