]> git.donarmstrong.com Git - qmk_firmware.git/blob - keyboards/preonic/keymaps/kinesis/keymap.c
Remove all Makefiles from the keyboards directory. (#1660)
[qmk_firmware.git] / keyboards / preonic / keymaps / kinesis / keymap.c
1 #include "preonic.h"
2 #include "action_layer.h"
3 #include "eeconfig.h"
4 #ifdef AUDIO_ENABLE
5 #include "audio.h"
6 #endif
7
8 // Each layer gets a name for readability, which is then used in the keymap matrix below.
9 // The underscores don't mean anything - you can have a layer called STUFF or any other name.
10 // Layer names don't all need to be of the same length, obviously, and you can also skip them
11 // entirely and just use numbers.
12 #define _QWERTY 0
13 #define _FN 1
14 #define _ULCK 2
15
16 // Fillers to make layering more clear
17 #define _______ KC_TRNS
18 #define XXXXXXX KC_NO
19 #define HYP_TIC ALL_T(KC_GRV)
20 #define EQ_LOCK TD(TD_EQ_LOCK)
21 #define MIN_ULK TD(TD_MIN_ULOCK)
22
23 //Tap Dance Declarations
24 enum {
25   TD_EQ_LOCK = 0,
26   TD_MIN_ULOCK
27 };
28
29 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
30
31   /* Qwerty
32    * ,-----------------------------------------------------------------------------------.
33    * |   =  |   1  |   2  |   3  |   4  |   5  |   6  |   7  |   8  |   9  |   0  |  -   |
34    * |------+------+------+------+------+------+------+------+------+------+------+------|
35    * | Tab  |   Q  |   W  |   E  |   R  |   T  |   Y  |   U  |   I  |   O  |   P  |  \   |
36    * |------+------+------+------+------+-------------+------+------+------+------+------|
37    * | Ctrl |   A  |   S  |   D  |   F  |   G  |   H  |   J  |   K  |   L  |   ;  |  "   |
38    * |------+------+------+------+------+------|------+------+------+------+------+------|
39    * | Shift|   Z  |   X  |   C  |   V  |   B  |   N  |   M  |   ,  |   .  |   /  |Shift |
40    * |------+------+------+------+------+------+------+------+------+------+------+------|
41    * |  FN  |   `  | Alt  | LGUI | Back | ESC  |ENTER | SPCE | RGUI |   [  |  ]   |  FN  |
42    * `-----------------------------------------------------------------------------------'
43    */
44   [_QWERTY] = {
45     {EQ_LOCK, KC_1,    KC_2,    KC_3,    KC_4,    KC_5,    KC_6,    KC_7,    KC_8,    KC_9,    KC_0,    MIN_ULK },
46     {KC_TAB,  KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,    KC_Y,    KC_U,    KC_I,    KC_O,    KC_P,    KC_BSLS },
47     {KC_LCTL, KC_A,    KC_S,    KC_D,    KC_F,    KC_G,    KC_H,    KC_J,    KC_K,    KC_L,    KC_SCLN, KC_QUOT },
48     {KC_LSPO, KC_Z,    KC_X,    KC_C,    KC_V,    KC_B,    KC_N,    KC_M,    KC_COMM, KC_DOT,  KC_SLSH, KC_RSPC },
49     {MO(_FN), HYP_TIC, KC_LALT, KC_LGUI, KC_BSPC, KC_ESC,  KC_ENT,  KC_SPC,  KC_RGUI, KC_LBRC, KC_RBRC, MO(_FN) }
50   },
51
52   /* Fn
53    * ,-----------------------------------------------------------------------------------.
54    * |      |  F1  |  F2  |  F3  |  F4  |  F5  |  F6  |  F7  |  F8  |  F9  |  F10 |      |
55    * |------+------+------+------+------+-------------+------+------+------+------+------|
56    * |      |  F11 |  F12 |  F13 |  F14 |  F15 |  F16 |  F17 |  F18 |  F19 |  F20 |      |
57    * |------+------+------+------+------+-------------+------+------+------+------+------|
58    * |      | VOL- | VOL+ | MUTE |BLtogg|      | LEFT | DOWN |  UP  | RGHT |      |      |
59    * |------+------+------+------+------+------|------+------+------+------+------+------|
60    * |      | BL-  | BL+  |Aud on|AudOff|AGnorm|AGswap|      |      |      |      |      |
61    * |------+------+------+------+------+------|------+------+------+------+------+------|
62    * |      |Voice-|Voice+|Mus on|MusOff|      |      |PLY/PS|      | PREV | NEXT |      |
63    * `-----------------------------------------------------------------------------------'
64    */
65   [_FN] = {
66     {_______, KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   KC_F6,   KC_F7,   KC_F8,   KC_F9,   KC_F10,  _______ },
67     {_______, KC_F11,  KC_F12,  KC_F13,  KC_F14,  KC_F15,  KC_F16,  KC_F17,  KC_F18,  KC_F19,  KC_F20,  _______ },
68     {_______, KC_VOLD, KC_VOLU, KC_MUTE, BL_TOGG, _______, KC_LEFT, KC_DOWN, KC_UP,   KC_RGHT, _______, _______ },
69     {_______, BL_DEC,  BL_INC,  AU_ON,   AU_OFF,  AG_NORM, AG_SWAP, _______, _______, _______, _______, _______ },
70     {_______, MUV_DE,  MUV_IN,  MU_ON,   MU_OFF,  _______, _______, KC_MPLY, _______, KC_MPRV, KC_MNXT, _______ }
71   }
72
73 };
74
75 float tone_startup[][2] = {
76   {NOTE_B5, 20},
77   {NOTE_B6, 8},
78   {NOTE_DS6, 20},
79   {NOTE_B6, 8}
80 };
81
82 float tone_goodbye[][2] = SONG(GOODBYE_SOUND);
83 float music_scale[][2]  = SONG(MUSIC_SCALE_SOUND);
84
85 void persistent_default_layer_set(uint16_t default_layer) {
86   eeconfig_update_default_layer(default_layer);
87   default_layer_set(default_layer);
88 }
89
90 /*bool process_record_user(uint16_t keycode, keyrecord_t *record) {*/
91   /*return true;*/
92   /*[>switch (keycode) {<]*/
93     /*[>case QWERTY:<]*/
94       /*[>return true;<]*/
95   /*[>}<]*/
96 /*};*/
97
98 void matrix_init_user(void) {
99   startup_user();
100 }
101
102 void startup_user()
103 {
104   _delay_ms(20); // gets rid of tick
105   PLAY_SONG(tone_startup);
106 }
107
108 void shutdown_user()
109 {
110   PLAY_SONG(tone_goodbye);
111   _delay_ms(150);
112   stop_all_notes();
113 }
114
115 void music_on_user(void)
116 {
117   music_scale_user();
118 }
119
120 void music_scale_user(void)
121 {
122   PLAY_SONG(music_scale);
123 }
124
125
126 qk_tap_dance_action_t tap_dance_actions[] = {
127   //Tap once for equal, twice for hyper + X (alfred lock)
128   [TD_EQ_LOCK] = ACTION_TAP_DANCE_DOUBLE(KC_EQL,  HYPR(KC_X)),
129   //Tap once for minus, twice for time.heals.nothing
130   [TD_MIN_ULOCK] = ACTION_TAP_DANCE_DOUBLE(KC_MINS, M(_ULCK))
131 };
132
133 const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
134 {
135   switch(id) {
136     case _ULCK:
137       if (record->event.pressed) {
138         /* time.heals.nothing */
139         return MACRO( I(220), T(T), T(I), T(M), T(E), T(DOT), T(H), T(E), T(A), T(L), T(S), T(DOT), T(N), T(O), T(T), T(H), T(I), T(N), T(G), END);
140       }
141       break;
142   }
143   return MACRO_NONE;
144 };