summaryrefslogtreecommitdiff
path: root/keyboards/thevankeyboards/minivan/keymaps/halvves/keymap.c
blob: 7054d97ff1d40881cbaf49af254458866b46b619 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
#include QMK_KEYBOARD_H

enum layer_names {
  _QWERTY,
  _COLEMAK,
  _DVORAK,
  _LOWER,
  _RAISE,
  _UTIL,
  _MOUSE,
  _ADJUST,
};

enum custom_keycodes {
  QWERTY = SAFE_RANGE,
  COLEMAK,
  DVORAK,
};

#define MOUSE  MO(_MOUSE)
#define ESC_UT LT(_UTIL, KC_ESC)
#define SPC_LO LT(_LOWER, KC_SPC)
#define SPC_RA LT(_RAISE, KC_SPC)

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Qwerty
* ,--------------------------------------------------------------------------.
* | Tab  |  Q  |  W  |  E  |  R  |  T  |  Y  |  U  |  I  |  O  |  P  |  Bksp |
* |------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`-------|
* | Lo/Esc|  A  |  S  |  D  |  F  |  G  |  H  |  J  |  K  |  L  |  ;  |   '  |
* |-------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`------|
* | Shift  |  Z  |  X  |  C  |  V  |  B  |  N  |  M  |  ,  |  .  | /   |Enter|
* |--------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----|
* | Ctrl | Alt  |  GUI  | Space/LOWER | Space/RAISE |Mouse |  [  |  ]  |     |
* `--------------------------------------------------------------------------'
*/
[_QWERTY] = LAYOUT_arrow(
KC_TAB,  KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,    KC_Y,    KC_U,    KC_I,    KC_O,    KC_P,    KC_BSPC,
ESC_UT,  KC_A,    KC_S,    KC_D,    KC_F,    KC_G,    KC_H,    KC_J,    KC_K,    KC_L,    KC_SCLN, KC_QUOT,
KC_LSFT, KC_Z,    KC_X,    KC_C,    KC_V,    KC_B,    KC_N,    KC_M,    KC_COMM, KC_DOT,  KC_SLSH, KC_ENT,
KC_LCTL, KC_LALT, KC_LGUI,                   SPC_LO,  SPC_RA,           MOUSE,   KC_LBRC, KC_RBRC, XXXXXXX
),

/* Colemak
* ,--------------------------------------------------------------------------.
* | Tab  |  Q  |  W  |  F  |  P  |  G  |  J  |  L  |  U  |  Y  |  ;  |  Del  |
* |------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`-------|
* | Lo/Esc|  A  |  R  |  S  |  T  |  D  |  H  |  N  |  E  |  I  |  O  |   '  |
* |-------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`------|
* | Shift  |  Z  |  X  |  C  |  V  |  B  |  K  |  M  |  ,  |  .  | /   |Enter|
* |--------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----|
* | Ctrl | Alt  |  GUI  | Space/LOWER | Space/RAISE |Mouse |  [  |  ]  |     |
* `--------------------------------------------------------------------------'
*/
[_COLEMAK] = LAYOUT_arrow(
KC_TAB,  KC_Q,    KC_W,    KC_F,    KC_P,    KC_G,    KC_J,    KC_L,    KC_U,    KC_Y,    KC_SCLN, KC_BSPC,
ESC_UT,  KC_A,    KC_R,    KC_S,    KC_T,    KC_D,    KC_H,    KC_N,    KC_E,    KC_I,    KC_O,    KC_QUOT,
KC_LSFT, KC_Z,    KC_X,    KC_C,    KC_V,    KC_B,    KC_K,    KC_M,    KC_COMM, KC_DOT,  KC_SLSH, KC_ENT,
KC_LCTL, KC_LALT, KC_LGUI,                   SPC_LO,  SPC_RA,           MOUSE,   KC_LBRC, KC_RBRC, XXXXXXX
),

