aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTerryMathews <terry@terrymathews.net>2017-01-22 15:37:48 -0500
committerTerryMathews <terry@terrymathews.net>2017-01-22 15:37:48 -0500
commit9d24943ec1285c2d5d5853390abd5eb4e0cd7a2c (patch)
tree99c0f600d4b8cebd6d752fca92f7f919c99f36fc
parent6f448856151572f5bee329e68842cdda867fa66b (diff)
downloadqmk_firmware-9d24943ec1285c2d5d5853390abd5eb4e0cd7a2c.tar.gz
qmk_firmware-9d24943ec1285c2d5d5853390abd5eb4e0cd7a2c.zip
Refactor code to eliminate duplicate defines
* Moved duplicated defines out of inappropriate source files (matrix pins in keymap subdirectory) * Eliminated default keymap directory * Hardcoded serial keymap to use serial defines and EE_CONFIG * Hardcoded i2c keymap to use i2c defines
-rw-r--r--keyboards/lets_split/config.h43
-rw-r--r--keyboards/lets_split/keymaps/default/keymap.c188
-rw-r--r--keyboards/lets_split/keymaps/i2c/config.h85
-rw-r--r--keyboards/lets_split/keymaps/serial/config.h87
-rw-r--r--keyboards/lets_split/rev1/config.h5
-rw-r--r--keyboards/lets_split/rev2/config.h4
6 files changed, 16 insertions, 396 deletions
diff --git a/keyboards/lets_split/config.h b/keyboards/lets_split/config.h
index 4db45ab0b..7df0c5752 100644
--- a/keyboards/lets_split/config.h
+++ b/keyboards/lets_split/config.h
@@ -20,49 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
20 20
21#include "config_common.h" 21#include "config_common.h"
22 22
23/* USB Device descriptor parameter */
24#define VENDOR_ID 0xFEED
25#define PRODUCT_ID 0x3060
26#define DEVICE_VER 0x0001
27#define MANUFACTURER Wootpatoot
28#define PRODUCT Lets Split
29#define DESCRIPTION A split keyboard for the cheap makers
30
31/* COL2ROW or ROW2COL */
32#define DIODE_DIRECTION COL2ROW
33
34/* define if matrix has ghost */
35//#define MATRIX_HAS_GHOST
36
37/* number of backlight levels */
38// #define BACKLIGHT_LEVELS 3
39
40/* Set 0 if debouncing isn't needed */
41#define DEBOUNCING_DELAY 5
42
43/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
44#define LOCKING_SUPPORT_ENABLE
45/* Locking resynchronize hack */
46#define LOCKING_RESYNC_ENABLE
47
48/* key combination for command */
49#define IS_COMMAND() ( \
50 keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
51)
52
53/* disable debug print */
54//#define NO_DEBUG
55
56/* disable print */
57//#define NO_PRINT
58
59/* disable action features */
60//#define NO_ACTION_LAYER
61//#define NO_ACTION_TAPPING
62//#define NO_ACTION_ONESHOT
63//#define NO_ACTION_MACRO
64//#define NO_ACTION_FUNCTION
65
66#ifdef SUBPROJECT_rev1 23#ifdef SUBPROJECT_rev1
67 #include "rev1/config.h" 24 #include "rev1/config.h"
68#endif 25#endif
diff --git a/keyboards/lets_split/keymaps/default/keymap.c b/keyboards/lets_split/keymaps/default/keymap.c
deleted file mode 100644
index 6f1f71f5f..000000000
--- a/keyboards/lets_split/keymaps/default/keymap.c
+++ /dev/null
@@ -1,188 +0,0 @@
1#include "lets_split.h"
2#include "action_layer.h"
3#include "eeconfig.h"
4
5extern keymap_config_t keymap_config;
6
7// Each layer gets a name for readability, which is then used in the keymap matrix below.
8// The underscores don't mean anything - you can have a layer called STUFF or any other name.
9// Layer names don't all need to be of the same length, obviously, and you can also skip them
10// entirely and just use numbers.
11#define _QWERTY 0
12#define _COLEMAK 1
13#define _DVORAK 2
14#define _LOWER 3
15#define _RAISE 4
16#define _ADJUST 16
17
18enum custom_keycodes {
19 QWERTY = SAFE_RANGE,
20 COLEMAK,
21 DVORAK,
22 LOWER,
23 RAISE,
24 ADJUST,
25};
26
27// Fillers to make layering more clear
28#define _______ KC_TRNS
29#define XXXXXXX KC_NO
30
31const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
32
33/* Qwerty
34 * ,-----------------------------------------------------------------------------------.
35 * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp |
36 * |------+------+------+------+------+-------------+------+------+------+------+------|
37 * | Esc | A | S | D | F | G | H | J | K | L | ; | " |
38 * |------+------+------+------+------+------|------+------+------+------+------+------|
39 * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter |
40 * |------+------+------+------+------+------+------+------+------+------+------+------|
41 * |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right |
42 * `-----------------------------------------------------------------------------------'
43 */
44[_QWERTY] = KEYMAP( \
45 KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \
46 KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \
47 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \
48 KC_LCTL, ADJUST, KC_LALT, KC_LGUI, LOWER, KC_SPC, MT(MOD_LSFT, KC_SPC), RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
49),
50
51/* Colemak
52 * ,-----------------------------------------------------------------------------------.
53 * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp |
54 * |------+------+------+------+------+-------------+------+------+------+------+------|
55 * | Esc | A | R | S | T | D | H | N | E | I | O | " |
56 * |------+------+------+------+------+------|------+------+------+------+------+------|
57 * | Shift| Z | X | C | V | B | K | M | , | . | / |Enter |
58 * |------+------+------+------+------+------+------+------+------+------+------+------|
59 * |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right |
60 * `-----------------------------------------------------------------------------------'
61 */
62[_COLEMAK] = KEYMAP( \
63 KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, \
64 KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, \
65 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \
66 ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
67),
68
69/* Dvorak
70 * ,-----------------------------------------------------------------------------------.
71 * | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp |
72 * |------+------+------+------+------+-------------+------+------+------+------+------|
73 * | Esc | A | O | E | U | I | D | H | T | N | S | / |
74 * |------+------+------+------+------+------|------+------+------+------+------+------|
75 * | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter |
76 * |------+------+------+------+------+------+------+------+------+------+------+------|
77 * |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right |
78 * `-----------------------------------------------------------------------------------'
79 */
80[_DVORAK] = KEYMAP( \
81 KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, \
82 KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, \
83 KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT , \
84 ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
85),
86[3] = KEYMAP( \
87 KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, \
88 KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \
89 _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),_______, _______, _______, \
90 _______, _______, _______, _______, _______, KC_BSPC, MT(MOD_LSFT, KC_BSPC), _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \
91),
92[4] = KEYMAP( \
93 KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______, \
94 KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \
95 _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______, \
96 _______, _______, _______, _______, _______, KC_ENT, MT(MOD_LSFT, KC_ENT), _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \
97),
98
99/* Adjust (Lower + Raise)
100 * ,-----------------------------------------------------------------------------------.
101 * | | Reset| | | | | | | | | | Del |
102 * |------+------+------+------+------+-------------+------+------+------+------+------|
103 * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | |
104 * |------+------+------+------+------+------|------+------+------+------+------+------|
105 * | | | | | | | | | | | | |
106 * |------+------+------+------+------+------+------+------+------+------+------+------|
107 * | | | | | | | | | | | |
108 * `-----------------------------------------------------------------------------------'
109 */
110[_ADJUST] = KEYMAP( \
111 _______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, \
112 _______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \
113 _______, RGB_TOG,RGB_MOD,RGB_HUI,RGB_HUD,RGB_SAI,RGB_SAD,RGB_VAI,RGB_VAD, _______, _______, _______, \
114 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
115)
116};
117
118#ifdef AUDIO_ENABLE
119float tone_qwerty[][2] = SONG(QWERTY_SOUND);
120float tone_dvorak[][2] = SONG(DVORAK_SOUND);
121float tone_colemak[][2] = SONG(COLEMAK_SOUND);
122#endif
123
124void persistant_default_layer_set(uint16_t default_layer) {
125 eeconfig_update_default_layer(default_layer);
126 default_layer_set(default_layer);
127}
128
129bool process_record_user(uint16_t keycode, keyrecord_t *record) {
130 switch (keycode) {
131 case QWERTY:
132 if (record->event.pressed) {
133 #ifdef AUDIO_ENABLE
134 PLAY_NOTE_ARRAY(tone_qwerty, false, 0);
135 #endif
136 persistant_default_layer_set(1UL<<_QWERTY);
137 }
138 return false;
139 break;
140 case COLEMAK:
141 if (record->event.pressed) {
142 #ifdef AUDIO_ENABLE
143 PLAY_NOTE_ARRAY(tone_colemak, false, 0);
144 #endif
145 persistant_default_layer_set(1UL<<_COLEMAK);
146 }
147 return false;
148 break;
149 case DVORAK:
150 if (record->event.pressed) {
151 #ifdef AUDIO_ENABLE
152 PLAY_NOTE_ARRAY(tone_dvorak, false, 0);
153 #endif
154 persistant_default_layer_set(1UL<<_DVORAK);
155 }
156 return false;
157 break;
158 case LOWER:
159 if (record->event.pressed) {
160 layer_on(_LOWER);
161 update_tri_layer(_LOWER, _RAISE, _ADJUST);
162 } else {
163 layer_off(_LOWER);
164 update_tri_layer(_LOWER, _RAISE, _ADJUST);
165 }
166 return false;
167 break;
168 case RAISE:
169 if (record->event.pressed) {
170 layer_on(_RAISE);
171 update_tri_layer(_LOWER, _RAISE, _ADJUST);
172 } else {
173 layer_off(_RAISE);
174 update_tri_layer(_LOWER, _RAISE, _ADJUST);
175 }
176 return false;
177 break;
178 case ADJUST:
179 if (record->event.pressed) {
180 layer_on(_ADJUST);
181 } else {
182 layer_off(_ADJUST);
183 }
184 return false;
185 break;
186 }
187 return true;
188} \ No newline at end of file
diff --git a/keyboards/lets_split/keymaps/i2c/config.h b/keyboards/lets_split/keymaps/i2c/config.h
index 72e5ae66b..efe8bb0f2 100644
--- a/keyboards/lets_split/keymaps/i2c/config.h
+++ b/keyboards/lets_split/keymaps/i2c/config.h
@@ -14,89 +14,14 @@ GNU General Public License for more details.
14You should have received a copy of the GNU General Public License 14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17
18#ifndef CONFIG_H
19#define CONFIG_H
20
21#include "config_common.h"
22
23/* USB Device descriptor parameter */
24#define VENDOR_ID 0xFEED
25#define PRODUCT_ID 0x3060
26#define DEVICE_VER 0x0001
27#define MANUFACTURER Wootpatoot
28#define PRODUCT Lets Split
29#define DESCRIPTION A split keyboard for the cheap makers
30
31/* key matrix size */
32// Rows are doubled-up
33#define MATRIX_ROWS 8
34#define MATRIX_COLS 6
35
36// wiring of each half
37#define MATRIX_ROW_PINS { B5, B4, E6, D7 }
38#define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3 }
39
40#define CATERINA_BOOTLOADER
41
42#define USE_I2C 17#define USE_I2C
43 18
44// Use serial if not using I2C
45#ifndef USE_I2C
46# define USE_SERIAL
47#endif
48
49// #define EE_HANDS
50
51#define I2C_MASTER_LEFT 19#define I2C_MASTER_LEFT
52// #define I2C_MASTER_RIGHT 20// #define I2C_MASTER_RIGHT
53 21
54/* COL2ROW or ROW2COL */ 22#ifdef SUBPROJECT_rev1
55#define DIODE_DIRECTION COL2ROW 23 #include "../../rev1/config.h"
56
57/* define if matrix has ghost */
58//#define MATRIX_HAS_GHOST
59
60/* number of backlight levels */
61// #define BACKLIGHT_LEVELS 3
62
63/* Set 0 if debouncing isn't needed */
64#define DEBOUNCING_DELAY 5
65
66/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
67#define LOCKING_SUPPORT_ENABLE
68/* Locking resynchronize hack */
69#define LOCKING_RESYNC_ENABLE
70
71/* key combination for command */
72#define IS_COMMAND() ( \
73 keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
74)
75
76/* ws2812 RGB LED */
77#define RGB_DI_PIN D4
78#define RGBLIGHT_ANIMATIONS
79#define RGBLED_NUM 8 // Number of LEDs
80#define RGBLIGHT_HUE_STEP 10
81#define RGBLIGHT_SAT_STEP 17
82#define RGBLIGHT_VAL_STEP 17
83
84/*
85 * Feature disable options
86 * These options are also useful to firmware size reduction.
87 */
88
89/* disable debug print */
90// #define NO_DEBUG
91
92/* disable print */
93// #define NO_PRINT
94
95/* disable action features */
96//#define NO_ACTION_LAYER
97//#define NO_ACTION_TAPPING
98//#define NO_ACTION_ONESHOT
99//#define NO_ACTION_MACRO
100//#define NO_ACTION_FUNCTION
101
102#endif 24#endif
25#ifdef SUBPROJECT_rev2
26 #include "../../rev2/config.h"
27#endif \ No newline at end of file
diff --git a/keyboards/lets_split/keymaps/serial/config.h b/keyboards/lets_split/keymaps/serial/config.h
index b0ad522fc..cd766cc4f 100644
--- a/keyboards/lets_split/keymaps/serial/config.h
+++ b/keyboards/lets_split/keymaps/serial/config.h
@@ -15,88 +15,15 @@ You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17 17
18#ifndef CONFIG_H
19#define CONFIG_H
20 18
21#include "config_common.h" 19#define USE_SERIAL
22 20
23/* USB Device descriptor parameter */ 21#define EE_HANDS
24#define VENDOR_ID 0xFEED
25#define PRODUCT_ID 0x3060
26#define DEVICE_VER 0x0001
27#define MANUFACTURER Wootpatoot
28#define PRODUCT Lets Split
29#define DESCRIPTION A split keyboard for the cheap makers
30 22
31/* key matrix size */
32// Rows are doubled-up
33#define MATRIX_ROWS 8
34#define MATRIX_COLS 6
35
36// wiring of each half
37#define MATRIX_ROW_PINS { B5, B4, E6, D7 }
38#define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3 }
39
40#define CATERINA_BOOTLOADER
41
42// #define USE_I2C
43
44// Use serial if not using I2C
45#ifndef USE_I2C
46# define USE_SERIAL
47#endif
48
49// #define EE_HANDS
50
51#define I2C_MASTER_LEFT
52// #define I2C_MASTER_RIGHT
53
54/* COL2ROW or ROW2COL */
55#define DIODE_DIRECTION COL2ROW
56
57/* define if matrix has ghost */
58//#define MATRIX_HAS_GHOST
59
60/* number of backlight levels */
61// #define BACKLIGHT_LEVELS 3
62
63/* Set 0 if debouncing isn't needed */
64#define DEBOUNCING_DELAY 5
65
66/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
67#define LOCKING_SUPPORT_ENABLE
68/* Locking resynchronize hack */
69#define LOCKING_RESYNC_ENABLE
70
71/* key combination for command */
72#define IS_COMMAND() ( \
73 keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
74)
75
76/* ws2812 RGB LED */
77#define RGB_DI_PIN D4
78#define RGBLIGHT_ANIMATIONS
79#define RGBLED_NUM 8 // Number of LEDs
80#define RGBLIGHT_HUE_STEP 10
81#define RGBLIGHT_SAT_STEP 17
82#define RGBLIGHT_VAL_STEP 17
83
84/*
85 * Feature disable options
86 * These options are also useful to firmware size reduction.
87 */
88
89/* disable debug print */
90// #define NO_DEBUG
91
92/* disable print */
93// #define NO_PRINT
94
95/* disable action features */
96//#define NO_ACTION_LAYER
97//#define NO_ACTION_TAPPING
98//#define NO_ACTION_ONESHOT
99//#define NO_ACTION_MACRO
100//#define NO_ACTION_FUNCTION
101 23
24#ifdef SUBPROJECT_rev1
25 #include "../../rev1/config.h"
102#endif 26#endif
27#ifdef SUBPROJECT_rev2
28 #include "../../rev2/config.h"
29#endif \ No newline at end of file
diff --git a/keyboards/lets_split/rev1/config.h b/keyboards/lets_split/rev1/config.h
index 825e5ec24..4d3d382a4 100644
--- a/keyboards/lets_split/rev1/config.h
+++ b/keyboards/lets_split/rev1/config.h
@@ -25,7 +25,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
25#define PRODUCT_ID 0x3060 25#define PRODUCT_ID 0x3060
26#define DEVICE_VER 0x0001 26#define DEVICE_VER 0x0001
27#define MANUFACTURER Wootpatoot 27#define MANUFACTURER Wootpatoot
28#define PRODUCT Lets Split
29#define PRODUCT Lets Split v1 28#define PRODUCT Lets Split v1
30#define DESCRIPTION A split keyboard for the cheap makers 29#define DESCRIPTION A split keyboard for the cheap makers
31 30
@@ -42,13 +41,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
42 41
43// #define USE_I2C 42// #define USE_I2C
44// Use serial if not using I2C 43// Use serial if not using I2C
45#ifndef USE_I2C 44/*#ifndef USE_I2C
46# define USE_SERIAL 45# define USE_SERIAL
47#endif 46#endif
48 47
49// #define EE_HANDS 48// #define EE_HANDS
50 49
51#define I2C_MASTER_LEFT 50#define I2C_MASTER_LEFT*/
52// #define I2C_MASTER_RIGHT 51// #define I2C_MASTER_RIGHT
53 52
54/* COL2ROW or ROW2COL */ 53/* COL2ROW or ROW2COL */
diff --git a/keyboards/lets_split/rev2/config.h b/keyboards/lets_split/rev2/config.h
index e9689d773..ed9e106db 100644
--- a/keyboards/lets_split/rev2/config.h
+++ b/keyboards/lets_split/rev2/config.h
@@ -42,13 +42,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
42// #define USE_I2C 42// #define USE_I2C
43 43
44// Use serial if not using I2C 44// Use serial if not using I2C
45#ifndef USE_I2C 45/*#ifndef USE_I2C
46# define USE_SERIAL 46# define USE_SERIAL
47#endif 47#endif
48 48
49// #define EE_HANDS 49// #define EE_HANDS
50 50
51#define I2C_MASTER_LEFT 51#define I2C_MASTER_LEFT*/
52// #define I2C_MASTER_RIGHT 52// #define I2C_MASTER_RIGHT
53 53
54/* COL2ROW or ROW2COL */ 54/* COL2ROW or ROW2COL */