ftsGesture.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * FTS Capacitive touch screen controller (FingerTipS)
  4. *
  5. * Copyright (C) 2016-2019, STMicroelectronics Limited.
  6. * Authors: AMG(Analog Mems Group) <[email protected]>
  7. *
  8. *
  9. * This program is free software; you can redistribute it and/or modify it
  10. * under the terms of the GNU General Public License version 2 as published by
  11. * the Free Software Foundation.
  12. *
  13. * This program is distributed in the hope that it will be useful, but WITHOUT
  14. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  15. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  16. * more details.
  17. *
  18. * You should have received a copy of the GNU General Public License along with
  19. * this program. If not, see <http://www.gnu.org/licenses/>.
  20. */
  21. /**
  22. *
  23. **************************************************************************
  24. ** STMicroelectronics **
  25. **************************************************************************
  26. ** [email protected] **
  27. **************************************************************************
  28. * *
  29. * FTS Gesture Utilities *
  30. * *
  31. **************************************************************************
  32. **************************************************************************
  33. */
  34. #ifndef _FTS_GESTURE_H_
  35. #define _FTS_GESTURE_H_
  36. #include "ftsHardware.h"
  37. #define GESTURE_MASK_SIZE 8
  38. //max number of gestures coordinates reported
  39. #define GESTURE_COORDS_REPORT_MAX 32
  40. // for each custom gesture should be provided 30
  41. //points (each point is a couple of x,y)
  42. #define GESTURE_CUSTOM_POINTS (30 * 2)
  43. //fw support up to 5 custom gestures
  44. #define GESTURE_CUSTOM_NUMBER 5
  45. #ifdef FTM3
  46. //number of points to transfer with each I2C transaction
  47. #define TEMPLATE_CHUNK (10 * 2)
  48. #else
  49. //number of points to transfer with each I2C transaction
  50. #define TEMPLATE_CHUNK (5 * 2)
  51. #endif
  52. //Gesture IDs
  53. #define GES_ID_UNKNOWN 0x00 //no meaningful gesture
  54. #define GES_ID_DBLTAP 0x01 //Double Tap
  55. #define GES_ID_O 0x02 //'O'
  56. #define GES_ID_C 0x03 //'C'
  57. #define GES_ID_M 0x04 //'M'
  58. #define GES_ID_W 0x05 //'W'
  59. #define GES_ID_E 0x06 //'e'
  60. #define GES_ID_HFLIP_L2R 0x07 //Left to right line
  61. #define GES_ID_HFLIP_R2L 0x08 //Right to left line
  62. #define GES_ID_VFLIP_T2D 0x09 //Top to bottom line
  63. #define GES_ID_VFLIP_D2T 0x0A //Bottom to Top line
  64. #define GES_ID_L 0x0B //'L'
  65. #define GES_ID_F 0x0C //'F'
  66. #define GES_ID_V 0x0D //'V'
  67. #define GES_ID_AT 0x0E //'@'
  68. #define GES_ID_S 0x0F //'S'
  69. #define GES_ID_Z 0x10 //'Z'
  70. #define GES_ID_CUST1 0x11 //Custom gesture 1
  71. #define GES_ID_CUST2 0x12 //Custom gesture 2
  72. #define GES_ID_CUST3 0x13 //Custom gesture 3
  73. #define GES_ID_CUST4 0x14 //Custom gesture 4
  74. #define GES_ID_CUST5 0x15 //Custom gesture 5
  75. #define GES_ID_LEFTBRACE 0x20 //'<'
  76. #define GES_ID_RIGHTBRACE 0x21 //'>'
  77. #define GESTURE_CUSTOM_OFFSET GES_ID_CUST1
  78. //Command sub-type
  79. #define GESTURE_ENABLE 0x01
  80. #define GESTURE_DISABLE 0x02
  81. #define GESTURE_ENB_CHECK 0x03
  82. #define GESTURE_START_ADD 0x10
  83. #define GESTURE_DATA_ADD 0x11
  84. #define GESTURE_FINISH_ADD 0x12
  85. #define GETURE_REMOVE_CUSTOM 0x13
  86. #define GESTURE_CHECK_CUSTOM 0x14
  87. //Event sub-type
  88. #define EVENT_TYPE_ENB 0x04
  89. #define EVENT_TYPE_CHECK_ENB 0x03
  90. #define EVENT_TYPE_GESTURE_DTC1 0x01
  91. #define EVENT_TYPE_GESTURE_DTC2 0x02
  92. int updateGestureMask(u8 *mask, int size, int en);
  93. int disableGesture(u8 *mask, int size);
  94. int enableGesture(u8 *mask, int size);
  95. int startAddCustomGesture(u8 gestureID);
  96. int finishAddCustomGesture(u8 gestureID);
  97. int loadCustomGesture(u8 *template, u8 gestureID);
  98. int reloadCustomGesture(void);
  99. int enterGestureMode(int reload);
  100. int addCustomGesture(u8 *data, int size, u8 gestureID);
  101. int removeCustomGesture(u8 gestureID);
  102. int isAnyGestureActive(void);
  103. int gestureIDtoGestureMask(u8 id, u8 *mask);
  104. int readGestureCoords(u8 *event);
  105. int getGestureCoords(u16 *x, u16 *y);
  106. #endif