aboutsummaryrefslogtreecommitdiff
path: root/keyboards/gmmk/pro/keymaps/mike1808/mike1808.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/gmmk/pro/keymaps/mike1808/mike1808.c')
-rw-r--r--keyboards/gmmk/pro/keymaps/mike1808/mike1808.c68
1 files changed, 68 insertions, 0 deletions
diff --git a/keyboards/gmmk/pro/keymaps/mike1808/mike1808.c b/keyboards/gmmk/pro/keymaps/mike1808/mike1808.c
new file mode 100644
index 000000000..881384609
--- /dev/null
+++ b/keyboards/gmmk/pro/keymaps/mike1808/mike1808.c
@@ -0,0 +1,68 @@
1/* Copyright 2021 Mikael Manukyan <arm.localhost@gmail.com>
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 "mike1808.h"
17
18#if (__has_include("secrets.h") && !defined(NO_SECRETS))
19# include "secrets.h"
20#else
21// `PROGMEM const char secret[][x]` may work better, but it takes up more space in the firmware
22// And I'm not familiar enough to know which is better or why...
23static const char *const secret[] = {"test1", "test2", "test3", "test4", "test5"};
24#endif
25
26// userspace_config_t userspace_config;
27
28bool process_record_secrets(uint16_t keycode, keyrecord_t *record) {
29 switch (keycode) {
30 case KC_SECRET_1 ... KC_SECRET_5: // Secrets! Externally defined strings, not stored in repo
31 if (!record->event.pressed) {
32 clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED);
33 send_string_with_delay(secrets[keycode - KC_SECRET_1], MACRO_TIMER);
34 }
35 return false;
36 break;
37 }
38 return true;
39}
40
41void suspend_power_down_user(void) {
42#ifdef RGB_MATRIX_ENABLE
43 rgb_matrix_set_suspend_state(true);
44#endif // RGB_MATRIX_ENABLE
45}
46
47void suspend_wakeup_init_user(void) {
48#ifdef RGB_MATRIX_ENABLE
49 rgb_matrix_set_suspend_state(false);
50#endif // RGB_MATRIX_ENABLE
51}
52
53#ifdef RGB_MATRIX_ENABLE
54void rgb_matrix_indicators_advanced_keymap(uint8_t led_min, uint8_t led_max) {
55 // Turn on sideglow when CAPS LOCK is activated
56 if (host_keyboard_led_state().caps_lock) {
57 HSV hsv = {CAPS_LOCK_COLOR};
58 hsv.v = rgb_matrix_get_val();
59 RGB rgb = hsv_to_rgb(hsv);
60
61 for (uint8_t i = led_min; i < led_max; i++) {
62 if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_UNDERGLOW)) {
63 RGB_MATRIX_INDICATOR_SET_COLOR(i, rgb.r, rgb.g, rgb.b);
64 }
65 }
66 }
67}
68#endif // RGB_MATRIX_ENABLE