Skip to content

Commit

Permalink
Add dumbpad config
Browse files Browse the repository at this point in the history
  • Loading branch information
halcyonCorsair committed Mar 2, 2022
1 parent 769b2f6 commit 590b0c1
Show file tree
Hide file tree
Showing 8 changed files with 379 additions and 0 deletions.
48 changes: 48 additions & 0 deletions keyboards/dumbpadv2/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
Copyright 2020 imchipwood
Copyright 2021 Josh Johnson
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 0x434B // CK
#define PRODUCT_ID 0x4050 // DP
#define DEVICE_VER 0x0001
#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

/* Dual rotary encoders */
#define ENCODERS_PAD_A { B2, D0 }
#define ENCODERS_PAD_B { D4, D1 }

/* Column/Row IO definitions */
#define DIODE_DIRECTION COL2ROW

/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCE 5

/* Reduce tapdance required taps from 5 to 2 */
#define TAPPING_TOGGLE 2
16 changes: 16 additions & 0 deletions keyboards/dumbpadv2/dumbpadv2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* 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 "dumbpadv2.h"
44 changes: 44 additions & 0 deletions keyboards/dumbpadv2/dumbpadv2.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/* 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/>.
*/
#pragma once
#include "quantum.h"

#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 }, \
}

#define LAYOUT_oled_top( \
k30, \
k31, k21, k11, k01, \
k32, k22, k12, k02, \
k33, k23, k13, k03, \
k34, k24, k14, k04 \
) \
{ \
{ KC_NO, k01, k02, k03, k04 }, \
{ KC_NO, k11, k12, k13, k14 }, \
{ KC_NO, k21, k22, k23, k24 }, \
{ k30, k31, k32, k33, k34 }, \
}
25 changes: 25 additions & 0 deletions keyboards/dumbpadv2/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"keyboard_name": "dumbpad",
"keyboard_folder": "dumbpad",
"url": "https://www.github.com/imchipwood/dumbpad",
"maintainer": "imchipwood",
"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}
]
},
"LAYOUT_oled_top": {
"layout": [
{"x":0, "y":3},
{"x":1, "y":3}, {"x":1, "y":2}, {"x":1, "y":1}, {"x":1, "y":0},
{"x":2, "y":3}, {"x":2, "y":2}, {"x":2, "y":1}, {"x":2, "y":0},
{"x":3, "y":3}, {"x":3, "y":2}, {"x":3, "y":1}, {"x":3, "y":0},
{"x":4, "y":3}, {"x":4, "y":2}, {"x":4, "y":1}, {"x":4, "y":0}
]
}
}
}
9 changes: 9 additions & 0 deletions keyboards/dumbpadv2/keymaps/livcg/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#pragma once

#define TAPPING_TOGGLE 2

// Set tapping term
#ifdef TAPPING_TERM
# undef TAPPING_TERM
#endif // TAPPING_TERM
#define TAPPING_TERM 200
126 changes: 126 additions & 0 deletions keyboards/dumbpadv2/keymaps/livcg/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
#include QMK_KEYBOARD_H

#define _BASE 0
#define _FUNC 1

enum custom_keycodes {
GITPUSH = SAFE_RANGE,
GITPULL,
GITSTATUS,
GITDIFF,
GITDC,
GITADD,
GITCOMMIT,
};

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_BASE] = LAYOUT_oled_top(
KC_MPLY,
KC_P7, KC_P8, KC_P9, KC_BSPC,
KC_P4, KC_P5, KC_P6, KC_ESC,
KC_P1, KC_P2, KC_P3, KC_TAB,
TT(_FUNC), KC_P0, KC_PDOT, KC_KP_ENTER
),

[_FUNC] = LAYOUT_oled_top(
_______,
KC_MPRV, KC_MNXT, KC_KP_SLASH,KC_KP_ASTERISK,
GITPUSH, GITPULL, GITSTATUS, KC_KP_PLUS,
GITADD, GITCOMMIT, GITDIFF, KC_KP_MINUS,
_______, XXXXXXX, GITDC, KC_PEQL
),
};

bool encoder_update_user(uint8_t index, bool clockwise) {
if (layer_state_is(_FUNC)) {
// Page up/Page down
if (clockwise) {
tap_code(KC_PGUP);
} else {
tap_code(KC_PGDN);
}
return false;
}

if (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
return false;
}

//MACRO ------------------------------------------------------- https://beta.docs.qmk.fm/using-qmk/advanced-keycodes/feature_macros
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case GITPUSH:
if (record->event.pressed) {
SEND_STRING("git push\n");
}
break;

case GITPULL:
if (record->event.pressed) {
SEND_STRING("git pull\n");
}
break;

case GITADD:
if (record->event.pressed) {
SEND_STRING("git add --all\n");
}
break;

case GITCOMMIT:
if (record->event.pressed) {
SEND_STRING("git commit -m ");
}
break;

case GITDIFF:
if (record->event.pressed) {
SEND_STRING("git diff\n");
}
break;

case GITDC:
if (record->event.pressed) {
SEND_STRING("git diff --cached\n");
}
break;

case GITSTATUS:
if (record->event.pressed) {
SEND_STRING("git status\n");
}
break;

}

