diff options
| author | Drashna Jaelre <drashna@live.com> | 2018-12-14 07:36:38 -0800 |
|---|---|---|
| committer | MechMerlin <30334081+mechmerlin@users.noreply.github.com> | 2018-12-14 07:36:38 -0800 |
| commit | 641bbeb41af87feb01882e9f8a252312d2665a6a (patch) | |
| tree | a5752c711af51e206dcad604a39cadcdfa04b07f /docs/feature_tap_dance.md | |
| parent | 60f9abca1245640e12d65aa60f5953ff1719408f (diff) | |
| download | qmk_firmware-641bbeb41af87feb01882e9f8a252312d2665a6a.tar.gz qmk_firmware-641bbeb41af87feb01882e9f8a252312d2665a6a.zip | |
Remove userspace info from Quad-Function Tap Dance example (#4631)
Diffstat (limited to 'docs/feature_tap_dance.md')
| -rw-r--r-- | docs/feature_tap_dance.md | 36 |
1 files changed, 7 insertions, 29 deletions
diff --git a/docs/feature_tap_dance.md b/docs/feature_tap_dance.md index b2b567f1d..f2f274944 100644 --- a/docs/feature_tap_dance.md +++ b/docs/feature_tap_dance.md | |||
| @@ -185,29 +185,11 @@ Below is a specific example: | |||
| 185 | 185 | ||
| 186 | ## Setup | 186 | ## Setup |
| 187 | 187 | ||
| 188 | You will need a few things that can be used for 'Quad Function Tap-Dance'. The suggested setup is to create a user directory for yourself. This directory will contain rules.mk `<your_name>.c` and `<your_name>.h`. This directory should be called `<your_name>`, and located in the top level `users` directory. There should already be a few examples to look at there. | 188 | You will need a few things that can be used for 'Quad Function Tap-Dance'. |
| 189 | 189 | ||
| 190 | ### In `/qmk_firmware/users/<your_name>/rules.mk` | 190 | You'll need to add these to the top of your `keymap.c` file, before your keymap. |
| 191 | 191 | ||
| 192 | Put the following: | ||
| 193 | ```c | 192 | ```c |
| 194 | TAP_DANCE_ENABLE = yes | ||
| 195 | SRC += your_name.c | ||
| 196 | ``` | ||
| 197 | |||
| 198 | Pretty simple. It is a nice way to keep some rules common on all your keymaps. | ||
| 199 | |||
| 200 | |||
| 201 | ### In `/qmk_firmware/users/<your_name>/<your_name>.h` | ||
| 202 | |||
| 203 | You will need a few things in this file: | ||
| 204 | |||
| 205 | ```c | ||
| 206 | #pragma once | ||
| 207 | |||
| 208 | #include "quantum.h" | ||
| 209 | #include "process_keycode/process_tap_dance.h" | ||
| 210 | |||
| 211 | typedef struct { | 193 | typedef struct { |
| 212 | bool is_press_action; | 194 | bool is_press_action; |
| 213 | int state; | 195 | int state; |
| @@ -234,18 +216,12 @@ int cur_dance (qk_tap_dance_state_t *state); | |||
| 234 | //for the x tap dance. Put it here so it can be used in any keymap | 216 | //for the x tap dance. Put it here so it can be used in any keymap |
| 235 | void x_finished (qk_tap_dance_state_t *state, void *user_data); | 217 | void x_finished (qk_tap_dance_state_t *state, void *user_data); |
| 236 | void x_reset (qk_tap_dance_state_t *state, void *user_data); | 218 | void x_reset (qk_tap_dance_state_t *state, void *user_data); |
| 237 | ``` | ||
| 238 | 219 | ||
| 239 | ### In `/qmk_firmware/users/<your_name>/<your_name>.c` | 220 | ``` |
| 240 | 221 | ||
| 241 | And then in your user's `.c` file you implement the functions above: | 222 | Now, at the bottom of your `keymap.c` file, you'll need to add the following: |
| 242 | 223 | ||
| 243 | ```c | 224 | ```c |
| 244 | #include "<your_name>.h" | ||
| 245 | #include "quantum.h" | ||
| 246 | #include "action.h" | ||
| 247 | #include "process_keycode/process_tap_dance.h" | ||
| 248 | |||
| 249 | /* Return an integer that corresponds to what kind of tap dance should be executed. | 225 | /* Return an integer that corresponds to what kind of tap dance should be executed. |
| 250 | * | 226 | * |
| 251 | * How to figure out tap dance state: interrupted and pressed. | 227 | * How to figure out tap dance state: interrupted and pressed. |
| @@ -335,4 +311,6 @@ qk_tap_dance_action_t tap_dance_actions[] = { | |||
| 335 | }; | 311 | }; |
| 336 | ``` | 312 | ``` |
| 337 | 313 | ||
| 338 | And then simply use `TD(X_CTL)` anywhere in your keymap after including `<your_name>.h`. | 314 | And then simply use `TD(X_CTL)` anywhere in your keymap. |
| 315 | |||
| 316 | If you want to implement this in your userspace, then you may want to check out how [DanielGGordon](https://github.com/qmk/qmk_firmware/tree/master/users/gordon) has implemented this in their userspace. | ||
