diff options
Diffstat (limited to 'qmk/keyboards/sofle_choc/keymaps/custom/layer_dance.h')
| -rw-r--r-- | qmk/keyboards/sofle_choc/keymaps/custom/layer_dance.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/qmk/keyboards/sofle_choc/keymaps/custom/layer_dance.h b/qmk/keyboards/sofle_choc/keymaps/custom/layer_dance.h new file mode 100644 index 0000000..7d44c3f --- /dev/null +++ b/qmk/keyboards/sofle_choc/keymaps/custom/layer_dance.h @@ -0,0 +1,24 @@ +#pragma once +#include QMK_KEYBOARD_H +#include "quad_tapdance.h" + +/** + * State of the tapdance, hold both the tapdance state, and the layer we need + * to activate when the key is activated. + */ +typedef struct { + td_state_t state; + const uint8_t layer; +} tap_dance_layer_t; + +void tap_dance_layer_finished(tap_dance_state_t *state, void *user_data); +void tap_dance_layer_reset(tap_dance_state_t *state, void *user_data); + +/** + * Helper for creating the tap_dance key. + */ +#define ACTION_TAP_DANCE_LAYER(layer) \ + { \ + .fn = {NULL, tap_dance_layer_finished, tap_dance_layer_reset}, \ + .user_data = (void *)&((tap_dance_layer_t){TD_NONE, layer}), \ + } |
