aboutsummaryrefslogtreecommitdiff
path: root/keyboards/hub16
diff options
context:
space:
mode:
authorNick Blyumberg <nblyumberg@gmail.com>2020-09-14 21:15:25 -0400
committerGitHub <noreply@github.com>2020-09-14 18:15:25 -0700
commitb58f9ef1e29c1de848f8896078111e55d6d62a65 (patch)
tree20350a6b1d3f0b1a8bac60157006b0a9d8a25b9d /keyboards/hub16
parent02551ae4991d818adb824fe39a82437281ee5306 (diff)
downloadqmk_firmware-b58f9ef1e29c1de848f8896078111e55d6d62a65.tar.gz
qmk_firmware-b58f9ef1e29c1de848f8896078111e55d6d62a65.zip
[Keymap] Hub16 AutoHotKey Companion (#10159)
* Hub16 AutoHotKey Companion * Revised after PR comments by Drashna * Update keyboards/hub16/keymaps/ahk_companion/readme.md Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/hub16/keymaps/ahk_companion/readme.md Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/hub16/keymaps/ahk_companion/readme.md Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/hub16/keymaps/ahk_companion/readme.md Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/hub16/keymaps/ahk_companion/readme.md Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/hub16/keymaps/ahk_companion/keymap.c Co-authored-by: Drashna Jaelre <drashna@live.com> Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com> Co-authored-by: Drashna Jaelre <drashna@live.com>
Diffstat (limited to 'keyboards/hub16')
-rw-r--r--keyboards/hub16/keymaps/ahk_companion/ahk_companion.ahk104
-rw-r--r--keyboards/hub16/keymaps/ahk_companion/config.h57
-rw-r--r--keyboards/hub16/keymaps/ahk_companion/keymap.c168
-rw-r--r--keyboards/hub16/keymaps/ahk_companion/readme.md71
-rwxr-xr-xkeyboards/hub16/keymaps/ahk_companion/rules.mk3
5 files changed, 403 insertions, 0 deletions
diff --git a/keyboards/hub16/keymaps/ahk_companion/ahk_companion.ahk b/keyboards/hub16/keymaps/ahk_companion/ahk_companion.ahk
new file mode 100644
index 000000000..becab49e5
--- /dev/null
+++ b/keyboards/hub16/keymaps/ahk_companion/ahk_companion.ahk
@@ -0,0 +1,104 @@
1#Persistent
2#SingleInstance force
3
4;=================================================================
5; Macro Pad Shortcuts ;
6;=================================================================
7
8;=================================================================
9; Layer 0
10;;=================================================================
11;Row 1
12
13F13::Send a
14F14::Send b
15F15::Send c
16F16::Send d
17
18;Row 2
19
20F17::Send e
21F18::Send f
22F19::Send g
23F20::Send h
24
25;Row 3
26
27F21::Send i
28F22::Send j
29F23::Send k
30F24::Send l
31
32
33;=================================================================
34; Layer 1
35;;=================================================================
36;Row 1
37
38!F13::Send m
39!F14::Send n
40!F15::Send o
41!F16::Send p
42
43;Row 2
44
45!F17::Send q
46!F18::Send r
47!F19::Send s
48!F20::Send t
49
50;Row 3
51
52!F21::Send u
53!F22::Send v
54!F23::Send w
55!F24::Send x
56
57
58;=================================================================
59; Layer 2
60;;=================================================================
61;Row 1
62
63+F13::Send y
64+F14::Send z
65+F15::Send A
66+F16::Send B
67
68;Row 2
69
70+F17::Send C
71+F18::Send D
72+F19::Send E
73+F20::Send F
74
75;Row 3
76
77+F21::Send G
78+F22::Send H
79+F23::Send I
80+F24::Send J
81
82;=================================================================
83; Layer 3
84;;=================================================================
85;Row 1
86
87^F13::Send K
88^F14::Send L
89^F15::Send M
90^F16::Send N
91
92;Row 2
93
94^F17::Send O
95^F18::Send P
96^F19::Send Q
97^F20::Send R
98
99;Row 3
100
101^F21::Send S
102^F22::Send T
103^F23::Send U
104^F24::Send V
diff --git a/keyboards/hub16/keymaps/ahk_companion/config.h b/keyboards/hub16/keymaps/ahk_companion/config.h
new file mode 100644
index 000000000..aa9e081c7
--- /dev/null
+++ b/keyboards/hub16/keymaps/ahk_companion/config.h
@@ -0,0 +1,57 @@
1/*
2Copyright 2019 Josh Johnson
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#pragma once
19
20#define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */
21// /*== all animations enable ==*/
22// #define RGBLIGHT_ANIMATIONS
23// /*== or choose animations ==*/
24// #define RGBLIGHT_EFFECT_BREATHING
25// #define RGBLIGHT_EFFECT_RAINBOW_MOOD
26// #define RGBLIGHT_EFFECT_RAINBOW_SWIRL
27// #define RGBLIGHT_EFFECT_SNAKE
28// #define RGBLIGHT_EFFECT_KNIGHT
29// #define RGBLIGHT_EFFECT_CHRISTMAS
30// #define RGBLIGHT_EFFECT_STATIC_GRADIENT
31// #define RGBLIGHT_EFFECT_RGB_TEST
32// #define RGBLIGHT_EFFECT_ALTERNATING
33// /*== customize breathing effect ==*/
34// /*==== (DEFAULT) use fixed table instead of exp() and sin() ====*/
35// #define RGBLIGHT_BREATHE_TABLE_SIZE 256 // 256(default) or 128 or 64
36// /*==== use exp() and sin() ====*/
37// #define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 // 1 to 2.7
38// #define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0 to 255
39// #endif
40
41/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
42#define DEBOUNCE 20
43
44// Time out one shot layers after 3 seconds
45#define ONESHOT_TIMEOUT 3000
46
47// Undef and redefine default brightness to half of 255
48#undef RGBLIGHT_LIMIT_VAL
49#define RGBLIGHT_LIMIT_VAL 255
50
51//Define a preview timeout for RGB reviews
52#define PREVIEW_TIMEOUT 5000
53
54// Enable Light Layers implementation
55#define RGBLIGHT_LAYERS
56// Allow Light Layers to override RGB off configuration
57#define RGBLIGHT_LAYERS_OVERRIDE_RGB_OFF
diff --git a/keyboards/hub16/keymaps/ahk_companion/keymap.c b/keyboards/hub16/keymaps/ahk_companion/keymap.c
new file mode 100644
index 000000000..bbc2ac09a
--- /dev/null
+++ b/keyboards/hub16/keymaps/ahk_companion/keymap.c
@@ -0,0 +1,168 @@
1/*
2Copyright 2019 Josh Johnson
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include QMK_KEYBOARD_H
19
20#if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_LAYERS)
21static uint32_t rgb_preview_timer = 0;
22#endif
23
24const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
25 //Layer 0 - Base Layer (F13 to F24, and One Shot Layer 1,2,3 or Toggle Layer 4)
26 [0] = LAYOUT(
27 KC_MPLY, KC_MUTE,
28 KC_F13, KC_F14, KC_F15, KC_F16,
29 KC_F17, KC_F18, KC_F19, KC_F20,
30 KC_F21, KC_F22, KC_F23, KC_F24,
31 OSL(1), OSL(2), OSL(3), TG(4) //Transparent to let you go between layers
32 ),
33
34 [1] = LAYOUT(
35 KC_MPLY, KC_MUTE,
36 LALT(KC_F13), LALT(KC_F14), LALT(KC_F15), LALT(KC_F16),
37 LALT(KC_F17), LALT(KC_F18), LALT(KC_F19), LALT(KC_F20),
38 LALT(KC_F21), LALT(KC_F22), LALT(KC_F23), LALT(KC_F24),
39 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS //Transparent to let you go between layers
40 ),
41
42 //Layer 2 - Shift + Function Key Layer
43 [2] = LAYOUT(
44 KC_MPLY, KC_MUTE,
45 LSFT(KC_F13), LSFT(KC_F14), LSFT(KC_F15), LSFT(KC_F16),
46 LSFT(KC_F17), LSFT(KC_F18), LSFT(KC_F19), LSFT(KC_F20),
47 LSFT(KC_F21), LSFT(KC_F22), LSFT(KC_F23), LSFT(KC_F24),
48 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS //Transparent to let you go between layers
49 ),
50
51 //Layer 3 - Control + Function Key
52 [3] = LAYOUT(
53 KC_MPLY, KC_MUTE,
54 LCTL(KC_F13), LCTL(KC_F14), LCTL(KC_F15), LCTL(KC_F16),
55 LCTL(KC_F17), LCTL(KC_F18), LCTL(KC_F19), LCTL(KC_F20),
56 LCTL(KC_F21), LCTL(KC_F22), LCTL(KC_F23), LCTL(KC_F24),
57 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS //Transparent to let you go between layers
58 ),
59
60 //Layer 4 - Multimedia
61 [4] = LAYOUT(
62 KC_MPLY, KC_MUTE,
63 KC_MPRV, KC_MPLY, KC_U, KC_K,
64 KC_NO, KC_NO, KC_ENT, KC_X,
65 KC_NO, RESET, LSFT(KC_HASH), KC_J,
66 TG(5), KC_TRNS, KC_TRNS, KC_TRNS //Transparent to let you go between layers
67 ),
68
69 //Layer 5 - Keyboard Lights, Programming and Special Functions
70 [5] = LAYOUT(
71 KC_MPLY, KC_MUTE,
72 RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI,
73 RGB_RMOD, RGB_HUD, RGB_SAD, RGB_VAD,
74 RGB_TOG, EEP_RST, RESET, KC_LSHIFT,
75 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS //Transparent to let you go between layers
76 ),
77};
78
79const rgblight_segment_t PROGMEM my_layer0_layer[] = RGBLIGHT_LAYER_SEGMENTS(
80 {0,16,HSV_ORANGE}
81 );
82const rgblight_segment_t PROGMEM my_layer1_layer[] = RGBLIGHT_LAYER_SEGMENTS(
83 {0,16,HSV_GREEN}
84 );
85const rgblight_segment_t PROGMEM my_layer2_layer[] = RGBLIGHT_LAYER_SEGMENTS(
86 {0,16,HSV_RED}
87 );
88const rgblight_segment_t PROGMEM my_layer3_layer[] = RGBLIGHT_LAYER_SEGMENTS(
89 {0,16,HSV_BLUE}
90 );
91const rgblight_segment_t PROGMEM my_layer4_layer[] = RGBLIGHT_LAYER_SEGMENTS(
92 {0,16,HSV_WHITE}
93 );
94const rgblight_segment_t PROGMEM my_layer5_layer[] = RGBLIGHT_LAYER_SEGMENTS(
95 {0,16,HSV_TEAL}
96 );
97const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST(
98 my_layer0_layer,
99 my_layer1_layer,
100 my_layer2_layer,
101 my_layer3_layer,
102 my_layer4_layer,
103 my_layer5_layer
104 );
105
106void encoder_update_user(uint8_t index, bool clockwise) {
107 if (index == 0) { /* Left Encoder */
108 if (clockwise) {
109 tap_code(KC_MPRV);
110 } else {
111 tap_code(KC_MNXT);
112 }
113 } else if (index == 1) { /* Right Encoder */
114 if (clockwise) {
115 tap_code(KC_VOLD);
116 } else {
117 tap_code(KC_VOLU);
118 }
119 }
120}
121void post_process_record_user(uint16_t keycode, keyrecord_t *record) {
122 // Allow for a preview of changes when modifying RGB
123# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_LAYERS)
124 switch (keycode) {
125 case RGB_TOG ... VLK_TOG:
126 for (uint8_t i = 0; i < RGBLIGHT_MAX_LAYERS; i++) {
127 rgblight_set_layer_state(i, false);
128 }
129 rgb_preview_timer = timer_read32();
130 break;
131 }
132# endif
133 return;
134}
135
136//Set the appropriate layer color
137layer_state_t layer_state_set_user(layer_state_t state) {
138 rgblight_set_layer_state(1, layer_state_cmp(state, 1));
139 rgblight_set_layer_state(2, layer_state_cmp(state, 2));
140 rgblight_set_layer_state(3, layer_state_cmp(state, 3));
141 rgblight_set_layer_state(4, layer_state_cmp(state, 4));
142 rgblight_set_layer_state(5, layer_state_cmp(state, 5));
143 return state;
144}
145
146void keyboard_post_init_user(void) {
147 //Enable the LED layers
148 rgblight_layers = my_rgb_layers;
149 layer_state_set_user(layer_state);
150}
151
152void matrix_scan_user(void) {
153# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_LAYERS)
154 // Allow preview for
155 if (rgb_preview_timer && TIMER_DIFF_32(timer_read32(), rgb_preview_timer) > PREVIEW_TIMEOUT) {
156 rgb_preview_timer = 0;
157 default_layer_state_set_user(default_layer_state);
158 layer_state_set_user(layer_state);
159 led_update_user((led_t) host_keyboard_leds());
160 }
161# endif
162}
163
164//EEPROM Reset Function
165void eeconfig_init_user(void) {
166 rgblight_enable(); // Enable RGB by default
167 rgblight_sethsv_orange(); // Set it to orange by default
168}
diff --git a/keyboards/hub16/keymaps/ahk_companion/readme.md b/keyboards/hub16/keymaps/ahk_companion/readme.md
new file mode 100644
index 000000000..6e8f9f2d2
--- /dev/null
+++ b/keyboards/hub16/keymaps/ahk_companion/readme.md
@@ -0,0 +1,71 @@
1# AutoHotKey Companion
2
3## Overview
4AutoHotKey Companion Keymap for <a href="https://www.tindie.com/products/joshajohnson/hub16-programmable-macro-keyboard/">Hub16 macropad</a> is designed be a quick and easy way to get started with AutoHotKey and to provide a foundation for customizing your own macropad. I upgraded to the Super16 from a Super16 because it kept the RGB underglow lights for an easy way (RGB) to identify what layer I was on with a quick glance or peripheral vision and added 2 rotary encoders and a USB 2.0 hub with USB-C ports. The F13 to F24 keys were selected as they are rarely used so you won't run into conflicts with existing application shortcuts and AutoHotKey recognizes them without any issues. *Note:* MacOS does not support/recognize F21 to F24 so these would need to be remapped for Mac users.
5
6Same functionality can be accomplished with other similar applications on the host system like Keyboard Maestro, AutoIt, etc.
7
8* <a href="https://www.autohotkey.com">AutoHotKey</a>(Windows)
9* <a href="https://www.autoitscript.com/site/autoit/">AutoIT</a> (Windows)
10* <a href="https://www.keyboardmaestro.com/main/">Keyboard Maestro</a>(Mac)
11* <a href="https://github.com/autokey/autokey">AutoKey</a>(Linux)
12
13This keymap allows for a total of 48 Function/Macro keys that are accessible within 2 sequential key presses (or more when extended with your own code and additional layers)
14
15## Encoders
16Encoder functionality was made based on my needs but it can be remapped as desired by changing the keycodes.
17
18Left Encoder:
19 * Counter clockwise: Previous Multimedia
20 * Clockwise: Next Multimedia
21 * Click: Play/Pause
22
23 Right Encoder:
24 * Counter clockwise: Volume Down
25 * Clockwise: Volume Up
26 * Click: Mute/Unmute
27
28## Alternate Implementations
29I chose to use <a href="https://docs.qmk.fm/#/feature_layers?id=switching-and-toggling-layers">QMK OSL</a> (One Shot Layer) functionality to avoid having to hold a key while selecting the next key and to have my layers always go back to the default layer as the starting point. This also helps me avoid having to cognitively remember what layer I am on.
30
31If persistent behavior is prefered, OSL can be swapped for TG which will toggle the layer on/off with a key press instead of clearing the layer once the Function key is pressed. This is useful if a layer contains several keys that need to be used in sequence. I also added a OSL timeout of 3 seconds, so that if the key is not pressed within 3 seconds the layer will go back to default. This can be adjusted in the config.h file by increasing 3000 to a desired value: `#define ONESHOT_TIMEOUT 3000`
32
33
34
35
36## Layers
37
38While the first 5 layers are accessible with only 1 key press at most, the 5th (less frequently used) layer is accessed by first going to the 4th layer, which makes the TG(5) button available on the bottom left. Space for additional 2 more layer toggles is available on the 2 middle buttons on the bottom row. Please refer to the layer diagrams.
39
40
41* Layer 0 (Base Layer) - the default layer and functions like sending the F13 to F24 keys along with the bottom row to activate another 4 layers.
42
43 ![Image of Base Layer ](https://i.imgur.com/0LhityX.png)
44
45* Layer 1 (Alt Layer) - Equivalent to Alt+Fxx key being pressed
46
47 ![Image of Layer 1 ](https://i.imgur.com/ZblqLZt.png)
48
49* Layer 2 (Shift Layer) - Equivalent to Shift+Fxx key being pressed
50
51 ![Image of Layer 2 ](https://i.imgur.com/ZQHwLC0.png)
52
53* Layer 3 (Control Layer) - Equivalent to Ctrl+Fxx key being pressed
54
55 ![Image of Layer 3 ](https://i.imgur.com/JkM8bqV.png)
56
57* Layer 4 (Config Layer) - Layer for multimedia. You can replace the KC_TRNS on this layer in keymap.c to TG(x) to enable additional layers.
58
59 ![Image of Layer 4 ](https://i.imgur.com/srDp5Lv.png)
60
61* Layer 5 (RGB Control/QMK) - RGB control layer and Quantum functions (Reset, EEPROM Reset, )
62
63 ![Image of Layer 5 ](https://i.imgur.com/Os3n8dx.png)
64
65## Host Configuration
66
67Once the keymap has been flashed to the Super16, you can download the accompanying AutoHotKey file or create your own and have it start automatically either via a Windows Task or another way. Using AutoHotKey allows adjustment of functionality of the buttons without the need to change your map and reflash the macropad every time.
68Starting the AHK file can be done either by:
69* Creating a Windows Task
70* Adding the AHK to the startup folder
71* Launch manually
diff --git a/keyboards/hub16/keymaps/ahk_companion/rules.mk b/keyboards/hub16/keymaps/ahk_companion/rules.mk
new file mode 100755
index 000000000..022a3eeee
--- /dev/null
+++ b/keyboards/hub16/keymaps/ahk_companion/rules.mk
@@ -0,0 +1,3 @@
1TAP_DANCE_ENABLE = no # Support for tap dancing
2
3