aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--readme.md27
1 files changed, 26 insertions, 1 deletions
diff --git a/readme.md b/readme.md
index affee1b62..3854f4b8d 100644
--- a/readme.md
+++ b/readme.md
@@ -409,7 +409,32 @@ Our next stop is `matrix_scan_tap_dance()`. This handles the timeout of tap-danc
409 409
410For the sake of flexibility, tap-dance actions can be either a pair of keycodes, or a user function. The latter allows one to handle higher tap counts, or do extra things, like blink the LEDs, fiddle with the backlighting, and so on. This is accomplished by using an union, and some clever macros. 410For the sake of flexibility, tap-dance actions can be either a pair of keycodes, or a user function. The latter allows one to handle higher tap counts, or do extra things, like blink the LEDs, fiddle with the backlighting, and so on. This is accomplished by using an union, and some clever macros.
411 411
412In the end, let's see a full example! 412#### Examples
413
414Here's a simple example for a single definition:
415
4161. In your `makefile`, add `TAP_DANCE_ENABLE = yes`
4172. In your `config.h` (which you can copy from `qmk_firmware/keyboards/planck/config.h` to your keymap directory), add `#define TAPPING_TERM 200`
4183. In your `keymap.c` file, define the variables and definitions, then add to your keymap:
419
420```c
421//Tap Dance Declarations
422enum {
423 TD_ESC_CAPS = 0
424};
425
426//Tap Dance Definitions
427const qk_tap_dance_action_t tap_dance_actions[] = {
428 //Tap once for Esc, twice for Caps Lock
429 [TD_ESC_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_ESC, KC_CAPS)
430// Other declarations would go here, separated by commas, if you have them
431};
432
433//In Layer declaration, add tap dance item in place of a key code
434TD(TD_ESC_CAPS)
435```
436
437Here's a more complex example involving custom actions:
413 438
414```c 439```c
415enum { 440enum {