aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortmk <nobody@nowhere>2013-07-21 10:44:21 +0900
committertmk <nobody@nowhere>2013-07-21 10:44:21 +0900
commit25aec56c082936a463d609357a04332c97c9940b (patch)
tree5c3813a5391b9b10f1dc07b259d075729f9c6344
parent86623f57247c92242751ceae4cb291e7f3d19540 (diff)
parent3e023e5b0cf15d3008346c6b946ae3adc51f7f18 (diff)
downloadqmk_firmware-25aec56c082936a463d609357a04332c97c9940b.tar.gz
qmk_firmware-25aec56c082936a463d609357a04332c97c9940b.zip
Merge branch 'bob_fix'
-rw-r--r--common/action.c6
-rw-r--r--common/action_code.h10
-rw-r--r--common/action_tapping.c71
3 files changed, 53 insertions, 34 deletions
diff --git a/common/action.c b/common/action.c
index b1fa0e31c..a42a7a4ae 100644
--- a/common/action.c
+++ b/common/action.c
@@ -237,7 +237,7 @@ void process_action(keyrecord_t *record)
237 break; 237 break;
238 #ifndef NO_ACTION_TAPPING 238 #ifndef NO_ACTION_TAPPING
239 case ACT_LAYER_TAP: 239 case ACT_LAYER_TAP:
240 case ACT_LAYER_TAP1: 240 case ACT_LAYER_TAP_EXT:
241 switch (action.layer_tap.code) { 241 switch (action.layer_tap.code) {
242 case OP_TAP_TOGGLE: 242 case OP_TAP_TOGGLE:
243 /* tap toggle */ 243 /* tap toggle */
@@ -458,7 +458,7 @@ bool is_tap_key(key_t key)
458 case ACT_LMODS_TAP: 458 case ACT_LMODS_TAP:
459 case ACT_RMODS_TAP: 459 case ACT_RMODS_TAP:
460 case ACT_LAYER_TAP: 460 case ACT_LAYER_TAP:
461 case ACT_LAYER_TAP1: 461 case ACT_LAYER_TAP_EXT:
462 return true; 462 return true;
463 case ACT_MACRO: 463 case ACT_MACRO:
464 case ACT_FUNCTION: 464 case ACT_FUNCTION:
@@ -496,7 +496,7 @@ void debug_action(action_t action)
496 case ACT_MOUSEKEY: dprint("ACT_MOUSEKEY"); break; 496 case ACT_MOUSEKEY: dprint("ACT_MOUSEKEY"); break;
497 case ACT_LAYER: dprint("ACT_LAYER"); break; 497 case ACT_LAYER: dprint("ACT_LAYER"); break;
498 case ACT_LAYER_TAP: dprint("ACT_LAYER_TAP"); break; 498 case ACT_LAYER_TAP: dprint("ACT_LAYER_TAP"); break;
499 case ACT_LAYER_TAP1: dprint("ACT_LAYER_TAP1"); break; 499 case ACT_LAYER_TAP_EXT: dprint("ACT_LAYER_TAP_EXT"); break;
500 case ACT_MACRO: dprint("ACT_MACRO"); break; 500 case ACT_MACRO: dprint("ACT_MACRO"); break;
501 case ACT_COMMAND: dprint("ACT_COMMAND"); break; 501 case ACT_COMMAND: dprint("ACT_COMMAND"); break;
502 case ACT_FUNCTION: dprint("ACT_FUNCTION"); break; 502 case ACT_FUNCTION: dprint("ACT_FUNCTION"); break;
diff --git a/common/action_code.h b/common/action_code.h
index 2272091cc..df6ce9998 100644
--- a/common/action_code.h
+++ b/common/action_code.h
@@ -62,8 +62,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
62 * 1000|ooee|pppE BBBB Layer Bitwise Operation 62 * 1000|ooee|pppE BBBB Layer Bitwise Operation
63 * oo: operation(00:AND, 01:OR, 10:XOR, 11:SET) 63 * oo: operation(00:AND, 01:OR, 10:XOR, 11:SET)
64 * ppp: 4-bit chunk part(0-7) 64 * ppp: 4-bit chunk part(0-7)
65 * eBBBB: bits and extra bit 65 * EBBBB: bits and extra bit
66 * ee: on event(00:default layer, 01:press, 10:release, 11:both) 66 * ee: on event(01:press, 10:release, 11:both)
67 * 67 *
68 * 1001|xxxx|xxxx xxxx (reserved) 68 * 1001|xxxx|xxxx xxxx (reserved)
69 * 1001|oopp|BBBB BBBB 8-bit Bitwise Operation??? 69 * 1001|oopp|BBBB BBBB 8-bit Bitwise Operation???
@@ -76,7 +76,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
76 * 101E|LLLL|1111 0010 Off/On 76 * 101E|LLLL|1111 0010 Off/On
77 * 101E|LLLL|1111 0011 Set/Clear 77 * 101E|LLLL|1111 0011 Set/Clear
78 * 101E|LLLL|1111 xxxx Reserved(0xF4-FF) 78 * 101E|LLLL|1111 xxxx Reserved(0xF4-FF)
79 * ELLLL: layer(0-31) 79 * ELLLL: layer 0-31(E: extra bit for layer 16-31)
80 * 80 *
81 * 81 *
82 * Extensions(11xx) 82 * Extensions(11xx)
@@ -108,8 +108,8 @@ enum action_kind_id {
108 ACT_MOUSEKEY = 0b0101, 108 ACT_MOUSEKEY = 0b0101,
109 /* Layer Actions */ 109 /* Layer Actions */
110 ACT_LAYER = 0b1000, 110 ACT_LAYER = 0b1000,
111 ACT_LAYER_TAP = 0b1010, 111 ACT_LAYER_TAP = 0b1010, /* Layer 0-15 */
112 ACT_LAYER_TAP1 = 0b1011, 112 ACT_LAYER_TAP_EXT = 0b1011, /* Layer 16-31 */
113 /* Extensions */ 113 /* Extensions */
114 ACT_MACRO = 0b1100, 114 ACT_MACRO = 0b1100,
115 ACT_BACKLIGHT = 0b1101, 115 ACT_BACKLIGHT = 0b1101,
diff --git a/common/action_tapping.c b/common/action_tapping.c
index 8b466079d..9b5512a8e 100644
--- a/common/action_tapping.c
+++ b/common/action_tapping.c
@@ -88,16 +88,16 @@ bool process_tapping(keyrecord_t *keyp)
88 // first tap! 88 // first tap!
89 debug("Tapping: First tap(0->1).\n"); 89 debug("Tapping: First tap(0->1).\n");
90 tapping_key.tap.count = 1; 90 tapping_key.tap.count = 1;
91 tapping_key.tap.interrupted = (waiting_buffer_has_anykey_pressed() ? true : false);
92 debug_tapping_key(); 91 debug_tapping_key();
93 process_action(&tapping_key); 92 process_action(&tapping_key);
94 93
95 // enqueue 94 // copy tapping state
96 keyp->tap = tapping_key.tap; 95 keyp->tap = tapping_key.tap;
96 // enqueue
97 return false; 97 return false;
98 } 98 }
99#if TAPPING_TERM >= 500 99#if TAPPING_TERM >= 500
100 /* This can prevent from typing some tap keys in a row at a time. */ 100 /* This can settle mod/fn state fast but may prevent from typing fast. */
101 else if (!event.pressed && waiting_buffer_typed(event)) { 101 else if (!event.pressed && waiting_buffer_typed(event)) {
102 // other key typed. not tap. 102 // other key typed. not tap.
103 debug("Tapping: End. No tap. Interfered by typing key\n"); 103 debug("Tapping: End. No tap. Interfered by typing key\n");
@@ -110,7 +110,11 @@ bool process_tapping(keyrecord_t *keyp)
110 } 110 }
111#endif 111#endif
112 else { 112 else {
113 // other key events shall be enq'd till tapping state settles. 113 // set interrupted flag when other key preesed during tapping
114 if (event.pressed) {
115 tapping_key.tap.interrupted = true;
116 }
117 // enqueue
114 return false; 118 return false;
115 } 119 }
116 } 120 }
@@ -124,7 +128,7 @@ bool process_tapping(keyrecord_t *keyp)
124 debug_tapping_key(); 128 debug_tapping_key();
125 return true; 129 return true;
126 } 130 }
127 else if (is_tap_key(keyp->event.key) && event.pressed) { 131 else if (is_tap_key(event.key) && event.pressed) {
128 if (tapping_key.tap.count > 1) { 132 if (tapping_key.tap.count > 1) {
129 debug("Tapping: Start new tap with releasing last tap(>1).\n"); 133 debug("Tapping: Start new tap with releasing last tap(>1).\n");
130 // unregister key 134 // unregister key
@@ -143,7 +147,7 @@ bool process_tapping(keyrecord_t *keyp)
143 return true; 147 return true;
144 } 148 }
145 else { 149 else {
146 if (!IS_NOEVENT(keyp->event)) { 150 if (!IS_NOEVENT(event)) {
147 debug("Tapping: key event while last tap(>0).\n"); 151 debug("Tapping: key event while last tap(>0).\n");
148 } 152 }
149 process_action(keyp); 153 process_action(keyp);
@@ -168,7 +172,7 @@ bool process_tapping(keyrecord_t *keyp)
168 tapping_key = (keyrecord_t){}; 172 tapping_key = (keyrecord_t){};
169 return true; 173 return true;
170 } 174 }
171 else if (is_tap_key(keyp->event.key) && event.pressed) { 175 else if (is_tap_key(event.key) && event.pressed) {
172 if (tapping_key.tap.count > 1) { 176 if (tapping_key.tap.count > 1) {
173 debug("Tapping: Start new tap with releasing last timeout tap(>1).\n"); 177 debug("Tapping: Start new tap with releasing last timeout tap(>1).\n");
174 // unregister key 178 // unregister key
@@ -187,7 +191,7 @@ bool process_tapping(keyrecord_t *keyp)
187 return true; 191 return true;
188 } 192 }
189 else { 193 else {
190 if (!IS_NOEVENT(keyp->event)) { 194 if (!IS_NOEVENT(event)) {
191 debug("Tapping: key event while last timeout tap(>0).\n"); 195 debug("Tapping: key event while last timeout tap(>0).\n");
192 } 196 }
193 process_action(keyp); 197 process_action(keyp);
@@ -197,28 +201,43 @@ bool process_tapping(keyrecord_t *keyp)
197 } 201 }
198 } else if (IS_TAPPING_RELEASED()) { 202 } else if (IS_TAPPING_RELEASED()) {
199 if (WITHIN_TAPPING_TERM(event)) { 203 if (WITHIN_TAPPING_TERM(event)) {
200 if (tapping_key.tap.count > 0 && IS_TAPPING_KEY(event.key) && event.pressed) { 204 if (event.pressed) {
201 // sequential tap. 205 if (IS_TAPPING_KEY(event.key)) {
202 keyp->tap = tapping_key.tap; 206 if (!tapping_key.tap.interrupted && tapping_key.tap.count > 0) {
203 keyp->tap.count += 1; 207 // sequential tap.
204 debug("Tapping: Tap press("); debug_dec(keyp->tap.count); debug(")\n"); 208 keyp->tap = tapping_key.tap;
205 process_action(keyp); 209 keyp->tap.count += 1;
206 tapping_key = *keyp; 210 debug("Tapping: Tap press("); debug_dec(keyp->tap.count); debug(")\n");
207 debug_tapping_key(); 211 process_action(keyp);
208 return true; 212 tapping_key = *keyp;
209 } else if (event.pressed && is_tap_key(event.key)) { 213 debug_tapping_key();
210 // Sequential tap can be interfered with other tap key. 214 return true;
211 debug("Tapping: Start with interfering other tap.\n"); 215 } else {
212 tapping_key = *keyp; 216 // FIX: start new tap again
213 waiting_buffer_scan_tap(); 217 tapping_key = *keyp;
214 debug_tapping_key(); 218 return true;
215 return true; 219 }
220 } else if (is_tap_key(event.key)) {
221 // Sequential tap can be interfered with other tap key.
222 debug("Tapping: Start with interfering other tap.\n");
223 tapping_key = *keyp;
224 waiting_buffer_scan_tap();
225 debug_tapping_key();
226 return true;
227 } else {
228 // should none in buffer
229 // FIX: interrupted when other key is pressed
230 tapping_key.tap.interrupted = true;
231 process_action(keyp);
232 return true;
233 }
216 } else { 234 } else {
217 if (!IS_NOEVENT(keyp->event)) debug("Tapping: other key just after tap.\n"); 235 if (!IS_NOEVENT(event)) debug("Tapping: other key just after tap.\n");
218 process_action(keyp); 236 process_action(keyp);
219 return true; 237 return true;
220 } 238 }
221 } else { 239 } else {
240 // FIX: process_aciton here?
222 // timeout. no sequential tap. 241 // timeout. no sequential tap.
223 debug("Tapping: End(Timeout after releasing last tap): "); 242 debug("Tapping: End(Timeout after releasing last tap): ");
224 debug_event(event); debug("\n"); 243 debug_event(event); debug("\n");
@@ -227,7 +246,7 @@ bool process_tapping(keyrecord_t *keyp)
227 return false; 246 return false;
228 } 247 }
229 } 248 }
230 // not tapping satate 249 // not tapping state
231 else { 250 else {
232 if (event.pressed && is_tap_key(event.key)) { 251 if (event.pressed && is_tap_key(event.key)) {
233 debug("Tapping: Start(Press tap key).\n"); 252 debug("Tapping: Start(Press tap key).\n");