[Keyboard] Add hardwired Dactyl macropad (#18761)

Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
This commit is contained in:
bwprobably
2022-11-20 00:27:10 -08:00
committed by GitHub
parent f0454c9682
commit 0420a74d4c
8 changed files with 282 additions and 0 deletions

View File

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

View File

@@ -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 }
]
}
}
}

View File

@@ -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;
}
}
}

View File

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

View File

@@ -0,0 +1 @@
# This file intentionally left blank