Co-authored-by: Drashna Jaelre <drashna@live.com> Co-authored-by: Ryan <fauxpark@gmail.com>pull/14586/head
@ -0,0 +1,30 @@ | |||
/* Copyright 2021 Andrew Braini | |||
* | |||
* This program is free software: you can redistribute it and/or modify | |||
* it under the terms of the GNU General Public License as published by | |||
* the Free Software Foundation, either version 2 of the License, or | |||
* (at your option) any later version. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU General Public License | |||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
*/ | |||
#include "battleship_gamepad.h" | |||
#include "joystick.h" | |||
#include "analog.h" | |||
/* joystick config */ | |||
joystick_config_t joystick_axes[JOYSTICK_AXES_COUNT] = { | |||
[0] = JOYSTICK_AXIS_IN(F5, 1023, 512, 0), | |||
[1] = JOYSTICK_AXIS_IN(F4, 0, 512, 1023) | |||
}; | |||
/* joystick button code (thumbstick pressed) */ | |||
void keyboard_pre_init_kb(void) { | |||
setPinInputHigh(F6); | |||
} |
@ -0,0 +1,31 @@ | |||
/* Copyright 2021 Andrew Braini | |||
* | |||
* This program is free software: you can redistribute it and/or modify | |||
* it under the terms of the GNU General Public License as published by | |||
* the Free Software Foundation, either version 2 of the License, or | |||
* (at your option) any later version. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU General Public License | |||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
*/ | |||
#include "quantum.h" | |||
#define LAYOUT( \ | |||
K00, K01, K02, K03, K04, K05, K06, K07, \ | |||
K10, K11, K12, K13, K14, K15, K16, K17, \ | |||
K20, K21, K22, K23, K24, K25, K26, K27, \ | |||
K30, K31, K32, K33, K34, K35, K36, K37, \ | |||
K40, K41, K42, K43, K44, K45, K46, K47 \ | |||
) { \ | |||
{ K00, K01, K02, K03, K04, K05, K06, K07 }, \ | |||
{ K10, K11, K12, K13, K14, K15, K16, K17 }, \ | |||
{ K20, K21, K22, K23, K24, K25, K26, K27 }, \ | |||
{ K30, K31, K32, K33, K34, K35, K36, K37 }, \ | |||
{ K40, K41, K42, K43, K44, K45, K46, K47 } \ | |||
} |
@ -0,0 +1,52 @@ | |||
/* Copyright 2021 Andrew Braini | |||
* | |||
* This program is free software: you can redistribute it and/or modify | |||
* it under the terms of the GNU General Public License as published by | |||
* the Free Software Foundation, either version 2 of the License, or | |||
* (at your option) any later version. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU General Public License | |||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
*/ | |||
#pragma once | |||
#include "config_common.h" | |||
/* USB Device descriptor parameter */ | |||
#define VENDOR_ID 0x4142 | |||
#define PRODUCT_ID 0x0000 | |||
#define DEVICE_VER 0x0001 | |||
#define MANUFACTURER arbraini | |||
#define PRODUCT Battleship Gamepad | |||
/* key matrix size */ | |||
#define MATRIX_ROWS 5 | |||
#define MATRIX_COLS 8 | |||
/* key matrix pins */ | |||
#define MATRIX_ROW_PINS { B6, B2, B3, B1, F7 } | |||
#define MATRIX_COL_PINS { D1, D0, D4, C6, D7, E6, B4, B5 } | |||
#define UNUSED_PINS | |||
/* joystick configuration */ | |||
#define JOYSTICK_BUTTON_COUNT 25 | |||
#define JOYSTICK_AXES_COUNT 2 | |||
#define JOYSTICK_AXES_RESOLUTION 10 | |||
/* COL2ROW or ROW2COL */ | |||
#define DIODE_DIRECTION COL2ROW | |||
/* Set 0 if debouncing isn't needed */ | |||
#define DEBOUNCE 5 | |||
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ | |||
#define LOCKING_SUPPORT_ENABLE | |||
/* Locking resynchronize hack */ | |||
#define LOCKING_RESYNC_ENABLE |
@ -0,0 +1,215 @@ | |||
{ | |||
"keyboard_name": "Battleship Gamepad", | |||
"url": "https://github.com/abraini-Nascent/battleship_gamepad", | |||
"maintainer": "arbraini", | |||
"layouts": { | |||
"LAYOUT": { | |||
"layout": [ | |||
{ | |||
"label": "F1", | |||
"x": 0, | |||
"y": 0 | |||
}, | |||
{ | |||
"label": "F2", | |||
"x": 1, | |||
"y": 0 | |||
}, | |||
{ | |||
"label": "Esc", | |||
"x": 2.25, | |||
"y": 0, | |||
"w": 1.25 | |||
}, | |||
{ | |||
"label": "!", | |||
"x": 3.5, | |||
"y": 0 | |||
}, | |||
{ | |||
"label": "@", | |||
"x": 4.5, | |||
"y": 0 | |||
}, | |||
{ | |||
"label": "#", | |||
"x": 5.5, | |||
"y": 0 | |||
}, | |||
{ | |||
"label": "$", | |||
"x": 6.5, | |||
"y": 0 | |||
}, | |||
{ | |||
"label": "%", | |||
"x": 7.5, | |||
"y": 0 | |||
}, | |||
{ | |||
"label": "F3", | |||
"x": 0, | |||
"y": 1 | |||
}, | |||
{ | |||
"label": "F4", | |||
"x": 1, | |||
"y": 1 | |||
}, | |||
{ | |||
"label": "Tab", | |||
"x": 2.25, | |||
"y": 1, | |||
"w": 1.25 | |||
}, | |||
{ | |||
"label": "Q", | |||
"x": 3.5, | |||
"y": 1 | |||
}, | |||
{ | |||
"label": "W", | |||
"x": 4.5, | |||
"y": 1 | |||
}, | |||
{ | |||
"label": "E", | |||
"x": 5.5, | |||
"y": 1 | |||
}, | |||
{ | |||
"label": "R", | |||
"x": 6.5, | |||
"y": 1 | |||
}, | |||
{ | |||
"label": "T", | |||
"x": 7.5, | |||
"y": 1 | |||
}, | |||
{ | |||
"label": "F5", | |||
"x": 0, | |||
"y": 2 | |||
}, | |||
{ | |||
"label": "F6", | |||
"x": 1, | |||
"y": 2 | |||
}, | |||
{ | |||
"label": "Caps<br>Lock", | |||
"x": 2.25, | |||
"y": 2, | |||
"w": 1.25 | |||
}, | |||
{ | |||
"label": "A", | |||
"x": 3.5, | |||
"y": 2 | |||
}, | |||
{ | |||
"label": "S", | |||
"x": 4.5, | |||
"y": 2 | |||
}, | |||
{ | |||
"label": "D", | |||
"x": 5.5, | |||
"y": 2 | |||
}, | |||
{ | |||
"label": "F", | |||
"x": 6.5, | |||
"y": 2 | |||
}, | |||
{ | |||
"label": "G", | |||
"x": 7.5, | |||
"y": 2 | |||
}, | |||
{ | |||
"label": "F7", | |||
"x": 0, | |||
"y": 3 | |||
}, | |||
{ | |||
"label": "F8", | |||
"x": 1, | |||
"y": 3 | |||
}, | |||
{ | |||
"label": "Shift", | |||
"x": 2.25, | |||
"y": 3, | |||
"w": 1.25 | |||
}, | |||
{ | |||
"label": "Z", | |||
"x": 3.5, | |||
"y": 3 | |||
}, | |||
{ | |||
"label": "X", | |||
"x": 4.5, | |||
"y": 3 | |||
}, | |||
{ | |||
"label": "C", | |||
"x": 5.5, | |||
"y": 3 | |||
}, | |||
{ | |||
"label": "V", | |||
"x": 6.5, | |||
"y": 3 | |||
}, | |||
{ | |||
"label": "B", | |||
"x": 7.5, | |||
"y": 3 | |||
}, | |||
{ | |||
"label": "F9", | |||
"x": 0, | |||
"y": 4 | |||
}, | |||
{ | |||
"label": "F10", | |||
"x": 1, | |||
"y": 4 | |||
}, | |||
{ | |||
"label": "", | |||
"x": 2.25, | |||
"y": 4, | |||
"w": 1.25 | |||
}, | |||
{ | |||
"label": "Ctrl", | |||
"x": 3.5, | |||
"y": 4 | |||
}, | |||
{ | |||
"label": "Alt", | |||
"x": 4.5, | |||
"y": 4 | |||
}, | |||
{ | |||
"label": "\u21e9", | |||
"x": 5.5, | |||
"y": 4 | |||
}, | |||
{ | |||
"label": "\u21e7", | |||
"x": 6.5, | |||
"y": 4 | |||
}, | |||
{ | |||
"x": 7.5, | |||
"y": 4 | |||
} | |||
] | |||
} | |||
} | |||
} |
@ -0,0 +1,41 @@ | |||
/* Copyright 2021 Andrew Braini | |||
* | |||
* This program is free software: you can redistribute it and/or modify | |||
* it under the terms of the GNU General Public License as published by | |||
* the Free Software Foundation, either version 2 of the License, or | |||
* (at your option) any later version. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU General Public License | |||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
*/ | |||
#include QMK_KEYBOARD_H | |||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
[0] = LAYOUT( | |||
KC_F1, KC_F2, KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, | |||
KC_F3, KC_F4, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, | |||
KC_F5, KC_F6, KC_NO, KC_A, KC_S, KC_D, KC_F, KC_G, | |||
KC_F7, KC_F8, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, | |||
KC_F9, KC_F10, LT(1, KC_NO), KC_LCTL, KC_LALT, KC_NO, LT(1, KC_NO), KC_SPC), | |||
[1] = LAYOUT( | |||
RESET, DEBUG, KC_TILD, KC_6, KC_7, KC_8, KC_9, KC_0, | |||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | |||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | |||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | |||
KC_F11, KC_F12, KC_TRNS, KC_TRNS, KC_TRNS, TG(2), KC_TRNS, KC_TRNS), | |||
[2] = LAYOUT( | |||
KC_TRNS, KC_TRNS, TG(2), JS_BUTTON0, JS_BUTTON1, JS_BUTTON2, JS_BUTTON3, JS_BUTTON4, | |||
KC_TRNS, KC_TRNS, KC_TRNS, JS_BUTTON5, JS_BUTTON6, JS_BUTTON7, JS_BUTTON8, JS_BUTTON9, | |||
KC_TRNS, KC_TRNS, KC_TRNS, JS_BUTTON10, JS_BUTTON11, JS_BUTTON12, JS_BUTTON13, JS_BUTTON14, | |||
KC_TRNS, KC_TRNS, KC_TRNS, JS_BUTTON15, JS_BUTTON16, JS_BUTTON17, JS_BUTTON18, JS_BUTTON19, | |||
KC_TRNS, KC_TRNS, KC_TRNS, JS_BUTTON20, JS_BUTTON21, JS_BUTTON22, JS_BUTTON23, JS_BUTTON24) | |||
}; |
@ -0,0 +1,2 @@ | |||
# Battleship Gamepad - Default layout | |||
Default layout with 2 axies thumbstick and press to click |
@ -0,0 +1,48 @@ | |||
/* Copyright 2021 Andrew Braini | |||
* | |||
* This program is free software: you can redistribute it and/or modify | |||
* it under the terms of the GNU General Public License as published by | |||
* the Free Software Foundation, either version 2 of the License, or | |||
* (at your option) any later version. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU General Public License | |||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
*/ | |||
#include QMK_KEYBOARD_H | |||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
[0] = LAYOUT( | |||
KC_F1, KC_F2, KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, | |||
KC_F3, KC_F4, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, | |||
KC_F5, KC_F6, KC_NO, KC_A, KC_S, KC_D, KC_F, KC_G, | |||
KC_F7, KC_F8, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, | |||
KC_F9, KC_F10, LT(1, KC_NO), KC_LCTL, KC_LALT, LT(2, KC_NO), LT(1, KC_NO), KC_SPC), | |||
[1] = LAYOUT( | |||
RESET, DEBUG, KC_TILD, KC_6, KC_7, KC_8, KC_9, KC_0, | |||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | |||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | |||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | |||
KC_F11, KC_F12, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), | |||
[2] = LAYOUT( | |||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | |||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | |||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | |||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | |||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), | |||
[3] = LAYOUT( | |||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | |||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | |||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | |||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | |||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS) | |||
}; |
@ -0,0 +1,2 @@ | |||
VIA_ENABLE = yes | |||
CONSOLE_ENABLE = no |
@ -0,0 +1,29 @@ | |||
# Battleship Gamepad | |||
![Battleship Gamepad](https://imgur.com/FCpQfzQ.jpg) | |||
A 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. | |||
Build instructions and 3d printer files can be found in the [project github repo](https://github.com/abraini-Nascent/battleship_gamepad) | |||
* Keyboard Maintainer: [arbraini](https://github.com/abraini-Nascent) | |||
* Hardware Supported: Arduino Pro Micro | |||
* Features: 40 keys in an ortho layout and an analog thumbstick. | |||
Make example for this keyboard (after setting up your build environment): | |||
make handwired/battleship_gamepad:default | |||
Flashing example for this keyboard: | |||
make handwired/battleship_gamepad:flash | |||
## Bootloader | |||
Enter the bootloader in 3 ways: | |||
* **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. | |||
* **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 `RESET`. In the default layout this is the key at (0,0) on layer 1. | |||
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). |
@ -0,0 +1,25 @@ | |||
# MCU name | |||
MCU = atmega32u4 | |||
# Bootloader selection | |||
BOOTLOADER = caterina | |||
SRC += analog.c | |||
# Build Options | |||
# change yes to no to disable | |||
# | |||
BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite | |||
MOUSEKEY_ENABLE = yes # Mouse keys | |||
EXTRAKEY_ENABLE = yes # Audio control and System control | |||
CONSOLE_ENABLE = no # Console for debug | |||
COMMAND_ENABLE = no # Commands for debug and configuration | |||
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | |||
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | |||
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | |||
NKRO_ENABLE = yes # USB Nkey Rollover | |||
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | |||
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow | |||
AUDIO_ENABLE = no # Audio output | |||
JOYSTICK_ENABLE = yes | |||
JOYSTICK_DRIVER = analog |