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.

77 lines
2.2 KiB

  1. /* Copyright 2019 ishtob
  2. * Driver for haptic feedback written for QMK
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #pragma once
  18. #include <stdint.h>
  19. #include <stdbool.h>
  20. #ifndef HAPTIC_FEEDBACK_DEFAULT
  21. # define HAPTIC_FEEDBACK_DEFAULT 0
  22. #endif
  23. #ifndef HAPTIC_MODE_DEFAULT
  24. # define HAPTIC_MODE_DEFAULT DRV_MODE_DEFAULT
  25. #endif
  26. /* EEPROM config settings */
  27. typedef union {
  28. uint32_t raw;
  29. struct {
  30. bool enable : 1;
  31. uint8_t feedback : 2;
  32. uint8_t mode : 7;
  33. bool buzz : 1;
  34. uint8_t dwell : 7;
  35. bool cont : 1;
  36. uint8_t amplitude : 8;
  37. uint8_t reserved : 5;
  38. };
  39. } haptic_config_t;
  40. typedef enum HAPTIC_FEEDBACK {
  41. KEY_PRESS,
  42. KEY_PRESS_RELEASE,
  43. KEY_RELEASE,
  44. HAPTIC_FEEDBACK_MAX,
  45. } HAPTIC_FEEDBACK;
  46. void haptic_init(void);
  47. void haptic_task(void);
  48. void eeconfig_debug_haptic(void);
  49. void haptic_enable(void);
  50. void haptic_disable(void);
  51. void haptic_toggle(void);
  52. void haptic_feedback_toggle(void);
  53. void haptic_mode_increase(void);
  54. void haptic_mode_decrease(void);
  55. void haptic_mode(uint8_t mode);
  56. void haptic_reset(void);
  57. void haptic_set_feedback(uint8_t feedback);
  58. void haptic_set_mode(uint8_t mode);
  59. void haptic_set_dwell(uint8_t dwell);
  60. void haptic_set_buzz(uint8_t buzz);
  61. void haptic_buzz_toggle(void);
  62. uint8_t haptic_get_enable(void);
  63. uint8_t haptic_get_mode(void);
  64. uint8_t haptic_get_feedback(void);
  65. void haptic_dwell_increase(void);
  66. void haptic_dwell_decrease(void);
  67. void haptic_toggle_continuous(void);
  68. void haptic_cont_increase(void);
  69. void haptic_cont_decrease(void);
  70. void haptic_play(void);
  71. void haptic_shutdown(void);