/* Dvorak
* ,--------------------------------------------------------------------------.
* | Tab  |  /  |  ,  |  .  |  P  |  Y  |  F  |  G  |  C  |  R  |  L  |  Del  |
* |------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`-------|
* | Lo/Esc|  A  |  O  |  E  |  U  |  I  |  D  |  H  |  T  |  N  |  S  |   '  |
* |-------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`------|
* | Shift  |  ;  |  Q  |  J  |  K  |  X  |  B  |  M  |  W  |  V  | Z   |Enter|
* |--------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----|
* | Ctrl | Alt  |  GUI  | Space/LOWER | Space/RAISE |Mouse |  [  |  ]  |     |
* `--------------------------------------------------------------------------'
*/
[_DVORAK] = LAYOUT_arrow(
KC_TAB,  KC_SLSH, KC_COMM, KC_DOT,  KC_P,    KC_Y,    KC_F,    KC_G,    KC_C,    KC_R,    KC_L,    KC_BSPC,
ESC_UT,  KC_A,    KC_O,    KC_E,    KC_U,    KC_I,    KC_D,    KC_H,    KC_T,    KC_N,    KC_S,    KC_QUOT,
KC_LSFT, KC_SCLN, KC_Q,    KC_J,    KC_K,    KC_X,    KC_B,    KC_M,    KC_W,    KC_V,    KC_Z,    KC_ENT,
KC_LCTL, KC_LALT, KC_LGUI,                   SPC_LO,  SPC_RA,           MOUSE,   KC_LBRC, KC_RBRC, XXXXXXX
),

/* Lower
* ,--------------------------------------------------------------------------.
* |   ~  |  !  |  @  |  #  |  $  |  %  |  ^  |  &  |  *  |  (  |  )  |  Del  |
* |------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`-------|
* | Del   | F1  | F2  | F3  | F4  | F5  | F6  |  _  |  +  |  {  |  }  |   |  |
* |-------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`------|
* |        | F7  | F8  | F9  | F10 | F11 | F12 |ISO ~|ISO ||     |     |     |
* |--------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----|
* |      |      |       |             |             | Next |Vol- |Vol+ |Play |
* `--------------------------------------------------------------------------'
*/
[_LOWER] = LAYOUT_arrow(
KC_TILD, KC_EXLM, KC_AT,   KC_HASH, KC_DLR,  KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL,
KC_DEL,  KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   KC_F6,   KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE,
_______, KC_F7,   KC_F8,   KC_F9,   KC_F10,  KC_F11,  KC_F12,S(KC_NUHS),S(KC_NUBS),_______, _______, _______,
_______, _______, _______,                   _______, _______,          KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
),

/* Raise
* ,--------------------------------------------------------------------------.
* |   `  |  1  |  2  |  3  |  4  |  5  |  6  |  7  |  8  |  9  |  0  |  Del  |
* |------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`-------|
* | Del   | F1  | F2  | F3  | F4  | F5  | F6  |  -  |  =  |  [  |  ]  |   \  |
* |-------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`------|
* |        | F7  | F8  | F9  | F10 | F11 | F12 |ISO #|ISO /|     |     |     |
* |--------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----|
* |      |      |       |             |             | Next |Vol- |Vol+ |Play |
* `--------------------------------------------------------------------------'
*/
[_RAISE] = LAYOUT_arrow(
KC_GRV,  KC_1,    KC_2,    KC_3,    KC_4,    KC_5,    KC_6,    KC_7,    KC_8,    KC_9,    KC_0,    KC_DEL,
KC_DEL,  KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   KC_F6,   KC_MINS, KC_EQL,  KC_LBRC, KC_RBRC, KC_BSLS,
_______, KC_F7,   KC_F8,   KC_F9,   KC_F10,  KC_F11,  KC_F12,  KC_NUHS, KC_NUBS, _______, _______, _______,
_______, _______, _______,                   _______, _______,          KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
),

/* Util
* ,--------------------------------------------------------------------------.
* |      |     |     |     |     |     |     |     |     |     |     |       |
* |------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`-------|
* |       |     |     |     |     |     |LEFT | UP  |DOWN |RIGHT|     |      |
* |-------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`------|
* |        |     |     |     |     |     |     |     |     |     |     |     |
* |--------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----|
* |      |      |       |             |             |      |     |     |     |
* `--------------------------------------------------------------------------'
*/
[_UTIL] = LAYOUT_arrow(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_UP,   KC_RGHT, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______,                   _______, _______,          _______, _______, _______, _______
),

