ソースを参照

Merge branch 'bob_fix'

led_matrix
tmk 11年前
コミット
25aec56c08
3個のファイルの変更53行の追加34行の削除
  1. 3
    3
      common/action.c
  2. 5
    5
      common/action_code.h
  3. 45
    26
      common/action_tapping.c

+ 3
- 3
common/action.c ファイルの表示

break; break;
#ifndef NO_ACTION_TAPPING #ifndef NO_ACTION_TAPPING
case ACT_LAYER_TAP: case ACT_LAYER_TAP:
case ACT_LAYER_TAP1:
case ACT_LAYER_TAP_EXT:
switch (action.layer_tap.code) { switch (action.layer_tap.code) {
case OP_TAP_TOGGLE: case OP_TAP_TOGGLE:
/* tap toggle */ /* tap toggle */
case ACT_LMODS_TAP: case ACT_LMODS_TAP:
case ACT_RMODS_TAP: case ACT_RMODS_TAP:
case ACT_LAYER_TAP: case ACT_LAYER_TAP:
case ACT_LAYER_TAP1:
case ACT_LAYER_TAP_EXT:
return true; return true;
case ACT_MACRO: case ACT_MACRO:
case ACT_FUNCTION: case ACT_FUNCTION:
case ACT_MOUSEKEY: dprint("ACT_MOUSEKEY"); break; case ACT_MOUSEKEY: dprint("ACT_MOUSEKEY"); break;
case ACT_LAYER: dprint("ACT_LAYER"); break; case ACT_LAYER: dprint("ACT_LAYER"); break;
case ACT_LAYER_TAP: dprint("ACT_LAYER_TAP"); break; case ACT_LAYER_TAP: dprint("ACT_LAYER_TAP"); break;
case ACT_LAYER_TAP1: dprint("ACT_LAYER_TAP1"); break;
case ACT_LAYER_TAP_EXT: dprint("ACT_LAYER_TAP_EXT"); break;
case ACT_MACRO: dprint("ACT_MACRO"); break; case ACT_MACRO: dprint("ACT_MACRO"); break;
case ACT_COMMAND: dprint("ACT_COMMAND"); break; case ACT_COMMAND: dprint("ACT_COMMAND"); break;
case ACT_FUNCTION: dprint("ACT_FUNCTION"); break; case ACT_FUNCTION: dprint("ACT_FUNCTION"); break;

+ 5
- 5
common/action_code.h ファイルの表示

* 1000|ooee|pppE BBBB Layer Bitwise Operation * 1000|ooee|pppE BBBB Layer Bitwise Operation
* oo: operation(00:AND, 01:OR, 10:XOR, 11:SET) * oo: operation(00:AND, 01:OR, 10:XOR, 11:SET)
* ppp: 4-bit chunk part(0-7) * ppp: 4-bit chunk part(0-7)
* eBBBB: bits and extra bit
* ee: on event(00:default layer, 01:press, 10:release, 11:both)
* EBBBB: bits and extra bit
* ee: on event(01:press, 10:release, 11:both)
* *
* 1001|xxxx|xxxx xxxx (reserved) * 1001|xxxx|xxxx xxxx (reserved)
* 1001|oopp|BBBB BBBB 8-bit Bitwise Operation??? * 1001|oopp|BBBB BBBB 8-bit Bitwise Operation???
* 101E|LLLL|1111 0010 Off/On * 101E|LLLL|1111 0010 Off/On
* 101E|LLLL|1111 0011 Set/Clear * 101E|LLLL|1111 0011 Set/Clear
* 101E|LLLL|1111 xxxx Reserved(0xF4-FF) * 101E|LLLL|1111 xxxx Reserved(0xF4-FF)
* ELLLL: layer(0-31)
* ELLLL: layer 0-31(E: extra bit for layer 16-31)
* *
* *
* Extensions(11xx) * Extensions(11xx)
ACT_MOUSEKEY = 0b0101, ACT_MOUSEKEY = 0b0101,
/* Layer Actions */ /* Layer Actions */
ACT_LAYER = 0b1000, ACT_LAYER = 0b1000,
ACT_LAYER_TAP = 0b1010,
ACT_LAYER_TAP1 = 0b1011,
ACT_LAYER_TAP = 0b1010, /* Layer 0-15 */
ACT_LAYER_TAP_EXT = 0b1011, /* Layer 16-31 */
/* Extensions */ /* Extensions */
ACT_MACRO = 0b1100, ACT_MACRO = 0b1100,
ACT_BACKLIGHT = 0b1101, ACT_BACKLIGHT = 0b1101,

+ 45
- 26
common/action_tapping.c ファイルの表示

// first tap! // first tap!
debug("Tapping: First tap(0->1).\n"); debug("Tapping: First tap(0->1).\n");
tapping_key.tap.count = 1; tapping_key.tap.count = 1;
tapping_key.tap.interrupted = (waiting_buffer_has_anykey_pressed() ? true : false);
debug_tapping_key(); debug_tapping_key();
process_action(&tapping_key); process_action(&tapping_key);


// enqueue
// copy tapping state
keyp->tap = tapping_key.tap; keyp->tap = tapping_key.tap;
// enqueue
return false; return false;
} }
#if TAPPING_TERM >= 500 #if TAPPING_TERM >= 500
/* This can prevent from typing some tap keys in a row at a time. */
/* This can settle mod/fn state fast but may prevent from typing fast. */
else if (!event.pressed && waiting_buffer_typed(event)) { else if (!event.pressed && waiting_buffer_typed(event)) {
// other key typed. not tap. // other key typed. not tap.
debug("Tapping: End. No tap. Interfered by typing key\n"); debug("Tapping: End. No tap. Interfered by typing key\n");
} }
#endif #endif
else { else {
// other key events shall be enq'd till tapping state settles.
// set interrupted flag when other key preesed during tapping
if (event.pressed) {
tapping_key.tap.interrupted = true;
}
// enqueue
return false; return false;
} }
} }
debug_tapping_key(); debug_tapping_key();
return true; return true;
} }
else if (is_tap_key(keyp->event.key) && event.pressed) {
else if (is_tap_key(event.key) && event.pressed) {
if (tapping_key.tap.count > 1) { if (tapping_key.tap.count > 1) {
debug("Tapping: Start new tap with releasing last tap(>1).\n"); debug("Tapping: Start new tap with releasing last tap(>1).\n");
// unregister key // unregister key
return true; return true;
} }
else { else {
if (!IS_NOEVENT(keyp->event)) {
if (!IS_NOEVENT(event)) {
debug("Tapping: key event while last tap(>0).\n"); debug("Tapping: key event while last tap(>0).\n");
} }
process_action(keyp); process_action(keyp);
tapping_key = (keyrecord_t){}; tapping_key = (keyrecord_t){};
return true; return true;
} }
else if (is_tap_key(keyp->event.key) && event.pressed) {
else if (is_tap_key(event.key) && event.pressed) {
if (tapping_key.tap.count > 1) { if (tapping_key.tap.count > 1) {
debug("Tapping: Start new tap with releasing last timeout tap(>1).\n"); debug("Tapping: Start new tap with releasing last timeout tap(>1).\n");
// unregister key // unregister key
return true; return true;
} }
else { else {
if (!IS_NOEVENT(keyp->event)) {
if (!IS_NOEVENT(event)) {
debug("Tapping: key event while last timeout tap(>0).\n"); debug("Tapping: key event while last timeout tap(>0).\n");
} }
process_action(keyp); process_action(keyp);
} }
} else if (IS_TAPPING_RELEASED()) { } else if (IS_TAPPING_RELEASED()) {
if (WITHIN_TAPPING_TERM(event)) { if (WITHIN_TAPPING_TERM(event)) {
if (tapping_key.tap.count > 0 && IS_TAPPING_KEY(event.key) && event.pressed) {
// sequential tap.
keyp->tap = tapping_key.tap;
keyp->tap.count += 1;
debug("Tapping: Tap press("); debug_dec(keyp->tap.count); debug(")\n");
process_action(keyp);
tapping_key = *keyp;
debug_tapping_key();
return true;
} else if (event.pressed && is_tap_key(event.key)) {
// Sequential tap can be interfered with other tap key.
debug("Tapping: Start with interfering other tap.\n");
tapping_key = *keyp;
waiting_buffer_scan_tap();
debug_tapping_key();
return true;
if (event.pressed) {
if (IS_TAPPING_KEY(event.key)) {
if (!tapping_key.tap.interrupted && tapping_key.tap.count > 0) {
// sequential tap.
keyp->tap = tapping_key.tap;
keyp->tap.count += 1;
debug("Tapping: Tap press("); debug_dec(keyp->tap.count); debug(")\n");
process_action(keyp);
tapping_key = *keyp;
debug_tapping_key();
return true;
} else {
// FIX: start new tap again
tapping_key = *keyp;
return true;
}
} else if (is_tap_key(event.key)) {
// Sequential tap can be interfered with other tap key.
debug("Tapping: Start with interfering other tap.\n");
tapping_key = *keyp;
waiting_buffer_scan_tap();
debug_tapping_key();
return true;
} else {
// should none in buffer
// FIX: interrupted when other key is pressed
tapping_key.tap.interrupted = true;
process_action(keyp);
return true;
}
} else { } else {
if (!IS_NOEVENT(keyp->event)) debug("Tapping: other key just after tap.\n");
if (!IS_NOEVENT(event)) debug("Tapping: other key just after tap.\n");
process_action(keyp); process_action(keyp);
return true; return true;
} }
} else { } else {
// FIX: process_aciton here?
// timeout. no sequential tap. // timeout. no sequential tap.
debug("Tapping: End(Timeout after releasing last tap): "); debug("Tapping: End(Timeout after releasing last tap): ");
debug_event(event); debug("\n"); debug_event(event); debug("\n");
return false; return false;
} }
} }
// not tapping satate
// not tapping state
else { else {
if (event.pressed && is_tap_key(event.key)) { if (event.pressed && is_tap_key(event.key)) {
debug("Tapping: Start(Press tap key).\n"); debug("Tapping: Start(Press tap key).\n");