aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--keyboard/atomic/Makefile78
-rw-r--r--keyboard/atomic/config.h2
-rw-r--r--keyboard/atomic/keymaps/pvc/makefile.mk16
-rw-r--r--keyboard/atomic/keymaps/pvc/pvc_atomic.c (renamed from keyboard/atomic/keymaps/pvc_atomic.c)170
-rw-r--r--keyboard/planck/Makefile24
-rw-r--r--keyboard/planck/config.h4
-rw-r--r--keyboard/planck/keymaps/pvc_planck.c71
-rw-r--r--tmk_core/common/action_layer.h1
8 files changed, 315 insertions, 51 deletions
diff --git a/keyboard/atomic/Makefile b/keyboard/atomic/Makefile
index 20cf4fff1..364efa3fa 100644
--- a/keyboard/atomic/Makefile
+++ b/keyboard/atomic/Makefile
@@ -27,7 +27,7 @@
27# make flip-ee = Download the eeprom file to the device, using Atmel FLIP 27# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
28# (must have Atmel FLIP installed). 28# (must have Atmel FLIP installed).
29# 29#
30# make debug = Start either simulavr or avarice as specified for debugging, 30# make debug = Start either simulavr or avarice as specified for debugging,
31# with avr-gdb or avr-insight as the front end for debugging. 31# with avr-gdb or avr-insight as the front end for debugging.
32# 32#
33# make filename.s = Just compile filename.c into the assembler code only. 33# make filename.s = Just compile filename.c into the assembler code only.
@@ -38,6 +38,27 @@
38# To rebuild project do "make clean" then "make all". 38# To rebuild project do "make clean" then "make all".
39#---------------------------------------------------------------------------- 39#----------------------------------------------------------------------------
40 40
41# Build Options
42# change to "no" to disable the options, or define them in the makefile.mk in
43# the appropriate keymap folder that will get included automatically
44#
45BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
46MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
47EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
48CONSOLE_ENABLE = yes # Console for debug(+400)
49COMMAND_ENABLE = yes # Commands for debug and configuration
50NKRO_ENABLE = no # USB Nkey Rollover - if this doesn't work, see here:
51 # https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
52BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
53MIDI_ENABLE = no # MIDI controls
54AUDIO_ENABLE = no # Audio output on port C6
55UNICODE_ENABLE = no # Unicode
56BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
57RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
58
59# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
60SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
61
41# Target file name (without extension). 62# Target file name (without extension).
42TARGET = atomic 63TARGET = atomic
43 64
@@ -50,15 +71,42 @@ TMK_DIR = ../../tmk_core
50TARGET_DIR = . 71TARGET_DIR = .
51 72
52# # project specific files 73# # project specific files
53SRC = atomic.c \ 74SRC = atomic.c
54 backlight.c 75
76ifdef keymap
77 KEYMAP = $(keymap)
78endif
55 79
56ifdef KEYMAP 80ifdef KEYMAP
57 SRC := keymaps/$(KEYMAP).c $(SRC) 81ifneq ("$(wildcard keymaps/$(KEYMAP).c)","")
82 KEYMAP_FILE = keymaps/$(KEYMAP).c
83else
84ifneq ("$(wildcard keymaps/$(KEYMAP)/keymap.c)","")
85 KEYMAP_FILE = keymaps/$(KEYMAP)/keymap.c
86ifneq ("$(wildcard keymaps/$(KEYMAP)/makefile.mk)","")
87 include keymaps/$(KEYMAP)/makefile.mk
88endif
89else
90$(error Keymap file does not exist)
91endif
92endif
93
94else
95
96ifneq ("$(wildcard keymaps/default.c)","")
97 KEYMAP_FILE = keymaps/default.c
58else 98else
59 SRC := keymaps/default.c $(SRC) 99 KEYMAP_FILE = keymaps/default/keymap.c
60endif 100endif
61 101
102ifneq ("$(wildcard keymaps/default/makefile.mk)","")
103 include keymaps/default/makefile.mk
104endif
105
106endif
107
108SRC := $(KEYMAP_FILE) $(SRC)
109
62CONFIG_H = config.h 110CONFIG_H = config.h
63 111
64# MCU name 112# MCU name
@@ -111,22 +159,10 @@ OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
111OPT_DEFS += -DBOOTLOADER_SIZE=4096 159OPT_DEFS += -DBOOTLOADER_SIZE=4096
112 160
113 161
114# Build Options 162ifeq ($(BACKLIGHT_ENABLE), yes)
115# comment out to disable the options. 163 SRC += backlight.c
116# 164endif
117BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
118MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
119EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
120CONSOLE_ENABLE = yes # Console for debug(+400)
121COMMAND_ENABLE = yes # Commands for debug and configuration
122#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
123BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
124#MIDI_ENABLE = yes # MIDI controls
125#UNICODE_ENABLE = yes # Unicode
126#BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID
127 165
128# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
129#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
130 166
131# Optimize size but this may cause error "relocation truncated to fit" 167# Optimize size but this may cause error "relocation truncated to fit"
132#EXTRALDFLAGS = -Wl,--relax 168#EXTRALDFLAGS = -Wl,--relax
@@ -136,4 +172,4 @@ VPATH += $(TARGET_DIR)
136VPATH += $(TOP_DIR) 172VPATH += $(TOP_DIR)
137VPATH += $(TMK_DIR) 173VPATH += $(TMK_DIR)
138 174
139include $(TOP_DIR)/quantum/quantum.mk 175include $(TOP_DIR)/quantum/quantum.mk \ No newline at end of file
diff --git a/keyboard/atomic/config.h b/keyboard/atomic/config.h
index f30a9e6cc..1b34decf9 100644
--- a/keyboard/atomic/config.h
+++ b/keyboard/atomic/config.h
@@ -130,7 +130,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
130//#define MAGIC_KEY_LAYER7 7 130//#define MAGIC_KEY_LAYER7 7
131//#define MAGIC_KEY_LAYER8 8 131//#define MAGIC_KEY_LAYER8 8
132//#define MAGIC_KEY_LAYER9 9 132//#define MAGIC_KEY_LAYER9 9
133//#define MAGIC_KEY_BOOTLOADER PAUSE 133#define MAGIC_KEY_BOOTLOADER B
134//#define MAGIC_KEY_LOCK CAPS 134//#define MAGIC_KEY_LOCK CAPS
135//#define MAGIC_KEY_EEPROM E 135//#define MAGIC_KEY_EEPROM E
136//#define MAGIC_KEY_NKRO N 136//#define MAGIC_KEY_NKRO N
diff --git a/keyboard/atomic/keymaps/pvc/makefile.mk b/keyboard/atomic/keymaps/pvc/makefile.mk
new file mode 100644
index 000000000..ff0a9c338
--- /dev/null
+++ b/keyboard/atomic/keymaps/pvc/makefile.mk
@@ -0,0 +1,16 @@
1BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
2MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
3EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
4CONSOLE_ENABLE = no # Console for debug(+400)
5COMMAND_ENABLE = yes # Commands for debug and configuration
6NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here:
7 # https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
8BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
9MIDI_ENABLE = no # MIDI controls
10AUDIO_ENABLE = no # Audio output on port C6
11UNICODE_ENABLE = no # Unicode
12BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
13RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
14
15# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
16SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
diff --git a/keyboard/atomic/keymaps/pvc_atomic.c b/keyboard/atomic/keymaps/pvc/pvc_atomic.c
index b18e3a377..3ddd3e329 100644
--- a/keyboard/atomic/keymaps/pvc_atomic.c
+++ b/keyboard/atomic/keymaps/pvc/pvc_atomic.c
@@ -1,9 +1,12 @@
1#include "atomic.h" 1#include "atomic.h"
2#include "action_layer.h"
2 3
3#define _QW 0 4#define _QW 0
4#define _LW 1 5#define _LW 1
5#define _RS 2 6#define _RS 2
6#define _FN 3 7#define _FN 3
8#define _F1 4
9#define _F2 5
7 10
8#define _______ KC_TRNS 11#define _______ KC_TRNS
9#define ___T___ KC_TRNS 12#define ___T___ KC_TRNS
@@ -29,7 +32,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
29 { KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL }, 32 { KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL },
30 { KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, XXXXXXX, KC_PGUP }, 33 { KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, XXXXXXX, KC_PGUP },
31 { KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, XXXXXXX, KC_UP, KC_PGDN }, 34 { KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, XXXXXXX, KC_UP, KC_PGDN },
32 { KC_LCTL, KC_LGUI, MO(_FN), KC_LALT, MO(_RS), KC_SPC, XXXXXXX, MO(_LW), KC_RALT, KC_HOME, KC_END, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT }, 35 { KC_LCTL, KC_LGUI, M(_FN), KC_LALT, M(_RS), KC_SPC, XXXXXXX, M(_LW), KC_RALT, KC_HOME, KC_END, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT },
33 }, 36 },
34 [_LW] = { /* LOWERED */ 37 [_LW] = { /* LOWERED */
35 { KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ___T___, ___T___ }, 38 { KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ___T___, ___T___ },
@@ -52,18 +55,167 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
52 { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, KC_MS_U, KC_WH_D }, 55 { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, KC_MS_U, KC_WH_D },
53 { _______, _______, _______, _______, _______, KC_BTN1, KC_BTN1, _______, _______, _______, _______, _______, KC_MS_L, KC_MS_D, KC_MS_R }, 56 { _______, _______, _______, _______, _______, KC_BTN1, KC_BTN1, _______, _______, _______, _______, _______, KC_MS_L, KC_MS_D, KC_MS_R },
54 }, 57 },
58 [_F1] = { /* FUNCTION */
59 { KC_NLCK, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ___T___, ___T___ },
60 { KC_SLCK, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, KC_PAUS, KC_PSCR },
61 { KC_CAPS, KC_BTN5, KC_BTN4, KC_BTN3, KC_BTN2, KC_ACL0, KC_ACL2, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY, _______, ___T___, ___T___, KC_WH_U },
62 { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, KC_MS_U, KC_WH_D },
63 { _______, _______, _______, _______, _______, KC_BTN1, KC_BTN1, _______, _______, _______, _______, _______, KC_MS_L, KC_MS_D, KC_MS_R },
64 },
65 [_F2] = { /* FUNCTION */
66 { KC_NLCK, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ___T___, ___T___ },
67 { KC_SLCK, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, KC_PAUS, KC_PSCR },
68 { KC_CAPS, KC_BTN5, KC_BTN4, KC_BTN3, KC_BTN2, KC_ACL0, KC_ACL2, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY, _______, ___T___, ___T___, KC_WH_U },
69 { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, KC_MS_U, KC_WH_D },
70 { _______, _______, _______, _______, _______, KC_BTN1, KC_BTN1, _______, _______, _______, _______, _______, KC_MS_L, KC_MS_D, KC_MS_R },
71 },
55}; 72};
56 73
74#define IS_LAYER_ON(layer) ((layer_state) & (1<<(layer)))
75#define IS_LAYER_OFF(layer) ((!layer_state) & (1<<(layer)))
76
77void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3)
78{
79 if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2))
80 {
81 layer_on(layer3);
82 }
83 else
84 {
85 layer_off(layer3);
86 }
87}
88
89void update_quad_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3, uint8_t layer4, bool order)
90{
91 if (order)
92 {
93 if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2))
94 {
95 layer_on(layer3);
96 }
97 else
98 {
99 layer_off(layer3);
100 layer_off(layer4);
101 }
102 }
103 else
104 {
105 if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2))
106 {
107 layer_on(layer4);
108 }
109 else
110 {
111 layer_off(layer3);
112 layer_off(layer4);
113 }
114 }
115}
116
117/* ignore me
118void change_quad_layer(uint8_t focus_layer, bool desired_focus_layer_state, uint8_t pair_layer, uint8_t layer3, uint8_t layer4)
119{
120
121 // If desired focus layer state == 1 and current focus layer state == 1
122 if ((desired_focus_layer_state) && IS_LAYER_ON(layer1))
123 {
124 // Do Nothing
125 }
126 // If desired focus layer state == 0 and current focus layer state == 1
127 else if ((desired_focus_layer_state) && IS_LAYER_ON(layer1))
128 {
129 // If
130 layer_off(layer3);
131 layer_off(layer4);
132 }
133 }
134 else
135 {
136 if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2))
137 {
138 layer_on(layer4);
139 }
140 else
141 {
142 layer_off(layer3);
143 layer_off(layer4);
144 }
145 }
146}
147*/
148
57const uint16_t PROGMEM fn_actions[] = { 149const uint16_t PROGMEM fn_actions[] = {
58}; 150};
59 151
60const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) 152
153const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
61{ 154{
62 // MACRODOWN only works in this function 155
63 switch(id) { 156 // MACRODOWN only works in this function
64 case 0: 157 switch(id)
65 return MACRODOWN(TYPE(KC_T), END); 158 {
66 break; 159 case _FN:
67 } 160 if (record->event.pressed) {
68 return MACRO_NONE; 161 print("FN_DN\n");
162 print_val_bin32(layer_state);
163 layer_on(_FN);
164 print_val_bin32(layer_state);
165 } else {
166 print("FN_UP\n");
167 print_val_bin32(layer_state);
168 layer_off(_FN);
169 print_val_bin32(layer_state);
170 }
171 break;
172
173 case _RS:
174 if (record->event.pressed) {
175 print("RS_DN\n");
176 print_val_bin32(layer_state);
177 layer_on(_RS);
178 //tri_layer++;
179 print_val_bin32(layer_state);
180 //update_tri_layer(_RS, _LW, _FN);
181 update_quad_layer(_RS, _LW, _F1, _F2, 0);
182 print_val_bin32(layer_state);
183 } else {
184 print("RS_UP\n");
185 print_val_bin32(layer_state);
186 layer_off(_RS);
187 //tri_layer--;
188 print_val_bin32(layer_state);
189 //update_tri_layer(_RS, _LW, _FN);
190 update_quad_layer(_RS, _LW, _F1, _F2, 0);
191 print_val_bin32(layer_state);
192 }
193 break;
194
195 case _LW:
196 if (record->event.pressed) {
197 print("LW_DN\n");
198 print_val_bin32(layer_state);
199 layer_on(_LW);
200 //tri_layer++;
201 print_val_bin32(layer_state);
202 //update_tri_layer(_RS, _LW, _FN);
203 update_quad_layer(_RS, _LW, _F1, _F2, 1);
204 print_val_bin32(layer_state);
205 } else {
206 print("LW_UP\n");
207 print_val_bin32(layer_state);
208 layer_off(_LW);
209 //tri_layer--;
210 print_val_bin32(layer_state);
211 //update_tri_layer(_RS, _LW, _FN);
212 update_quad_layer(_RS, _LW, _F1, _F2, 1);
213 print_val_bin32(layer_state);
214 }
215 break;
216
217 default:
218 break;
219 }
220 return MACRO_NONE;
69}; 221};
diff --git a/keyboard/planck/Makefile b/keyboard/planck/Makefile
index dc6e46df2..992679f47 100644
--- a/keyboard/planck/Makefile
+++ b/keyboard/planck/Makefile
@@ -159,7 +159,31 @@ OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
159OPT_DEFS += -DBOOTLOADER_SIZE=4096 159OPT_DEFS += -DBOOTLOADER_SIZE=4096
160 160
161 161
162<<<<<<< HEAD
163# Build Options
164# comment out to disable the options.
165#
166BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
167MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
168EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
169CONSOLE_ENABLE = yes # Console for debug(+400)
170COMMAND_ENABLE = yes # Commands for debug and configuration
171NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
172# BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
173# MIDI_ENABLE = yes # MIDI controls
174# AUDIO_ENABLE = yes # Audio output on port C6
175# UNICODE_ENABLE = yes # Unicode
176# BLUETOOTH_ENABLE = ye # Enable Bluetooth with the Adafruit EZ-Key HID
177# RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
178
179# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
180#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
181
182
183ifdef BACKLIGHT_ENABLE
184=======
162ifeq ($(BACKLIGHT_ENABLE), yes) 185ifeq ($(BACKLIGHT_ENABLE), yes)
186>>>>>>> master
163 SRC += backlight.c 187 SRC += backlight.c
164endif 188endif
165 189
diff --git a/keyboard/planck/config.h b/keyboard/planck/config.h
index d3719e0cb..7d64f0977 100644
--- a/keyboard/planck/config.h
+++ b/keyboard/planck/config.h
@@ -73,10 +73,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
73 */ 73 */
74 74
75/* disable debug print */ 75/* disable debug print */
76#define NO_DEBUG 76//#define NO_DEBUG
77 77
78/* disable print */ 78/* disable print */
79#define NO_PRINT 79//#define NO_PRINT
80 80
81/* disable action features */ 81/* disable action features */
82//#define NO_ACTION_LAYER 82//#define NO_ACTION_LAYER
diff --git a/keyboard/planck/keymaps/pvc_planck.c b/keyboard/planck/keymaps/pvc_planck.c
index ed062609f..20bb5d86d 100644
--- a/keyboard/planck/keymaps/pvc_planck.c
+++ b/keyboard/planck/keymaps/pvc_planck.c
@@ -2,6 +2,8 @@
2// this is the style you want to emulate. 2// this is the style you want to emulate.
3 3
4#include "planck.h" 4#include "planck.h"
5#include "print.h"
6#include "action_layer.h"
5#ifdef BACKLIGHT_ENABLE 7#ifdef BACKLIGHT_ENABLE
6 #include "backlight.h" 8 #include "backlight.h"
7#endif 9#endif
@@ -38,10 +40,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
38 * `-----------------------------------------------------------------------------------' 40 * `-----------------------------------------------------------------------------------'
39 */ 41 */
40[_QW] = { 42[_QW] = {
41 {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, 43 {RESET, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
42 {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, 44 {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT},
43 {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_UP, KC_ENT }, 45 {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_UP, KC_ENT },
44 {KC_LCTL, KC_LGUI, KC_LALT, KC_DEL, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_SLSH, KC_LEFT, KC_DOWN, KC_RGHT} 46 {KC_LCTL, KC_LGUI, KC_LALT, KC_DEL, M(_LW), KC_SPC, KC_SPC, M(_RS), KC_SLSH, KC_LEFT, KC_DOWN, KC_RGHT}
45}, 47},
46 48
47/* Colemak 49/* Colemak
@@ -95,7 +97,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
95 {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, 97 {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
96 {_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, 98 {_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS},
97 {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, XXXXXXX, XXXXXXX, RESET, _______}, 99 {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, XXXXXXX, XXXXXXX, RESET, _______},
98 {_______, _______, _______, _______, MO(_FN), _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} 100 {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
99}, 101},
100 102
101/* Lower 103/* Lower
@@ -113,7 +115,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
113 {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC}, 115 {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC},
114 {_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE}, 116 {_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE},
115 {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, XXXXXXX, XXXXXXX, MG_B, _______}, 117 {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, XXXXXXX, XXXXXXX, MG_B, _______},
116 {_______, _______, _______, _______, _______, _______, _______, MO(_FN), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} 118 {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
117}, 119},
118 120
119/* Function 121/* Function
@@ -139,20 +141,53 @@ const uint16_t PROGMEM fn_actions[] = {
139 141
140}; 142};
141 143
144
145int tri_layer = 0;
146void update_tri_layer(int layer) {
147 if (tri_layer > 1) {
148 layer_on(layer);
149 } else {
150 layer_off(layer);
151 }
152}
153
154
142const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) 155const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
143{ 156{
144 // MACRODOWN only works in this function 157 // MACRODOWN only works in this function
145 switch(id) { 158 switch(id)
146 case 0: 159 {
147 if (record->event.pressed) { 160 case _RS:
148 register_code(KC_RSFT); 161 if (record->event.pressed) {
149 #ifdef BACKLIGHT_ENABLE 162 print("RS_DN");
150 backlight_step(); 163 layer_on(_RS);
151 #endif 164 tri_layer++;
152 } else { 165 update_tri_layer(_FN);
153 unregister_code(KC_RSFT); 166 } else {
154 } 167 print("RS_UP");
155 break; 168 layer_off(_RS);
156 } 169 tri_layer--;
157 return MACRO_NONE; 170 update_tri_layer(_FN);
171 phex(layer_state);
172 }
173 break;
174
175 case _LW:
176 if (record->event.pressed) {
177 print("LW_DN");
178 layer_on(_LW);
179 tri_layer++;
180 update_tri_layer(_FN);
181 } else {
182 print("LW_UP");
183 layer_off(_LW);
184 tri_layer--;
185 update_tri_layer(_FN);
186 }
187 break;
188
189 default:
190 break;
191 }
192 return MACRO_NONE;
158}; 193};
diff --git a/tmk_core/common/action_layer.h b/tmk_core/common/action_layer.h
index 3a4b1e334..025cf5420 100644
--- a/tmk_core/common/action_layer.h
+++ b/tmk_core/common/action_layer.h
@@ -68,6 +68,7 @@ void layer_xor(uint32_t state);
68#define layer_and(state) 68#define layer_and(state)
69#define layer_xor(state) 69#define layer_xor(state)
70#define layer_debug() 70#define layer_debug()
71
71#endif 72#endif
72 73
73/* pressed actions cache */ 74/* pressed actions cache */