-
-
Notifications
You must be signed in to change notification settings - Fork 38.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Keyboard] Create the battleship gamepad keyboard. (#14551)
Co-authored-by: Drashna Jaelre <[email protected]> Co-authored-by: Ryan <[email protected]>
- Loading branch information
1 parent
257bc47
commit 863d9c3
Showing
10 changed files
with
475 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
keyboards/handwired/battleship_gamepad/battleship_gamepad.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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:https://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); | ||
} |
31 changes: 31 additions & 0 deletions
31
keyboards/handwired/battleship_gamepad/battleship_gamepad.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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:https://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 } \ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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:https://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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
] | ||
} | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
keyboards/handwired/battleship_gamepad/keymaps/default/keymap.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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:https://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) | ||
}; |
2 changes: 2 additions & 0 deletions
2
keyboards/handwired/battleship_gamepad/keymaps/default/readme.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Battleship Gamepad - Default layout | ||
Default layout with 2 axies thumbstick and press to click |
Oops, something went wrong.