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.

53 lines
1.9 KiB

  1. /* Copyright 2020 Alexander Tulloh
  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. /* common interface for opitcal sensors */
  17. #if defined ADNS_9800
  18. #include "drivers/sensors/adns9800.h"
  19. #define config_optical_sensor_t config_adns_t
  20. #define report_optical_sensor_t report_adns_t
  21. #define optical_sensor_init adns_init
  22. #define optical_sensor_get_config adns_get_config
  23. #define optical_sensor_set_config adns_set_config
  24. #define optical_sensor_get_report adns_get_report
  25. #elif defined PMW_3360
  26. #include "../pmw/pmw.h"
  27. #define config_optical_sensor_t config_pmw_t
  28. #define report_optical_sensor_t report_pmw_t
  29. #define optical_sensor_init pmw_init
  30. #define optical_sensor_get_config pmw_get_config
  31. #define optical_sensor_set_config pmw_set_config
  32. #define optical_sensor_get_report pmw_get_report
  33. #else
  34. /* fallback stub */
  35. #include <stdint.h>
  36. typedef struct {
  37. uint16_t cpi;
  38. } config_optical_sensor_t;
  39. typedef struct {
  40. int16_t x;
  41. int16_t y;
  42. } report_optical_sensor_t;
  43. #define optical_sensor_init(){ }
  44. #define optical_sensor_get_config() (config_optical_sensor_t){ }
  45. #define optical_sensor_set_config(config_optical_sensor_t){ }
  46. #define optical_sensor_get_report() (report_optical_sensor_t){ }
  47. #endif