haptic_utils.c 898 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright 2021 Christoph Rehmann (crehmann)
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #include "haptic_utils.h"
  4. #ifdef HAPTIC_ENABLE
  5. #include "drivers/haptic/DRV2605L.h"
  6. #endif
  7. #ifdef HAPTIC_ENABLE
  8. bool get_haptic_enabled_key(uint16_t keycode, keyrecord_t *record) {
  9. switch (keycode) {
  10. case KC_BTN1 ... KC_BTN5:
  11. return true;
  12. break;
  13. }
  14. return false;
  15. }
  16. #endif
  17. void process_layer_pulse(layer_state_t state) {
  18. #ifdef HAPTIC_ENABLE
  19. switch (get_highest_layer(state)) {
  20. case 1:
  21. DRV_pulse(soft_bump);
  22. break;
  23. case 2:
  24. DRV_pulse(sh_dblsharp_tick);
  25. break;
  26. case 3:
  27. DRV_pulse(lg_dblclick_str);
  28. break;
  29. case 4:
  30. DRV_pulse(soft_bump);
  31. break;
  32. case 5:
  33. DRV_pulse(pulsing_sharp);
  34. break;
  35. }
  36. #endif
  37. }