aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authortmk <nobody@nowhere>2013-11-28 16:31:06 +0900
committertmk <nobody@nowhere>2013-11-28 16:31:06 +0900
commitfd9ee507a557e17b5af9fcd8892868ddf07bbb7a (patch)
tree05f1f89e90a23d3dff01052a1875be2cf3133135 /common
parentf3132adb33fd38e8d9d49845809ad5cb89f9c9c1 (diff)
parenta6afa845b98d4fa7097c840fedbace59fef8f738 (diff)
downloadqmk_firmware-fd9ee507a557e17b5af9fcd8892868ddf07bbb7a.tar.gz
qmk_firmware-fd9ee507a557e17b5af9fcd8892868ddf07bbb7a.zip
Merge branch 'modstaptoggle' of git://github.com/simonmelhart/tmk_keyboard into simonmelhart-modstaptoggle
Conflicts: common/action_code.h
Diffstat (limited to 'common')
-rw-r--r--common/action.c11
-rw-r--r--common/action_code.h3
2 files changed, 14 insertions, 0 deletions
diff --git a/common/action.c b/common/action.c
index 485abf81e..e6938f5a2 100644
--- a/common/action.c
+++ b/common/action.c
@@ -128,6 +128,17 @@ void process_action(keyrecord_t *record)
128 } 128 }
129 break; 129 break;
130 #endif 130 #endif
131 case MODS_TAP_TOGGLE:
132 if (event.pressed) {
133 if (tap_count <= TAPPING_TOGGLE) {
134 register_mods(mods);
135 }
136 } else {
137 if (tap_count < TAPPING_TOGGLE) {
138 unregister_mods(mods);
139 }
140 }
141 break;
131 default: 142 default:
132 if (event.pressed) { 143 if (event.pressed) {
133 if (tap_count > 0) { 144 if (tap_count > 0) {
diff --git a/common/action_code.h b/common/action_code.h
index b08d36124..8df86b119 100644
--- a/common/action_code.h
+++ b/common/action_code.h
@@ -34,6 +34,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
34 * 34 *
35 * ACT_MODS_TAP(001r): 35 * ACT_MODS_TAP(001r):
36 * 001r|mods|0000 0000 Modifiers with OneShot 36 * 001r|mods|0000 0000 Modifiers with OneShot
37 * 001r|mods|0000 0001 Modifiers with tap toggle
37 * 001r|mods|0000 00xx (reserved) 38 * 001r|mods|0000 00xx (reserved)
38 * 001r|mods| keycode Modifiers with Tap Key(Dual role) 39 * 001r|mods| keycode Modifiers with Tap Key(Dual role)
39 * 40 *
@@ -205,12 +206,14 @@ enum mods_bit {
205}; 206};
206enum mods_codes { 207enum mods_codes {
207 MODS_ONESHOT = 0x00, 208 MODS_ONESHOT = 0x00,
209 MODS_TAP_TOGGLE = 0x01,
208}; 210};
209#define ACTION_KEY(key) ACTION(ACT_MODS, (key)) 211#define ACTION_KEY(key) ACTION(ACT_MODS, (key))
210#define ACTION_MODS(mods) ACTION(ACT_MODS, ((mods)&0x1f)<<8 | 0) 212#define ACTION_MODS(mods) ACTION(ACT_MODS, ((mods)&0x1f)<<8 | 0)
211#define ACTION_MODS_KEY(mods, key) ACTION(ACT_MODS, ((mods)&0x1f)<<8 | (key)) 213#define ACTION_MODS_KEY(mods, key) ACTION(ACT_MODS, ((mods)&0x1f)<<8 | (key))
212#define ACTION_MODS_TAP_KEY(mods, key) ACTION(ACT_MODS_TAP, ((mods)&0x1f)<<8 | (key)) 214#define ACTION_MODS_TAP_KEY(mods, key) ACTION(ACT_MODS_TAP, ((mods)&0x1f)<<8 | (key))
213#define ACTION_MODS_ONESHOT(mods) ACTION(ACT_MODS_TAP, ((mods)&0x1f)<<8 | MODS_ONESHOT) 215#define ACTION_MODS_ONESHOT(mods) ACTION(ACT_MODS_TAP, ((mods)&0x1f)<<8 | MODS_ONESHOT)
216#define ACTION_MODS_TAP_TOGGLE(mods) ACTION(ACT_MODS_TAP, ((mods)&0x1f)<<8 | MODS_TAP_TOGGLE)
214 217
215 218
216/* 219/*