aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris McLennon <mclennon@indeed.com>2016-09-28 13:24:29 -0500
committerChris McLennon <mclennon@indeed.com>2016-09-28 13:24:29 -0500
commit65b0eff6d863d458464c35a8571071ad4a519af5 (patch)
treed1696abee7f86c366bddd4a2889f6be7ee5af03b
parent812219e8a0bf5f317c000d3c5247cdb93a6d7fff (diff)
downloadqmk_firmware-65b0eff6d863d458464c35a8571071ad4a519af5.tar.gz
qmk_firmware-65b0eff6d863d458464c35a8571071ad4a519af5.zip
Contributing new keymap to Ergodox
-rw-r--r--keyboards/ergodox/keymaps/mclennon_osx/README.md5
-rw-r--r--keyboards/ergodox/keymaps/mclennon_osx/config.h93
-rw-r--r--keyboards/ergodox/keymaps/mclennon_osx/keymap.c144
3 files changed, 242 insertions, 0 deletions
diff --git a/keyboards/ergodox/keymaps/mclennon_osx/README.md b/keyboards/ergodox/keymaps/mclennon_osx/README.md
new file mode 100644
index 000000000..60980d043
--- /dev/null
+++ b/keyboards/ergodox/keymaps/mclennon_osx/README.md
@@ -0,0 +1,5 @@
1# Ergodox EZ for OS X
2
3This keymapping is designed to be reasonably familiar to an ordinary Mac keyboard while taking advantage of the Ergodox EZ's features. Caps lock instead enables a layer which allows a user to use HJKL as arrow keys and to control media. Shift and control have additional mappings on S and D to provide easier access while holding down caps lock.
4
5If you choose to compile this yourself, be sure to compile with `#define PREVENT_STUCK_MODIFIERS` in your `config.h`. Firmware built using [qmk_firmware](https://github.com/jackhumbert/qmk_firmware/).
diff --git a/keyboards/ergodox/keymaps/mclennon_osx/config.h b/keyboards/ergodox/keymaps/mclennon_osx/config.h
new file mode 100644
index 000000000..99cbaf000
--- /dev/null
+++ b/keyboards/ergodox/keymaps/mclennon_osx/config.h
@@ -0,0 +1,93 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3Copyright 2013 Oleg Kostyuk <cub.uanic@gmail.com>
4
5This program is free software: you can redistribute it and/or modify
6it under the terms of the GNU General Public License as published by
7the Free Software Foundation, either version 2 of the License, or
8(at your option) any later version.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19#ifndef CONFIG_H
20#define CONFIG_H
21
22#include "config_common.h"
23
24/* USB Device descriptor parameter */
25#define VENDOR_ID 0xFEED
26#define PRODUCT_ID 0x1307
27#define DEVICE_VER 0x0001
28#define MANUFACTURER ErgoDox EZ
29#define PRODUCT ErgoDox EZ
30#define DESCRIPTION t.m.k. keyboard firmware for Ergodox
31
32/* key matrix size */
33#define MATRIX_ROWS 14
34#define MATRIX_COLS 6
35
36#define MOUSEKEY_DELAY 100
37#define MOUSEKEY_INTERVAL 20
38#define MOUSEKEY_MAX_SPEED 3
39#define MOUSEKEY_TIME_TO_MAX 10
40
41#define TAPPING_TOGGLE 1
42
43#define COLS (int []){ F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7 }
44#define ROWS (int []){ D0, D5, B5, B6 }
45
46/* COL2ROW or ROW2COL */
47#define DIODE_DIRECTION COL2ROW
48
49/* define if matrix has ghost */
50//#define MATRIX_HAS_GHOST
51
52/* number of backlight levels */
53#define BACKLIGHT_LEVELS 3
54
55/* Set 0 if debouncing isn't needed */
56#define DEBOUNCE 2
57#define TAPPING_TERM 200
58#define IGNORE_MOD_TAP_INTERRUPT // this makes it possible to do rolling combos (zx) with keys that convert to other keys on hold (z becomes ctrl when you hold it, and when this option isn't enabled, z rapidly followed by x actually sends Ctrl-x. That's bad.)
59
60/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
61#define LOCKING_SUPPORT_ENABLE
62/* Locking resynchronize hack */
63#define LOCKING_RESYNC_ENABLE
64
65/* key combination for command */
66#define IS_COMMAND() ( \
67 keyboard_report->mods == (MOD_BIT(KC_LCTL) | MOD_BIT(KC_RCTL)) || \
68 keyboard_report->mods == (MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT)) \
69)
70
71/*
72 * Feature disable options
73 * These options are also useful to firmware size reduction.
74 */
75
76/* disable debug print */
77// #define NO_DEBUG
78
79/* disable print */
80// #define NO_PRINT
81
82/* disable action features */
83//#define NO_ACTION_LAYER
84//#define NO_ACTION_TAPPING
85//#define NO_ACTION_ONESHOT
86//#define NO_ACTION_MACRO
87//#define NO_ACTION_FUNCTION
88//#define DEBUG_MATRIX_SCAN_RATE
89
90// CUSTOM
91#define PREVENT_STUCK_MODIFIERS
92
93#endif
diff --git a/keyboards/ergodox/keymaps/mclennon_osx/keymap.c b/keyboards/ergodox/keymaps/mclennon_osx/keymap.c
new file mode 100644
index 000000000..627ff01e4
--- /dev/null
+++ b/keyboards/ergodox/keymaps/mclennon_osx/keymap.c
@@ -0,0 +1,144 @@
1// Media keys work on OSX, but not on Windows.
2#include "ergodox.h"
3#include "debug.h"
4#include "action_layer.h"
5
6#define BASE 0 // Default layer
7#define AUXI 1 // Auxiliary layer
8
9const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
10/* Keymap 0: Basic Layer
11 *
12 * ,--------------------------------------------------. ,--------------------------------------------------.
13 * | ~` | 1 | 2 | 3 | 4 | 5 | 6 | | 7 | 8 | 9 | 0 | -_ | += | Bkspc |
14 * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
15 * | Tab | Q | W | E | R | T | L1 | | Del | Y | U | I | O | P | |\ |
16 * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
17 * | L1 | A | S | D | F | G |------| |------| H | J | K | L | ;: | Enter |
18 * |--------+------+------+------+------+------| {[ | | }] |------+------+------+------+------+--------|
19 * | LShift | Z | X | C | V | B | | | | N | M | <, | >. | ?/ | "' |
20 * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
21 * |LCtrl | | | | Esc | | | | | | |
22 * `----------------------------------' `----------------------------------'
23 * ,-------------. ,-------------.
24 * | | | |Power | |
25 * ,------|------|------| |------+--------+------.
26 * | | | | | | | |
27 * | LGui | LAlt |------| |------| Bkspc |Space |
28 * | | | | | Del | | |
29 * `--------------------' `----------------------'
30 */
31// If it accepts an argument (i.e, is a function), it doesn't need KC_.
32// Otherwise, it needs KC_*
33[BASE] = KEYMAP( // layer 0 : default
34 // left hand
35 KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6,
36 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, MO(1),
37 MO(1), KC_A, KC_S, KC_D, KC_F, KC_G,
38 KC_LSHIFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_LBRC,
39 KC_LCTL, KC_TRNS,KC_TRNS,KC_TRNS,KC_ESC,
40 KC_TRNS,KC_TRNS,
41 KC_TRNS,
42 KC_LGUI,KC_LALT,KC_TRNS,
43
44 // right hand
45 KC_7, KC_8, KC_9, KC_0, KC_MINS,KC_EQL, KC_BSPC,
46 KC_DELETE, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLASH,
47 KC_H, KC_J, KC_K, KC_L, KC_SCLN,KC_ENT,
48 KC_RBRC, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH,KC_QUOT,
49 KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
50 KC_PWR, KC_TRNS,
51 KC_TRNS,
52 KC_DELETE, KC_BSPC, KC_SPC
53 ),
54/* Keymap 1: Auxiliary Layer
55 *
56 * ,--------------------------------------------------. ,--------------------------------------------------.
57 * | | F1 | F2 | F3 | F4 | F5 | F6 | | F7 | F8 | F9 | F10 | F11 | F12 | |
58 * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
59 * | | | | | | | TRNS | | | Mute | VolDn| VolUp| Play | | |
60 * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
61 * | TRNS | |LShift| LCtrl| | |------| |------| LEFT | DOWN | UP |RIGHT | | |
62 * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
63 * | LShift | | | | | | | | | MPrv | MNxt | | | | |
64 * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
65 * |LCtrl | | | | | | | | | | |
66 * `----------------------------------' `----------------------------------'
67 * ,-------------. ,-------------.
68 * | | | | | |
69 * ,------|------|------| |------+------+------.
70 * | | | | | | | |
71 * | LGui | LAlt |------| |------| Bkspc| Space|
72 * | | | | | Del | | |
73 * `--------------------' `--------------------'
74 */
75// AUXILIARY
76[AUXI] = KEYMAP(
77 // left hand
78 KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6,
79 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
80 KC_TRNS, KC_TRNS, KC_LSHIFT,KC_LCTL, KC_TRNS, KC_TRNS,
81 KC_LSHIFT,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
82 KC_LCTL, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
83 KC_TRNS, KC_TRNS,
84 KC_TRNS,
85 KC_LGUI, KC_LALT, KC_TRNS,
86 // right hand
87 KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS,
88 KC_TRNS, KC_MUTE, KC_VOLD, KC_VOLU, KC_MPLY, KC_TRNS, KC_TRNS,
89 KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT,KC_TRNS, KC_TRNS,
90 KC_TRNS, KC_MPRV, KC_MNXT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
91 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
92 KC_PWR, KC_TRNS,
93 KC_TRNS,
94 KC_DELETE, KC_BSPC, KC_SPC
95),
96};
97
98const uint16_t PROGMEM fn_actions[] = {
99 [1] = ACTION_LAYER_TAP_TOGGLE(AUXI) // FN1 - Momentary Layer 1 (Auxiliary)
100};
101
102const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
103{
104 // MACRODOWN only works in this function
105 switch(id) {
106 case 0:
107 if (record->event.pressed) {
108 register_code(KC_RSFT);
109 } else {
110 unregister_code(KC_RSFT);
111 }
112 break;
113 }
114 return MACRO_NONE;
115};
116
117// Runs just one time when the keyboard initializes.
118void matrix_init_user(void) {
119
120};
121
122// Runs constantly in the background, in a loop.
123void matrix_scan_user(void) {
124
125 uint8_t layer = biton32(layer_state);
126
127 ergodox_board_led_off();
128 ergodox_right_led_1_off();
129 ergodox_right_led_2_off();
130 ergodox_right_led_3_off();
131 switch (layer) {
132 // TODO: Make this relevant to the ErgoDox EZ.
133 case 1:
134 ergodox_right_led_1_on();
135 break;
136 case 2:
137 ergodox_right_led_2_on();
138 break;
139 default:
140 // none
141 break;
142 }
143
144};