aboutsummaryrefslogtreecommitdiff
path: root/keyboards/contender/keymaps/default/keymap.c
diff options
context:
space:
mode:
authorAkshay <[email protected]>2022-04-10 12:13:40 +0100
committerAkshay <[email protected]>2022-04-10 12:13:40 +0100
commitdc90387ce7d8ba7b607d9c48540bf6d8b560f14d (patch)
tree4ccb8fa5886b66fa9d480edef74236c27f035e16 /keyboards/contender/keymaps/default/keymap.c
Diffstat (limited to 'keyboards/contender/keymaps/default/keymap.c')
-rw-r--r--keyboards/contender/keymaps/default/keymap.c111
1 files changed, 111 insertions, 0 deletions
diff --git a/keyboards/contender/keymaps/default/keymap.c b/keyboards/contender/keymaps/default/keymap.c
new file mode 100644
index 000000000..7784c7d59
--- /dev/null
+++ b/keyboards/contender/keymaps/default/keymap.c
@@ -0,0 +1,111 @@
1/* Copyright 2020 sotoba
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 QMK_KEYBOARD_H
17
18// Defines names for use in layer keycodes and the keymap
19enum layer_names {
20 _BASE,
21 _UNRULY,
22 _FUNCTION
23};
24
25// Defines the keycodes used by our macros in process_record_user
26enum custom_keycodes {
27 DOUBLE_ZERO = SAFE_RANGE
28};
29
30const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
31 /* Base */
32 [_BASE] = LAYOUT(
33 KC_ESCAPE, KC_LSFT, KC_TAB, KC_BSPACE,
34 KC_NLCK, KC_KP_SLASH, KC_KP_ASTERISK, KC_EQUAL,
35 KC_KP_7, KC_KP_8, KC_KP_9, KC_KP_MINUS,
36 MO(_FUNCTION), KC_KP_4, KC_KP_5, KC_KP_6, KC_KP_PLUS,
37 RGB_TOG, KC_KP_1, KC_KP_2, KC_KP_3, KC_KP_ENTER,
38 TG(_UNRULY), KC_KP_0, DOUBLE_ZERO, KC_KP_DOT
39 ),
40 /* Lightning */
41 [_UNRULY] = LAYOUT(
42 KC_ESCAPE, KC_LSFT, KC_TAB, KC_BSPACE,
43 KC_NLCK, KC_KP_SLASH, KC_KP_ASTERISK, KC_EQUAL,
44 KC_KP_7, KC_KP_8, KC_KP_9, KC_KP_MINUS,
45 KC_TRNS, KC_KP_4, KC_KP_5, KC_KP_6, KC_KP_PLUS,
46 KC_TRNS, KC_KP_1, KC_KP_2, KC_KP_3, KC_KP_ENTER,
47 KC_TRNS, KC_KP_0, DOUBLE_ZERO, KC_KP_DOT
48 ),
49 /* Function */
50 [_FUNCTION] = LAYOUT(
51 RESET, KC_NO, KC_NO, KC_NO,
52 KC_NO, KC_NO, KC_NO, KC_NO,
53 KC_NO, KC_NO, KC_NO, KC_NO,
54 KC_TRNS, RGB_RMOD, RGB_MOD, KC_NO, KC_NO,
55 KC_TRNS, RGB_HUI, RGB_SAI, RGB_VAI, KC_NO,
56 KC_TRNS, RGB_HUD, RGB_SAD, RGB_VAD
57 )
58};
59
60bool process_record_user(uint16_t keycode, keyrecord_t *record) {
61 switch (keycode) {
62 case DOUBLE_ZERO:
63 if (record->event.pressed) {
64 // when keycode DOUBLE_ZERO is pressed
65 SEND_STRING("00");
66 }
67 break;
68 }
69 return true;
70}
71
72#ifdef RGBLIGHT_LAYERS
73const rgblight_segment_t PROGMEM num_layer[] = RGBLIGHT_LAYER_SEGMENTS(
74 {26, 7, HSV_SPRINGGREEN}
75);
76
77const rgblight_segment_t PROGMEM unruly_layer[] = RGBLIGHT_LAYER_SEGMENTS(
78 {0, 4, HSV_OFF},
79 {4, 2, HSV_WHITE},
80 {6, 2, HSV_PURPLE},
81 {8, 2, HSV_RED},
82 {10, 2, HSV_BLUE},
83 {12, 2, HSV_YELLOW},
84 {14, 2, HSV_GREEN},
85 {16, 3, HSV_ORANGE},
86 {19, 1, HSV_OFF},
87 {20, 3, HSV_PINK},
88 {23, 10, HSV_GREEN}
89);
90
91const rgblight_segment_t* const PROGMEM rgb_layers[] = RGBLIGHT_LAYERS_LIST(
92 num_layer,
93 unruly_layer
94);
95
96void keyboard_post_init_user(void) {
97 // Enable the LED layers
98 rgblight_layers = rgb_layers;
99}
100
101layer_state_t layer_state_set_user(layer_state_t state) {
102 rgblight_set_layer_state(1, layer_state_cmp(state, _UNRULY));
103 return state;
104}
105
106bool led_update_user(led_t led_state) {
107 rgblight_set_layer_state(0, led_state.num_lock);
108 return true;
109}
110
111#endif