forked from forks/qmk_firmware
[Keyboard] Dumbpad VIA support added (#13512)
Co-authored-by: Ryan <fauxpark@gmail.com>
This commit is contained in:
parent
3b4c35da6b
commit
425e1e665d
|
@ -21,14 +21,29 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
/* USB Device descriptor parameter */
|
||||
#define VENDOR_ID 0xFEED
|
||||
#define PRODUCT_ID 0x0913
|
||||
#define DEVICE_VER 0x0007
|
||||
#define MANUFACTURER imchipwood
|
||||
#define PRODUCT dumbpad
|
||||
|
||||
/* Column/Row IO definitions */
|
||||
#define MATRIX_ROWS 4
|
||||
#define MATRIX_COLS 5
|
||||
#define MATRIX_ROW_PINS { F4, F5, F6, F7 }
|
||||
#define MATRIX_COL_PINS { C6, D7, E6, B4, B5 }
|
||||
#define UNUSED_PINS
|
||||
|
||||
/* COL2ROW, ROW2COL*/
|
||||
#define DIODE_DIRECTION COL2ROW
|
||||
|
||||
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
||||
#define DEBOUNCE 5
|
||||
/* Single rotary encoder */
|
||||
#define ENCODERS_PAD_A { B2, D0 }
|
||||
#define ENCODERS_PAD_B { D4, D1 }
|
||||
#define ENCODER_RESOLUTIONS { 4, 4 }
|
||||
|
||||
/* Reduce tapdance required taps from 5 to 2 */
|
||||
#define TAPPING_TOGGLE 2
|
||||
/* Onboard LEDs */
|
||||
#define LED_00 B3
|
||||
#define LED_01 B1
|
||||
|
||||
/* Bootmagic - hold down rotary encoder pushbutton while plugging in to enter bootloader */
|
||||
#define BOOTMAGIC_LITE_ROW 3
|
||||
#define BOOTMAGIC_LITE_COLUMN 0
|
||||
|
|
59
keyboards/dumbpad/dumbpad.c
Normal file
59
keyboards/dumbpad/dumbpad.c
Normal file
|
@ -0,0 +1,59 @@
|
|||
/* Copyright 2019 Chip
|
||||
*
|
||||
* 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 "dumbpad.h"
|
||||
|
||||
void keyboard_pre_init_kb(void) {
|
||||
// Set LED IO as outputs
|
||||
setPinOutput(LED_00);
|
||||
setPinOutput(LED_01);
|
||||
keyboard_pre_init_user();
|
||||
}
|
||||
|
||||
void shutdown_user() {
|
||||
// Shutdown LEDs
|
||||
writePinLow(LED_00);
|
||||
writePinLow(LED_01);
|
||||
}
|
||||
|
||||
layer_state_t layer_state_set_kb(layer_state_t state) {
|
||||
// Layer LEDs act as binary indication of current layer
|
||||
uint8_t layer = get_highest_layer(state);
|
||||
writePin(LED_00, layer & 0b1);
|
||||
writePin(LED_01, (layer >> 1) & 0b1);
|
||||
return layer_state_set_user(state);
|
||||
}
|
||||
|
||||
// Optional override functions below.
|
||||
// You can leave any or all of these undefined.
|
||||
// These are only required if you want to perform custom actions.
|
||||
|
||||
void matrix_init_kb(void) {
|
||||
// put your keyboard start-up code here
|
||||
// runs once when the firmware starts up
|
||||
uint8_t led_delay_ms = 80;
|
||||
for (int i = 0; i < 2; i++) {
|
||||
writePinHigh(LED_00);
|
||||
writePinHigh(LED_01);
|
||||
wait_ms(led_delay_ms);
|
||||
writePinLow(LED_00);
|
||||
writePinLow(LED_01);
|
||||
if (i < 1) {
|
||||
wait_ms(led_delay_ms);
|
||||
}
|
||||
}
|
||||
|
||||
matrix_init_user();
|
||||
}
|
39
keyboards/dumbpad/dumbpad.h
Normal file
39
keyboards/dumbpad/dumbpad.h
Normal file
|
@ -0,0 +1,39 @@
|
|||
/* Copyright 2019 Chip
|
||||
*
|
||||
* 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"
|
||||
|
||||
/* This a shortcut to help you visually see your layout.
|
||||
*
|
||||
* The first section contains all of the arguments representing the physical
|
||||
* layout of the board and position of the keys.
|
||||
*
|
||||
* The second converts the arguments into a two-dimensional array which
|
||||
* represents the switch matrix.
|
||||
*/
|
||||
#define LAYOUT( \
|
||||
k01, k02, k03, k04, \
|
||||
k11, k12, k13, k14, \
|
||||
k21, k22, k23, k24, \
|
||||
k30, k31, k32, k33, k34 \
|
||||
) \
|
||||
{ \
|
||||
{ KC_NO, k01, k02, k03, k04 }, \
|
||||
{ KC_NO, k11, k12, k13, k14 }, \
|
||||
{ KC_NO, k21, k22, k23, k24 }, \
|
||||
{ k30, k31, k32, k33, k34 }, \
|
||||
}
|
18
keyboards/dumbpad/info.json
Normal file
18
keyboards/dumbpad/info.json
Normal file
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"keyboard_name": "dumbpad",
|
||||
"keyboard_folder": "dumbpad",
|
||||
"url": "https://www.github.com/imchipwood/dumbpad",
|
||||
"maintainer": "imchipwood",
|
||||
"width": 5,
|
||||
"height": 4,
|
||||
"layouts": {
|
||||
"LAYOUT": {
|
||||
"layout": [
|
||||
{"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":4, "y":0},
|
||||
{"x":1, "y":1}, {"x":2, "y":1}, {"x":3, "y":1}, {"x":4, "y":1},
|
||||
{"x":1, "y":2}, {"x":2, "y":2}, {"x":3, "y":2}, {"x":4, "y":2},
|
||||
{"x":0, "y":3}, {"x":1, "y":3}, {"x":2, "y":3}, {"x":3, "y":3}, {"x":4, "y":3}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
89
keyboards/dumbpad/keymaps/default/keymap.c
Normal file
89
keyboards/dumbpad/keymaps/default/keymap.c
Normal file
|
@ -0,0 +1,89 @@
|
|||
/* Copyright 2020 imchipwood
|
||||
*
|
||||
* 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] = {
|
||||
/*
|
||||
BASE LAYER
|
||||
/-----------------------------------------------------`
|
||||
| | 7 | 8 | 9 | Bkspc |
|
||||
| |---------|---------|---------|---------|
|
||||
| | 4 | 5 | 6 | Esc |
|
||||
| |---------|---------|---------|---------|
|
||||
| | 1 | 2 | 3 | Tab |
|
||||
|-------------|---------|---------|---------|---------|
|
||||
| Left mouse | TT(1) | 0 | . | Enter |
|
||||
\-----------------------------------------------------'
|
||||
*/
|
||||
[0] = LAYOUT(
|
||||
KC_7, KC_8, KC_9, KC_BSPC,
|
||||
KC_4, KC_5, KC_6, KC_ESC,
|
||||
KC_1, KC_2, KC_3, KC_TAB,
|
||||
KC_BTN1, TT(1), KC_0, LSFT_T(KC_DOT), KC_ENTER
|
||||
),
|
||||
/*
|
||||
SUB LAYER
|
||||
/-----------------------------------------------------`
|
||||
| | | | | Reset |
|
||||
| |---------|---------|---------|---------|
|
||||
| | | | | + |
|
||||
| |---------|---------|---------|---------|
|
||||
| | | | | - |
|
||||
|-------------|---------|---------|---------|---------|
|
||||
| LOCK | | | | = |
|
||||
\-----------------------------------------------------'
|
||||
*/
|
||||
[1] = LAYOUT(
|
||||
_______, _______, _______, RESET,
|
||||
_______, _______, _______, KC_KP_PLUS,
|
||||
_______, _______, _______, KC_KP_MINUS,
|
||||
KC_LOCK, _______, _______, _______, KC_EQL
|
||||
),
|
||||
};
|
||||
|
||||
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||
/* Custom encoder control - handles CW/CCW turning of encoder
|
||||
* Default behavior:
|
||||
* main layer:
|
||||
* CW: move mouse right
|
||||
* CCW: move mouse left
|
||||
* other layers:
|
||||
* CW: = (equals/plus - increase slider in Adobe products)
|
||||
* CCW: - (minus/underscore - decrease slider in adobe products)
|
||||
*/
|
||||
if (index == 0) {
|
||||
switch (get_highest_layer(layer_state)) {
|
||||
case 0:
|
||||
// main layer - move mouse right (CW) and left (CCW)
|
||||
if (clockwise) {
|
||||
tap_code(KC_MS_R);
|
||||
} else {
|
||||
tap_code(KC_MS_L);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// other layers - =/+ (quals/plus) (CW) and -/_ (minus/underscore) (CCW)
|
||||
if (clockwise) {
|
||||
tap_code(KC_EQL);
|
||||
} else {
|
||||
tap_code(KC_MINS);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
175
keyboards/dumbpad/keymaps/via/keymap.c
Normal file
175
keyboards/dumbpad/keymaps/via/keymap.c
Normal file
|
@ -0,0 +1,175 @@
|
|||
/* Copyright 2019 imchipwood
|
||||
*
|
||||
* 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] = {
|
||||
/*
|
||||
BASE LAYER
|
||||
/-----------------------------------------------------`
|
||||
| | 7 | 8 | 9 | Bkspc |
|
||||
| |---------|---------|---------|---------|
|
||||
| | 4 | 5 | 6 | Esc |
|
||||
| |---------|---------|---------|---------|
|
||||
| | 1 | 2 | 3 | Tab |
|
||||
|-------------|---------|---------|---------|---------|
|
||||
| Left mouse | MO(1) | 0 | . | Enter |
|
||||
\-----------------------------------------------------'
|
||||
*/
|
||||
[0] = LAYOUT(
|
||||
KC_7, KC_8, KC_9, KC_BSPC,
|
||||
KC_4, KC_5, KC_6, KC_ESC,
|
||||
KC_1, KC_2, KC_3, KC_TAB,
|
||||
KC_BTN1, MO(1), KC_0, KC_PDOT, KC_ENTER
|
||||
),
|
||||
/*
|
||||
SUB LAYER
|
||||
/-----------------------------------------------------`
|
||||
| | | | | Reset |
|
||||
| |---------|---------|---------|---------|
|
||||
| | | | | + |
|
||||
| |---------|---------|---------|---------|
|
||||
| | | | | - |
|
||||
|-------------|---------|---------|---------|---------|
|
||||
| LOCK | | MO(2) | | = |
|
||||
\-----------------------------------------------------'
|
||||
*/
|
||||
[1] = LAYOUT(
|
||||
_______, _______, _______, RESET,
|
||||
_______, _______, _______, KC_KP_PLUS,
|
||||
_______, _______, _______, KC_KP_MINUS,
|
||||
KC_MUTE, _______, MO(2) , _______, KC_EQL
|
||||
),
|
||||
|
||||
/*
|
||||
DEBUG LAYER
|
||||
/-----------------------------------------------------`
|
||||
| | | | | Reset |
|
||||
| |---------|---------|---------|---------|
|
||||
| | | | | |
|
||||
| |---------|---------|---------|---------|
|
||||
| | | | | |
|
||||
|-------------|---------|---------|---------|---------|
|
||||
| | | | | |
|
||||
\-----------------------------------------------------'
|
||||
*/
|
||||
[2] = LAYOUT(
|
||||
_______, _______, _______, RESET,
|
||||
_______, _______, _______, _______,
|
||||
_______, _______, _______, _______,
|
||||
_______, _______, _______, MO(3) , _______
|
||||
),
|
||||
|
||||
/*
|
||||
EXTRA LAYER
|
||||
/-----------------------------------------------------`
|
||||
| | | | | |
|
||||
| |---------|---------|---------|---------|
|
||||
| | | | | |
|
||||
| |---------|---------|---------|---------|
|
||||
| | | | | |
|
||||
|-------------|---------|---------|---------|---------|
|
||||
| | | | | |
|
||||
\-----------------------------------------------------'
|
||||
*/
|
||||
[3] = LAYOUT(
|
||||
_______, _______, _______, _______,
|
||||
_______, _______, _______, _______,
|
||||
_______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______
|
||||
),
|
||||
};
|
||||
|
||||
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||
if (index == 0) {
|
||||
switch (get_highest_layer(layer_state)) {
|
||||
case 0:
|
||||
// sub layer - Scroll
|
||||
if (clockwise) {
|
||||
tap_code(KC_MS_WH_DOWN);
|
||||
} else {
|
||||
tap_code(KC_MS_WH_UP);
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
// main layer - Volume
|
||||
if (clockwise) {
|
||||
tap_code(KC_VOLU);
|
||||
} else {
|
||||
tap_code(KC_VOLD);
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
// debug layer - Change track
|
||||
if (clockwise) {
|
||||
tap_code(KC_MNXT);
|
||||
} else {
|
||||
tap_code(KC_MPRV);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// any other layer Scroll
|
||||
if (clockwise) {
|
||||
tap_code(KC_MS_WH_DOWN);
|
||||
} else {
|
||||
tap_code(KC_MS_WH_UP);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (index == 1) {
|
||||
switch (get_highest_layer(layer_state)) {
|
||||
case 0:
|
||||
// sub layer - Volume
|
||||
if (clockwise) {
|
||||
tap_code(KC_VOLU);
|
||||
} else {
|
||||
tap_code(KC_VOLD);
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
// main layer - Scroll
|
||||
if (clockwise) {
|
||||
tap_code(KC_MS_WH_DOWN);
|
||||
} else {
|
||||
tap_code(KC_MS_WH_UP);
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
// debug layer - Brightness
|
||||
if (clockwise) {
|
||||
tap_code(KC_BRID);
|
||||
} else {
|
||||
tap_code(KC_BRIU);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// any other layer Scroll
|
||||
if (clockwise) {
|
||||
tap_code(KC_MS_WH_DOWN);
|
||||
} else {
|
||||
tap_code(KC_MS_WH_UP);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
3
keyboards/dumbpad/keymaps/via/rules.mk
Normal file
3
keyboards/dumbpad/keymaps/via/rules.mk
Normal file
|
@ -0,0 +1,3 @@
|
|||
CONSOLE_ENABLE = no
|
||||
LTO_ENABLE = yes
|
||||
VIA_ENABLE = yes
|
|
@ -1 +1,25 @@
|
|||
DEFAULT_FOLDER = dumbpad/v0x
|
||||
# MCU name
|
||||
MCU = atmega32u4
|
||||
|
||||
# Bootloader selection
|
||||
BOOTLOADER = caterina
|
||||
|
||||
# Build Options
|
||||
# change yes to no to disable
|
||||
#
|
||||
BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration
|
||||
MOUSEKEY_ENABLE = yes # Mouse keys
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control
|
||||
CONSOLE_ENABLE = yes # 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 = no # USB Nkey Rollover
|
||||
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
||||
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
|
||||
BLUETOOTH_ENABLE = no # Enable Bluetooth
|
||||
AUDIO_ENABLE = no # Audio output
|
||||
|
||||
ENCODER_ENABLE = yes
|
||||
KEY_LOCK_ENABLE = yes
|
||||
|
|
Loading…
Reference in a new issue