diff options
| -rw-r--r-- | docs/config_options.md | 2 | ||||
| -rw-r--r-- | docs/feature_macros.md | 2 | ||||
| -rw-r--r-- | quantum/quantum.c | 8 | ||||
| -rw-r--r-- | quantum/quantum.h | 2 | ||||
| -rw-r--r-- | tmk_core/common/action.c | 12 | ||||
| -rw-r--r-- | tmk_core/common/action.h | 2 |
6 files changed, 26 insertions, 2 deletions
diff --git a/docs/config_options.md b/docs/config_options.md index b811fa877..69fecc8b4 100644 --- a/docs/config_options.md +++ b/docs/config_options.md | |||
| @@ -160,6 +160,8 @@ If you define these options you will enable the associated feature, which may in | |||
| 160 | * Set this to the number of combos that you're using in the [Combo](feature_combo.md) feature. | 160 | * Set this to the number of combos that you're using in the [Combo](feature_combo.md) feature. |
| 161 | * `#define COMBO_TERM 200` | 161 | * `#define COMBO_TERM 200` |
| 162 | * how long for the Combo keys to be detected. Defaults to `TAPPING_TERM` if not defined. | 162 | * how long for the Combo keys to be detected. Defaults to `TAPPING_TERM` if not defined. |
| 163 | * `#define TAP_CODE_DELAY 100` | ||
| 164 | * Sets the delay between `register_code` and `unregister_code`, if you're having issues with it registering properly (common on VUSB boards). The value is in milliseconds. | ||
| 163 | 165 | ||
| 164 | ## RGB Light Configuration | 166 | ## RGB Light Configuration |
| 165 | 167 | ||
diff --git a/docs/feature_macros.md b/docs/feature_macros.md index 29ba29fef..aa13fb97f 100644 --- a/docs/feature_macros.md +++ b/docs/feature_macros.md | |||
| @@ -250,6 +250,8 @@ Parallel to `register_code` function, this sends the `<kc>` keyup event to the c | |||
| 250 | 250 | ||
| 251 | This will send `register_code(<kc>)` and then `unregister_code(<kc>)`. This is useful if you want to send both the press and release events ("tap" the key, rather than hold it). | 251 | This will send `register_code(<kc>)` and then `unregister_code(<kc>)`. This is useful if you want to send both the press and release events ("tap" the key, rather than hold it). |
| 252 | 252 | ||
| 253 | If you're having issues with taps (un)registering, you can add a delay between the register and unregister events by setting `#define TAP_CODE_DELAY 100` in your `config.h` file. The value is in milliseconds. | ||
| 254 | |||
| 253 | ### `clear_keyboard();` | 255 | ### `clear_keyboard();` |
| 254 | 256 | ||
| 255 | This will clear all mods and keys currently pressed. | 257 | This will clear all mods and keys currently pressed. |
diff --git a/quantum/quantum.c b/quantum/quantum.c index 69692233e..a57d4f89f 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c | |||
| @@ -132,6 +132,14 @@ void unregister_code16 (uint16_t code) { | |||
| 132 | } | 132 | } |
| 133 | } | 133 | } |
| 134 | 134 | ||
| 135 | void tap_code16(uint16_t code) { | ||
| 136 | register_code16(code); | ||
| 137 | #if TAP_CODE_DELAY > 0 | ||
| 138 | wait_ms(TAP_CODE_DELAY); | ||
| 139 | #endif | ||
| 140 | unregister_code16(code); | ||
| 141 | } | ||
| 142 | |||
| 135 | __attribute__ ((weak)) | 143 | __attribute__ ((weak)) |
| 136 | bool process_action_kb(keyrecord_t *record) { | 144 | bool process_action_kb(keyrecord_t *record) { |
| 137 | return true; | 145 | return true; |
diff --git a/quantum/quantum.h b/quantum/quantum.h index 5920e4b13..0faf1af29 100644 --- a/quantum/quantum.h +++ b/quantum/quantum.h | |||
| @@ -243,7 +243,7 @@ void shutdown_user(void); | |||
| 243 | 243 | ||
| 244 | void register_code16(uint16_t code); | 244 | void register_code16(uint16_t code); |
| 245 | void unregister_code16(uint16_t code); | 245 | void unregister_code16(uint16_t code); |
| 246 | inline void tap_code16(uint16_t code) { register_code16(code); unregister_code16(code); } | 246 | void tap_code16(uint16_t code); |
| 247 | 247 | ||
| 248 | #ifdef BACKLIGHT_ENABLE | 248 | #ifdef BACKLIGHT_ENABLE |
| 249 | void backlight_init_ports(void); | 249 | void backlight_init_ports(void); |
diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c index 8bdcd54e3..456d1e25f 100644 --- a/tmk_core/common/action.c +++ b/tmk_core/common/action.c | |||
| @@ -851,6 +851,18 @@ void unregister_code(uint8_t code) | |||
| 851 | * | 851 | * |
| 852 | * FIXME: Needs documentation. | 852 | * FIXME: Needs documentation. |
| 853 | */ | 853 | */ |
| 854 | void tap_code(uint8_t code) { | ||
| 855 | register_code(code); | ||
| 856 | #if TAP_CODE_DELAY > 0 | ||
| 857 | wait_ms(TAP_CODE_DELAY); | ||
| 858 | #endif | ||
| 859 | unregister_code(code); | ||
| 860 | } | ||
| 861 | |||
| 862 | /** \brief Utilities for actions. (FIXME: Needs better description) | ||
| 863 | * | ||
| 864 | * FIXME: Needs documentation. | ||
| 865 | */ | ||
| 854 | void register_mods(uint8_t mods) | 866 | void register_mods(uint8_t mods) |
| 855 | { | 867 | { |
| 856 | if (mods) { | 868 | if (mods) { |
diff --git a/tmk_core/common/action.h b/tmk_core/common/action.h index 833febe9c..5d797fd62 100644 --- a/tmk_core/common/action.h +++ b/tmk_core/common/action.h | |||
| @@ -88,7 +88,7 @@ void process_record(keyrecord_t *record); | |||
| 88 | void process_action(keyrecord_t *record, action_t action); | 88 | void process_action(keyrecord_t *record, action_t action); |
| 89 | void register_code(uint8_t code); | 89 | void register_code(uint8_t code); |
| 90 | void unregister_code(uint8_t code); | 90 | void unregister_code(uint8_t code); |
| 91 | inline void tap_code(uint8_t code) { register_code(code); unregister_code(code); } | 91 | void tap_code(uint8_t code); |
| 92 | void register_mods(uint8_t mods); | 92 | void register_mods(uint8_t mods); |
| 93 | void unregister_mods(uint8_t mods); | 93 | void unregister_mods(uint8_t mods); |
| 94 | //void set_mods(uint8_t mods); | 94 | //void set_mods(uint8_t mods); |