/* Mouse
* ,--------------------------------------------------------------------------.
* |      |     | M U |     |     |     |     |     |     |L Clk|R Clk| W Up  |
* |------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`-------|
* |       | M L | M D | M R |     |     |     |     |     |     |     |W Dwn |
* |-------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`------|
* |        |     |     |     |     |     |     |     |     |     |     |     |
* |--------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----|
* |      |      |       |             |             |      |     |     |     |
* `--------------------------------------------------------------------------'
*/
[_MOUSE] = LAYOUT_arrow(
XXXXXXX, XXXXXXX, KC_MS_U, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_BTN1, KC_BTN2, KC_WH_U,
XXXXXXX, KC_MS_L, KC_MS_D, KC_MS_R, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_WH_D,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX,                   XXXXXXX, XXXXXXX,          XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
),

/* Adjust
* ,--------------------------------------------------------------------------.
* |      |     |     |     |     |QWRTY|COLMK|DVRAK|     |     |     | RESET |
* |------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`-------|
* |       |     |     |     |     |     |     |     |     |     |     |      |
* |-------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`------|
* |        |     |     |     |     |     |     |     |     |     |     |     |
* |--------`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----`-----|
* |      |      |       |             |             |      |     |     |     |
* `--------------------------------------------------------------------------'
*/
[_ADJUST] = LAYOUT_arrow(
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, QWERTY,  COLEMAK, DVORAK,  XXXXXXX, XXXXXXX, XXXXXXX, RESET,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX,                   XXXXXXX, XXXXXXX,          XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
)


};

void keyboard_post_init_user(void) {
  #ifdef RGBLIGHT_ENABLE
    // set up rgb effects on only the third led (index 2)
    rgblight_set_effect_range(2, 1);

    // set led effects to breathing mode in warm white
    rgblight_sethsv_noeeprom(38, 191, 198);
    rgblight_mode_noeeprom(RGBLIGHT_EFFECT_BREATHING + 2);

    // set other led's to off
    setrgb(0, 0, 0, (LED_TYPE *)&led[0]);
    setrgb(0, 0, 0, (LED_TYPE *)&led[1]);
    rgblight_set();
  #endif
}

layer_state_t layer_state_set_user(layer_state_t state) {
  state = update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
  #ifdef RGBLIGHT_ENABLE
    if (layer_state_cmp(state, _ADJUST)) {
      setrgb(70, 255, 200, (LED_TYPE *)&led[0]);
      setrgb(255, 70, 100, (LED_TYPE *)&led[1]);
    } else if (layer_state_cmp(state, _LOWER)) {
      setrgb(70, 255, 200, (LED_TYPE *)&led[0]);
      setrgb(0, 0, 0, (LED_TYPE *)&led[1]);
    } else if (layer_state_cmp(state, _RAISE)) {
      setrgb(0, 0, 0, (LED_TYPE *)&led[0]);
      setrgb(255, 70, 100, (LED_TYPE *)&led[1]);
    } else if (layer_state_cmp(state, _UTIL)) {
      setrgb(200, 70, 225, (LED_TYPE *)&led[0]);
      setrgb(200, 70, 225, (LED_TYPE *)&led[1]);
    } else if (layer_state_cmp(state, _MOUSE)) {
      setrgb(255, 145, 5, (LED_TYPE *)&led[0]);
      setrgb(255, 145, 5, (LED_TYPE *)&led[1]);
    } else {
      setrgb(0, 0, 0, (LED_TYPE *)&led[0]);
      setrgb(0, 0, 0, (LED_TYPE *)&led[1]);
    }

    rgblight_set();
  #endif

  return state;
}

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  switch (keycode) {
    case QWERTY:
      if (record->event.pressed) {
        set_single_persistent_default_layer(_QWERTY);
      }
      return false;
    case COLEMAK:
      if (record->event.pressed) {
        set_single_persistent_default_layer(_COLEMAK);
      }
      return false;
    case DVORAK:
      if (record->event.pressed) {
        set_single_persistent_default_layer(_DVORAK);
      }
      return false;
  }
  return true;
}