aboutsummaryrefslogtreecommitdiff
path: root/layouts/community/tkl_ansi/talljoe-tkl/keymap.c
diff options
context:
space:
mode:
Diffstat (limited to 'layouts/community/tkl_ansi/talljoe-tkl/keymap.c')
-rw-r--r--layouts/community/tkl_ansi/talljoe-tkl/keymap.c89
1 files changed, 89 insertions, 0 deletions
diff --git a/layouts/community/tkl_ansi/talljoe-tkl/keymap.c b/layouts/community/tkl_ansi/talljoe-tkl/keymap.c
new file mode 100644
index 000000000..b5dc54492
--- /dev/null
+++ b/layouts/community/tkl_ansi/talljoe-tkl/keymap.c
@@ -0,0 +1,89 @@
1#ifdef KEYBOARD_zeal60
2#include "config.h"
3#include "zeal60.h"
4#include "zeal_backlight.h"
5#include "action_layer.h"
6#include "solarized.h"
7#include "talljoe.h"
8
9// from zeal_backlight.c
10// we want to be able to set indicators for the spacebar stabs
11// but they are not represented by a row/index.
12extern zeal_backlight_config g_config;
13void map_row_column_to_led( uint8_t row, uint8_t column, uint8_t *led );
14
15void set_backlight_defaults(void) {
16 uint8_t space;
17 uint8_t caps_lock;
18 map_row_column_to_led(3, 12, &caps_lock);
19 map_row_column_to_led(4, 7, &space);
20 zeal_backlight_config default_values = {
21 .use_split_backspace = USE_SPLIT_BACKSPACE,
22 .use_split_left_shift = USE_SPLIT_LEFT_SHIFT,
23 .use_split_right_shift = USE_SPLIT_RIGHT_SHIFT,
24 .use_7u_spacebar = USE_7U_SPACEBAR,
25 .use_iso_enter = USE_ISO_ENTER,
26 .disable_when_usb_suspended = 1,
27 .disable_after_timeout = 0,
28 .brightness = 255,
29 .effect = 10,
30 .color_1 = solarized.base2,
31 .color_2 = solarized.base02,
32 .caps_lock_indicator = { .index = caps_lock, .color = solarized.red },
33 .layer_1_indicator = { .index = space, .color = solarized.blue },
34 .layer_2_indicator = { .index = space, .color = solarized.yellow },
35 .layer_3_indicator = { .index = 254, .color = solarized.red },
36 .alphas_mods = {
37 BACKLIGHT_ALPHAS_MODS_ROW_0,
38 BACKLIGHT_ALPHAS_MODS_ROW_1,
39 BACKLIGHT_ALPHAS_MODS_ROW_2,
40 BACKLIGHT_ALPHAS_MODS_ROW_3,
41 BACKLIGHT_ALPHAS_MODS_ROW_4 }
42 };
43 memcpy(&g_config, &default_values, sizeof(zeal_backlight_config));
44 backlight_config_save();
45
46 solarized_t* S = &solarized;
47 HSV alphas = S->base2;
48 HSV custom_color_map[MATRIX_ROWS][MATRIX_COLS] = CM(
49 S->red, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, S->red,
50 S->orange, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, S->orange,
51 S->green, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, S->green,
52 S->blue, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, alphas, S->blue, S->blue,
53 S->violet, S->magenta, S->yellow, alphas, S->yellow, S->magenta, S->violet, S->green
54 );
55 for (uint8_t row = 0; row < MATRIX_ROWS; ++row) {
56 for (uint8_t col = 0; col < MATRIX_COLS; ++col) {
57 backlight_set_key_color(row, col, custom_color_map[row][col]);
58 }
59 }
60}
61
62bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
63 static uint8_t last_effect;
64 switch (keycode) {
65 case DFAULTS:
66 if (IS_PRESSED(record->event)) set_backlight_defaults();
67 return false;
68 case BL_TOGG:
69 if (IS_PRESSED(record->event)) {
70 if (g_config.effect) {
71 last_effect = g_config.effect;
72 g_config.effect = 0;
73 } else {
74 g_config.effect = last_effect;
75 }
76 }
77 return false;
78 case EFFECT...EFFECT_END:
79 if (IS_PRESSED(record->event)) {
80 uint8_t effect = keycode - EFFECT;
81 g_config.effect = effect;
82 backlight_config_save();
83 }
84 return false;
85 }
86
87 return true;
88}
89#endif