diff options
| author | Emmanuel Odongo <aizenkrosis@hotmail.com> | 2018-08-01 02:50:02 +0200 |
|---|---|---|
| committer | Drashna Jaelre <drashna@live.com> | 2018-07-31 17:50:02 -0700 |
| commit | bb86d8a00c117759cd5b71b20d5974d41ffb455c (patch) | |
| tree | d631620d60b9c71c683cbb4ce59b13a2921f695d /docs/feature_tap_dance.md | |
| parent | cbf200e9dd39138f053368835e9af2069f7c1902 (diff) | |
| download | qmk_firmware-bb86d8a00c117759cd5b71b20d5974d41ffb455c.tar.gz qmk_firmware-bb86d8a00c117759cd5b71b20d5974d41ffb455c.zip | |
Docs: Fix some minor errors in tap dance example (#3530)
* Fix some minor errors in tap dance example
Fix for #3529
Fix minor errors in the code examples for __Example 4: 'Quad Function Tap-Dance'__ and relevant documentation.
Clarified the need to include the header file in `keymap.c`.
* Use #pragma once in header guard
Fix for #3529
Implement change requested in #3530
Diffstat (limited to 'docs/feature_tap_dance.md')
| -rw-r--r-- | docs/feature_tap_dance.md | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/docs/feature_tap_dance.md b/docs/feature_tap_dance.md index 99298fbda..93d190883 100644 --- a/docs/feature_tap_dance.md +++ b/docs/feature_tap_dance.md | |||
| @@ -196,22 +196,20 @@ SRC += your_name.c | |||
| 196 | Pretty simple. It is a nice way to keep some rules common on all your keymaps. | 196 | Pretty simple. It is a nice way to keep some rules common on all your keymaps. |
| 197 | 197 | ||
| 198 | 198 | ||
| 199 | ### In `/qmk_firmware/users/<your_name>/<you_name>.h` | 199 | ### In `/qmk_firmware/users/<your_name>/<your_name>.h` |
| 200 | 200 | ||
| 201 | You will need a few things in this file: | 201 | You will need a few things in this file: |
| 202 | 202 | ||
| 203 | ```c | 203 | ```c |
| 204 | #ifndef YOUR_NAME | 204 | #pragma once |
| 205 | #define YOUR_NAME | ||
| 206 | 205 | ||
| 207 | #include "quantum.h" | 206 | #include "quantum.h" |
| 208 | #include "process_keycode/process_tap_dance.h" | 207 | #include "process_keycode/process_tap_dance.h" |
| 209 | 208 | ||
| 210 | |||
| 211 | typedef struct { | 209 | typedef struct { |
| 212 | bool is_press_action; | 210 | bool is_press_action; |
| 213 | int state; | 211 | int state; |
| 214 | } xtap; | 212 | } tap; |
| 215 | 213 | ||
| 216 | enum { | 214 | enum { |
| 217 | SINGLE_TAP = 1, | 215 | SINGLE_TAP = 1, |
| @@ -225,9 +223,9 @@ enum { | |||
| 225 | 223 | ||
| 226 | //Tap dance enums | 224 | //Tap dance enums |
| 227 | enum { | 225 | enum { |
| 228 | CTL_X = 0, | 226 | X_CTL = 0, |
| 229 | SOME_OTHER_DANCE | 227 | SOME_OTHER_DANCE |
| 230 | } | 228 | }; |
| 231 | 229 | ||
| 232 | int cur_dance (qk_tap_dance_state_t *state); | 230 | int cur_dance (qk_tap_dance_state_t *state); |
| 233 | 231 | ||
| @@ -241,7 +239,7 @@ void x_reset (qk_tap_dance_state_t *state, void *user_data); | |||
| 241 | And then in your user's `.c` file you implement the functions above: | 239 | And then in your user's `.c` file you implement the functions above: |
| 242 | 240 | ||
| 243 | ```c | 241 | ```c |
| 244 | #include "gordon.h" | 242 | #include "<your_name>.h" |
| 245 | #include "quantum.h" | 243 | #include "quantum.h" |
| 246 | #include "action.h" | 244 | #include "action.h" |
| 247 | #include "process_keycode/process_tap_dance.h" | 245 | #include "process_keycode/process_tap_dance.h" |
| @@ -335,4 +333,4 @@ qk_tap_dance_action_t tap_dance_actions[] = { | |||
| 335 | }; | 333 | }; |
| 336 | ``` | 334 | ``` |
| 337 | 335 | ||
| 338 | And then simply use TD(X_CTL) anywhere in your keymap. | 336 | And then simply use `TD(X_CTL)` anywhere in your keymap after including `<your_name>.h`. |
