summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Leventhal <45154268+jessel92@users.noreply.github.com>2020-02-04 20:56:50 -0500
committerGitHub <noreply@github.com>2020-02-05 12:56:50 +1100
commit8a749a7a8e0c47488b19bb92ac5b35bc60f66dd8 (patch)
treed6564de91209bcd654144356f281a379125f8277
parent964ed177165072572112abfbdbba3317ed13170c (diff)
Encoder brush size (#8087)
* Added brush size to encoder knob as new keymap * Encoder keymap added
-rw-r--r--keyboards/ncc1701kb/info.json12
-rw-r--r--keyboards/ncc1701kb/keymaps/brushsize/keymap.c51
2 files changed, 62 insertions, 1 deletions
diff --git a/keyboards/ncc1701kb/info.json b/keyboards/ncc1701kb/info.json
index bc0f04db16..d5a80ba0d1 100644
--- a/keyboards/ncc1701kb/info.json
+++ b/keyboards/ncc1701kb/info.json
@@ -6,7 +6,17 @@
6 "height": 3, 6 "height": 3,
7 "layouts": { 7 "layouts": {
8 "LAYOUT": { 8 "LAYOUT": {
9 "layout": [{"x":0, "y":0}, {"label":"Encoder", "x":1, "y":0}, {"x":2, "y":0}, {"x":0, "y":1}, {"x":1, "y":1}, {"x":2, "y":1}, {"x":0, "y":2}, {"x":1, "y":2}, {"x":2, "y":2}] 9 "layout": [
10 {"x":0, "y":0},
11 {"label":"Encoder", "x":1, "y":0},
12 {"x":2, "y":0},
13 {"x":0, "y":1},
14 {"x":1, "y":1},
15 {"x":2, "y":1},
16 {"x":0, "y":2},
17 {"x":1, "y":2},
18 {"x":2, "y":2}
19 ]
10 } 20 }
11 } 21 }
12} 22}
diff --git a/keyboards/ncc1701kb/keymaps/brushsize/keymap.c b/keyboards/ncc1701kb/keymaps/brushsize/keymap.c
new file mode 100644
index 0000000000..4150e70997
--- /dev/null
+++ b/keyboards/ncc1701kb/keymaps/brushsize/keymap.c
@@ -0,0 +1,51 @@
1#include QMK_KEYBOARD_H
2
3const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
4
5/* LAYER 0
6 * ,-----------------------.
7 * | << | MUTE | >> | ENCODER - PRESS (MUTE) / KNOB (Brush size)
8 * |-------+-------+-------|
9 * | STOP | PLAY | MEDIA |
10 * |-------+-------+-------|
11 * | CALC | MAIL | PC/FN |
12 * `-----------------------'
13 */
14[0] = LAYOUT(
15 KC_MPRV, KC_MUTE, KC_MNXT,
16 KC_MSTP, KC_MPLY, KC_MSEL,
17 KC_CALC, KC_MAIL, LT(1, KC_MYCM)
18),
19
20/* LAYER 1
21 * ,-----------------------.
22 * |BL TOG | | BREATH|
23 * |-------+-------+-------|
24 * | BL + | BL - |BL CYCL|
25 * |-------+-------+-------|
26 * | BL ON | BL OFF| |
27 * `-----------------------'
28 */
29[1] = LAYOUT(
30 BL_TOGG, KC_TRNS, BL_BRTG,
31 BL_INC, BL_DEC, BL_STEP,
32 BL_ON, BL_OFF, KC_TRNS
33)
34
35};
36
37void encoder_update_user(uint8_t index, bool clockwise) {
38 if (index == 0) { /* First encoder */
39 if (clockwise) {
40 tap_code(KC_RBRC);
41 } else {
42 tap_code(KC_LBRC);
43 }
44 } else if (index == 1) { /* Second encoder */
45 if (clockwise) {
46 tap_code(KC_RBRC);
47 } else {
48 tap_code(KC_LBRC);
49 }
50 }
51} \ No newline at end of file