No Description
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.

pmw3360.h 865B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * pmw3360.h
  3. */
  4. #ifndef __PMW3360_H__
  5. #define __PMW3360_H__
  6. #include <sys/types.h>
  7. struct pmw_motion {
  8. bool motion;
  9. int32_t delta_x;
  10. int32_t delta_y;
  11. };
  12. int pmw_init(void);
  13. void pmw_run(void);
  14. bool pmw_is_alive(void);
  15. struct pmw_motion pmw_get(void);
  16. /*
  17. * 0x00: 100 cpi (minimum cpi)
  18. * 0x01: 200 cpi
  19. * 0x02: 300 cpi
  20. * ...
  21. * 0x31: 5000 cpi (default cpi)
  22. * ...
  23. * 0x77: 12000 cpi (maximum cpi)
  24. */
  25. void pmw_set_sensitivity(uint8_t sens);
  26. uint8_t pmw_get_sensitivity(void);
  27. #define PMW_SENSE_TO_CPI(sense) (100 + (sense * 100))
  28. #define PMW_CPI_TO_SENSE(cpi) ((cpi / 100) - 1)
  29. void pmw_set_angle(int8_t angle);
  30. int8_t pmw_get_angle(void);
  31. void pmw_print_status(char *buff, size_t len);
  32. void pmw_dump_data(bool serial);
  33. ssize_t pmw_frame_capture(uint8_t *buff, size_t buffsize);
  34. #define PMW_FRAME_CAPTURE_LEN 1296
  35. #endif // __PMW3360_H__