hpm_touch.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * Copyright (c) 2021 HPMicro
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. *
  6. */
  7. #ifndef HPM_TOUCH_H
  8. #define HPM_TOUCH_H
  9. #include "hpm_common.h"
  10. #if defined(CONFIG_TOUCH_FT5406) && (CONFIG_TOUCH_FT5406 == 1)
  11. #include "hpm_ft5406.h"
  12. #define HPM_TOUCH_MAX_POINTS (FT5406_MAX_TOUCH_POINTS)
  13. #elif defined(CONFIG_TOUCH_GT9XX) && (CONFIG_TOUCH_GT9XX == 1)
  14. #include "hpm_gt9xx.h"
  15. #define HPM_TOUCH_MAX_POINTS (GT9XX_MAX_TOUCH_POINTS)
  16. #else
  17. #error "unknown touch type, either have CONFIG_FT5406 or CONFIG_GT9XX defined"
  18. #endif
  19. enum {
  20. status_touch_buffer_no_ready = MAKE_STATUS(status_group_touch, 0),
  21. status_touch_points_over_number = MAKE_STATUS(status_group_touch, 1),
  22. };
  23. typedef struct {
  24. uint16_t x;
  25. uint16_t y;
  26. } touch_point_t;
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. hpm_stat_t touch_init(I2C_Type *i2c_ptr);
  31. hpm_stat_t touch_config(bool exchange_xy, bool reverse_x, bool reverse_y);
  32. hpm_stat_t touch_get_data(touch_point_t *points, uint8_t *num_of_points);
  33. #ifdef __cplusplus
  34. }
  35. #endif
  36. #endif /* HPM_TOUCH_H */