]> git.donarmstrong.com Git - tmk_firmware.git/commitdiff
Merge branch 'modstaptoggle' of git://github.com/simonmelhart/tmk_keyboard into simon...
authortmk <nobody@nowhere>
Thu, 28 Nov 2013 07:31:06 +0000 (16:31 +0900)
committertmk <nobody@nowhere>
Thu, 28 Nov 2013 07:31:06 +0000 (16:31 +0900)
Conflicts:
common/action_code.h

common/action.c
common/action_code.h
doc/keymap.md

index 485abf81e305396a6cd428d60cef644634f75abb..e6938f5a237ad6eec433c08a845b907f8176b8df 100644 (file)
@@ -128,6 +128,17 @@ void process_action(keyrecord_t *record)
                         }
                         break;
     #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:
                         if (event.pressed) {
                             if (tap_count > 0) {
index b08d36124e5b06d4b881bb43bd7fbd97910e808b..8df86b11929e5afa8de07edb839c39d69defa6f3 100644 (file)
@@ -34,6 +34,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  * ACT_MODS_TAP(001r):
  * 001r|mods|0000 0000    Modifiers with OneShot
+ * 001r|mods|0000 0001    Modifiers with tap toggle
  * 001r|mods|0000 00xx    (reserved)
  * 001r|mods| keycode     Modifiers with Tap Key(Dual role)
  *
@@ -205,12 +206,14 @@ enum mods_bit {
 };
 enum mods_codes {
     MODS_ONESHOT = 0x00,
+    MODS_TAP_TOGGLE = 0x01,
 };
 #define ACTION_KEY(key)                 ACTION(ACT_MODS, (key))
 #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_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_TAP_TOGGLE(mods)    ACTION(ACT_MODS_TAP, ((mods)&0x1f)<<8 | MODS_TAP_TOGGLE)
 
 
 /*
index 11e80a9c319b8935520a61f9ac14ac3ca729f587..3a549de62e199757859557c96edc039e469441c0 100644 (file)
@@ -526,6 +526,12 @@ Say you want to type 'The', you have to push and hold Shift key before type 't'
 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