ft5446.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /*
  2. * Copyright (c) 2006-2018, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2022-04-11 Wayne the first version
  9. */
  10. #ifndef __FT5446_H__
  11. #define __FT5446_H__
  12. #include "touch.h"
  13. #define FT_REGITER_LEN 1
  14. #define FT_MAX_TOUCH 5
  15. #define FT5446_ADDRESS 0x38
  16. #pragma anon_unions
  17. typedef struct
  18. {
  19. //03H
  20. union
  21. {
  22. uint8_t m_u8XH;
  23. struct
  24. {
  25. uint8_t u8X_11_8: 4;
  26. uint8_t : 2;
  27. uint8_t u8EvtFlag: 2;
  28. #define FT_EVENTFLAG_PRESS_DOWN 0x0
  29. #define FT_EVENTFLAG_LIFT_UP 0x1
  30. #define FT_EVENTFLAG_CONTACT 0x2
  31. #define FT_EVENTFLAG_NONE 0x3
  32. };
  33. };
  34. //04H
  35. union
  36. {
  37. uint8_t m_u8XL;
  38. struct
  39. {
  40. uint8_t u8X_7_0;
  41. };
  42. };
  43. //05H
  44. union
  45. {
  46. uint8_t m_u8YH;
  47. struct
  48. {
  49. uint8_t u8Y_11_8: 4;
  50. uint8_t u8TouchID: 4; /* Touch ID of Touch Point, this value is 0x0F when the ID is invalid */
  51. };
  52. };
  53. //06H
  54. union
  55. {
  56. uint8_t m_u8YL;
  57. struct
  58. {
  59. uint8_t u8Y_7_0;
  60. };
  61. };
  62. //07H
  63. uint8_t m_u8Weight; /* Touch pressure value */
  64. //08H
  65. union
  66. {
  67. uint8_t m_u8Misc;
  68. struct
  69. {
  70. uint8_t : 4;
  71. uint8_t u8TouchArea: 4; /* Touch area value */
  72. };
  73. };
  74. } S_FT_TP;
  75. #pragma pack(push)
  76. #pragma pack(4)
  77. typedef struct
  78. {
  79. union
  80. {
  81. uint8_t m_u8ModeSwitch;
  82. #define FT_DEVICE_MODE_WORKING 0x0
  83. #define FT_DEVICE_MODE_TEST 0x4
  84. struct
  85. {
  86. uint8_t : 4;
  87. uint8_t u8DevMode: 3;
  88. uint8_t : 1;
  89. };
  90. };
  91. uint8_t m_u8Guesture;
  92. #define FT_GESTURE_ID_MOVE_UP 0x10
  93. #define FT_GESTURE_ID_MOVE_RIGHT 0x14
  94. #define FT_GESTURE_ID_MOVE_DOWN 0x18
  95. #define FT_GESTURE_ID_MOVE_LEFT 0x1C
  96. #define FT_GESTURE_ID_MOVE_IN 0x48
  97. #define FT_GESTURE_ID_MOVE_OUT 0x49
  98. #define FT_GESTURE_ID_MOVE_NONE 0x00
  99. union
  100. {
  101. uint8_t m_u8Status;
  102. struct
  103. {
  104. uint8_t u8TDStatus: 4;
  105. uint8_t : 4;
  106. };
  107. };
  108. S_FT_TP m_sTP[FT_MAX_TOUCH];
  109. } S_FT_REGMAP;
  110. #pragma pack(pop)
  111. int rt_hw_ft5446_init(const char *name, struct rt_touch_config *cfg);
  112. #endif /* __FT5446_H__ */