aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Braini <abraini@nascentdigital.com>2021-09-24 12:27:29 -0400
committerGitHub <noreply@github.com>2021-09-24 09:27:29 -0700
commit863d9c35feb583356c92aaa04c1b0f234febabc1 (patch)
tree9611e561262bec8cef8fa554db6aee65ac65d6e7
parent257bc473e5483b1411bb5015ccbbaadd08e6ff24 (diff)
downloadqmk_firmware-863d9c35feb583356c92aaa04c1b0f234febabc1.tar.gz
qmk_firmware-863d9c35feb583356c92aaa04c1b0f234febabc1.zip
[Keyboard] Create the battleship gamepad keyboard. (#14551)
Co-authored-by: Drashna Jaelre <drashna@live.com> Co-authored-by: Ryan <fauxpark@gmail.com>
-rw-r--r--keyboards/handwired/battleship_gamepad/battleship_gamepad.c30
-rw-r--r--keyboards/handwired/battleship_gamepad/battleship_gamepad.h31
-rw-r--r--keyboards/handwired/battleship_gamepad/config.h52
-rw-r--r--keyboards/handwired/battleship_gamepad/info.json215
-rw-r--r--keyboards/handwired/battleship_gamepad/keymaps/default/keymap.c41
-rw-r--r--keyboards/handwired/battleship_gamepad/keymaps/default/readme.md2
-rw-r--r--keyboards/handwired/battleship_gamepad/keymaps/via/keymap.c48
-rw-r--r--keyboards/handwired/battleship_gamepad/keymaps/via/rules.mk2
-rw-r--r--keyboards/handwired/battleship_gamepad/readme.md29
-rw-r--r--keyboards/handwired/battleship_gamepad/rules.mk25
10 files changed, 475 insertions, 0 deletions
diff --git a/keyboards/handwired/battleship_gamepad/battleship_gamepad.c b/keyboards/handwired/battleship_gamepad/battleship_gamepad.c
new file mode 100644
index 000000000..918a3852d
--- /dev/null
+++ b/keyboards/handwired/battleship_gamepad/battleship_gamepad.c
@@ -0,0 +1,30 @@
1/* Copyright 2021 Andrew Braini
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
17#include "battleship_gamepad.h"
18#include "joystick.h"
19#include "analog.h"
20
21/* joystick config */
22joystick_config_t joystick_axes[JOYSTICK_AXES_COUNT] = {
23 [0] = JOYSTICK_AXIS_IN(F5, 1023, 512, 0),
24 [1] = JOYSTICK_AXIS_IN(F4, 0, 512, 1023)
25};
26
27/* joystick button code (thumbstick pressed) */
28void keyboard_pre_init_kb(void) {
29 setPinInputHigh(F6);
30}
diff --git a/keyboards/handwired/battleship_gamepad/battleship_gamepad.h b/keyboards/handwired/battleship_gamepad/battleship_gamepad.h
new file mode 100644
index 000000000..67cf11220
--- /dev/null
+++ b/keyboards/handwired/battleship_gamepad/battleship_gamepad.h
@@ -0,0 +1,31 @@
1/* Copyright 2021 Andrew Braini
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
17#include "quantum.h"
18
19#define LAYOUT( \
20 K00, K01, K02, K03, K04, K05, K06, K07, \
21 K10, K11, K12, K13, K14, K15, K16, K17, \
22 K20, K21, K22, K23, K24, K25, K26, K27, \
23 K30, K31, K32, K33, K34, K35, K36, K37, \
24 K40, K41, K42, K43, K44, K45, K46, K47 \
25) { \
26 { K00, K01, K02, K03, K04, K05, K06, K07 }, \
27 { K10, K11, K12, K13, K14, K15, K16, K17 }, \
28 { K20, K21, K22, K23, K24, K25, K26, K27 }, \
29 { K30, K31, K32, K33, K34, K35, K36, K37 }, \
30 { K40, K41, K42, K43, K44, K45, K46, K47 } \
31}
diff --git a/keyboards/handwired/battleship_gamepad/config.h b/keyboards/handwired/battleship_gamepad/config.h
new file mode 100644
index 000000000..1cbfbf87e
--- /dev/null
+++ b/keyboards/handwired/battleship_gamepad/config.h
@@ -0,0 +1,52 @@
1/* Copyright 2021 Andrew Braini
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
17#pragma once
18
19#include "config_common.h"
20
21/* USB Device descriptor parameter */
22#define VENDOR_ID 0x4142
23#define PRODUCT_ID 0x0000
24#define DEVICE_VER 0x0001
25#define MANUFACTURER arbraini
26#define PRODUCT Battleship Gamepad
27
28/* key matrix size */
29#define MATRIX_ROWS 5
30#define MATRIX_COLS 8
31
32/* key matrix pins */
33#define MATRIX_ROW_PINS { B6, B2, B3, B1, F7 }
34#define MATRIX_COL_PINS { D1, D0, D4, C6, D7, E6, B4, B5 }
35#define UNUSED_PINS
36
37/* joystick configuration */
38#define JOYSTICK_BUTTON_COUNT 25
39#define JOYSTICK_AXES_COUNT 2
40#define JOYSTICK_AXES_RESOLUTION 10
41
42/* COL2ROW or ROW2COL */
43#define DIODE_DIRECTION COL2ROW
44
45/* Set 0 if debouncing isn't needed */
46#define DEBOUNCE 5
47
48/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
49#define LOCKING_SUPPORT_ENABLE
50
51/* Locking resynchronize hack */
52#define LOCKING_RESYNC_ENABLE
diff --git a/keyboards/handwired/battleship_gamepad/info.json b/keyboards/handwired/battleship_gamepad/info.json
new file mode 100644
index 000000000..581f290aa
--- /dev/null
+++ b/keyboards/handwired/battleship_gamepad/info.json
@@ -0,0 +1,215 @@
1{
2 "keyboard_name": "Battleship Gamepad",
3 "url": "https://github.com/abraini-Nascent/battleship_gamepad",
4 "maintainer": "arbraini",
5 "layouts": {
6 "LAYOUT": {
7 "layout": [
8 {
9 "label": "F1",
10 "x": 0,
11 "y": 0
12 },
13 {
14 "label": "F2",
15 "x": 1,
16 "y": 0
17 },
18 {
19 "label": "Esc",
20 "x": 2.25,
21 "y": 0,
22 "w": 1.25
23 },
24 {
25 "label": "!",
26 "x": 3.5,
27 "y": 0
28 },
29 {
30 "label": "@",
31 "x": 4.5,
32 "y": 0
33 },
34 {
35 "label": "#",
36 "x": 5.5,
37 "y": 0
38 },
39 {
40 "label": "$",
41 "x": 6.5,
42 "y": 0
43 },
44 {
45 "label": "%",
46 "x": 7.5,
47 "y": 0
48 },
49 {
50 "label": "F3",
51 "x": 0,
52 "y": 1
53 },
54 {
55 "label": "F4",
56 "x": 1,
57 "y": 1
58 },
59 {
60 "label": "Tab",
61 "x": 2.25,
62 "y": 1,
63 "w": 1.25
64 },
65 {
66 "label": "Q",
67 "x": 3.5,
68 "y": 1
69 },
70 {
71 "label": "W",
72 "x": 4.5,
73 "y": 1
74 },
75 {
76 "label": "E",
77 "x": 5.5,
78 "y": 1
79 },
80 {
81 "label": "R",
82 "x": 6.5,
83 "y": 1
84 },
85 {
86 "label": "T",
87 "x": 7.5,
88 "y": 1
89 },
90 {
91 "label": "F5",
92 "x": 0,
93 "y": 2
94 },
95 {
96 "label": "F6",
97 "x": 1,
98 "y": 2
99 },
100 {
101 "label": "Caps<br>Lock",
102 "x": 2.25,
103 "y": 2,
104 "w": 1.25
105 },
106 {
107 "label": "A",
108 "x": 3.5,
109 "y": 2
110 },
111 {
112 "label": "S",
113 "x": 4.5,
114 "y": 2
115 },
116 {
117 "label": "D",
118 "x": 5.5,
119 "y": 2
120 },
121 {
122 "label": "F",
123 "x": 6.5,
124 "y": 2
125 },
126 {
127 "label": "G",
128 "x": 7.5,
129 "y": 2
130 },
131 {
132 "label": "F7",
133 "x": 0,
134 "y": 3
135 },
136 {
137 "label": "F8",
138 "x": 1,
139 "y": 3
140 },
141 {
142 "label": "Shift",
143 "x": 2.25,
144 "y": 3,
145 "w": 1.25
146 },
147 {
148 "label": "Z",
149 "x": 3.5,
150 "y": 3
151 },
152 {
153 "label": "X",
154 "x": 4.5,
155 "y": 3
156 },
157 {
158 "label": "C",
159 "x": 5.5,
160 "y": 3
161 },
162 {
163 "label": "V",
164 "x": 6.5,
165 "y": 3
166 },
167 {
168 "label": "B",
169 "x": 7.5,
170 "y": 3
171 },
172 {
173 "label": "F9",
174 "x": 0,
175 "y": 4
176 },
177 {
178 "label": "F10",
179 "x": 1,
180 "y": 4
181 },
182 {
183 "label": "",
184 "x": 2.25,
185 "y": 4,
186 "w": 1.25
187 },
188 {
189 "label": "Ctrl",
190 "x": 3.5,
191 "y": 4
192 },
193 {
194 "label": "Alt",
195 "x": 4.5,
196 "y": 4
197 },
198 {
199 "label": "\u21e9",
200 "x": 5.5,
201 "y": 4
202 },
203 {
204 "label": "\u21e7",
205 "x": 6.5,
206 "y": 4
207 },
208 {
209 "x": 7.5,
210 "y": 4
211 }
212 ]
213 }
214 }
215}
diff --git a/keyboards/handwired/battleship_gamepad/keymaps/default/keymap.c b/keyboards/handwired/battleship_gamepad/keymaps/default/keymap.c
new file mode 100644
index 000000000..fa71419ff
--- /dev/null
+++ b/keyboards/handwired/battleship_gamepad/keymaps/default/keymap.c
@@ -0,0 +1,41 @@
1/* Copyright 2021 Andrew Braini
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
17#include QMK_KEYBOARD_H
18
19const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
20
21 [0] = LAYOUT(
22 KC_F1, KC_F2, KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5,
23 KC_F3, KC_F4, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T,
24 KC_F5, KC_F6, KC_NO, KC_A, KC_S, KC_D, KC_F, KC_G,
25 KC_F7, KC_F8, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B,
26 KC_F9, KC_F10, LT(1, KC_NO), KC_LCTL, KC_LALT, KC_NO, LT(1, KC_NO), KC_SPC),
27
28 [1] = LAYOUT(
29 RESET, DEBUG, KC_TILD, KC_6, KC_7, KC_8, KC_9, KC_0,
30 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
31 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
32 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
33 KC_F11, KC_F12, KC_TRNS, KC_TRNS, KC_TRNS, TG(2), KC_TRNS, KC_TRNS),
34
35 [2] = LAYOUT(
36 KC_TRNS, KC_TRNS, TG(2), JS_BUTTON0, JS_BUTTON1, JS_BUTTON2, JS_BUTTON3, JS_BUTTON4,
37 KC_TRNS, KC_TRNS, KC_TRNS, JS_BUTTON5, JS_BUTTON6, JS_BUTTON7, JS_BUTTON8, JS_BUTTON9,
38 KC_TRNS, KC_TRNS, KC_TRNS, JS_BUTTON10, JS_BUTTON11, JS_BUTTON12, JS_BUTTON13, JS_BUTTON14,
39 KC_TRNS, KC_TRNS, KC_TRNS, JS_BUTTON15, JS_BUTTON16, JS_BUTTON17, JS_BUTTON18, JS_BUTTON19,
40 KC_TRNS, KC_TRNS, KC_TRNS, JS_BUTTON20, JS_BUTTON21, JS_BUTTON22, JS_BUTTON23, JS_BUTTON24)
41};
diff --git a/keyboards/handwired/battleship_gamepad/keymaps/default/readme.md b/keyboards/handwired/battleship_gamepad/keymaps/default/readme.md
new file mode 100644
index 000000000..1de5d7dd6
--- /dev/null
+++ b/keyboards/handwired/battleship_gamepad/keymaps/default/readme.md
@@ -0,0 +1,2 @@
1# Battleship Gamepad - Default layout
2Default layout with 2 axies thumbstick and press to click
diff --git a/keyboards/handwired/battleship_gamepad/keymaps/via/keymap.c b/keyboards/handwired/battleship_gamepad/keymaps/via/keymap.c
new file mode 100644
index 000000000..9a70d36b7
--- /dev/null
+++ b/keyboards/handwired/battleship_gamepad/keymaps/via/keymap.c
@@ -0,0 +1,48 @@
1/* Copyright 2021 Andrew Braini
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
17#include QMK_KEYBOARD_H
18
19const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
20
21 [0] = LAYOUT(
22 KC_F1, KC_F2, KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5,
23 KC_F3, KC_F4, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T,
24 KC_F5, KC_F6, KC_NO, KC_A, KC_S, KC_D, KC_F, KC_G,
25 KC_F7, KC_F8, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B,
26 KC_F9, KC_F10, LT(1, KC_NO), KC_LCTL, KC_LALT, LT(2, KC_NO), LT(1, KC_NO), KC_SPC),
27
28 [1] = LAYOUT(
29 RESET, DEBUG, KC_TILD, KC_6, KC_7, KC_8, KC_9, KC_0,
30 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
31 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
32 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
33 KC_F11, KC_F12, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
34
35 [2] = LAYOUT(
36 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
37 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
38 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
39 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
40 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
41
42 [3] = LAYOUT(
43 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
44 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
45 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
46 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
47 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS)
48};
diff --git a/keyboards/handwired/battleship_gamepad/keymaps/via/rules.mk b/keyboards/handwired/battleship_gamepad/keymaps/via/rules.mk
new file mode 100644
index 000000000..35a31dea8
--- /dev/null
+++ b/keyboards/handwired/battleship_gamepad/keymaps/via/rules.mk
@@ -0,0 +1,2 @@
1VIA_ENABLE = yes
2CONSOLE_ENABLE = no
diff --git a/keyboards/handwired/battleship_gamepad/readme.md b/keyboards/handwired/battleship_gamepad/readme.md
new file mode 100644
index 000000000..c56675316
--- /dev/null
+++ b/keyboards/handwired/battleship_gamepad/readme.md
@@ -0,0 +1,29 @@
1# Battleship Gamepad
2
3![Battleship Gamepad](https://imgur.com/FCpQfzQ.jpg)
4
5A hand-wired 3d-printed mechanical keyboard intended for one hand with an analog thumbstick for movement. The layout matches the left side of large "battleship" keyboards with their extra bank of 2x5 1u F keys.
6
7Build instructions and 3d printer files can be found in the [project github repo](https://github.com/abraini-Nascent/battleship_gamepad)
8
9* Keyboard Maintainer: [arbraini](https://github.com/abraini-Nascent)
10* Hardware Supported: Arduino Pro Micro
11* Features: 40 keys in an ortho layout and an analog thumbstick.
12
13Make example for this keyboard (after setting up your build environment):
14
15 make handwired/battleship_gamepad:default
16
17Flashing example for this keyboard:
18
19 make handwired/battleship_gamepad:flash
20
21## Bootloader
22
23Enter the bootloader in 3 ways:
24
25* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (the top left key in the 2x5 bank) and plug in the keyboard.
26* **Physical reset button**: Briefly press the button on the back of the PCB - some may have pads you must short instead.
27* **Keycode in layout**: Press the key mapped to `RESET`. In the default layout this is the key at (0,0) on layer 1.
28
29See 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).
diff --git a/keyboards/handwired/battleship_gamepad/rules.mk b/keyboards/handwired/battleship_gamepad/rules.mk
new file mode 100644
index 000000000..b7a26d8fc
--- /dev/null
+++ b/keyboards/handwired/battleship_gamepad/rules.mk
@@ -0,0 +1,25 @@
1# MCU name
2MCU = atmega32u4
3
4# Bootloader selection
5BOOTLOADER = caterina
6
7SRC += analog.c
8
9# Build Options
10# change yes to no to disable
11#
12BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite
13MOUSEKEY_ENABLE = yes # Mouse keys
14EXTRAKEY_ENABLE = yes # Audio control and System control
15CONSOLE_ENABLE = no # Console for debug
16COMMAND_ENABLE = no # Commands for debug and configuration
17# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
18SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
19# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
20NKRO_ENABLE = yes # USB Nkey Rollover
21BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
22RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
23AUDIO_ENABLE = no # Audio output
24JOYSTICK_ENABLE = yes
25JOYSTICK_DRIVER = analog