aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrookiebwoy <81021475+rookiebwoy@users.noreply.github.com>2021-05-15 05:09:10 +0200
committerGitHub <noreply@github.com>2021-05-14 20:09:10 -0700
commitb057194568270ce379d1900b2567052d565ce1dd (patch)
tree931f1ebd4379452ad0dbce5849266c82fa9c29a1
parent83be6ba472bd8cba9dc8102c193ed9d2b6546799 (diff)
downloadqmk_firmware-b057194568270ce379d1900b2567052d565ce1dd.tar.gz
qmk_firmware-b057194568270ce379d1900b2567052d565ce1dd.zip
[Keyboard] Add Neopad macropad (#12614)
-rwxr-xr-xkeyboards/neopad/config.h34
-rw-r--r--keyboards/neopad/readme.md25
-rwxr-xr-xkeyboards/neopad/rev1/config.h41
-rwxr-xr-xkeyboards/neopad/rev1/info.json16
-rwxr-xr-xkeyboards/neopad/rev1/keymaps/default/keymap.c153
-rw-r--r--keyboards/neopad/rev1/readme.md5
-rwxr-xr-xkeyboards/neopad/rev1/rev1.c61
-rwxr-xr-xkeyboards/neopad/rev1/rev1.h26
-rwxr-xr-xkeyboards/neopad/rev1/rules.mk25
-rwxr-xr-xkeyboards/neopad/rules.mk1
10 files changed, 387 insertions, 0 deletions
diff --git a/keyboards/neopad/config.h b/keyboards/neopad/config.h
new file mode 100755
index 000000000..79798b1d6
--- /dev/null
+++ b/keyboards/neopad/config.h
@@ -0,0 +1,34 @@
1/*
2Copyright 2021 rookiebwoy
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17#pragma once
18
19#include "config_common.h"
20
21/* USB Device descriptor parameter */
22#define VENDOR_ID 0xFEED
23#define PRODUCT_ID 0x0913
24#define MANUFACTURER rookiebwoy
25#define PRODUCT neopad
26
27/* Column/Row IO definitions */
28#define DIODE_DIRECTION COL2ROW
29
30/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
31#define DEBOUNCE 5
32
33/* Reduce tapdance required taps from 5 to 2 */
34#define TAPPING_TOGGLE 2
diff --git a/keyboards/neopad/readme.md b/keyboards/neopad/readme.md
new file mode 100644
index 000000000..9e83e9bb6
--- /dev/null
+++ b/keyboards/neopad/readme.md
@@ -0,0 +1,25 @@
1# Neopad
2
3Neopad is a little macropad with four switches and two rotary encoders, made by through hole components only.
4_Actually the number of switches is six, because even the encoder are allowed to click._
5
6![Neopad](https://i.imgur.com/TgOkj2Fh.jpg "Neopad first proto")
7
8The Neopad in the photo above is the first prototype. See the project repository for revision 1 update and KiCad files.
9
10* Keyboard maintainer: [rookiebwoy](https://github.com/rookiebwoy)
11* Hardware supported: ProMicro, _Elite-C (not tested)_
12* Project repository: [Neopad on github](https://github.com/rookiebwoy/neopad)
13
14Make example for this keyboard (after setting up your build environment):
15
16 make neopad/rev1:default
17
18Flashing example for this keyboard:
19
20 make neopad/rev1:default:flash
21
22When asked by the terminal, press the dedicated `RESET` button (the one above the 2 LEDs) to enter the bootloader and let the OS detects the device.
23
24See 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 [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
25
diff --git a/keyboards/neopad/rev1/config.h b/keyboards/neopad/rev1/config.h
new file mode 100755
index 000000000..92d339271
--- /dev/null
+++ b/keyboards/neopad/rev1/config.h
@@ -0,0 +1,41 @@
1/*
2Copyright 2021 rookiebwoy
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17#pragma once
18
19#include "config_common.h"
20
21/* USB Device descriptor parameter */
22#define DEVICE_VER 0x0010
23
24/* Column/Row IO definitions */
25#define MATRIX_ROWS 2
26#define MATRIX_COLS 3
27#define MATRIX_ROW_PINS { F4, F5 }
28#define MATRIX_COL_PINS { B3, B2, B6 }
29#define UNUSED_PINS
30
31/* Dual rotary encoders */
32#define ENCODERS_PAD_A { D1, D4 }
33#define ENCODERS_PAD_B { D0, C6 }
34
35/* Onboard LEDs */
36#define LED_00 F6
37#define LED_01 F7
38
39/* Bootmagic - hold down rotary encoder pushbutton while plugging in to enter bootloader */
40#define BOOTMAGIC_LITE_ROW 0
41#define BOOTMAGIC_LITE_COLUMN 0
diff --git a/keyboards/neopad/rev1/info.json b/keyboards/neopad/rev1/info.json
new file mode 100755
index 000000000..44d5babe4
--- /dev/null
+++ b/keyboards/neopad/rev1/info.json
@@ -0,0 +1,16 @@
1{
2 "keyboard_name": "neopad",
3 "keyboard_folder": "neopad/rev1",
4 "url": "https://github.com/rookiebwoy/neopad)",
5 "maintainer": "rookiebwoy",
6 "width": 3,
7 "height": 2,
8 "layouts": {
9 "LAYOUT": {
10 "layout": [
11 {"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0},
12 {"x":0, "y":1}, {"x":1, "y":1}, {"x":2, "y":1}
13 ]
14 }
15 }
16}
diff --git a/keyboards/neopad/rev1/keymaps/default/keymap.c b/keyboards/neopad/rev1/keymaps/default/keymap.c
new file mode 100755
index 000000000..061e26d43
--- /dev/null
+++ b/keyboards/neopad/rev1/keymaps/default/keymap.c
@@ -0,0 +1,153 @@
1/* Copyright 2021 rookiebwoy
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#include QMK_KEYBOARD_H
17
18const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
19 /*
20 LAYER 0 - MUSIC
21 /-----------------------------`
22 | TO(1) | stop | mute | L ENC: prev/next song
23 |---------|---------|---------|
24 | prev | play | next | R ENC: vol up/down
25 \-----------------------------'
26 */
27 [0] = LAYOUT(
28 TO(1), KC_MSTP, KC_MUTE,
29 KC_MPRV, KC_MPLY, KC_MNXT
30 ),
31
32 /*
33 LAYER 1 - MOVEMENT IN WINDOWS
34 /---------------------------------------`
35 | TO(2) | maximize | show desktop | L ENC: change desktop
36 |-------------|----------|--------------|
37 | move window | minimize | move window | R ENC: change browser tab + change explorer window
38 \---------------------------------------'
39 */
40 [1] = LAYOUT(
41 TO(2), LGUI(KC_UP), LGUI(KC_D),
42 LGUI(KC_LEFT), LGUI(KC_DOWN), LGUI(KC_RIGHT)
43 ),
44
45 /*
46 LAYER 2 - SHORTCUT
47 /------------------------------`
48 | TO(3) | esc | task man | L ENC: redo/undo
49 |---------|---------|----------|
50 | cut | copy | paste | R ENC: mouse wheel up/down
51 \------------------------------'
52 */
53 [2] = LAYOUT(
54 TO(3), KC_ESC, LCTL(LSFT(KC_ESC)),
55 LCTL(KC_X), LCTL(KC_C), LCTL(KC_V)
56 ),
57
58 /*
59 LAYER 3 - AUDACITY
60 /-----------------------------`
61 | TO(0) | REC | canc | L ENC: pan right/left
62 |---------|---------|---------|
63 | ctrl | play | pause | R ENC: mouse wheel up/down
64 \-----------------------------'
65 */
66 [3] = LAYOUT(
67 TO(0), LSFT(KC_R), KC_DEL,
68 KC_LCTL, KC_SPC, KC_P
69 ),
70
71};
72
73
74void encoder_update_user(uint8_t index, bool clockwise) {
75 if (index == 0) { /* LEFT ENCODER */
76 switch (get_highest_layer(layer_state)) {
77 case 0:
78 // layer 0 - next song (CW) and previous (CCW)
79 if (clockwise) {
80 tap_code(KC_MNXT);
81 } else {
82 tap_code(KC_MPRV);
83 }
84 break;
85
86 case 1:
87 // layer 1 - change desktop right (CW) and left (CCW)
88 if (clockwise) {
89 tap_code16(LCTL(LGUI(KC_RIGHT)));
90 } else {
91 tap_code16(LCTL(LGUI(KC_LEFT)));
92 }
93 break;
94
95 case 2:
96 // layer 2 - redo (CW) and undo (CCW)
97 if (clockwise) {
98 tap_code16(LCTL(KC_Y));
99 } else {
100 tap_code16(LCTL(KC_Z));
101 }
102 break;
103
104 case 3:
105 // layer 3 - pan right (CW) and left (CCW)
106 if (clockwise) {
107 tap_code(KC_WH_R);
108 } else {
109 tap_code(KC_WH_L);
110 }
111 break;
112 }
113
114 } else if (index == 1) { /* RIGHT ENCODER */
115 switch (get_highest_layer(layer_state)) {
116 case 0:
117 // layer 0 - volume up (CW) and down (CCW)
118 if (clockwise) {
119 tap_code(KC_VOLU);
120 } else {
121 tap_code(KC_VOLD);
122 }
123 break;
124
125 case 1:
126 // layer 1 - change browser tab (CW) and change explorer window (CCW)
127 if (clockwise) {
128 tap_code16(LCTL(KC_TAB));
129 } else {
130 tap_code16(LALT(LSFT(KC_TAB)));
131 }
132 break;
133
134 case 2:
135 // layer 2 - wheel up (CW) and down (CCW)
136 if (clockwise) {
137 tap_code(KC_WH_U);
138 } else {
139 tap_code(KC_WH_D);
140 }
141 break;
142
143 case 3:
144 // layer 3 - wheel up (CW) and down (CCW)
145 if (clockwise) {
146 tap_code(KC_WH_U);
147 } else {
148 tap_code(KC_WH_D);
149 }
150 break;
151 }
152 }
153}
diff --git a/keyboards/neopad/rev1/readme.md b/keyboards/neopad/rev1/readme.md
new file mode 100644
index 000000000..126592272
--- /dev/null
+++ b/keyboards/neopad/rev1/readme.md
@@ -0,0 +1,5 @@
1# Neopad rev1
2
3Final revision of the Neopad macropad. For in depth look please go to [project repository](https://github.com/rookiebwoy/neopad).
4
5
diff --git a/keyboards/neopad/rev1/rev1.c b/keyboards/neopad/rev1/rev1.c
new file mode 100755
index 000000000..20e2c4d05
--- /dev/null
+++ b/keyboards/neopad/rev1/rev1.c
@@ -0,0 +1,61 @@
1/* Copyright 2021 rookiebwoy
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#include "rev1.h"
17
18void keyboard_pre_init_kb(void) {
19 // Set LED IO as outputs
20 setPinOutput(LED_00);
21 setPinOutput(LED_01);
22 keyboard_pre_init_user();
23}
24
25void shutdown_user() {
26 // Shutdown LEDs
27 writePinLow(LED_00);
28 writePinLow(LED_01);
29}
30
31layer_state_t layer_state_set_kb(layer_state_t state) {
32 state = layer_state_set_user(state);
33
34 // Layer LEDs act as binary indication of current layer
35 uint8_t layer = get_highest_layer(state);
36 writePin(LED_00, layer & 0b1);
37 writePin(LED_01, (layer >> 1) & 0b1);
38 return state;
39}
40
41// Optional override functions below.
42// You can leave any or all of these undefined.
43// These are only required if you want to perform custom actions.
44
45void matrix_init_kb(void) {
46 // put your keyboard start-up code here
47 // runs once when the firmware starts up
48 uint8_t led_delay_ms = 80;
49 for (int i = 0; i < 2; i++) {
50 writePinHigh(LED_00);
51 writePinHigh(LED_01);
52 wait_ms(led_delay_ms);
53 writePinLow(LED_00);
54 writePinLow(LED_01);
55 if (i < 1) {
56 wait_ms(led_delay_ms);
57 }
58 }
59
60 matrix_init_user();
61}
diff --git a/keyboards/neopad/rev1/rev1.h b/keyboards/neopad/rev1/rev1.h
new file mode 100755
index 000000000..87b9405bb
--- /dev/null
+++ b/keyboards/neopad/rev1/rev1.h
@@ -0,0 +1,26 @@
1/* Copyright 2021 rookiebwoy
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#pragma once
17#include "quantum.h"
18
19#define LAYOUT( \
20 k00, k01, k02, \
21 k10, k11, k12 \
22) \
23{ \
24 { k00, k01, k02 }, \
25 { k10, k11, k12 } \
26}
diff --git a/keyboards/neopad/rev1/rules.mk b/keyboards/neopad/rev1/rules.mk
new file mode 100755
index 000000000..309e3d48c
--- /dev/null
+++ b/keyboards/neopad/rev1/rules.mk
@@ -0,0 +1,25 @@
1# MCU name
2MCU = atmega32u4
3
4# Bootloader selection
5BOOTLOADER = caterina
6
7# Build Options
8# change yes to no to disable
9#
10BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration
11MOUSEKEY_ENABLE = yes # Mouse keys
12EXTRAKEY_ENABLE = yes # Audio control and System control
13CONSOLE_ENABLE = yes # Console for debug
14COMMAND_ENABLE = no # Commands for debug and configuration
15# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
16SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
17# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
18NKRO_ENABLE = no # USB Nkey Rollover
19BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
20RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
21BLUETOOTH_ENABLE = no # Enable Bluetooth
22AUDIO_ENABLE = no # Audio output
23
24ENCODER_ENABLE = yes
25KEY_LOCK_ENABLE = yes
diff --git a/keyboards/neopad/rules.mk b/keyboards/neopad/rules.mk
new file mode 100755
index 000000000..8fc1afe95
--- /dev/null
+++ b/keyboards/neopad/rules.mk
@@ -0,0 +1 @@
DEFAULT_FOLDER = neopad/rev1