You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.2 KiB

  1. #include "sethBarberee.h"
  2. #ifdef RGBLIGHT_ENABLE
  3. #ifdef TAP_DANCE_ENABLE
  4. // Initialize it now
  5. tap caps_status = {
  6. .toggled = false,
  7. .toggle_mode = CAPS_LOCK_MODE,
  8. .normal_mode = NORMAL_MODE
  9. };
  10. void dance_ecap_finished (qk_tap_dance_state_t *state, void *user_data){
  11. if(state->count == 1){
  12. register_code(KC_ESC);
  13. } else {
  14. register_code(KC_CAPS);
  15. if(!caps_status.toggled){
  16. // Toggling caps so indicate
  17. caps_status.toggled = true;
  18. rgblight_mode_noeeprom(caps_status.toggle_mode);
  19. } else {
  20. // Turning off so return to normal mode
  21. caps_status.toggled = false;
  22. rgblight_mode_noeeprom(caps_status.normal_mode);
  23. }
  24. }
  25. }
  26. void dance_ecap_reset (qk_tap_dance_state_t *state, void *user_data){
  27. if(state->count == 1){
  28. unregister_code(KC_ESC);
  29. } else {
  30. unregister_code(KC_CAPS);
  31. }
  32. }
  33. //Tap Dance Definitions
  34. qk_tap_dance_action_t tap_dance_actions[] = {
  35. //Tap once for Esc, twice for Caps Lock
  36. [TD_ECAP] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, dance_ecap_finished, dance_ecap_reset),
  37. // Other declarations would go here, separated by commas, if you have them
  38. };
  39. #endif
  40. #endif