aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--keyboards/keebio/bdn9/keymaps/mousepad/config.h3
-rw-r--r--keyboards/keebio/bdn9/keymaps/mousepad/keymap.c81
-rw-r--r--keyboards/keebio/bdn9/keymaps/mousepad/readme.md16
-rw-r--r--keyboards/keebio/bdn9/keymaps/mousepad/rule.mk2
4 files changed, 102 insertions, 0 deletions
diff --git a/keyboards/keebio/bdn9/keymaps/mousepad/config.h b/keyboards/keebio/bdn9/keymaps/mousepad/config.h
new file mode 100644
index 000000000..a2eb1a95f
--- /dev/null
+++ b/keyboards/keebio/bdn9/keymaps/mousepad/config.h
@@ -0,0 +1,3 @@
1#define MK_3_SPEED
2#define TERMINAL_HELP
3
diff --git a/keyboards/keebio/bdn9/keymaps/mousepad/keymap.c b/keyboards/keebio/bdn9/keymaps/mousepad/keymap.c
new file mode 100644
index 000000000..79ae56fd2
--- /dev/null
+++ b/keyboards/keebio/bdn9/keymaps/mousepad/keymap.c
@@ -0,0 +1,81 @@
1/* Copyright 2019 Danny Nguyen <danny@keeb.io>
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
19bool is_alt_tab_active = false; // ADD this near the begining of keymap.c
20uint16_t alt_tab_timer = 0; // we will be using them soon.
21
22enum custom_keycodes { // Make sure have the awesome keycode ready
23 ALT_TAB = SAFE_RANGE,
24};
25
26
27const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
28 [0] = LAYOUT(
29 KC_MS_BTN1, KC_MS_BTN2, KC_MS_BTN3,
30 KC_WH_U, ALT_TAB, KC_WH_L,
31 KC_WH_D, TT(1), KC_WH_R
32 ),
33 [1] = LAYOUT(
34 RESET, KC_ACL0, KC_ACL1,
35 KC_VOLU, KC_ACL2, KC_BRIU,
36 KC_VOLD, TO(1), KC_BRID
37 ),
38};
39
40void encoder_update_user(uint8_t index, bool clockwise) {
41 if (index == 0) {
42 if (clockwise) {
43 tap_code(KC_MS_LEFT);
44 } else {
45 tap_code(KC_MS_RIGHT);
46 }
47 }
48 else if (index == 1) {
49 if (clockwise) {
50 tap_code(KC_MS_U);
51 } else {
52 tap_code(KC_MS_D);
53 }
54 }
55}
56bool process_record_user(uint16_t keycode, keyrecord_t *record) {
57 switch (keycode) { // This will do most of the grunt work with the keycodes.
58 case ALT_TAB:
59 if (record->event.pressed) {
60 if (!is_alt_tab_active) {
61 is_alt_tab_active = true;
62 register_code(KC_LALT);
63 }
64 alt_tab_timer = timer_read();
65 register_code(KC_TAB);
66 } else {
67 unregister_code(KC_TAB);
68 }
69 break;
70 }
71 return true;
72}
73
74void matrix_scan_user(void) { // The very important timer.
75 if (is_alt_tab_active) {
76 if (timer_elapsed(alt_tab_timer) > 1000) {
77 unregister_code(KC_LALT);
78 is_alt_tab_active = false;
79 }
80 }
81}
diff --git a/keyboards/keebio/bdn9/keymaps/mousepad/readme.md b/keyboards/keebio/bdn9/keymaps/mousepad/readme.md
new file mode 100644
index 000000000..fc843929d
--- /dev/null
+++ b/keyboards/keebio/bdn9/keymaps/mousepad/readme.md
@@ -0,0 +1,16 @@
1# Mousepad layout for BDN9
2##### 2 encoders required
3Why use a movable mouse when you can "Etech-a-sketch" style mousepad.
4The left encoder will move the X axis; leaving the right to handle the Y axis
5
6| | | |
7|:-:|:-:|:-:|
8| Left Click | Middle Click | Right Click |
9| Scroll Up | Super ALT↯TAB | Scroll Left |
10| Scroll Down | ADJUSTMENT Layer | Scroll Right|
11
12| | | |
13|:-:|:-:|:-:|
14| RESET | Mouse ACL0 | Mouse ACL1 |
15| VOL UP | Mouse ACL2 | Brightness UP |
16| VOL Down | Adjustment Layer OFF | Brightness Down |
diff --git a/keyboards/keebio/bdn9/keymaps/mousepad/rule.mk b/keyboards/keebio/bdn9/keymaps/mousepad/rule.mk
new file mode 100644
index 000000000..ff752ab42
--- /dev/null
+++ b/keyboards/keebio/bdn9/keymaps/mousepad/rule.mk
@@ -0,0 +1,2 @@
1MOUSEKEY_ENABLE = yes
2TAPDANCE_ENABLE = yes