aboutsummaryrefslogtreecommitdiff
path: root/keyboards/dmqdesign
diff options
context:
space:
mode:
authorNicholas Junker <nicholas.junker125@gmail.com>2020-04-20 22:55:17 -0400
committerGitHub <noreply@github.com>2020-04-20 19:55:17 -0700
commit92a50a386af4bfe8ce69766719d95df1126917ca (patch)
tree8f14a39cbb6ea0af2490999839a5b1ec1e041afc /keyboards/dmqdesign
parent357c6009be059b196f15b4c77306ac88a8d13d87 (diff)
downloadqmk_firmware-92a50a386af4bfe8ce69766719d95df1126917ca.tar.gz
qmk_firmware-92a50a386af4bfe8ce69766719d95df1126917ca.zip
[Keyboard] DMQ Design SPIN (#8820)
* added SPIN keyboard and respective keymaps * Update keyboards/dmqdesign/spin/keymaps/default/keymap.c * Update keyboards/dmqdesign/spin/keymaps/encoderLayers/keymap.c * Update keyboards/dmqdesign/spin/rules.mk * Update keyboards/dmqdesign/spin/spin.c * Update keyboards/dmqdesign/spin/spin.h * Update keyboards/dmqdesign/spin/keymaps/encoderLayers/keymap.c * Update keyboards/dmqdesign/spin/readme.md * Update keyboards/dmqdesign/spin/readme.md * Update keyboards/dmqdesign/spin/spin.h * Update keyboards/dmqdesign/spin/rules.mk * Update keyboards/dmqdesign/spin/config.h * Update keyboards/dmqdesign/spin/keymaps/encoderLayers/keymap.c * Update keyboards/dmqdesign/spin/keymaps/encoderLayers/keymap.c * changed keymap to all lowercase, removed LED typecasts * made encoderLayers all lowercase * fixed the duplicate folder after changing name (hopefully) * fixed the info.json, followed the keyboard support doc * Update keyboards/dmqdesign/spin/info.json * Update keyboards/dmqdesign/spin/info.json * Update keyboards/dmqdesign/spin/info.json * Update keyboards/dmqdesign/spin/info.json
Diffstat (limited to 'keyboards/dmqdesign')
-rw-r--r--keyboards/dmqdesign/spin/config.h58
-rw-r--r--keyboards/dmqdesign/spin/info.json28
-rw-r--r--keyboards/dmqdesign/spin/keymaps/default/config.h21
-rw-r--r--keyboards/dmqdesign/spin/keymaps/default/keymap.c47
-rw-r--r--keyboards/dmqdesign/spin/keymaps/default/readme.md1
-rw-r--r--keyboards/dmqdesign/spin/keymaps/encoderlayers/config.h23
-rw-r--r--keyboards/dmqdesign/spin/keymaps/encoderlayers/keymap.c151
-rw-r--r--keyboards/dmqdesign/spin/keymaps/encoderlayers/readme.md1
-rw-r--r--keyboards/dmqdesign/spin/readme.md17
-rw-r--r--keyboards/dmqdesign/spin/rules.mk34
-rw-r--r--keyboards/dmqdesign/spin/spin.c16
-rw-r--r--keyboards/dmqdesign/spin/spin.h29
12 files changed, 426 insertions, 0 deletions
diff --git a/keyboards/dmqdesign/spin/config.h b/keyboards/dmqdesign/spin/config.h
new file mode 100644
index 000000000..63a3aa94b
--- /dev/null
+++ b/keyboards/dmqdesign/spin/config.h
@@ -0,0 +1,58 @@
1/*
2Copyright 2019-2020 DMQ Design
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 0xA455
24#define PRODUCT_ID 0x0001
25#define DEVICE_VER 0x0001
26#define MANUFACTURER DMQ Design
27#define PRODUCT SPIN
28#define DESCRIPTION The SPIN Macro Pad is a 12 key Macro Pad by DMQ Design with 3 rotary encoders, inspired by the Plaid & RoMac.
29
30/* key matrix size */
31#define MATRIX_ROWS 3
32#define MATRIX_COLS 5
33//Matrix is 3x5 instead of 3x4, as the 3 encoders are wired into the matrix
34
35#define MATRIX_ROW_PINS { F0, F1, F4 }
36#define MATRIX_COL_PINS { F5, F6, F7, C7, C6 }
37#define UNUSED_PINS { D5, D2, D1, D0, B7, B3, B2, B0, E6 }
38
39/* COL2ROW, ROW2COL*/
40#define DIODE_DIRECTION COL2ROW
41
42//rotary encoder setup
43#define ENCODERS_PAD_A { B6, B4, D6 }
44#define ENCODERS_PAD_B { B5, D7, D4 }
45#define ENCODER_RESOLUTION 4
46
47//Data pin for the 3 RGB LEDs
48#define RGB_DI_PIN D3
49//Number of RGB LEDs
50#define RGBLED_NUM 3
51
52/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
53#define DEBOUNCE 5
54
55/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
56#define LOCKING_SUPPORT_ENABLE
57/* Locking resynchronize hack */
58#define LOCKING_RESYNC_ENABLE
diff --git a/keyboards/dmqdesign/spin/info.json b/keyboards/dmqdesign/spin/info.json
new file mode 100644
index 000000000..032ff3990
--- /dev/null
+++ b/keyboards/dmqdesign/spin/info.json
@@ -0,0 +1,28 @@
1{
2 "keyboard_name": "SPIN",
3 "url": "https://www.DMQdesign.com",
4 "maintainer": "Quarren42",
5 "width": 4.5,
6 "height": 4,
7 "layouts": {
8 "LAYOUT": {
9 "layout": [
10 {"x":0, "y":0},
11 {"x":1, "y":0},
12 {"x":2, "y":0},
13 {"x":3.5, "y":0},
14 {"x":0, "y":1},
15 {"x":1, "y":1},
16 {"x":2, "y":1},
17 {"x":3.5, "y":1.5},
18 {"x":0, "y":2},
19 {"x":1, "y":2},
20 {"x":2, "y":2},
21 {"x":3.5, "y":3},
22 {"x":0, "y":3},
23 {"x":1, "y":3},
24 {"x":2, "y":3}
25 ]
26 }
27 }
28}
diff --git a/keyboards/dmqdesign/spin/keymaps/default/config.h b/keyboards/dmqdesign/spin/keymaps/default/config.h
new file mode 100644
index 000000000..a6d4ee431
--- /dev/null
+++ b/keyboards/dmqdesign/spin/keymaps/default/config.h
@@ -0,0 +1,21 @@
1/* Copyright 2019-2020 DMQ Design
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#define RGBLIGHT_HUE_STEP 8
20
21// place overrides here
diff --git a/keyboards/dmqdesign/spin/keymaps/default/keymap.c b/keyboards/dmqdesign/spin/keymaps/default/keymap.c
new file mode 100644
index 000000000..0b5e6bd0b
--- /dev/null
+++ b/keyboards/dmqdesign/spin/keymaps/default/keymap.c
@@ -0,0 +1,47 @@
1/* Copyright 2019-2020 DMQ Design
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 [0] = LAYOUT(/* Base */
20 KC_7, KC_8, KC_9, KC_TRNS,
21 KC_4, KC_5, KC_6, KC_TRNS,
22 KC_1, KC_2, KC_3, KC_TRNS,
23 KC_0, RGB_TOG, KC_ENTER
24 ),
25};
26
27void encoder_update_user(uint8_t index, bool clockwise) {
28 if (index == 0) { /* First encoder */
29 if (clockwise) {
30 rgblight_increase_hue(); //Cycle through the RGB hue
31 } else {
32 rgblight_decrease_hue();
33 }
34 } else if (index == 1) { /* Second encoder */
35 if (clockwise) {
36 tap_code(KC_VOLU); //Example of using tap_code which lets you use keycodes outside of the keymap
37 } else {
38 tap_code(KC_VOLD);
39 }
40 } else if (index == 2) { /* Third encoder */
41 if (clockwise) {
42 rgblight_increase_val(); //Change brightness on the RGB LEDs
43 } else {
44 rgblight_decrease_val();
45 }
46 }
47}
diff --git a/keyboards/dmqdesign/spin/keymaps/default/readme.md b/keyboards/dmqdesign/spin/keymaps/default/readme.md
new file mode 100644
index 000000000..384b1a7d8
--- /dev/null
+++ b/keyboards/dmqdesign/spin/keymaps/default/readme.md
@@ -0,0 +1 @@
# The default keymap for the SPIN Macro Pad, it includes basic encoder & rgb functionality. \ No newline at end of file
diff --git a/keyboards/dmqdesign/spin/keymaps/encoderlayers/config.h b/keyboards/dmqdesign/spin/keymaps/encoderlayers/config.h
new file mode 100644
index 000000000..feedd68eb
--- /dev/null
+++ b/keyboards/dmqdesign/spin/keymaps/encoderlayers/config.h
@@ -0,0 +1,23 @@
1/* Copyright 2019-2020 DMQ Design
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#define RGBLIGHT_EFFECT_RAINBOW_MOOD
20#define RGBLIGHT_HUE_STEP 8
21#define MIDI_ENABLE_STRICT 1
22#define MIDI_ADVANCED
23
diff --git a/keyboards/dmqdesign/spin/keymaps/encoderlayers/keymap.c b/keyboards/dmqdesign/spin/keymaps/encoderlayers/keymap.c
new file mode 100644
index 000000000..cb2a21f55
--- /dev/null
+++ b/keyboards/dmqdesign/spin/keymaps/encoderlayers/keymap.c
@@ -0,0 +1,151 @@
1/* Copyright 2019-2020 DMQ Design
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#include "midi.h"
18#include "qmk_midi.h"
19
20enum layers
21{
22 _BL,
23 _FL,
24 _TL
25};
26
27uint8_t currentLayer;
28
29//The below layers are intentionally empty in order to give a good starting point for how to configure multiple layers.
30const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
31 [_BL] = LAYOUT(/* Base */
32 KC_KP_7, KC_KP_8, KC_KP_9, TO(_BL),
33 KC_KP_4, KC_KP_5, KC_KP_6, TO(_FL),
34 KC_KP_1, KC_KP_2, KC_KP_3, TO(_TL),
35 KC_KP_0, RGB_TOG, RGB_MOD
36 ),
37
38 [_FL] = LAYOUT(/* Base */
39 KC_NO, KC_NO, KC_NO, KC_TRNS,
40 KC_NO, KC_NO, KC_NO, KC_TRNS,
41 KC_NO, KC_NO, KC_NO, KC_TRNS,
42 KC_MS_BTN1, KC_NO, KC_MS_BTN2
43 ),
44
45 [_TL] = LAYOUT(/* Base */
46 KC_NO, KC_NO, KC_NO, KC_TRNS,
47 KC_NO, KC_NO, KC_NO, KC_TRNS,
48 KC_NO, KC_NO, KC_NO, KC_TRNS,
49 KC_NO, KC_NO, KC_NO
50 )
51};
52
53void encoder_update_user(uint8_t index, bool clockwise) {
54 if (index == 0) { /* First encoder */
55 switch (currentLayer) { //break each encoder update into a switch statement for the current layer
56 case _BL:
57 if (clockwise) {
58 rgblight_increase_hue();
59 } else {
60 rgblight_decrease_hue();
61 }
62 break;
63 case _FL:
64 if (clockwise) {
65 midi_send_cc(&midi_device, 0, 0x14, 1);
66 } else {
67 midi_send_cc(&midi_device, 0, 0x15, 1);
68 }
69 break;
70 case _TL:
71 if (clockwise) {
72 midi_send_cc(&midi_device, 0, 0x1A, 1);
73 } else {
74 midi_send_cc(&midi_device, 0, 0x1B, 1);
75 }
76 break;
77 }
78 } else if (index == 1) { /* Second encoder */
79 switch (currentLayer) {
80 case _BL:
81 if (clockwise) {
82 tap_code(KC_VOLU);
83 } else {
84 tap_code(KC_VOLD);
85 }
86 break;
87 case _FL:
88 if (clockwise) {
89 midi_send_cc(&midi_device, 0, 0x16, 1);
90 } else {
91 midi_send_cc(&midi_device, 0, 0x17, 1);
92 }
93 break;
94 case _TL:
95 if (clockwise) {
96 midi_send_cc(&midi_device, 0, 0x1C, 1);
97 } else {
98 midi_send_cc(&midi_device, 0, 0x1D, 1);
99 }
100 break;
101 }
102 } else if (index == 2) { /* Third encoder */
103 switch (currentLayer) {
104 case _BL:
105 if (clockwise) {
106 rgblight_increase_val();
107 } else {
108 rgblight_decrease_val();
109 }
110 break;
111 case _FL:
112 if (clockwise) {
113 midi_send_cc(&midi_device, 0, 0x18, 1);
114 } else {
115 midi_send_cc(&midi_device, 0, 0x19, 1);
116 }
117 break;
118 case _TL:
119 if (clockwise) {
120 midi_send_cc(&midi_device, 0, 0x1E, 1);
121 } else {
122 midi_send_cc(&midi_device, 0, 0x1F, 1);
123 }
124 break;
125 }
126 }
127}
128
129layer_state_t layer_state_set_user(layer_state_t state) { //This will run every time the layer is updated
130 currentLayer = get_highest_layer(state);
131
132 switch (currentLayer) {
133 case _BL:
134 setrgb(RGB_WHITE, &led[0]); //Set the top LED to white for the bottom layer
135 setrgb(0, 0, 0, &led[1]);
136 setrgb(0, 0, 0, &led[2]);
137 break;
138 case _FL:
139 setrgb(0, 0, 0, &led[0]); //Set the middle LED to white for the middle layer
140 setrgb(RGB_WHITE, &led[1]);
141 setrgb(0, 0, 0, &led[2]);
142 break;
143 case _TL:
144 setrgb(0, 0, 0, &led[0]);
145 setrgb(0, 0, 0, &led[1]);
146 setrgb(RGB_WHITE, &led[2]); //Set the bottom LED to white for the top layer
147 break;
148 }
149 rgblight_set();
150 return state;
151}
diff --git a/keyboards/dmqdesign/spin/keymaps/encoderlayers/readme.md b/keyboards/dmqdesign/spin/keymaps/encoderlayers/readme.md
new file mode 100644
index 000000000..256fb16d4
--- /dev/null
+++ b/keyboards/dmqdesign/spin/keymaps/encoderlayers/readme.md
@@ -0,0 +1 @@
# This keymap is intended to demonstrate how to implement different encoder functions dependent on layer, and on how to implement MIDI control with encoders. \ No newline at end of file
diff --git a/keyboards/dmqdesign/spin/readme.md b/keyboards/dmqdesign/spin/readme.md
new file mode 100644
index 000000000..8f856a81d
--- /dev/null
+++ b/keyboards/dmqdesign/spin/readme.md
@@ -0,0 +1,17 @@
1# SPIN
2
3![SPIN](https://i.imgur.com/5oYg1WD.jpg)
4
5The SPIN Macro Pad is a USB-C, hotswappable Macro Pad with 3 encoders designed by Nick from DMQ Design.
6
7* Keyboard Maintainer: [Nicholas Junker](https://github.com/Quarren42)
8* Hardware Supported: SPIN Macro Pad PCB/kit
9* Hardware Availability: The macro pad is available at [DMQdesign.com](www.dmqdesign.com)
10
11Make example for this keyboard (after setting up your build environment):
12
13 make dmqdesign/spin:default
14
15I have two example keymaps available, both the default and the encoderlayers keymap which demonstrates using different encoder functions based on the layer chosen.
16
17See 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/dmqdesign/spin/rules.mk b/keyboards/dmqdesign/spin/rules.mk
new file mode 100644
index 000000000..f8dc59afa
--- /dev/null
+++ b/keyboards/dmqdesign/spin/rules.mk
@@ -0,0 +1,34 @@
1# MCU name
2MCU = atmega32u4
3
4# Bootloader selection
5# Teensy halfkay
6# Pro Micro caterina
7# Atmel DFU atmel-dfu
8# LUFA DFU lufa-dfu
9# QMK DFU qmk-dfu
10# ATmega32A bootloadHID
11# ATmega328P USBasp
12BOOTLOADER = atmel-dfu
13
14# Build Options
15# change yes to no to disable
16#
17BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration
18MOUSEKEY_ENABLE = yes # Mouse keys
19EXTRAKEY_ENABLE = yes # Audio control and System control
20CONSOLE_ENABLE = no # Console for debug
21COMMAND_ENABLE = no # Commands for debug and configuration
22# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
23SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
24# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
25NKRO_ENABLE = yes # USB Nkey Rollover
26BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
27RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
28MIDI_ENABLE = yes # MIDI support
29UNICODE_ENABLE = no # Unicode
30BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
31AUDIO_ENABLE = no # Audio output on port C6
32FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
33HD44780_ENABLE = no # Enable support for HD44780 based LCDs
34ENCODER_ENABLE = yes # Enable rotary encoder support
diff --git a/keyboards/dmqdesign/spin/spin.c b/keyboards/dmqdesign/spin/spin.c
new file mode 100644
index 000000000..fe3f267d1
--- /dev/null
+++ b/keyboards/dmqdesign/spin/spin.c
@@ -0,0 +1,16 @@
1/* Copyright 2019-2020 DMQ Design
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 "spin.h"
diff --git a/keyboards/dmqdesign/spin/spin.h b/keyboards/dmqdesign/spin/spin.h
new file mode 100644
index 000000000..d60dbe82f
--- /dev/null
+++ b/keyboards/dmqdesign/spin/spin.h
@@ -0,0 +1,29 @@
1/* Copyright 2019-2020 DMQ Design
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#define LAYOUT( \
21 k00, k01, k02, k03, \
22 k10, k11, k12, k13, \
23 k20, k21, k22, k23, \
24 k30, k31, k32 \
25) { \
26 {k00, k10, k20, k30, k23}, \
27 {k01, k11, k21, k31, k13}, \
28 {k02, k12, k22, k32, k03} \
29}