return true;
};

#ifdef OLED_ENABLE
// Used to draw on to the oled screen
bool oled_task_user(void) {
oled_set_cursor(0, 0); // sets cursor to (row, column) using charactar spacing (5 rows on 128x32 screen, anything more will overflow back to the top)
// Host Keyboard Layer Status
oled_write_P(PSTR("Layer: "), false);
switch (get_highest_layer(layer_state|default_layer_state)) {
case _BASE:
oled_write_P(PSTR("Base"), false);
break;
case _FUNC:
oled_write_P(PSTR("Function"), false);
break;
default:
oled_write_P(PSTR("Undefined"), false);
}

oled_write_P(PSTR("\n\n"), false);
oled_write_P(PSTR("Every day is a\n"), false);
oled_write_P(PSTR("fresh opportunity"), false);

return true;
}
#endif
87 changes: 87 additions & 0 deletions keyboards/dumbpadv2/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# dumbpad v1.x dual-encoder

![dumbpad](https://i.imgur.com/s69rdfA.png)

## Single- vs Dual-Encoder Support

The combined Cherry MX/encoder sockets allow single- and dual-encoder configurations.

The only rule when using two encoders is that there cannot be two encoders on the left side at once, or two on the right side.
This table shows where the encoders are in the switch grid ("X" for encoder, "s" for switch):

| C0 | C1 | C2 | C3 | C4 |
|:---:|:---:|:---:|:---:|:---:|
| |__X__| s | s |__X__|
| | s | s | s | s |
| | s | s | s | s |
|__X__|__X__| s | s |__X__|

- The three encoders in columns C0 and C1 are connected to each other
- The two encoders in column C4 are connected to each other

So, if doing dual encoders, one must be in column C4 and the other in either C0 or C1. Three or more encoders will not work.

The following sections describe the configurations that the default keymaps in QMK are designed for.

### Single-Encoder (Default Configuration)

In the default configuration, the encoder is in column 0, the bottom left corner below the Pro Micro. All other sockets are filled with switches.

| C0 | C1 | C2 | C3 | C4 |
|:---:|:---:|:---:|:---:|:---:|
| | s | s | s | s |
| | s | s | s | s |
| | s | s | s | s |
|__X__| s | s | s | s |

![single encoder](https://i.imgur.com/8ZPz1gFl.jpg)

### Dual-Encoder Bottom

One dual-encoder configuration has encoders in the bottom two corners of the 4x4 grid, and switches in the rest of the grid. The socket in column 0 is left empty.

| C0 | C1 | C2 | C3 | C4 |
|:---:|:---:|:---:|:---:|:---:|
| | s | s | s | s |
| | s | s | s | s |
| | s | s | s | s |
| |__X__| s | s |__X__|

![dual-encoder bottom](https://i.imgur.com/QCqKDMSl.jpg)

### Dual-Encoder Top

Another dual-encoder configuration has encoders in the top two corners of the 4x4 grid, and switches in the rest of the grid. The socket in column 0 is left empty.

| C0 | C1 | C2 | C3 | C4 |
|:---:|:---:|:---:|:---:|:---:|
| |__X__| s | s |__X__|
| | s | s | s | s |
| | s | s | s | s |
| | s | s | s | s |

![dual-encoder top](https://i.imgur.com/Rq6ox2Ol.jpg)

### No-Encoder

You may also choose not to use any rotary encoders if you like!

### Bill Of Materials

- Cherry-style mechanical switches
- EC11 rotary encoder with pushbutton (7-pin) - one or two depending on your desired configuration
- 1n4148 diodes (thru hole) - one per switch and rotary encoder (if using clickable encoder(s))
- 1x Arduino Pro Micro or pin-compatible ATmega32u4-based MCU
- (optional) 3x 3mm LEDs
- (optional) 3x 330 ohm resistors (for limiting current in LEDs)
- (optional) 6mm SPST switch for resetting MCU

* Keyboard Maintainer: [imchipwood](https://github.com/imchipwood)
* Hardware repository: [dumbpad on github](https://github.com/imchipwood/dumbpad)
* PCB Revisions Supported: v1.0_dual

Make example for this keyboard (after setting up your build environment):

make dumbpad/v1x_dualencoder:default

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).
24 changes: 24 additions & 0 deletions keyboards/dumbpadv2/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# MCU name
MCU = atmega32u4

# Bootloader selection
BOOTLOADER = atmel-dfu

BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite
MOUSEKEY_ENABLE = no # 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
NKRO_ENABLE = no # USB Nkey Rollover
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
AUDIO_ENABLE = no # Audio output

ENCODER_ENABLE = yes
OLED_ENABLE = yes
OLED_DRIVER = SSD1306
WPM_ENABLE = yes

#LAYOUTS = default oled_top

0 comments on commit 590b0c1

Please sign in to comment.