trackball.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
  2. * Copyright 2019 Sunjun Kim
  3. * Copyright 2020 Ploopy Corporation
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #pragma once
  19. #include "quantum.h"
  20. #include "spi_master.h"
  21. #include "pmw3360.h"
  22. #include "analog.h"
  23. #include "opt_encoder.h"
  24. #include "pointing_device.h"
  25. #if defined(KEYBOARD_ploopyco_trackball_rev1)
  26. # include "rev1.h"
  27. #elif defined(KEYBOARD_ploopyco_trackball_rev1_005)
  28. # include "rev1_005.h"
  29. #endif
  30. // Sensor defs
  31. #define OPT_ENC1 F0
  32. #define OPT_ENC2 F4
  33. #define OPT_ENC1_MUX 0
  34. #define OPT_ENC2_MUX 4
  35. void process_mouse(report_mouse_t* mouse_report);
  36. void process_mouse_user(report_mouse_t* mouse_report, int16_t x, int16_t y);
  37. void process_wheel(report_mouse_t* mouse_report);
  38. void process_wheel_user(report_mouse_t* mouse_report, int16_t h, int16_t v);
  39. #define LAYOUT(BL, BM, BR, BF, BB) \
  40. { {BL, BM, BR, BF, BB}, }
  41. typedef union {
  42. uint32_t raw;
  43. struct {
  44. uint8_t dpi_config;
  45. };
  46. } keyboard_config_t;
  47. extern keyboard_config_t keyboard_config;
  48. extern uint16_t dpi_array[];
  49. enum ploopy_keycodes {
  50. #ifdef VIA_ENABLE
  51. DPI_CONFIG = USER00,
  52. #else
  53. DPI_CONFIG = SAFE_RANGE,
  54. #endif
  55. DRAG_SCROLL,
  56. #ifdef VIA_ENABLE
  57. PLOOPY_SAFE_RANGE = SAFE_RANGE,
  58. #else
  59. PLOOPY_SAFE_RANGE,
  60. #endif
  61. };