mousekey.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. Copyright 2011 Jun Wako <wakojun@gmail.com>
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. #pragma once
  15. #include <stdbool.h>
  16. #include "host.h"
  17. /* max value on report descriptor */
  18. #ifndef MOUSEKEY_MOVE_MAX
  19. #define MOUSEKEY_MOVE_MAX 127
  20. #elif MOUSEKEY_MOVE_MAX > 127
  21. #error MOUSEKEY_MOVE_MAX needs to be smaller than 127
  22. #endif
  23. #ifndef MOUSEKEY_WHEEL_MAX
  24. #define MOUSEKEY_WHEEL_MAX 127
  25. #elif MOUSEKEY_WHEEL_MAX > 127
  26. #error MOUSEKEY_WHEEL_MAX needs to be smaller than 127
  27. #endif
  28. #ifndef MOUSEKEY_MOVE_DELTA
  29. #define MOUSEKEY_MOVE_DELTA 5
  30. #endif
  31. #ifndef MOUSEKEY_WHEEL_DELTA
  32. #define MOUSEKEY_WHEEL_DELTA 1
  33. #endif
  34. #ifndef MOUSEKEY_DELAY
  35. #define MOUSEKEY_DELAY 300
  36. #endif
  37. #ifndef MOUSEKEY_INTERVAL
  38. #define MOUSEKEY_INTERVAL 50
  39. #endif
  40. #ifndef MOUSEKEY_MAX_SPEED
  41. #define MOUSEKEY_MAX_SPEED 10
  42. #endif
  43. #ifndef MOUSEKEY_TIME_TO_MAX
  44. #define MOUSEKEY_TIME_TO_MAX 20
  45. #endif
  46. #ifndef MOUSEKEY_WHEEL_MAX_SPEED
  47. #define MOUSEKEY_WHEEL_MAX_SPEED 8
  48. #endif
  49. #ifndef MOUSEKEY_WHEEL_TIME_TO_MAX
  50. #define MOUSEKEY_WHEEL_TIME_TO_MAX 40
  51. #endif
  52. #ifdef __cplusplus
  53. extern "C" {
  54. #endif
  55. extern uint8_t mk_delay;
  56. extern uint8_t mk_interval;
  57. extern uint8_t mk_max_speed;
  58. extern uint8_t mk_time_to_max;
  59. extern uint8_t mk_wheel_max_speed;
  60. extern uint8_t mk_wheel_time_to_max;
  61. void mousekey_task(void);
  62. void mousekey_on(uint8_t code);
  63. void mousekey_off(uint8_t code);
  64. void mousekey_clear(void);
  65. void mousekey_send(void);
  66. #ifdef __cplusplus
  67. }
  68. #endif