diff options
author | Jesse Leventhal <45154268+jessel92@users.noreply.github.com> | 2020-02-04 20:56:50 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-05 12:56:50 +1100 |
commit | 8a749a7a8e0c47488b19bb92ac5b35bc60f66dd8 (patch) | |
tree | d6564de91209bcd654144356f281a379125f8277 /keyboards/ncc1701kb | |
parent | 964ed177165072572112abfbdbba3317ed13170c (diff) |
Encoder brush size (#8087)
* Added brush size to encoder knob as new keymap
* Encoder keymap added
Diffstat (limited to 'keyboards/ncc1701kb')
-rw-r--r-- | keyboards/ncc1701kb/info.json | 12 | ||||
-rw-r--r-- | keyboards/ncc1701kb/keymaps/brushsize/keymap.c | 51 |
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 @@ "height": 3, "layouts": { "LAYOUT": { - "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}] + "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} + ] } } } 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 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* LAYER 0 + * ,-----------------------. + * | << | MUTE | >> | ENCODER - PRESS (MUTE) / KNOB (Brush size) + * |-------+-------+-------| + * | STOP | PLAY | MEDIA | + * |-------+-------+-------| + * | CALC | MAIL | PC/FN | + * `-----------------------' + */ +[0] = LAYOUT( + KC_MPRV, KC_MUTE, KC_MNXT, + KC_MSTP, KC_MPLY, KC_MSEL, + KC_CALC, KC_MAIL, LT(1, KC_MYCM) +), + +/* LAYER 1 + * ,-----------------------. + * |BL TOG | | BREATH| + * |-------+-------+-------| + * | BL + | BL - |BL CYCL| + * |-------+-------+-------| + * | BL ON | BL OFF| | + * `-----------------------' + */ +[1] = LAYOUT( + BL_TOGG, KC_TRNS, BL_BRTG, + BL_INC, BL_DEC, BL_STEP, + BL_ON, BL_OFF, KC_TRNS +) + +}; + +void encoder_update_user(uint8_t index, bool clockwise) { + if (index == 0) { /* First encoder */ + if (clockwise) { + tap_code(KC_RBRC); + } else { + tap_code(KC_LBRC); + } + } else if (index == 1) { /* Second encoder */ + if (clockwise) { + tap_code(KC_RBRC); + } else { + tap_code(KC_LBRC); + } + } +}
\ No newline at end of file |