aboutsummaryrefslogtreecommitdiff
path: root/keyboards/1upkeyboards
diff options
context:
space:
mode:
authorNick Blyumberg <nblyumberg@gmail.com>2020-07-01 02:49:16 -0400
committerGitHub <noreply@github.com>2020-06-30 23:49:16 -0700
commit907c1c64cfd1e1c132c65a19ef30bb255255c37b (patch)
tree6e6554327023ffe4ff43d0fb45ad3ffad95c3421 /keyboards/1upkeyboards
parent8b9e3e9979ffddaa91e022e8ab953be5c7c5283e (diff)
downloadqmk_firmware-907c1c64cfd1e1c132c65a19ef30bb255255c37b.tar.gz
qmk_firmware-907c1c64cfd1e1c132c65a19ef30bb255255c37b.zip
[Keymap] AutoHotKey Companion keymap for Super16 (#9216)
* Started AHK Companion Development * Updated the readme * Added AutoHotKey companion file * Updated documentation * Cleaned up the files and revised documentation * Finished the readme.md updates * Fixed the LED issue where the last LED did not reflect the right color
Diffstat (limited to 'keyboards/1upkeyboards')
-rw-r--r--keyboards/1upkeyboards/super16/keymaps/ahk_companion/ahk_companion.ahk104
-rw-r--r--keyboards/1upkeyboards/super16/keymaps/ahk_companion/config.h19
-rw-r--r--keyboards/1upkeyboards/super16/keymaps/ahk_companion/keymap.c136
-rw-r--r--keyboards/1upkeyboards/super16/keymaps/ahk_companion/readme.md58
-rw-r--r--keyboards/1upkeyboards/super16/keymaps/ahk_companion/rules.mk2
5 files changed, 319 insertions, 0 deletions
diff --git a/keyboards/1upkeyboards/super16/keymaps/ahk_companion/ahk_companion.ahk b/keyboards/1upkeyboards/super16/keymaps/ahk_companion/ahk_companion.ahk
new file mode 100644
index 000000000..becab49e5
--- /dev/null
+++ b/keyboards/1upkeyboards/super16/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/1upkeyboards/super16/keymaps/ahk_companion/config.h b/keyboards/1upkeyboards/super16/keymaps/ahk_companion/config.h
new file mode 100644
index 000000000..3b7fd81d6
--- /dev/null
+++ b/keyboards/1upkeyboards/super16/keymaps/ahk_companion/config.h
@@ -0,0 +1,19 @@
1#pragma once
2
3// Time out one shot layers after 3 seconds
4#define ONESHOT_TIMEOUT 3000
5
6#define RGBLED_NUM 16
7
8// Undef and redefine default brightness to half of 255
9#undef RGBLIGHT_LIMIT_VAL
10#define RGBLIGHT_LIMIT_VAL 128
11
12//Define a preview timeout for RGB reviews
13#define PREVIEW_TIMEOUT 5000
14#define TAPPING_TERM 200
15
16// Enable Light Layers implementation
17#define RGBLIGHT_LAYERS
18// Allow Light Layers to override RGB off configuration
19#define RGBLIGHT_LAYERS_OVERRIDE_RGB_OFF
diff --git a/keyboards/1upkeyboards/super16/keymaps/ahk_companion/keymap.c b/keyboards/1upkeyboards/super16/keymaps/ahk_companion/keymap.c
new file mode 100644
index 000000000..e62f3b609
--- /dev/null
+++ b/keyboards/1upkeyboards/super16/keymaps/ahk_companion/keymap.c
@@ -0,0 +1,136 @@
1#include QMK_KEYBOARD_H
2
3#if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_LAYERS)
4static uint32_t rgb_preview_timer = 0;
5#endif
6extern rgblight_config_t rgblight_config;
7
8const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
9 //Layer 0 - Base Layer (F13 to F24, and One Shot Layer 1,2,3 or Toggle Layer 4)
10 [0] = LAYOUT_ortho_4x4(
11 KC_F13, KC_F14, KC_F15, KC_F16,
12 KC_F17, KC_F18, KC_F19, KC_F20,
13 KC_F21, KC_F22, KC_F23, KC_F24,
14 OSL(1), OSL(2), OSL(3), TG(4) //Transparent to let you go between layers
15 ),
16
17 [1] = LAYOUT_ortho_4x4(
18 LALT(KC_F13), LALT(KC_F14), LALT(KC_F15), LALT(KC_F16),
19 LALT(KC_F17), LALT(KC_F18), LALT(KC_F19), LALT(KC_F20),
20 LALT(KC_F21), LALT(KC_F22), LALT(KC_F23), LALT(KC_F24),
21 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS //Transparent to let you go between layers
22 ),
23
24 //Layer 2 - Shift + Function Key Layer
25 [2] = LAYOUT_ortho_4x4(
26 LSFT(KC_F13), LSFT(KC_F14), LSFT(KC_F15), LSFT(KC_F16),
27 LSFT(KC_F17), LSFT(KC_F18), LSFT(KC_F19), LSFT(KC_F20),
28 LSFT(KC_F21), LSFT(KC_F22), LSFT(KC_F23), LSFT(KC_F24),
29 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS //Transparent to let you go between layers
30 ),
31
32 //Layer 3 - Control + Function Key
33 [3] = LAYOUT_ortho_4x4(
34 LCTL(KC_F13), LCTL(KC_F14), LCTL(KC_F15), LCTL(KC_F16),
35 LCTL(KC_F17), LCTL(KC_F18), LCTL(KC_F19), LCTL(KC_F20),
36 LCTL(KC_F21), LCTL(KC_F22), LCTL(KC_F23), LCTL(KC_F24),
37 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS //Transparent to let you go between layers
38 ),
39
40 //Layer 4 - Multimedia
41 [4] = LAYOUT_ortho_4x4(
42 KC_MPRV, KC_MPLY, KC_MNXT, KC_VOLU,
43 KC_NO, KC_NO, KC_NO, KC_MUTE,
44 KC_NO, RESET, EEP_RST, KC_VOLD,
45 TG(5), KC_TRNS, KC_TRNS, KC_TRNS //Transparent to let you go between layers
46 ),
47
48 //Layer 5 - Keyboard Lights, Programming and Special Functions
49 [5] = LAYOUT_ortho_4x4(
50 RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI,
51 RGB_RMOD, RGB_HUD, RGB_SAD, RGB_VAD,
52 RGB_TOG, EEP_RST, RESET, KC_LSHIFT,
53 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS //Transparent to let you go between layers
54 ),
55};
56
57const rgblight_segment_t PROGMEM my_layer0_layer[] = RGBLIGHT_LAYER_SEGMENTS(
58 {0,16,HSV_ORANGE}
59 );
60const rgblight_segment_t PROGMEM my_layer1_layer[] = RGBLIGHT_LAYER_SEGMENTS(
61 {0,16,HSV_GREEN}
62 );
63const rgblight_segment_t PROGMEM my_layer2_layer[] = RGBLIGHT_LAYER_SEGMENTS(
64 {0,16,HSV_RED}
65 );
66const rgblight_segment_t PROGMEM my_layer3_layer[] = RGBLIGHT_LAYER_SEGMENTS(
67 {0,16,HSV_BLUE}
68 );
69const rgblight_segment_t PROGMEM my_layer4_layer[] = RGBLIGHT_LAYER_SEGMENTS(
70 {0,16,HSV_WHITE}
71 );
72const rgblight_segment_t PROGMEM my_layer5_layer[] = RGBLIGHT_LAYER_SEGMENTS(
73 {0,16,HSV_TEAL}
74 );
75const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST(
76 my_layer0_layer,
77 my_layer1_layer,
78 my_layer2_layer,
79 my_layer3_layer,
80 my_layer4_layer,
81 my_layer5_layer
82 );
83
84bool process_record_user(uint16_t keycode, keyrecord_t *record) {
85 return true;
86}
87
88void post_process_record_user(uint16_t keycode, keyrecord_t *record) {
89 // Allow for a preview of changes when modifying RGB
90# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_LAYERS)
91 switch (keycode) {
92 case RGB_TOG ... VLK_TOG:
93 for (uint8_t i = 0; i < RGBLIGHT_MAX_LAYERS; i++) {
94 rgblight_set_layer_state(i, false);
95 }
96 rgb_preview_timer = timer_read32();
97 break;
98 }
99# endif
100 return;
101}
102
103//Set the appropriate layer color
104layer_state_t layer_state_set_user(layer_state_t state) {
105 rgblight_set_layer_state(1, layer_state_cmp(state, 1));
106 rgblight_set_layer_state(2, layer_state_cmp(state, 2));
107 rgblight_set_layer_state(3, layer_state_cmp(state, 3));
108 rgblight_set_layer_state(4, layer_state_cmp(state, 4));
109 rgblight_set_layer_state(5, layer_state_cmp(state, 5));
110 return state;
111}
112
113void keyboard_post_init_user(void) {
114 //Enable the LED layers
115 rgblight_layers = my_rgb_layers;
116 layer_state_set_user(layer_state);
117}
118
119void matrix_scan_user(void) {
120# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_LAYERS)
121 // Allow preview for
122 if (rgb_preview_timer && TIMER_DIFF_32(timer_read32(), rgb_preview_timer) > PREVIEW_TIMEOUT) {
123 rgb_preview_timer = 0;
124 default_layer_state_set_user(default_layer_state);
125 layer_state_set_user(layer_state);
126 led_update_user((led_t) host_keyboard_leds());
127 }
128# endif
129}
130
131//EEPROM Reset Function
132void eeconfig_init_user(void) {
133 rgblight_enable(); // Enable RGB by default
134 rgblight_sethsv_orange(); // Set it to orange by default
135}
136
diff --git a/keyboards/1upkeyboards/super16/keymaps/ahk_companion/readme.md b/keyboards/1upkeyboards/super16/keymaps/ahk_companion/readme.md
new file mode 100644
index 000000000..7a0107c99
--- /dev/null
+++ b/keyboards/1upkeyboards/super16/keymaps/ahk_companion/readme.md
@@ -0,0 +1,58 @@
1## AutoHotKey Companion ##
2
3### Overview ###
4AutoHotKey Companion Keymap for <a href="https://www.1upkeyboards.com/shop/keyboard-kits/macro-pads/super-16-macro-pad/">1upkeyboards Super16</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 chose the Super16 because it provided an easy way (RGB) to identify what layer I was on with a quick glance or peripheral vision. 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.
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### Alternate Implementations ###
16I 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.
17
18If 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`
19
20
21
22
23### Layers ###
24
25While 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.
26
27
28* 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.
29
30 ![Image of Base Layer ](https://i.imgur.com/0LhityX.png)
31
32* Layer 1 (Alt Layer) - Equivalent to Alt+Fxx key being pressed
33
34 ![Image of Layer 1 ](https://i.imgur.com/ZblqLZt.png)
35
36* Layer 2 (Shift Layer) - Equivalent to Shift+Fxx key being pressed
37
38 ![Image of Layer 2 ](https://i.imgur.com/ZQHwLC0.png)
39
40* Layer 3 (Control Layer) - Equivalent to Ctrl+Fxx key being pressed
41
42 ![Image of Layer 3 ](https://i.imgur.com/JkM8bqV.png)
43
44* 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.
45
46 ![Image of Layer 4 ](https://i.imgur.com/srDp5Lv.png)
47
48* Layer 5 (RGB Control/QMK) - RGB control layer and Quantum functions (Reset, EEPROM Reset, )
49
50 ![Image of Layer 5 ](https://i.imgur.com/Os3n8dx.png)
51
52### Host Configuration ###
53
54Once 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.
55Starting the AHK file can be done either by:
56* Creating a Windows Task
57* Adding the AHK to the startup folder
58* Launch manually
diff --git a/keyboards/1upkeyboards/super16/keymaps/ahk_companion/rules.mk b/keyboards/1upkeyboards/super16/keymaps/ahk_companion/rules.mk
new file mode 100644
index 000000000..b5bd51b32
--- /dev/null
+++ b/keyboards/1upkeyboards/super16/keymaps/ahk_companion/rules.mk
@@ -0,0 +1,2 @@
1RGB_MATRIX_ENABLE = no
2RGBLIGHT_ENABLE = yes