aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorimchipwood <imchipwood@gmail.com>2019-08-20 22:08:30 -0700
committerDrashna Jaelre <drashna@live.com>2019-08-20 22:08:30 -0700
commit977c316eb1bdca7f0e13026936322cb9a9fcd0d2 (patch)
tree5b6bb40c251833b6c6e75632b374552960364d81
parent367eac22293ac148e19e545e110d5a591de1eb6e (diff)
downloadqmk_firmware-977c316eb1bdca7f0e13026936322cb9a9fcd0d2.tar.gz
qmk_firmware-977c316eb1bdca7f0e13026936322cb9a9fcd0d2.zip
[Keymap] dumbpad updates, new keymap (#6481)
* removed some debug prints * removed unnecessary files, tweaked some things * rotary encoder button now connected into column 0, row 3 * tweaked keymap and moved encoder control into keymap * tweaks * added test keymap * updated some things to make it easier to work with QMK configurator * updates after merging latest master in * fixed a few things * removed test keymap and all related #ifdefs * changed some dumbpad default keys, added KC_LOCK * added image to readme * added link to PCB github repo * moved lock key to the rotary encoder pushbutton * making suggested changes from @fauxpark in https://github.com/qmk/qmk_firmware/pull/6452 * adding bootmagic lite since i'm lazy and haven't soldered on the reset button... * renamed to * using 7 underscores for KC_TRNS * adding my layout (default is for wife) * updated my own layout, tweaked default keymap to use cleaner switch for encoder control * removed commented out import from imchipwood keymap, removed unnecessary comment from default layout * added LED layer control * flash the layer indicator LEDs at startup * change layer_state_set_user to layer_state_set_kb Co-Authored-By: Joel Challis <git@zvecr.com> * in layer_state_set_kb, return layer_state_set_user Co-Authored-By: Drashna Jaelre <drashna@live.com> * remove include of upper level config.h, add pragma once Co-Authored-By: Drashna Jaelre <drashna@live.com> * changing default keymap slightly, added config.h for default layout * change _delay_ms to wait_ms * replaced locking numlock with numlock * Update keyboards/dumbpad/dumbpad.c change `keyboard_pre_init_user` to `keyboard_pre_init_kb` Co-Authored-By: Joel Challis <git@zvecr.com> * Update keyboards/dumbpad/dumbpad.c adding `keyboard_pre_init_user()` to `keyboard_pre_init_kb()` Co-Authored-By: Joel Challis <git@zvecr.com> * fixed some comments about the layer key (MO to TT) and the SUB layer rotary encoder control
-rw-r--r--keyboards/dumbpad/config.h4
-rw-r--r--keyboards/dumbpad/dumbpad.c40
-rw-r--r--keyboards/dumbpad/keymaps/default/config.h2
-rw-r--r--keyboards/dumbpad/keymaps/default/keymap.c45
-rw-r--r--keyboards/dumbpad/keymaps/imchipwood/config.h2
-rw-r--r--keyboards/dumbpad/keymaps/imchipwood/keymap.c163
6 files changed, 237 insertions, 19 deletions
diff --git a/keyboards/dumbpad/config.h b/keyboards/dumbpad/config.h
index a7d4e7b3c..3c27a35b2 100644
--- a/keyboards/dumbpad/config.h
+++ b/keyboards/dumbpad/config.h
@@ -51,6 +51,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
51#define ENCODERS_PAD_A { D0 } 51#define ENCODERS_PAD_A { D0 }
52#define ENCODERS_PAD_B { D4 } 52#define ENCODERS_PAD_B { D4 }
53 53
54/* LED layer indicators */
55#define LAYER_INDICATOR_LED_0 B3
56#define LAYER_INDICATOR_LED_1 B1
57
54/* Bootmagic - hold down rotary encoder pushbutton while plugging in to enter bootloader */ 58/* Bootmagic - hold down rotary encoder pushbutton while plugging in to enter bootloader */
55#define BOOTMAGIC_LITE_ROW 3 59#define BOOTMAGIC_LITE_ROW 3
56#define BOOTMAGIC_LITE_COLUMN 0 60#define BOOTMAGIC_LITE_COLUMN 0
diff --git a/keyboards/dumbpad/dumbpad.c b/keyboards/dumbpad/dumbpad.c
index b53856237..d9b649c71 100644
--- a/keyboards/dumbpad/dumbpad.c
+++ b/keyboards/dumbpad/dumbpad.c
@@ -15,15 +15,49 @@
15 */ 15 */
16#include "dumbpad.h" 16#include "dumbpad.h"
17 17
18void keyboard_pre_init_kb(void) {
19 // Set the layer LED IO as outputs
20 setPinOutput(LAYER_INDICATOR_LED_0);
21 setPinOutput(LAYER_INDICATOR_LED_1);
22
23 keyboard_pre_init_user();
24}
25
26void shutdown_user() {
27 // Shutdown the layer LEDs
28 writePinLow(LAYER_INDICATOR_LED_0);
29 writePinLow(LAYER_INDICATOR_LED_1);
30}
31
32layer_state_t layer_state_set_kb(layer_state_t state) {
33 // Layer LEDs act as binary indication of current layer
34 uint8_t layer = biton32(state);
35 writePin(LAYER_INDICATOR_LED_0, layer & 0b1);
36 writePin(LAYER_INDICATOR_LED_1, (layer >> 1) & 0b1);
37 return layer_state_set_user(state);
38}
39
18// Optional override functions below. 40// Optional override functions below.
19// You can leave any or all of these undefined. 41// You can leave any or all of these undefined.
20// These are only required if you want to perform custom actions. 42// These are only required if you want to perform custom actions.
21 43
22/*
23
24void matrix_init_kb(void) { 44void matrix_init_kb(void) {
25 // put your keyboard start-up code here 45 // put your keyboard start-up code here
26 // runs once when the firmware starts up 46 // runs once when the firmware starts up
47 for (int i = 0; i < 2; i++) {
48 writePin(LAYER_INDICATOR_LED_0, true);
49 writePin(LAYER_INDICATOR_LED_1, false);
50 wait_ms(100);
51 writePin(LAYER_INDICATOR_LED_0, true);
52 writePin(LAYER_INDICATOR_LED_1, true);
53 wait_ms(100);
54 writePin(LAYER_INDICATOR_LED_0, false);
55 writePin(LAYER_INDICATOR_LED_1, true);
56 wait_ms(100);
57 writePin(LAYER_INDICATOR_LED_0, false);
58 writePin(LAYER_INDICATOR_LED_1, false);
59 wait_ms(100);
60 }
27 61
28 matrix_init_user(); 62 matrix_init_user();
29} 63}
@@ -47,5 +81,3 @@ void led_set_kb(uint8_t usb_led) {
47 81
48 led_set_user(usb_led); 82 led_set_user(usb_led);
49} 83}
50
51*/
diff --git a/keyboards/dumbpad/keymaps/default/config.h b/keyboards/dumbpad/keymaps/default/config.h
new file mode 100644
index 000000000..838088559
--- /dev/null
+++ b/keyboards/dumbpad/keymaps/default/config.h
@@ -0,0 +1,2 @@
1#pragma once
2#define TAPPING_TOGGLE 2
diff --git a/keyboards/dumbpad/keymaps/default/keymap.c b/keyboards/dumbpad/keymaps/default/keymap.c
index 061215a61..c0d4a7c07 100644
--- a/keyboards/dumbpad/keymaps/default/keymap.c
+++ b/keyboards/dumbpad/keymaps/default/keymap.c
@@ -28,14 +28,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
28 | |---------|---------|---------|---------| 28 | |---------|---------|---------|---------|
29 | | 1 | 2 | 3 | Tab | 29 | | 1 | 2 | 3 | Tab |
30 |-------------|---------|---------|---------|---------| 30 |-------------|---------|---------|---------|---------|
31 | Left mouse | MO(SUB) | 0 | . | Enter | 31 | Left mouse | TT(SUB) | 0 | . | Enter |
32 \-----------------------------------------------------' 32 \-----------------------------------------------------'
33 */ 33 */
34 [_BASE] = LAYOUT( /* Base */ 34 [_BASE] = LAYOUT(
35 KC_7, KC_8, KC_9, KC_BSPC, 35 KC_7, KC_8, KC_9, KC_BSPC,
36 KC_4, KC_5, KC_6, KC_ESC, 36 KC_4, KC_5, KC_6, KC_ESC,
37 KC_1, KC_2, KC_3, KC_TAB, 37 KC_1, KC_2, KC_3, KC_TAB,
38 KC_BTN1, MO(_SUB), KC_0, KC_DOT, KC_ENTER 38 KC_BTN1, TT(_SUB), KC_0, KC_DOT, KC_ENTER
39 ), 39 ),
40 /* 40 /*
41 SUB LAYER 41 SUB LAYER
@@ -88,19 +88,34 @@ void led_set_user(uint8_t usb_led) {
88} 88}
89 89
90void encoder_update_user(uint8_t index, bool clockwise) { 90void encoder_update_user(uint8_t index, bool clockwise) {
91 /* Custom encoder control - handles CW/CCW turning of encoder
92 * Default behavior:
93 * main layer:
94 * CW: move mouse right
95 * CCW: move mouse left
96 * other layers:
97 * CW: = (equals/plus - increase slider in Adobe products)
98 * CCW: - (minus/underscore - decrease slider in adobe products)
99 */
91 if (index == 0) { 100 if (index == 0) {
92 if (layer_state && 0x1) { 101 switch (biton32(layer_state)) {
93 if (clockwise) { 102 case _BASE:
94 tap_code(KC_VOLU); 103 // main layer - move mouse right (CW) and left (CCW)
95 } else { 104 if (clockwise) {
96 tap_code(KC_VOLD); 105 tap_code(KC_MS_R);
97 } 106 } else {
98 } else { 107 tap_code(KC_MS_L);
99 if (clockwise) { 108 }
100 tap_code(KC_MS_R); 109 break;
101 } else { 110
102 tap_code(KC_MS_L); 111 default:
103 } 112 // other layers - =/+ (quals/plus) (CW) and -/_ (minus/underscore) (CCW)
113 if (clockwise) {
114 tap_code(KC_EQL);
115 } else {
116 tap_code(KC_MINS);
117 }
118 break;
104 } 119 }
105 } 120 }
106} 121}
diff --git a/keyboards/dumbpad/keymaps/imchipwood/config.h b/keyboards/dumbpad/keymaps/imchipwood/config.h
new file mode 100644
index 000000000..838088559
--- /dev/null
+++ b/keyboards/dumbpad/keymaps/imchipwood/config.h
@@ -0,0 +1,2 @@
1#pragma once
2#define TAPPING_TOGGLE 2
diff --git a/keyboards/dumbpad/keymaps/imchipwood/keymap.c b/keyboards/dumbpad/keymaps/imchipwood/keymap.c
new file mode 100644
index 000000000..73a8e824c
--- /dev/null
+++ b/keyboards/dumbpad/keymaps/imchipwood/keymap.c
@@ -0,0 +1,163 @@
1/* Copyright 2019 imchipwood
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
18#define _BASE 0
19#define _SUB 1
20#define _DBG 2
21
22
23const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
24 /*
25 BASE LAYER
26 /-----------------------------------------------------`
27 | | 7 | 8 | 9 | Bkspc |
28 | |---------|---------|---------|---------|
29 | | 4 | 5 | 6 | + |
30 | |---------|---------|---------|---------|
31 | | 1 | 2 | 3 | * |
32 |-------------|---------|---------|---------|---------|
33 | Play/Pause | TT(SUB) | 0 | . | Enter |
34 \-----------------------------------------------------'
35 */
36 [_BASE] = LAYOUT(
37 KC_P7, KC_P8, KC_P9, KC_BSPC,
38 KC_P4, KC_P5, KC_P6, KC_KP_PLUS,
39 KC_P1, KC_P2, KC_P3, KC_KP_ASTERISK,
40 KC_MPLY, TT(_SUB), KC_P0, KC_PDOT, KC_KP_ENTER
41 ),
42 /*
43 SUB LAYER
44 /-----------------------------------------------------`
45 | | | | | Numlock |
46 | |---------|---------|---------|---------|
47 | | | | | - |
48 | |---------|---------|---------|---------|
49 | | | | | / |
50 |-------------|---------|---------|---------|---------|
51 | MO(_DBG) | | | | = |
52 \-----------------------------------------------------'
53 */
54 [_SUB] = LAYOUT(
55 _______, _______, _______, KC_NLCK,
56 _______, _______, _______, KC_KP_MINUS,
57 _______, _______, _______, KC_KP_SLASH,
58 MO(_DBG), _______, _______, _______, KC_KP_EQUAL
59 ),
60 /*
61 DEBUG LAYER
62 /-----------------------------------------------------`
63 | | | | | Reset |
64 | |---------|---------|---------|---------|
65 | | | | | |
66 | |---------|---------|---------|---------|
67 | | | | | |
68 |-------------|---------|---------|---------|---------|
69 | | | | | |
70 \-----------------------------------------------------'
71 */
72 [_DBG] = LAYOUT(
73 _______, _______, _______, RESET,
74 _______, _______, _______, _______,
75 _______, _______, _______, _______,
76 _______, _______, _______, _______, _______
77 ),
78};
79
80bool process_record_user(uint16_t keycode, keyrecord_t *record) {
81 // If console is enabled, it will print the matrix position and status of each key pressed
82/*
83#ifdef CONSOLE_ENABLE
84 uprintf("KL: kc: %u, col: %u, row: %u, pressed: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed);
85#endif
86*/
87 return true;
88}
89
90void keyboard_post_init_user(void) {
91 // Customise these values to desired behaviour
92 //debug_enable = true;
93 //debug_matrix = true;
94 //debug_keyboard = true;
95 //debug_mouse = true;
96}
97
98void matrix_init_user(void) {
99
100}
101
102void matrix_scan_user(void) {
103
104}
105
106void led_set_user(uint8_t usb_led) {
107
108}
109
110
111void encoder_update_user(uint8_t index, bool clockwise) {
112 /* Custom encoder control - handles CW/CCW turning of encoder
113 * Cusotom behavior:
114 * main layer:
115 * CW: volume up
116 * CCW: volume down
117 * sub layer:
118 * CW: next media track
119 * CCW: prev media track
120 * debug layer:
121 * CW: brightness up
122 * CCW: brightness down
123 */
124 if (index == 0) {
125 switch (biton32(layer_state)) {
126 case _BASE:
127 // main layer - volume up (CW) and down (CCW)
128 if (clockwise) {
129 tap_code(KC_VOLU);
130 } else {
131 tap_code(KC_VOLD);
132 }
133 break;
134
135 case _SUB:
136 // sub layer - next track (CW) and previous track (CCW)
137 if (clockwise) {
138 tap_code(KC_MNXT);
139 } else {
140 tap_code(KC_MPRV);
141 }
142 break;
143
144 case _DBG:
145 // debug layer - brightness up (CW) and brightness down (CCW)
146 if (clockwise) {
147 tap_code(KC_BRIU);
148 } else {
149 tap_code(KC_BRID);
150 }
151 break;
152
153 default:
154 // any other layer (shouldn't exist..) - volume up (CW) and down (CCW)
155 if (clockwise) {
156 tap_code(KC_VOLU);
157 } else {
158 tap_code(KC_VOLD);
159 }
160 break;
161 }
162 }
163}