diff options
Diffstat (limited to 'keyboards/dozen0/keymaps/default/keymap.c')
-rw-r--r-- | keyboards/dozen0/keymaps/default/keymap.c | 122 |
1 files changed, 122 insertions, 0 deletions
diff --git a/keyboards/dozen0/keymaps/default/keymap.c b/keyboards/dozen0/keymaps/default/keymap.c new file mode 100644 index 000000000..a869c6e93 --- /dev/null +++ b/keyboards/dozen0/keymaps/default/keymap.c | |||
@@ -0,0 +1,122 @@ | |||
1 | /* Copyright 2019 yynmt | ||
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 | #ifdef RGBLIGHT_ENABLE | ||
19 | //Following line allows macro to read current RGB settings | ||
20 | extern rgblight_config_t rgblight_config; | ||
21 | #endif | ||
22 | |||
23 | enum layer_number { | ||
24 | _BASE = 0, | ||
25 | _LOWER, | ||
26 | _RAISE, | ||
27 | _ADJUST | ||
28 | }; | ||
29 | |||
30 | enum custom_keycodes { | ||
31 | BASE = SAFE_RANGE, | ||
32 | LOWER, | ||
33 | RAISE, | ||
34 | ADJUST, | ||
35 | RGBRST | ||
36 | }; | ||
37 | |||
38 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
39 | /* Base | ||
40 | * ,-----------------------------------------. | ||
41 | * | Cut | Copy |Paste | Up |Delete| Bksp | | ||
42 | * | | | | | |Raise | | ||
43 | * |------+------+------+------+------+------| | ||
44 | * | Ctrl |Shift | Left | Down |Right |Enter | | ||
45 | * | | | | | |Lower | | ||
46 | * `-----------------------------------------' | ||
47 | */ | ||
48 | [_BASE] = LAYOUT( | ||
49 | LCTL(KC_X), LCTL(KC_C), LCTL(KC_V), KC_UP, KC_DEL, LT(_RAISE,KC_BSPC), | ||
50 | KC_LCTL, KC_LSFT, KC_LEFT, KC_DOWN, KC_RGHT, LT(_LOWER,KC_ENT) | ||
51 | ), | ||
52 | |||
53 | /* Lower | ||
54 | * ,-----------------------------------------. | ||
55 | * | | | | Page | | | | ||
56 | * | | | | Up | | | | ||
57 | * |------+------+------+------+------+------| | ||
58 | * | | | Home | Page | End | | | ||
59 | * | | | | Down | | | | ||
60 | * `-----------------------------------------' | ||
61 | */ | ||
62 | [_LOWER] = LAYOUT( | ||
63 | _______, _______, _______, KC_PGUP, _______, _______, | ||
64 | _______, _______, KC_HOME, KC_PGDN, KC_END, _______ | ||
65 | ), | ||
66 | |||
67 | /* Raise | ||
68 | * ,-----------------------------------------. | ||
69 | * | | | | | | | | ||
70 | * | | | | | | | | ||
71 | * |------+------+------+------+------+------| | ||
72 | * | | | | | | | | ||
73 | * | | | | | | | | ||
74 | * `-----------------------------------------' | ||
75 | */ | ||
76 | [_RAISE] = LAYOUT( | ||
77 | _______, _______, _______, _______, _______, _______, | ||
78 | _______, _______, _______, _______, _______, _______ | ||
79 | ), | ||
80 | |||
81 | /* Adjust | ||
82 | * ,-----------------------------------------. | ||
83 | * | RGB | RGB | RGB | RGB | RGB | | | ||
84 | * |Toggle|Mode+ | Hue+ | Sat+ | Val+ | | | ||
85 | * |------+------+------+------+------+------| | ||
86 | * | RGB | RGB | RGB | RGB | RGB | | | ||
87 | * |Reset |Mode- | Hue- | Sat- | Val- | | | ||
88 | * `-----------------------------------------' | ||
89 | */ | ||
90 | [_ADJUST] = LAYOUT( | ||
91 | RGB_TOG, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, _______, | ||
92 | RGBRST, RGB_RMOD, RGB_HUD, RGB_SAD, RGB_VAD, _______ | ||
93 | ) | ||
94 | }; | ||
95 | |||
96 | layer_state_t layer_state_set_user(layer_state_t state) { | ||
97 | return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); | ||
98 | } | ||
99 | |||
100 | int RGB_current_mode; | ||
101 | |||
102 | void matrix_init_user(void) { | ||
103 | #ifdef RGBLIGHT_ENABLE | ||
104 | RGB_current_mode = rgblight_config.mode; | ||
105 | #endif | ||
106 | } | ||
107 | |||
108 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
109 | |||
110 | switch (keycode) { | ||
111 | case RGBRST: | ||
112 | #ifdef RGBLIGHT_ENABLE | ||
113 | if (record->event.pressed) { | ||
114 | eeconfig_update_rgblight_default(); | ||
115 | rgblight_enable(); | ||
116 | RGB_current_mode = rgblight_config.mode; | ||
117 | } | ||
118 | #endif | ||
119 | break; | ||
120 | } | ||
121 | return true; | ||
122 | } | ||