aboutsummaryrefslogtreecommitdiff
path: root/keyboards/swiftrax
diff options
context:
space:
mode:
authorBrandon Claveria <48102030+swiftrax@users.noreply.github.com>2021-01-26 16:52:17 -0800
committerGitHub <noreply@github.com>2021-01-27 00:52:17 +0000
commita0d9221dcc085b196e071581e9e7d8d9a96037fe (patch)
tree50b11cc792f53b0467685719b24e59e8843b3428 /keyboards/swiftrax
parent7e8d97f8f05288dd6fe7fd2d8943bb27fc3f3117 (diff)
downloadqmk_firmware-a0d9221dcc085b196e071581e9e7d8d9a96037fe.tar.gz
qmk_firmware-a0d9221dcc085b196e071581e9e7d8d9a96037fe.zip
pull retropad out of handwired and update readme.md (#11545)
Co-authored-by: Swiftrax <swiftrax@gmail.com>
Diffstat (limited to 'keyboards/swiftrax')
-rw-r--r--keyboards/swiftrax/retropad/config.h64
-rw-r--r--keyboards/swiftrax/retropad/info.json12
-rw-r--r--keyboards/swiftrax/retropad/keymaps/default/keymap.c69
-rw-r--r--keyboards/swiftrax/retropad/keymaps/via/keymap.c69
-rw-r--r--keyboards/swiftrax/retropad/keymaps/via/rules.mk1
-rw-r--r--keyboards/swiftrax/retropad/readme.md13
-rw-r--r--keyboards/swiftrax/retropad/retropad.c16
-rw-r--r--keyboards/swiftrax/retropad/retropad.h31
-rw-r--r--keyboards/swiftrax/retropad/rules.mk23
9 files changed, 298 insertions, 0 deletions
diff --git a/keyboards/swiftrax/retropad/config.h b/keyboards/swiftrax/retropad/config.h
new file mode 100644
index 000000000..e604eda41
--- /dev/null
+++ b/keyboards/swiftrax/retropad/config.h
@@ -0,0 +1,64 @@
1/*
2Copyright 2020 Swiftrax <swiftrax@gmail.com>
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
18#pragma once
19
20#include "config_common.h"
21
22/* USB Device descriptor parameter */
23#define VENDOR_ID 0x04D8
24#define PRODUCT_ID 0xEB0C
25#define DEVICE_VER 0x0001
26#define MANUFACTURER Swiftrax
27#define PRODUCT Retropad
28
29/* key matrix size */
30#define MATRIX_ROWS 3
31#define MATRIX_COLS 2
32
33// ROWS: Top to bottom, COLS: Left to right
34
35#define MATRIX_ROW_PINS { C7, C6, B5 }
36#define MATRIX_COL_PINS { B4, D2 }
37
38#define ENCODERS_PAD_A { D0 }
39#define ENCODERS_PAD_B { D1 }
40
41/* COL2ROW or ROW2COL */
42#define DIODE_DIRECTION COL2ROW
43
44#define RGB_DI_PIN B7
45#ifdef RGB_DI_PIN
46#define RGBLIGHT_ANIMATIONS
47#define RGBLED_NUM 6
48#define RGBLIGHT_HUE_STEP 8
49#define RGBLIGHT_SAT_STEP 8
50#define RGBLIGHT_VAL_STEP 8
51#endif
52
53/* define if matrix has ghost */
54//#define MATRIX_HAS_GHOST
55
56/* Set 0 if debouncing isn't needed */
57#define DEBOUNCE 5
58
59/*EEPROM for via*/
60#define DYNAMIC_KEYMAP_LAYER_COUNT 3
61
62/* bootmagic row col assignment */
63#define BOOTMAGIC_LITE_ROW 1
64#define BOOTMAGIC_LITE_COLUMN 0
diff --git a/keyboards/swiftrax/retropad/info.json b/keyboards/swiftrax/retropad/info.json
new file mode 100644
index 000000000..9637c7b3f
--- /dev/null
+++ b/keyboards/swiftrax/retropad/info.json
@@ -0,0 +1,12 @@
1{
2 "keyboard_name": "Retropad",
3 "url": "https://github.com/swiftrax",
4 "maintainer": "swiftrax",
5 "width": 2,
6 "height": 3.5,
7 "layouts": {
8 "LAYOUT": {
9 "layout": [{"label":"0,1", "x":0.5, "y":0}, {"label":"1,0", "x":0, "y":1.5}, {"label":"1,1", "x":1, "y":1.5}, {"label":"2,0", "x":0, "y":2.5}, {"label":"2,1", "x":1, "y":2.5}]
10 }
11 }
12} \ No newline at end of file
diff --git a/keyboards/swiftrax/retropad/keymaps/default/keymap.c b/keyboards/swiftrax/retropad/keymaps/default/keymap.c
new file mode 100644
index 000000000..8b9992e1d
--- /dev/null
+++ b/keyboards/swiftrax/retropad/keymaps/default/keymap.c
@@ -0,0 +1,69 @@
1 /* Copyright 2020 swiftrax
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[0] = LAYOUT(
21 TO(1), //windows
22 KC_MSTP, KC_MPLY,
23 KC_MPRV, KC_MNXT),
24
25[1] = LAYOUT( //macOS
26 TO(2),
27 KC_MSTP, KC_MPLY,
28 KC_MRWD, KC_MFFD),
29
30[2] = LAYOUT(
31 TO(0),
32 KC_HOME, KC_PGUP,
33 KC_END, KC_PGDN),
34};
35
36void encoder_update_user(uint8_t index, bool clockwise) {
37 if(IS_LAYER_ON(2)){
38 if (clockwise)
39 tap_code(KC_LEFT);
40 else
41 tap_code(KC_RGHT);
42 }
43 else{
44 if(clockwise)
45 tap_code(KC_VOLU);
46 else
47 tap_code(KC_VOLD);
48 }
49}
50
51void matrix_init_user(void) {
52 // set top LED to output and off (active low)
53 setPinOutput(D5);
54 writePinHigh(D5);
55 // set middle LED to output and off (active low)
56 setPinOutput(D4);
57 writePinHigh(D4);
58 // set bottom LED to output and off (active low)
59 setPinOutput(D3);
60 writePinHigh(D3);
61}
62
63// write to above indicators in a binary fashion based on current layer
64layer_state_t layer_state_set_user(layer_state_t state) {
65 writePin(D5, get_highest_layer(state));
66 writePin(D4, !layer_state_cmp(state, 1));
67 writePin(D3, !layer_state_cmp(state, 2));
68 return state;
69} \ No newline at end of file
diff --git a/keyboards/swiftrax/retropad/keymaps/via/keymap.c b/keyboards/swiftrax/retropad/keymaps/via/keymap.c
new file mode 100644
index 000000000..8b9992e1d
--- /dev/null
+++ b/keyboards/swiftrax/retropad/keymaps/via/keymap.c
@@ -0,0 +1,69 @@
1 /* Copyright 2020 swiftrax
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[0] = LAYOUT(
21 TO(1), //windows
22 KC_MSTP, KC_MPLY,
23 KC_MPRV, KC_MNXT),
24
25[1] = LAYOUT( //macOS
26 TO(2),
27 KC_MSTP, KC_MPLY,
28 KC_MRWD, KC_MFFD),
29
30[2] = LAYOUT(
31 TO(0),
32 KC_HOME, KC_PGUP,
33 KC_END, KC_PGDN),
34};
35
36void encoder_update_user(uint8_t index, bool clockwise) {
37 if(IS_LAYER_ON(2)){
38 if (clockwise)
39 tap_code(KC_LEFT);
40 else
41 tap_code(KC_RGHT);
42 }
43 else{
44 if(clockwise)
45 tap_code(KC_VOLU);
46 else
47 tap_code(KC_VOLD);
48 }
49}
50
51void matrix_init_user(void) {
52 // set top LED to output and off (active low)
53 setPinOutput(D5);
54 writePinHigh(D5);
55 // set middle LED to output and off (active low)
56 setPinOutput(D4);
57 writePinHigh(D4);
58 // set bottom LED to output and off (active low)
59 setPinOutput(D3);
60 writePinHigh(D3);
61}
62
63// write to above indicators in a binary fashion based on current layer
64layer_state_t layer_state_set_user(layer_state_t state) {
65 writePin(D5, get_highest_layer(state));
66 writePin(D4, !layer_state_cmp(state, 1));
67 writePin(D3, !layer_state_cmp(state, 2));
68 return state;
69} \ No newline at end of file
diff --git a/keyboards/swiftrax/retropad/keymaps/via/rules.mk b/keyboards/swiftrax/retropad/keymaps/via/rules.mk
new file mode 100644
index 000000000..036bd6d1c
--- /dev/null
+++ b/keyboards/swiftrax/retropad/keymaps/via/rules.mk
@@ -0,0 +1 @@
VIA_ENABLE = yes \ No newline at end of file
diff --git a/keyboards/swiftrax/retropad/readme.md b/keyboards/swiftrax/retropad/readme.md
new file mode 100644
index 000000000..34f6af405
--- /dev/null
+++ b/keyboards/swiftrax/retropad/readme.md
@@ -0,0 +1,13 @@
1# Retropad
2
32x2 macro pad with a rotary encoder
4
5* Keyboard Maintainer: Swiftrax
6* Hardware Supported: Retropad PCB
7* Hardware Availability: https://github.com/swiftrax
8
9Make example for this keyboard (after setting up your build environment):
10
11 make swiftrax/retropad:default
12
13See 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/swiftrax/retropad/retropad.c b/keyboards/swiftrax/retropad/retropad.c
new file mode 100644
index 000000000..3ffe29528
--- /dev/null
+++ b/keyboards/swiftrax/retropad/retropad.c
@@ -0,0 +1,16 @@
1/* Copyright 2020 swiftrax
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 "retropad.h" \ No newline at end of file
diff --git a/keyboards/swiftrax/retropad/retropad.h b/keyboards/swiftrax/retropad/retropad.h
new file mode 100644
index 000000000..e7527d5c0
--- /dev/null
+++ b/keyboards/swiftrax/retropad/retropad.h
@@ -0,0 +1,31 @@
1/* Copyright 2020 swiftrax
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
18#include "quantum.h"
19
20// readability
21#define XXX KC_NO
22
23#define LAYOUT( \
24 K001, \
25 K100, K101, \
26 K200, K201 \
27) { \
28 { XXX, K001, }, \
29 { K100, K101, }, \
30 { K200, K201, } \
31}
diff --git a/keyboards/swiftrax/retropad/rules.mk b/keyboards/swiftrax/retropad/rules.mk
new file mode 100644
index 000000000..8771c701d
--- /dev/null
+++ b/keyboards/swiftrax/retropad/rules.mk
@@ -0,0 +1,23 @@
1# MCU name
2MCU = atmega32u2
3
4# Bootloader selection
5BOOTLOADER = atmel-dfu
6
7# Build Options
8# change yes to no to disable
9#
10BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration
11MOUSEKEY_ENABLE = no # Mouse keys
12EXTRAKEY_ENABLE = yes # Audio control and System control
13CONSOLE_ENABLE = no # 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 = yes # Enable keyboard RGB underglow
21BLUETOOTH_ENABLE = no # Enable Bluetooth
22AUDIO_ENABLE = no # Audio output
23ENCODER_ENABLE = yes