summaryrefslogtreecommitdiff
path: root/keyboards/9key/keymaps/tap_dance/keymap.c
blob: d8b2945dc5e336b4992c5bf221fc19ec09d6c33a (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
#include QMK_KEYBOARD_H

// Tap Dance Declarations
enum tap_dances {
  ENT_5 = 0,
  ZERO_7,
};

// Macro Declarations
enum custom_keycodes {
  DBL_0 = SAFE_RANGE,
};

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

/* LAYER 0
 * ,-----------------------.
 * |   1   |   2   |   3   |
 * |-------+-------+-------|
 * |   4   | 5/ENT |   6   | Dbl Tap 5 for Enter
 * |-------+-------+-------|
 * |  7/0  |   8   | 9/FN  | 7/0 = Dbl Tap 7 for 0  -  9/FN = Hold 9 for FN
 * `-----------------------'
 */
[0] = LAYOUT(
  KC_1,       KC_2,      KC_3,
  KC_4,       TD(ENT_5), KC_6,
  TD(ZERO_7), KC_8,      LT(1, KC_9)
),

/* LAYER 1
 * ,-----------------------.
 * |  ESC  |   +   |   -   |
 * |-------+-------+-------|
 * |  BSPC |   *   |   /   |
 * |-------+-------+-------|
 * |  00   |   .   |       |
 * `-----------------------'
 */
[1] = LAYOUT(
  KC_ESC,   KC_PLUS, KC_MINS,
  KC_BSPC,  KC_ASTR, KC_SLSH,
  DBL_0,    KC_DOT,  KC_TRNS
)

};

tap_dance_action_t tap_dance_actions[] = {
  [ENT_5] = ACTION_TAP_DANCE_DOUBLE(KC_5, KC_ENT),
  [ZERO_7] = ACTION_TAP_DANCE_DOUBLE(KC_7, KC_0)
};

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  switch (keycode) {
    case DBL_0:
      if (record->event.pressed) {
        // when keycode QMKBEST is pressed
        tap_code(KC_P0);
        tap_code(KC_P0);
      }
      break;

  }
  return true;
};


void matrix_init_user(void) {
}