aboutsummaryrefslogtreecommitdiff
path: root/keyboards/tunks/ergo33/keymaps/default/keymap.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/tunks/ergo33/keymaps/default/keymap.c')
-rw-r--r--keyboards/tunks/ergo33/keymaps/default/keymap.c110
1 files changed, 110 insertions, 0 deletions
diff --git a/keyboards/tunks/ergo33/keymaps/default/keymap.c b/keyboards/tunks/ergo33/keymaps/default/keymap.c
new file mode 100644
index 000000000..e26e556cb
--- /dev/null
+++ b/keyboards/tunks/ergo33/keymaps/default/keymap.c
@@ -0,0 +1,110 @@
1/* Copyright 2020 Mika Kuitunen
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
17#include QMK_KEYBOARD_H
18
19/* Each layer gets a name for readability, which is then used in the keymap matrix below.
20 * The underscores don't mean anything - you can have a layer called STUFF or any other name.
21 */
22enum layers {
23 _BASE = 0,
24 _RGB,
25};
26
27const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
28
29 [_BASE] = LAYOUT(
30 KC_ESC, KC_0, KC_1, KC_2, KC_3, KC_4, KC_5,
31 KC_Y, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T,
32 KC_H, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G,
33 KC_N, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, TG(_RGB),
34 KC_LGUI, KC_LCTL, KC_ENT,
35 KC_LALT, KC_SPC, KC_ENT
36 ),
37
38 [_RGB] = LAYOUT(
39 RGB_RMOD, RGB_MOD, RGB_TOG, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
40 RGB_HUD, RGB_HUI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
41 RGB_SAD, RGB_SAI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
42 RGB_VAD, RGB_VAI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, TG(_RGB),
43 KC_TRNS, KC_TRNS, KC_TRNS,
44 KC_TRNS, KC_TRNS, KC_TRNS
45 ),
46};
47
48#ifdef ENCODER_ENABLE
49void encoder_update_user(uint8_t index, bool clockwise) {
50 if (index == 0) {
51 if (clockwise) {
52 tap_code(KC_MS_WH_DOWN);
53 } else {
54 tap_code(KC_MS_WH_UP);
55 }
56 }
57}
58#endif
59
60
61#ifdef RGBLIGHT_LAYERS
62#define HUE_PRIMARY 10
63#define HSV_OFF 0, 0, 0
64#define HSV_CAPS HUE_PRIMARY, 255, 64
65#define HSV_LAYER_BASE HUE_PRIMARY, 255, 64
66#define HSV_LAYER_RGB 213, 255, 64
67
68const rgblight_segment_t PROGMEM ug_default_layer[] = RGBLIGHT_LAYER_SEGMENTS(
69 {10, 4, HSV_OFF}
70);
71
72const rgblight_segment_t PROGMEM ug_caps_layer[] = RGBLIGHT_LAYER_SEGMENTS(
73 {11, 1, HSV_CAPS}
74);
75
76const rgblight_segment_t PROGMEM ug_base_layer[] = RGBLIGHT_LAYER_SEGMENTS(
77 {13, 1, HSV_LAYER_BASE}
78);
79
80const rgblight_segment_t PROGMEM ug_rgb_layer[] = RGBLIGHT_LAYER_SEGMENTS(
81 {13, 1, HSV_LAYER_RGB}
82);
83
84/* Define layer order, later layers take precedence */
85const rgblight_segment_t* const PROGMEM ug_layers[] = RGBLIGHT_LAYERS_LIST(
86 ug_default_layer,
87 ug_caps_layer,
88 ug_base_layer,
89 ug_rgb_layer
90);
91
92void keyboard_post_init_user(void) {
93 /* Enable the LED layers and set the initial state */
94 rgblight_layers = ug_layers;
95 rgblight_set_layer_state(0, true);
96 rgblight_set_layer_state(2, true);
97}
98
99layer_state_t layer_state_set_user(layer_state_t state) {
100 /* Both layers will light up if both kb layers are active, latter overrides */
101 rgblight_set_layer_state(2, layer_state_cmp(state, 0));
102 rgblight_set_layer_state(3, layer_state_cmp(state, 1));
103 return state;
104}
105
106bool led_update_user(led_t led_state) {
107 rgblight_set_layer_state(1, led_state.caps_lock);
108 return true;
109}
110#endif