浏览代码

Add tap toggle modifiers

Including documentation.
tags/v1.9
Simon Melhart 10 年前
父节点
当前提交
a6afa845b9
共有 3 个文件被更改,包括 20 次插入0 次删除
  1. 11
    0
      common/action.c
  2. 3
    0
      common/action_code.h
  3. 6
    0
      doc/keymap.md

+ 11
- 0
common/action.c 查看文件

} }
break; break;
#endif #endif
case MODS_TAP_TOGGLE:
if (event.pressed) {
if (tap_count <= TAPPING_TOGGLE) {
register_mods(mods);
}
} else {
if (tap_count < TAPPING_TOGGLE) {
unregister_mods(mods);
}
}
break;
default: default:
if (event.pressed) { if (event.pressed) {
if (tap_count > 0) { if (tap_count > 0) {

+ 3
- 0
common/action_code.h 查看文件

* *
* ACT_MODS_TAP(001r): * ACT_MODS_TAP(001r):
* 001r|mods|0000 0000 Modifiers with OneShot * 001r|mods|0000 0000 Modifiers with OneShot
* 001r|mods|0000 0001 Modifiers with tap toggle
* 001r|mods|0000 00xx (reserved) * 001r|mods|0000 00xx (reserved)
* 001r|mods| keycode Modifiers with Tap Key(Dual role) * 001r|mods| keycode Modifiers with Tap Key(Dual role)
* *
}; };
enum mods_codes { enum mods_codes {
MODS_ONESHOT = 0x00, MODS_ONESHOT = 0x00,
MODS_TAP_TOGGLE = 0x01,
}; };
#define ACTION_KEY(key) ACTION(ACT_MODS, (key)) #define ACTION_KEY(key) ACTION(ACT_MODS, (key))
#define ACTION_MODS(mods) ACTION(ACT_MODS, (mods&0x1f)<<8 | 0) #define ACTION_MODS(mods) ACTION(ACT_MODS, (mods&0x1f)<<8 | 0)
#define ACTION_MODS_KEY(mods, key) ACTION(ACT_MODS, (mods&0x1f)<<8 | (key)) #define ACTION_MODS_KEY(mods, key) ACTION(ACT_MODS, (mods&0x1f)<<8 | (key))
#define ACTION_MODS_TAP_KEY(mods, key) ACTION(ACT_MODS_TAP, (mods&0x1f)<<8 | (key)) #define ACTION_MODS_TAP_KEY(mods, key) ACTION(ACT_MODS_TAP, (mods&0x1f)<<8 | (key))
#define ACTION_MODS_ONESHOT(mods) ACTION(ACT_MODS_TAP, (mods&0x1f)<<8 | MODS_ONESHOT) #define ACTION_MODS_ONESHOT(mods) ACTION(ACT_MODS_TAP, (mods&0x1f)<<8 | MODS_ONESHOT)
#define ACTION_MODS_TAP_TOGGLE(mods) ACTION(ACT_MODS_TAP, (mods&0x1f)<<8 | MODS_TAP_TOGGLE)




/* /*

+ 6
- 0
doc/keymap.md 查看文件

Oneshot effect is cancel unless following key is pressed down within `ONESHOT_TIMEOUT` of `config.h`. No timeout when it is `0` or not defined. Oneshot effect is cancel unless following key is pressed down within `ONESHOT_TIMEOUT` of `config.h`. No timeout when it is `0` or not defined.




### 4.4 Tap Toggle Mods
Similar to layer tap toggle, this works as a momentary modifier when holding, but toggles on with several taps. A single tap will 'unstick' the modifier again.

ACTION_MODS_TAP_TOGGLE(MOD_LSFT)






## 5. Legacy Keymap ## 5. Legacy Keymap

正在加载...
取消
保存