summaryrefslogtreecommitdiffstats
path: root/keyboards/lets_split/keymaps/heartrobotninja/keymap.c
blob: 9fee02786306844ac08e74087f1ebac092559046 (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
#include "lets_split.h"
#include "action_layer.h"
#include "action_util.h"
#include "debug.h"
#include "eeconfig.h"

extern keymap_config_t keymap_config;

// Each layer gets a name for readability, which is then used in the keymap matrix below.
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
// Layer names don't all need to be of the same length, obviously, and you can also skip them
// entirely and just use numbers.
#define _COLE 0
#define _LOWER 1
#define _RAISE 2
#define _AUX 16

/* Layers */
enum
{
  COLE = 0,
  LOWER, // right hand 10 key.
  RAISE, // left hand Fn, right hand symbols.
  AUX,
};

/* Tap Dancery */
enum
{
  TD_BTK,
  TD_TDE,
  TD_LPRN,
  TD_RPRN,
  TD_MIN,
  TD_USC,
};

bool time_travel = false;

// Fillers to make layering more clear
#define ____ KC_TRNS

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

        /* Colemak
 * ,-----------------------------------------------------------------------------------.
 * | ' " `|   Q  |   W  |   F  |   P  |   G  |   J  |   L  |   U  |   Y  |  = + | ~ ; :|
 * |------+------+------+------+------+-------------+------+------+------+------+------|
 * | ( [ {|   A  |   R  |   S  |   T  |   D  |   H  |   N  |   E  |   I  |   O  | ) ] }|
 * |------+------+------+------+------+------|------+------+------+------+------+------|
 * | - , <|   Z  |   X  |   C  |   V  |   B  |   K  |   M  |   ?  |   |  |   ^  | _ . >|
 * |------+------+------+------+------+------+------+------+------+------+------+------|
 * |Lower |Raise | Ctrl | Alt  | Bksp | Spc  |Enter |LShft | ESC  |  <   |   v  |   >  |
 * `-----------------------------------------------------------------------------------'
 */
        [_COLE] = LAYOUT(
            TD(TD_BTK), KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_EQL, TD(TD_TDE),
            TD(TD_LPRN), KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, TD(TD_RPRN),
            TD(TD_MIN), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_SLSH, KC_BSLS, KC_UP, TD(TD_USC),
            LOWER, RAISE, OSM(MOD_LCTL), OSM(MOD_LALT), KC_SPC, KC_BSPC, KC_ENT, OSM(MOD_LSFT), KC_ESC, KC_LEFT, KC_DOWN, KC_RGHT),

        /* Lower
 * ,-----------------------------------------------------------------------------------.
 * | ---- | ---- | ---- | ---- | ---- | ---- |   7  |   8  |   9  |   *  |   /  |   ^  |
 * |------+------+------+------+------+-------------+------+------+------+------+------|
 * | ---- | ---- | ---- | ---- | ---- | ---- |  4   |   5  |   6  |   +  |   -  | ---- |
 * |------+------+------+------+------+------|------+------+------+------+------+------|
 * | ---- | ---- | ---- | ---- | ---- | ---- |  1   |   2  |   3  |   =  | ---- | ---- |
 * |------+------+------+------+------+------+------+------+------+------+------+------|
 * | ---- | ---- | ---- | ---- | ---- | ---- | ---- |   0  |   .  | ---- | ---- | ---- |
 * `-----------------------------------------------------------------------------------'
 */
        [_LOWER] = LAYOUT(
            ____, ____, ____, ____, ____, ____, KC_7, KC_8, KC_9, KC_PAST, KC_PSLS, KC_CIRC,
            ____, ____, ____, ____, ____, ____, KC_4, KC_5, KC_6, KC_PPLS, KC_PMNS, ____,
            ____, ____, ____, ____, ____, ____, KC_1, KC_2, KC_3, KC_PEQL, ____, ____,
            ____, ____, ____, ____, ____, ____, ____, KC_0, KC_MNXT, ____, ____, ____),

        /* Raise
 * ,-----------------------------------------------------------------------------------.
 * |  F1  |  F2  |  F3  |   F4  |  F5  |  F6 |   !  |   @  |   #  |   $  |   %  |  ` ~ |
 * |------+------+------+------+------+-------------+------+------+------+------+------|
 * |  F7  |  F8  |  F9  |  F10 |  F11 |  F12 |   ^  |   &  |   *  |   (  |   )  |  - _ |
 * |------+------+------+------+------+------|------+------+------+------+------+------|
 * | ____ | ____ | ____ | ____ | ____ | ____ |  [ { |  ] } |  \ | |  ; : | ' "  |  = + |
 * |------+------+------+------+------+------+------+------+------+------+------+------|
 * | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ |  , < | . >  |  / ? |
 * `-----------------------------------------------------------------------------------'
 */
        [_RAISE] = LAYOUT(
            KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_GRV,
            KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_MINS,
            KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_LBRC, KC_RBRC, KC_BSLS, KC_SCLN, KC_QUOT, KC_EQL,
            ____, ____, ____, ____, ____, ____, ____, ____, ____, KC_COMM, KC_DOT, KC_SLSH),

        /* Adjust (Lower + Raise)
 * ,-----------------------------------------------------------------------------------.
 * | Reset| ____ | ____ | ____ | ____ | ____ | ____ | LOCK | ____ | ____ | ____ | VUP  |
 * |------+------+------+------+------+-------------+------+------+------+------+------|
 * | ____ | ____ |  RUN | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ | VDWN |
 * |------+------+------+------+------+------|------+------+------+------+------+------|
 * | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ | PGUP | MUTE |
 * |------+------+------+------+------+------+------+------+------+------+------+------|
 * | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ | HOME | PGDN | END  |
 * `-----------------------------------------------------------------------------------'
 */
        [_AUX] = LAYOUT(
            RESET, ____, ____, ____, ____, ____, ____, LGUI(KC_L), ____, ____, ____, KC_VOLU,
            ____, ____, LGUI(KC_R), ____, ____, ____, ____, ____, ____, ____, ____, KC_VOLD,
            ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, KC_PGUP, KC_MUTE,
            ____, ____, ____, ____, KC_TAB, KC_DEL, ____, ____, ____, KC_HOME, KC_PGDOWN, KC_END)

};

