summaryrefslogtreecommitdiffstats
path: root/keyboards/miuni32/keymaps/kifinnsson/keymap.c
blob: 51a0b6fefa1f1df67d1eef99b4ceda75f6e0d9ed (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
#include QMK_KEYBOARD_H

enum miuni32_layers {
  _BEAKL,
  _LOWER,
  _RAISE,
  _UNION
};

enum miuni32_keycodes {
  BEAKL = SAFE_RANGE,
  LOWER,
  RAISE
};

#define SPC_SHF SFT_T(KC_SPC)

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  /* Level 0: BEAKL
   * ,---------------------------------------------------------------------------------------.
   * |   J   |   H   |   O   |   U   |   K   | LOWER |   G   |   C   |   R   |   F   |   Z   |
   * |---------------------------------------------------------------------------------------|
   * |   Q   |   I   |   E   |   A   |   Y   | RAISE |   D   |   S   |   T   |   N   |   B   |
   * |---------------------------------------------------------------------------------------|
   * |   /   |   ,   |   '   |   .   |   X   |SPC\SHF|   W   |   M   |   L   |   P   |   V   |
   * |---------------------------------------------------------------------------------------|
   */
  [_BEAKL] = LAYOUT_ortho_3x11(
    KC_J,    KC_H,    KC_O,    KC_U,   KC_K, LOWER,   KC_G, KC_C, KC_R, KC_F, KC_Z,
    KC_Q,    KC_I,    KC_E,    KC_A,   KC_Y, RAISE,   KC_D, KC_S, KC_T, KC_N, KC_B,
    KC_SLSH, KC_COMM, KC_QUOT, KC_DOT, KC_X, SPC_SHF, KC_W, KC_M, KC_L, KC_P, KC_V
  ),
  /* Lower
     * ,---------------------------------------------------------------------------------------.
     * |  Tab  |   {   |   _   |   }   |   &   |       |  Gui  |   [   |   %   |   ]   | Bkspc |
     * |---------------------------------------------------------------------------------------|
     * |   \   |   (   |   1   |   )   |   #   |       |   $   |   <   |   0   |   >   |   |   |
     * |---------------------------------------------------------------------------------------|
     * |   5   |   4   |   3   |   2   |  Ctl  |       |  Alt  |   9   |   8   |   7   |   6   |
     * |---------------------------------------------------------------------------------------|
     */
  [_LOWER] = LAYOUT_ortho_3x11(
    KC_TAB,  KC_LCBR, KC_UNDS, KC_RBRC, KC_AMPR, _______, KC_RGUI, KC_LBRC, KC_PERC, KC_RBRC, KC_BSPC,
    KC_BSLS, KC_LPRN, KC_1,    KC_RPRN, KC_HASH, _______, KC_DLR,  KC_LT,   KC_0,    KC_GT,   KC_PIPE,
    KC_5,    KC_4,    KC_3,    KC_2,    KC_LCTL, _______, KC_RALT, KC_9,    KC_8,    KC_7,    KC_6
  ),
  /* Raise
     * ,---------------------------------------------------------------------------------------.
     * |   F1  |   F2  |   F3  |   F4  |   F5  |       |   F6  |   F7  |   F8  |   F9  |  F10  |
     * |---------------------------------------------------------------------------------------|
     * |  F11  |  F12  |   !   |   -   |   +   |       |   =   |   ;   |   )   |   `   |   ?   |
     * |------------------------------- -------------------------------------------------------|
     * |   %   |   $   |   #   |   @   |       |       |       |   (   |   *   |   &   |   ^   |
     * |---------------------------------------------------------------------------------------|
     */
  [_RAISE] = LAYOUT_ortho_3x11(
    KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   _______, KC_F6,   KC_F7,   KC_F8,   KC_F9,   KC_F10,
    KC_F11,  KC_F12,  KC_EXLM, KC_MINS, KC_PLUS, _______, KC_EQL,  KC_SCLN, KC_RPRN, KC_GRV,  KC_QUES,
    KC_PERC, KC_DLR,  KC_HASH, KC_AT,   _______, _______, _______, KC_LPRN, KC_ASTR, KC_AMPR, KC_CIRC
  ),
  /* Union
     * ,---------------------------------------------------------------------------------------.
     * | QK_BOOT |       |       |       |       |       |       |       |       |       |  Del  |
     * |---------------------------------------------------------------------------------------|
     * |       |       |       |       |       |       |       |       |       |       |       |
     * |---------------------------------------------------------------------------------------|
     * |       |       |       |       |       |       |       |       |       |       |       |
     * |---------------------------------------------------------------------------------------|
     */
  [_UNION] = LAYOUT_ortho_3x11(
    QK_BOOT, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL,
    _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
    _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
  )
};

//planck like tri layer
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  switch (keycode) {
  case BEAKL:
    if (record->event.pressed) {
      set_single_persistent_default_layer(_BEAKL);
    }
    return false;
    break;
  case LOWER:
    if (record->event.pressed) {
      layer_on(_LOWER);
      update_tri_layer(_LOWER, _RAISE, _UNION);
    } else {
      layer_off(_LOWER);
      update_tri_layer(_LOWER, _RAISE, _UNION);
    }
    return false;
    break;
  case RAISE:
    if (record->event.pressed) {
      layer_on(_RAISE);
      update_tri_layer(_LOWER, _RAISE, _UNION);
    } else {
      layer_off(_RAISE);
      update_tri_layer(_LOWER, _RAISE, _UNION);
    }
    return false;
    break;
  }
  return true;
}