]> git.friedersdorff.com Git - max/tmk_keyboard.git/blob - keyboard/ergodox/keymap_max.c
Add a qwerty layer
[max/tmk_keyboard.git] / keyboard / ergodox / keymap_max.c
1 /*
2 Copyright 2016 Paul Williamson <squarefrog@gmail.com>
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 */
17 #include <util/delay.h>
18 #include "bootloader.h"
19 #include "keymap_common.h"
20
21
22 const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
23
24     /*
25      * Keymap 0: Default Colemak Layer
26      *
27      * This is a general purpose Colemak layout which should serve as a good
28      * basis for your own custom layout. Mac users may want to swap the
29      * position of the Alt and GUI keys.
30      *
31      * ,--------------------------------------------------.           ,-------------------------------------------------.
32      * |  Esc   |   1  |   2  |   3  |   4  |   5  |  ~#  |           |      |   6  |   7  |   8  |   9  |   0  |   -    |
33      * |--------+------+------+------+------+-------------|           |------+------+------+------+------+------+--------|
34      * |  Tab   |   Q  |   W  |   F  |   P  |   G  |  [   |           |  ]   |   J  |   L  |   U  |   Y  |   ;  |   +    |
35      * |--------+------+------+------+------+------|      |           |      |------+------+------+------+------+--------|
36      * | LShift |   A  |   R  |   S  |   T  |   D  |------|           |------|   H  |   N  |   E  |   I  |   O  |   '    |
37      * |--------+------+------+------+------+------|      |           |      |------+------+------+------+------+--------|
38      * |   \    |   Z  |   X  |   C  |   V  |   B  |      |           |      |   K  |   M  |   ,  |   .  |   /  | RShift |
39      * `--------+------+------+------+------+-------------'           `-------------+------+------+------+------+--------'
40      *   |      |      | LAlt | Home | BkSp |                                       |  Del | End  | RAlt |      | RCtrl |
41      *   `----------------------------------'                                       `----------------------------------'
42      *                                        ,-------------.       ,-------------.
43      *                                        |      | L1   |       | PgUp | PgDn |
44      *                                 ,------|------|------|       |------+------+------.
45      *                                 |      |      |      |       | RAlt |      |      |
46      *                                 |Space | LCtrl|------|       |------| LAlt | Enter|
47      *                                 |      |      | LGui |       | ~L2  |      |      |
48      *                                 `--------------------'       `--------------------'
49      */
50
51     KEYMAP(
52         // left hand
53         ESC, 1,   2,   3,   4,   5,   NUHS,
54         TAB, Q,   W,   F,   P,   G,   LBRC,
55         LSFT,A,   R,   S,   T,   D,
56         NUBS,Z,   X,   C,   V,   B,   NO,
57         NO,  NO, LALT, HOME ,BSPC,
58                                         NO, FN1,
59                                              NO,
60                                  SPC,LCTL, LGUI,
61        // right hand
62              NO,6,   7,   8,   9,   0,   MINS,
63              RBRC,J,   L,   U,   Y,   SCLN,EQL,
64                   H,   N,   E,   I,   O,   QUOT,
65              NO,  K,   M,   COMM,DOT, SLSH,RSFT,
66                       DEL,  END, RALT,NO,  RCTL,
67         PGUP,PGDN,
68         RALT,
69         FN2,LALT, ENT
70     ),
71
72     /*
73      * Keymap 1: Default qwerty Layer
74      *
75      * This is a general purpose Colemak layout which should serve as a good
76      * basis for your own custom layout. Mac users may want to swap the
77      * position of the Alt and GUI keys.
78      *
79      * ,--------------------------------------------------.           ,-------------------------------------------------.
80      * |  Esc   |   1  |   2  |   3  |   4  |   5  |  ~#  |           |      |   6  |   7  |   8  |   9  |   0  |   -    |
81      * |--------+------+------+------+------+-------------|           |------+------+------+------+------+------+--------|
82      * |  Tab   |   Q  |   W  |   E  |   R  |   T  |  [   |           |  ]   |   Y  |   U  |   I  |   O  |   P  |   +    |
83      * |--------+------+------+------+------+------|      |           |      |------+------+------+------+------+--------|
84      * | LShift |   A  |   S  |   D  |   F  |   G  |------|           |------|   H  |   J  |   K  |   L  |   ;  |   '    |
85      * |--------+------+------+------+------+------|      |           |      |------+------+------+------+------+--------|
86      * |   \    |   Z  |   X  |   C  |   V  |   B  |      |           |      |   N  |   M  |   ,  |   .  |   /  | RShift |
87      * `--------+------+------+------+------+-------------'           `-------------+------+------+------+------+--------'
88      *   |      |      | LAlt | Home | BkSp |                                       |  Del | End  | RAlt |      | RCtrl |
89      *   `----------------------------------'                                       `----------------------------------'
90      *                                        ,-------------.       ,-------------.
91      *                                        |      | L0  |       | PgUp | PgDn |
92      *                                 ,------|------|------|       |------+------+------.
93      *                                 |      |      |      |       | RAlt |      |      |
94      *                                 |Space | LCtrl|------|       |------| LAlt | Enter|
95      *                                 |      |      | LGui |       | ~L2  |      |      |
96      *                                 `--------------------'       `--------------------'
97      */
98
99     KEYMAP(
100         // left hand
101         ESC, 1,   2,   3,   4,   5,   NUHS,
102         TAB, Q,   W,   E,   R,   T,   LBRC,
103         LSFT,A,   S,   D,   F,   G,
104         NUBS,Z,   X,   C,   V,   B,   NO,
105         NO,  NO, LALT, HOME ,BSPC,
106                                         NO, FN0,
107                                              NO,
108                                  SPC,LCTL, LGUI,
109        // right hand
110              NO,  6,   7,   8,   9,   0,   MINS,
111              RBRC,Y,   U,   I,   O,   P,   EQL,
112                   H,   J,   K,   L,   SCLN,QUOT,
113              NO,  N,   M,   COMM,DOT, SLSH,RSFT,
114                       DEL,  END, RALT,NO,  RCTL,
115         PGUP,PGDN,
116         RALT,
117         FN2,LALT, ENT
118     ),
119
120
121     /*
122      * Layer 2: Function keys
123      *
124      * This layer contains function keys, and media keys.     *
125      * Most of the non-modifier keys are marked as NO, so it's immediately
126      * obvious if you start typing on a secondary layer.
127      *
128      * ,--------------------------------------------------.           ,--------------------------------------------------.
129      * |   `    |  F1  |  F2  |  F3  |  F4  |  F5  |  F11 |           |  F12 |  F6  |  F7  |  F8  |  F9  |  F10 |  TRNS  |
130      * |--------+------+------+------+------+-------------|           |------+------+------+------+------+------+--------|
131      * |   TRNS |      |  UP  |      |      |      | TRNS |           | TRNS |      |      |      |      |      |  TRNS  |
132      * |--------+------+------+------+------+------|      |           |      |------+------+------+------+------+--------|
133      * |   TRNS | LEFT | DOWN |RIGHT |      |      |------|           |------|      |      |      |      |      |  TRNS  |
134      * |--------+------+------+------+------+------|      |           |      |------+------+------+------+------+--------|
135      * |   TRNS |      |      |      |      |      |      |           |      |      |      |      |      |      |  TRNS  |
136      * `--------+------+------+------+------+-------------'           `-------------+------+------+------+------+--------'
137      *   | TRNS | TRNS | Play |  RW  |  FF  |                                       | Mute | Vol- | Vol+ | TRNS | TRNS |
138      *   `----------------------------------'                                       `----------------------------------'
139      *                                        ,-------------.       ,-------------.
140      *                                        |      |      |       | HOME |  END |
141      *                                 ,------|------|------|       |------+------+------.
142      *                                 |      |      | TRNS |       | TRNS |      |      |
143      *                                 | TRNS |      |------|       |------| TRNS | TRNS |
144      *                                 |      |      | TRNS |       | TRNS |      |      |
145      *                                 `--------------------'       `--------------------'
146      */
147
148     KEYMAP(
149         // left hand
150         GRV ,F1,  F2,  F3,  F4,  F5,  F11,
151         TRNS,NO,  UP,  NO,  NO,  NO,  TRNS,
152         TRNS,LEFT,DOWN,RIGHT,NO, NO,
153         TRNS,NO,  NO,  NO,  NO,  NO,    NO,
154         TRNS,TRNS,MPLY,MPRV,MNXT,
155                                       NO,  NO,
156                                            TRNS,
157                                  TRNS,NO,  TRNS,
158         // right hand
159              F12, F6,  F7,  F8,  F9,  F10, TRNS,
160              TRNS,NO,  NO,  NO,  NO,  NO,  TRNS,
161                   NO,NO,NO,  NO,NO,  TRNS,
162              NO,  NO,  NO,  NO,  NO,  NO,  TRNS,
163                        MUTE,VOLD,VOLU,TRNS,TRNS,
164         HOME,END,
165         TRNS,
166         TRNS,TRNS,TRNS
167     )
168
169 };
170
171 /* id for user defined functions */
172 enum function_id {
173     TEENSY_KEY,
174 };
175
176 /*
177  * Fn action definition
178  */
179 const action_t PROGMEM fn_actions[] = {
180     // Layer shifting
181     [0] = ACTION_LAYER_SET(0, ON_PRESS),           // Switch to Layer 0
182     [1] = ACTION_LAYER_SET(1, ON_PRESS),           // Switch to Layer 1
183     [2] = ACTION_LAYER_MOMENTARY(2),               // Momentarily switch to layer 2
184
185     // Teensy
186     [31] = ACTION_FUNCTION(TEENSY_KEY),
187 };
188
189 void action_function(keyrecord_t *event, uint8_t id, uint8_t opt)
190 {
191     if (id == TEENSY_KEY) {
192         clear_keyboard();
193         print("\n\nJump to bootloader... ");
194         _delay_ms(250);
195         bootloader_jump(); // should not return
196         print("not supported.\n");
197     }
198 }
199