logo

qmk_firmware

custom branch of QMK firmware git clone https://anongit.hacktivis.me/git/qmk_firmware.git

pimoroni_trackball.h (2138B)


  1. /* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
  2. * Copyright 2021 Dasky (@daskygit)
  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 "report.h"
  20. #include "i2c_master.h"
  21. #include "pointing_device.h"
  22. #ifndef PIMORONI_TRACKBALL_ADDRESS
  23. # define PIMORONI_TRACKBALL_ADDRESS 0x0A
  24. #endif
  25. #ifndef PIMORONI_TRACKBALL_SCALE
  26. # define PIMORONI_TRACKBALL_SCALE 5
  27. #endif
  28. #ifndef PIMORONI_TRACKBALL_DEBOUNCE_CYCLES
  29. # define PIMORONI_TRACKBALL_DEBOUNCE_CYCLES 20
  30. #endif
  31. #ifndef PIMORONI_TRACKBALL_ERROR_COUNT
  32. # define PIMORONI_TRACKBALL_ERROR_COUNT 10
  33. #endif
  34. #ifndef PIMORONI_TRACKBALL_TIMEOUT
  35. # define PIMORONI_TRACKBALL_TIMEOUT 100
  36. #endif
  37. #ifndef PIMORONI_TRACKBALL_DEBUG_INTERVAL
  38. # define PIMORONI_TRACKBALL_DEBUG_INTERVAL 100
  39. #endif
  40. typedef struct {
  41. uint8_t left;
  42. uint8_t right;
  43. uint8_t up;
  44. uint8_t down;
  45. uint8_t click;
  46. } pimoroni_data_t;
  47. const pointing_device_driver_t pimoroni_trackball_pointing_device_driver;
  48. void pimoroni_trackball_device_init(void);
  49. void pimoroni_trackball_set_rgbw(uint8_t red, uint8_t green, uint8_t blue, uint8_t white);
  50. int16_t pimoroni_trackball_get_offsets(uint8_t negative_dir, uint8_t positive_dir, uint8_t scale);
  51. uint16_t pimoroni_trackball_get_cpi(void);
  52. void pimoroni_trackball_set_cpi(uint16_t cpi);
  53. i2c_status_t read_pimoroni_trackball(pimoroni_data_t* data);
  54. report_mouse_t pimoroni_trackball_get_report(report_mouse_t mouse_report);