aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxiao <307671+xia0@users.noreply.github.com>2022-02-21 19:40:11 +1100
committerGitHub <noreply@github.com>2022-02-21 00:40:11 -0800
commit18490537a5a2c050ecfa1ee2209229eba6b8b342 (patch)
tree89777cc3cba6d5f9a3d3a77bce6c30408f4dca0d
parent2d1f2810a41b8a93c21035b14afacb717ef7c822 (diff)
downloadqmk_firmware-18490537a5a2c050ecfa1ee2209229eba6b8b342.tar.gz
qmk_firmware-18490537a5a2c050ecfa1ee2209229eba6b8b342.zip
[Keyboard] Add Snatchpad keyboard (#16330)
Co-authored-by: Drashna Jaelre <drashna@live.com> Co-authored-by: Ryan <fauxpark@gmail.com> Co-authored-by: xia0 <xiao@morgan.net.au>
-rw-r--r--keyboards/handwired/snatchpad/config.h145
-rw-r--r--keyboards/handwired/snatchpad/info.json21
-rw-r--r--keyboards/handwired/snatchpad/keymaps/default/keymap.c23
-rw-r--r--keyboards/handwired/snatchpad/keymaps/default/readme.md1
-rw-r--r--keyboards/handwired/snatchpad/readme.md34
-rw-r--r--keyboards/handwired/snatchpad/rules.mk20
-rw-r--r--keyboards/handwired/snatchpad/snatchpad.c66
-rw-r--r--keyboards/handwired/snatchpad/snatchpad.h24
8 files changed, 334 insertions, 0 deletions
diff --git a/keyboards/handwired/snatchpad/config.h b/keyboards/handwired/snatchpad/config.h
new file mode 100644
index 000000000..c0d337d5d
--- /dev/null
+++ b/keyboards/handwired/snatchpad/config.h
@@ -0,0 +1,145 @@
1// Copyright 2022 xia0 (@xia0)
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#pragma once
5
6#include "config_common.h"
7
8/* USB Device descriptor parameter */
9#define VENDOR_ID 0x6662
10#define PRODUCT_ID 0x7370
11#define DEVICE_VER 0x0001
12#define MANUFACTURER xia0
13#define PRODUCT snatchpad
14
15/* key matrix size */
16#define MATRIX_ROWS 3
17#define MATRIX_COLS 3
18
19/*
20 * Keyboard Matrix Assignments
21 *
22 * Change this to how you wired your keyboards
23 * COLS: AVR pins used for columns, left to right
24 * ROWS: AVR pins used for rows, top to bottom
25 * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
26 * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
27 *
28 */
29#define MATRIX_ROW_PINS { F4, F5, F6 }
30#define MATRIX_COL_PINS { B1, B3, B2 }
31#define UNUSED_PINS
32
33/* COL2ROW, ROW2COL */
34#define DIODE_DIRECTION COL2ROW
35
36/* Rotary encoder options */
37#define ENCODER_RESOLUTIONS { 4, 4 }
38#define ENCODERS_PAD_A { D3, D0 }
39#define ENCODERS_PAD_B { D2, D1 }
40
41
42
43/*
44 * Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk, and define SOFT_SERIAL_PIN.
45 */
46//#define SOFT_SERIAL_PIN D0 // or D1, D2, D3, E6
47
48//#define LED_NUM_LOCK_PIN B0
49//#define LED_CAPS_LOCK_PIN B1
50//#define LED_SCROLL_LOCK_PIN B2
51//#define LED_COMPOSE_PIN B3
52//#define LED_KANA_PIN B4
53
54//#define BACKLIGHT_PIN B7
55//#define BACKLIGHT_LEVELS 3
56//#define BACKLIGHT_BREATHING
57
58//#define RGB_DI_PIN E2
59//#ifdef RGB_DI_PIN
60//# define RGBLED_NUM 16
61//# define RGBLIGHT_HUE_STEP 8
62//# define RGBLIGHT_SAT_STEP 8
63//# define RGBLIGHT_VAL_STEP 8
64//# define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */
65//# define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */
66/*== all animations enable ==*/
67//# define RGBLIGHT_ANIMATIONS
68/*== or choose animations ==*/
69//# define RGBLIGHT_EFFECT_BREATHING
70//# define RGBLIGHT_EFFECT_RAINBOW_MOOD
71//# define RGBLIGHT_EFFECT_RAINBOW_SWIRL
72//# define RGBLIGHT_EFFECT_SNAKE
73//# define RGBLIGHT_EFFECT_KNIGHT
74//# define RGBLIGHT_EFFECT_CHRISTMAS
75//# define RGBLIGHT_EFFECT_STATIC_GRADIENT
76//# define RGBLIGHT_EFFECT_RGB_TEST
77//# define RGBLIGHT_EFFECT_ALTERNATING
78/*== customize breathing effect ==*/
79/*==== (DEFAULT) use fixed table instead of exp() and sin() ====*/
80//# define RGBLIGHT_BREATHE_TABLE_SIZE 256 // 256(default) or 128 or 64
81/*==== use exp() and sin() ====*/
82//# define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 // 1 to 2.7
83//# define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0 to 255
84//#endif
85
86/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
87#define DEBOUNCE 5
88
89/* define if matrix has ghost (lacks anti-ghosting diodes) */
90//#define MATRIX_HAS_GHOST
91
92/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
93#define LOCKING_SUPPORT_ENABLE
94/* Locking resynchronize hack */
95#define LOCKING_RESYNC_ENABLE
96
97/* If defined, GRAVE_ESC will always act as ESC when CTRL is held.
98 * This is useful for the Windows task manager shortcut (ctrl+shift+esc).
99 */
100//#define GRAVE_ESC_CTRL_OVERRIDE
101
102/*
103 * Force NKRO
104 *
105 * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved
106 * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the
107 * makefile for this to work.)
108 *
109 * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N)
110 * until the next keyboard reset.
111 *
112 * NKRO may prevent your keystrokes from being detected in the BIOS, but it is
113 * fully operational during normal computer usage.
114 *
115 * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N)
116 * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by
117 * bootmagic, NKRO mode will always be enabled until it is toggled again during a
118 * power-up.
119 *
120 */
121//#define FORCE_NKRO
122
123/*
124 * Feature disable options
125 * These options are also useful to firmware size reduction.
126 */
127
128/* disable debug print */
129//#define NO_DEBUG
130
131/* disable print */
132//#define NO_PRINT
133
134/* disable action features */
135//#define NO_ACTION_LAYER
136//#define NO_ACTION_TAPPING
137//#define NO_ACTION_ONESHOT
138
139/* disable these deprecated features by default */
140#define NO_ACTION_MACRO
141#define NO_ACTION_FUNCTION
142
143/* Bootmagic Lite key configuration */
144//#define BOOTMAGIC_LITE_ROW 0
145//#define BOOTMAGIC_LITE_COLUMN 0
diff --git a/keyboards/handwired/snatchpad/info.json b/keyboards/handwired/snatchpad/info.json
new file mode 100644
index 000000000..c1d193cfe
--- /dev/null
+++ b/keyboards/handwired/snatchpad/info.json
@@ -0,0 +1,21 @@
1{
2 "keyboard_name": "snatchpad",
3 "url": "",
4 "maintainer": "xia0",
5 "layouts": {
6 "LAYOUT": {
7 "layout": [
8 {"x": 0, "y": 0},
9 {"x": 1, "y": 0},
10 {"x": 2, "y": 0},
11
12 {"x": 0, "y": 1},
13 {"x": 1, "y": 1},
14 {"x": 2, "y": 1},
15
16 {"x": 0, "y": 1},
17 {"x": 2, "y": 1}
18 ]
19 }
20 }
21}
diff --git a/keyboards/handwired/snatchpad/keymaps/default/keymap.c b/keyboards/handwired/snatchpad/keymaps/default/keymap.c
new file mode 100644
index 000000000..a473d4778
--- /dev/null
+++ b/keyboards/handwired/snatchpad/keymaps/default/keymap.c
@@ -0,0 +1,23 @@
1// Copyright 2022 xia0 (@xia0)
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#include QMK_KEYBOARD_H
5
6const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
7 [0] = LAYOUT(
8 KC_ESC , KC_SPC , MO(2) ,
9 KC_MPRV, KC_MNXT, KC_ENT ,
10 KC_MUTE, KC_MPLY
11 ),
12 [1] = LAYOUT(
13 KC_LOCK, KC_UP , _______,
14 KC_LEFT, KC_DOWN, KC_RGHT,
15 KC_BTN1, KC_BTN2
16 ),
17 [2] = LAYOUT(
18 _______, _______, _______,
19 _______, _______, _______,
20 TO(0) , TO(1)
21 )
22};
23
diff --git a/keyboards/handwired/snatchpad/keymaps/default/readme.md b/keyboards/handwired/snatchpad/keymaps/default/readme.md
new file mode 100644
index 000000000..11c0c781c
--- /dev/null
+++ b/keyboards/handwired/snatchpad/keymaps/default/readme.md
@@ -0,0 +1 @@
# The default keymap for snatchpad
diff --git a/keyboards/handwired/snatchpad/readme.md b/keyboards/handwired/snatchpad/readme.md
new file mode 100644
index 000000000..98021cc6b
--- /dev/null
+++ b/keyboards/handwired/snatchpad/readme.md
@@ -0,0 +1,34 @@
1# snatchpad
2
3![snatchpad etch-a-sketch macropad](https://i.imgur.com/aRIM8Nah.jpg)
4
5A 6-key macropad with 2 rotary encoders intended for use as a pointing device.
6
7In addition to the 3d printed parts and microcontroller, the following hardware is required:
8* 4 * 3x3 mm threaded inserts
9* 4 * 4mm M3 bolt
10* USB daughter board
11
12---
13
14* Keyboard Maintainer: [xia0](https://github.com/xia0)
15* Hardware Supported: e.g. Arduino Pro Micro
16* Hardware Availability: [github](https://github.com/xia0/keeb_files/tree/main/snatchpad)
17
18Make example for this keyboard (after setting up your build environment):
19
20 make handwired/snatchpad:default
21
22Flashing example for this keyboard:
23
24 make handwired/snatchpad:default:flash
25
26See 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).
27
28## Bootloader
29
30Enter the bootloader in 3 ways:
31
32* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard
33* **Physical reset button**: Briefly press the button on the back of the PCB - some may have pads you must short instead
34* **Keycode in layout**: Press the key mapped to `RESET` if it is available
diff --git a/keyboards/handwired/snatchpad/rules.mk b/keyboards/handwired/snatchpad/rules.mk
new file mode 100644
index 000000000..7c73773c0
--- /dev/null
+++ b/keyboards/handwired/snatchpad/rules.mk
@@ -0,0 +1,20 @@
1# MCU name
2MCU = atmega32u4
3
4# Bootloader selection
5BOOTLOADER = atmel-dfu
6
7# Build Options
8# change yes to no to disable
9#
10BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
11MOUSEKEY_ENABLE = yes # Mouse keys
12EXTRAKEY_ENABLE = yes # Audio control and System control
13CONSOLE_ENABLE = no # Console for debug
14COMMAND_ENABLE = no # Commands for debug and configuration
15NKRO_ENABLE = yes # Enable N-Key Rollover
16BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
17RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
18AUDIO_ENABLE = no # Audio output
19KEY_LOCK_ENABLE = yes
20ENCODER_ENABLE = yes
diff --git a/keyboards/handwired/snatchpad/snatchpad.c b/keyboards/handwired/snatchpad/snatchpad.c
new file mode 100644
index 000000000..621ba1112
--- /dev/null
+++ b/keyboards/handwired/snatchpad/snatchpad.c
@@ -0,0 +1,66 @@
1// Copyright 2022 xia0 (@xia0)
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#include "snatchpad.h"
5
6#ifdef ENCODER_ENABLE
7bool encoder_update_kb(uint8_t index, bool clockwise) {
8 if (!encoder_update_user(index, clockwise)) {
9 return false;
10 }
11
12 uint8_t layer = get_highest_layer(layer_state);
13
14 if (index == 0) { /* First encoder */
15 switch (layer) {
16 case 0:
17 if (clockwise) {
18 tap_code_delay(KC_VOLU, 10);
19 } else {
20 tap_code_delay(KC_VOLD, 10);
21 }
22 break;
23 case 2:
24 if (clockwise) {
25 tap_code16(LCTL(KC_MINUS));
26 } else {
27 tap_code16(LCTL(KC_EQUAL));
28 }
29 break;
30 default:
31 if (clockwise) {
32 tap_code(KC_MS_L);
33 } else {
34 tap_code(KC_MS_R);
35 }
36 break;
37 }
38
39 } else if (index == 1) { /* Second encoder */
40 switch (layer) {
41 case 0:
42 if (clockwise) {
43 tap_code(KC_MFFD);
44 } else {
45 tap_code(KC_MRWD);
46 }
47 break;
48 case 2:
49 if (clockwise) {
50 tap_code16(LCTL(KC_Y));
51 } else {
52 tap_code16(LCTL(KC_Z));
53 }
54 break;
55 default:
56 if (clockwise) {
57 tap_code(KC_MS_D);
58 } else {
59 tap_code(KC_MS_U);
60 }
61 break;
62 }
63 }
64 return true;
65}
66#endif
diff --git a/keyboards/handwired/snatchpad/snatchpad.h b/keyboards/handwired/snatchpad/snatchpad.h
new file mode 100644
index 000000000..07d6bd209
--- /dev/null
+++ b/keyboards/handwired/snatchpad/snatchpad.h
@@ -0,0 +1,24 @@
1// Copyright 2022 xia0 (@xia0)
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#pragma once
5
6#include "quantum.h"
7
8/* This is a shortcut to help you visually see your layout.
9 *
10 * The first section contains all of the arguments representing the physical
11 * layout of the board and position of the keys.
12 *
13 * The second converts the arguments into a two-dimensional array which
14 * represents the switch matrix.
15 */
16#define LAYOUT( \
17 k00, k01, k02, \
18 k10, k11, k12, \
19 k20, k22 \
20) { \
21 { k00 , k01 , k02 }, \
22 { k10 , k11 , k12 }, \
23 { k20 , KC_NO , k22 } \
24}