qk_tap_dance_action_t tap_dance_actions[] = {
        [TD_BTK] = ACTION_TAP_DANCE_DOUBLE(KC_QUOT, KC_GRV),
        [TD_TDE] = ACTION_TAP_DANCE_DOUBLE(KC_SCLN, KC_TILD),
        [TD_LPRN] = ACTION_TAP_DANCE_DOUBLE(KC_LBRC, KC_LPRN),
        [TD_RPRN] = ACTION_TAP_DANCE_DOUBLE(KC_RBRC, KC_RPRN),
        [TD_MIN] = ACTION_TAP_DANCE_DOUBLE(KC_COMM, KC_MINS),
        [TD_USC] = ACTION_TAP_DANCE_DOUBLE(KC_DOT, KC_UNDS)};

void persistent_default_layer_set(uint16_t default_layer)
{
  eeconfig_update_default_layer(default_layer);
  default_layer_set(default_layer);
};

void matrix_scan_user(void){};

void matrix_init_user(void){};

bool process_record_user(uint16_t keycode, keyrecord_t *record)
{
  switch (keycode)
  {
  case COLE:
    if (record->event.pressed)
    {
      persistent_default_layer_set(1UL << _COLE);
    }
    return false;
    break;
  case LOWER:
    if (record->event.pressed)
    {
      layer_on(_LOWER);
      update_tri_layer(_LOWER, _RAISE, _AUX);
    }
    else
    {
      layer_off(_LOWER);
      update_tri_layer(_LOWER, _RAISE, _AUX);
    }
    return false;
    break;
  case RAISE:
    if (record->event.pressed)
    {
      layer_on(_RAISE);
      update_tri_layer(_LOWER, _RAISE, _AUX);
    }
    else
    {
      layer_off(_RAISE);
      update_tri_layer(_LOWER, _RAISE, _AUX);
    }
    return false;
    break;
  case AUX:
    if (record->event.pressed)
    {
      layer_on(_AUX);
    }
    else
    {
      layer_off(_AUX);
    }
    return false;
    break;
  }
  return true;
}