paw3222.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* Copyright 2024 Colin Lam (Ploopy Corporation)
  2. *
  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. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #pragma once
  17. #include <stdbool.h>
  18. #include <stdint.h>
  19. #include "pointing_device.h"
  20. #ifndef PAW3222_CS_PIN
  21. # ifdef POINTING_DEVICE_CS_PIN
  22. # define PAW3222_CS_PIN POINTING_DEVICE_CS_PIN
  23. # else
  24. # error "No chip select pin defined -- missing POINTING_DEVICE_CS_PIN or PAW3222_CS_PIN define"
  25. # endif
  26. #endif
  27. #ifndef PAW3222_SPI_DIVISOR
  28. # error "No PAW3222 SPI divisor defined -- missing PAW3222_SPI_DIVISOR"
  29. #endif
  30. typedef struct {
  31. int16_t dx;
  32. int16_t dy;
  33. } report_paw3222_t;
  34. extern const pointing_device_driver_t paw3222_pointing_device_driver;
  35. bool paw3222_init(void);
  36. report_paw3222_t paw3222_read_burst(void);
  37. void paw3222_set_cpi(uint16_t cpi);
  38. uint16_t paw3222_get_cpi(void);
  39. report_mouse_t paw3222_get_report(report_mouse_t mouse_report);
  40. bool paw3222_check_signature(void);