Skip to content

Commit

Permalink
Start adding notes for future examples/docs based on examples emailed…
Browse files Browse the repository at this point in the history
… to end-users
  • Loading branch information
obra committed May 6, 2024
1 parent fd7f5f9 commit ae0f2bd
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions docs/tapdance-example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
This is an example that exercises, I think, all of the different core behaviors of Kaleidoscope's TapDance keys:

```
void tapDanceAction(uint8_t tap_dance_index,
KeyAddr key_addr,
uint8_t tap_count,
kaleidoscope::plugin::TapDance::ActionType tap_dance_action) {
switch (tap_dance_index) {
case 0:
// kaleidoscope::plugin::TapDance::Timeout, if the tap-dance key has been released when its timeout expires.
if (tap_dance_action == kaleidoscope::plugin::TapDance::ActionType::Timeout) {
tapDanceActionKeys(tap_count, tap_dance_action, Key_Q, Key_W, Key_E);
}
// kaleidoscope::plugin::TapDance::Hold, if the tap-dance key is still being held when its timeout expires.
else if ( tap_dance_action == kaleidoscope::plugin::TapDance::ActionType::Hold) {
tapDanceActionKeys(tap_count, tap_dance_action, Key_A, Key_S, Key_D);
}
// kaleidoscope::plugin::TapDance::Interrupt, if another key is pressed before the tap-dance key’s timeout expires.
else if (tap_dance_action == kaleidoscope::plugin::TapDance::ActionType::Interrupt) {
tapDanceActionKeys(tap_count, tap_dance_action, Key_Z, Key_X, Key_C);
}
}
}
```

TapDance here counts taps + what's going on when it's done counting:
Was the tapdance key released before the timer expired, Was it still being held down when the timer expired, was another key hit before you released the tapdance key. So three quick taps will get you an 'E', A hold will get you an "A", A tap and hold will get you an "S", two taps and a hold will get you a "D"
Hold until some other key is hit will get you a Z, etc.
The other things you'd need to do are "#include "Kaleidoscope-TapDance.h"" at the top of your sketch, add "TapDance" to the list of "KALEIDOSCOPE_INIT_PLUGINS", and stick a "TD(0)" somewhere in your keymap.

0 comments on commit ae0f2bd

Please sign in to comment.