* 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.jsonpull/8883/head
@ -0,0 +1,58 @@ | |||
/* | |||
Copyright 2019-2020 DMQ Design | |||
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 0xA455 | |||
#define PRODUCT_ID 0x0001 | |||
#define DEVICE_VER 0x0001 | |||
#define MANUFACTURER DMQ Design | |||
#define PRODUCT SPIN | |||
#define DESCRIPTION The SPIN Macro Pad is a 12 key Macro Pad by DMQ Design with 3 rotary encoders, inspired by the Plaid & RoMac. | |||
/* key matrix size */ | |||
#define MATRIX_ROWS 3 | |||
#define MATRIX_COLS 5 | |||
//Matrix is 3x5 instead of 3x4, as the 3 encoders are wired into the matrix | |||
#define MATRIX_ROW_PINS { F0, F1, F4 } | |||
#define MATRIX_COL_PINS { F5, F6, F7, C7, C6 } | |||
#define UNUSED_PINS { D5, D2, D1, D0, B7, B3, B2, B0, E6 } | |||
/* COL2ROW, ROW2COL*/ | |||
#define DIODE_DIRECTION COL2ROW | |||
//rotary encoder setup | |||
#define ENCODERS_PAD_A { B6, B4, D6 } | |||
#define ENCODERS_PAD_B { B5, D7, D4 } | |||
#define ENCODER_RESOLUTION 4 | |||
//Data pin for the 3 RGB LEDs | |||
#define RGB_DI_PIN D3 | |||
//Number of RGB LEDs | |||
#define RGBLED_NUM 3 | |||
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not 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,28 @@ | |||
{ | |||
"keyboard_name": "SPIN", | |||
"url": "https://www.DMQdesign.com", | |||
"maintainer": "Quarren42", | |||
"width": 4.5, | |||
"height": 4, | |||
"layouts": { | |||
"LAYOUT": { | |||
"layout": [ | |||
{"x":0, "y":0}, | |||
{"x":1, "y":0}, | |||
{"x":2, "y":0}, | |||
{"x":3.5, "y":0}, | |||
{"x":0, "y":1}, | |||
{"x":1, "y":1}, | |||
{"x":2, "y":1}, | |||
{"x":3.5, "y":1.5}, | |||
{"x":0, "y":2}, | |||
{"x":1, "y":2}, | |||
{"x":2, "y":2}, | |||
{"x":3.5, "y":3}, | |||
{"x":0, "y":3}, | |||
{"x":1, "y":3}, | |||
{"x":2, "y":3} | |||
] | |||
} | |||
} | |||
} |
@ -0,0 +1,21 @@ | |||
/* Copyright 2019-2020 DMQ Design | |||
* | |||
* 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 | |||
#define RGBLIGHT_HUE_STEP 8 | |||
// place overrides here |
@ -0,0 +1,47 @@ | |||
/* Copyright 2019-2020 DMQ Design | |||
* | |||
* 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(/* Base */ | |||
KC_7, KC_8, KC_9, KC_TRNS, | |||
KC_4, KC_5, KC_6, KC_TRNS, | |||
KC_1, KC_2, KC_3, KC_TRNS, | |||
KC_0, RGB_TOG, KC_ENTER | |||
), | |||
}; | |||
void encoder_update_user(uint8_t index, bool clockwise) { | |||
if (index == 0) { /* First encoder */ | |||
if (clockwise) { | |||
rgblight_increase_hue(); //Cycle through the RGB hue | |||
} else { | |||
rgblight_decrease_hue(); | |||
} | |||
} else if (index == 1) { /* Second encoder */ | |||
if (clockwise) { | |||
tap_code(KC_VOLU); //Example of using tap_code which lets you use keycodes outside of the keymap | |||
} else { | |||
tap_code(KC_VOLD); | |||
} | |||
} else if (index == 2) { /* Third encoder */ | |||
if (clockwise) { | |||
rgblight_increase_val(); //Change brightness on the RGB LEDs | |||
} else { | |||
rgblight_decrease_val(); | |||
} | |||
} | |||
} |
@ -0,0 +1 @@ | |||
# The default keymap for the SPIN Macro Pad, it includes basic encoder & rgb functionality. |
@ -0,0 +1,23 @@ | |||
/* Copyright 2019-2020 DMQ Design | |||
* | |||
* 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 | |||
#define RGBLIGHT_EFFECT_RAINBOW_MOOD | |||
#define RGBLIGHT_HUE_STEP 8 | |||
#define MIDI_ENABLE_STRICT 1 | |||
#define MIDI_ADVANCED | |||
@ -0,0 +1,151 @@ | |||
/* Copyright 2019-2020 DMQ Design | |||
* | |||
* 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 | |||
#include "midi.h" | |||
#include "qmk_midi.h" | |||
enum layers | |||
{ | |||
_BL, | |||
_FL, | |||
_TL | |||
}; | |||
uint8_t currentLayer; | |||
//The below layers are intentionally empty in order to give a good starting point for how to configure multiple layers. | |||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
[_BL] = LAYOUT(/* Base */ | |||
KC_KP_7, KC_KP_8, KC_KP_9, TO(_BL), | |||
KC_KP_4, KC_KP_5, KC_KP_6, TO(_FL), | |||
KC_KP_1, KC_KP_2, KC_KP_3, TO(_TL), | |||
KC_KP_0, RGB_TOG, RGB_MOD | |||
), | |||
[_FL] = LAYOUT(/* Base */ | |||
KC_NO, KC_NO, KC_NO, KC_TRNS, | |||
KC_NO, KC_NO, KC_NO, KC_TRNS, | |||
KC_NO, KC_NO, KC_NO, KC_TRNS, | |||
KC_MS_BTN1, KC_NO, KC_MS_BTN2 | |||
), | |||
[_TL] = LAYOUT(/* Base */ | |||
KC_NO, KC_NO, KC_NO, KC_TRNS, | |||
KC_NO, KC_NO, KC_NO, KC_TRNS, | |||
KC_NO, KC_NO, KC_NO, KC_TRNS, | |||
KC_NO, KC_NO, KC_NO | |||
) | |||
}; | |||
void encoder_update_user(uint8_t index, bool clockwise) { | |||
if (index == 0) { /* First encoder */ | |||
switch (currentLayer) { //break each encoder update into a switch statement for the current layer | |||
case _BL: | |||
if (clockwise) { | |||
rgblight_increase_hue(); | |||
} else { | |||
rgblight_decrease_hue(); | |||
} | |||
break; | |||
case _FL: | |||
if (clockwise) { | |||
midi_send_cc(&midi_device, 0, 0x14, 1); | |||
} else { | |||
midi_send_cc(&midi_device, 0, 0x15, 1); | |||
} | |||
break; | |||
case _TL: | |||
if (clockwise) { | |||
midi_send_cc(&midi_device, 0, 0x1A, 1); | |||
} else { | |||
midi_send_cc(&midi_device, 0, 0x1B, 1); | |||
} | |||
break; | |||
} | |||
} else if (index == 1) { /* Second encoder */ | |||
switch (currentLayer) { | |||
case _BL: | |||
if (clockwise) { | |||
tap_code(KC_VOLU); | |||
} else { | |||
tap_code(KC_VOLD); | |||
} | |||
break; | |||
case _FL: | |||
if (clockwise) { | |||
midi_send_cc(&midi_device, 0, 0x16, 1); | |||
} else { | |||
midi_send_cc(&midi_device, 0, 0x17, 1); | |||
} | |||
break; | |||
case _TL: | |||
if (clockwise) { | |||
midi_send_cc(&midi_device, 0, 0x1C, 1); | |||
} else { | |||
midi_send_cc(&midi_device, 0, 0x1D, 1); | |||
} | |||
break; | |||
} | |||
} else if (index == 2) { /* Third encoder */ | |||
switch (currentLayer) { | |||
case _BL: | |||
if (clockwise) { | |||
rgblight_increase_val(); | |||
} else { | |||
rgblight_decrease_val(); | |||
} | |||
break; | |||
case _FL: | |||
if (clockwise) { | |||
midi_send_cc(&midi_device, 0, 0x18, 1); | |||
} else { | |||
midi_send_cc(&midi_device, 0, 0x19, 1); | |||
} | |||
break; | |||
case _TL: | |||
if (clockwise) { | |||
midi_send_cc(&midi_device, 0, 0x1E, 1); | |||
} else { | |||
midi_send_cc(&midi_device, 0, 0x1F, 1); | |||
} | |||
break; | |||
} | |||
} | |||
} | |||
layer_state_t layer_state_set_user(layer_state_t state) { //This will run every time the layer is updated | |||
currentLayer = get_highest_layer(state); | |||
switch (currentLayer) { | |||
case _BL: | |||
setrgb(RGB_WHITE, &led[0]); //Set the top LED to white for the bottom layer | |||
setrgb(0, 0, 0, &led[1]); | |||
setrgb(0, 0, 0, &led[2]); | |||
break; | |||
case _FL: | |||
setrgb(0, 0, 0, &led[0]); //Set the middle LED to white for the middle layer | |||
setrgb(RGB_WHITE, &led[1]); | |||
setrgb(0, 0, 0, &led[2]); | |||
break; | |||
case _TL: | |||
setrgb(0, 0, 0, &led[0]); | |||
setrgb(0, 0, 0, &led[1]); | |||
setrgb(RGB_WHITE, &led[2]); //Set the bottom LED to white for the top layer | |||
break; | |||
} | |||
rgblight_set(); | |||
return state; | |||
} |
@ -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. |
@ -0,0 +1,17 @@ | |||
# SPIN | |||
![SPIN](https://i.imgur.com/5oYg1WD.jpg) | |||
The SPIN Macro Pad is a USB-C, hotswappable Macro Pad with 3 encoders designed by Nick from DMQ Design. | |||
* Keyboard Maintainer: [Nicholas Junker](https://github.com/Quarren42) | |||
* Hardware Supported: SPIN Macro Pad PCB/kit | |||
* Hardware Availability: The macro pad is available at [DMQdesign.com](www.dmqdesign.com) | |||
Make example for this keyboard (after setting up your build environment): | |||
make dmqdesign/spin:default | |||
I have two example keymaps available, both the default and the encoderlayers keymap which demonstrates using different encoder functions based on the layer chosen. | |||
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,34 @@ | |||
# MCU name | |||
MCU = atmega32u4 | |||
# Bootloader selection | |||
# Teensy halfkay | |||
# Pro Micro caterina | |||
# Atmel DFU atmel-dfu | |||
# LUFA DFU lufa-dfu | |||
# QMK DFU qmk-dfu | |||
# ATmega32A bootloadHID | |||
# ATmega328P USBasp | |||
BOOTLOADER = atmel-dfu | |||
# Build Options | |||
# change yes to no to disable | |||
# | |||
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration | |||
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 = yes # Enable keyboard RGB underglow | |||
MIDI_ENABLE = yes # MIDI support | |||
UNICODE_ENABLE = no # Unicode | |||
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID | |||
AUDIO_ENABLE = no # Audio output on port C6 | |||
FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches | |||
HD44780_ENABLE = no # Enable support for HD44780 based LCDs | |||
ENCODER_ENABLE = yes # Enable rotary encoder support |
@ -0,0 +1,16 @@ | |||
/* Copyright 2019-2020 DMQ Design | |||
* | |||
* 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 "spin.h" |
@ -0,0 +1,29 @@ | |||
/* Copyright 2019-2020 DMQ Design | |||
* | |||
* 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 "quantum.h" | |||
#define LAYOUT( \ | |||
k00, k01, k02, k03, \ | |||
k10, k11, k12, k13, \ | |||
k20, k21, k22, k23, \ | |||
k30, k31, k32 \ | |||
) { \ | |||
{k00, k10, k20, k30, k23}, \ | |||
{k01, k11, k21, k31, k13}, \ | |||
{k02, k12, k22, k32, k03} \ | |||
} |