wm_touchsensor.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /**
  2. * @file wm_touchsensor.h
  3. *
  4. * @brief touchsensor Driver Module
  5. *
  6. * @author
  7. *
  8. * Copyright (c) 2021 Winner Microelectronics Co., Ltd.
  9. */
  10. #include "wm_type_def.h"
  11. /**
  12. * @brief This function is used to initialize touch sensor.
  13. *
  14. * @param[in] sensorno is the touch sensor number from 1-15
  15. * @param[in] scan_period is scan period for per touch sensor ,unit:16ms, >0
  16. * @param[in] window is count window, window must be greater than 2.Real count window is window - 2.
  17. * @param[in] enable is touch sensor enable bit.
  18. *
  19. * @retval 0:success
  20. *
  21. * @note if use touch sensor, user must configure the IO multiplex by API wm_touch_sensor_config.
  22. */
  23. int tls_touchsensor_init_config(u32 sensorno, u8 scan_period, u8 window, u32 enable);
  24. /**
  25. * @brief This function is used to initialize touch scan channel.
  26. *
  27. * @param[in] sensorno is the touch sensor number from 1-15
  28. *
  29. * @retval 0:success
  30. *
  31. * @note if use touch sensor, user must configure the IO multiplex by API wm_touch_sensor_config.
  32. */
  33. int tls_touchsensor_chan_config(u32 sensorno);
  34. /**
  35. * @brief This function is used to initialize touch general configuration.
  36. *
  37. * @param[in] scanperiod is scan period for per touch sensor ,unit:16ms, >0
  38. * @param[in] window is count window, window must be greater than 2.Real count window is window - 2.
  39. * @param[in] bias is touch sensor bias current
  40. *
  41. * @retval 0:success
  42. *
  43. * @note if use touch sensor, user must configure the IO multiplex by API wm_touch_sensor_config.
  44. */
  45. int tls_touchsensor_scan_config(u8 scanperiod, u8 window, u8 bias);
  46. /**
  47. * @brief This function is used to start touch scan
  48. *
  49. * @retval 0:success
  50. *
  51. * @note if use touch sensor, user must configure the IO multiplex by API wm_touch_sensor_config.
  52. */
  53. int tls_touchsensor_scan_start(void);
  54. /**
  55. * @brief This function is used to stop touch scan
  56. *
  57. * @retval 0:success
  58. *
  59. * @note if use touch sensor, user must configure the IO multiplex by API wm_touch_sensor_config.
  60. */
  61. int tls_touchsensor_scan_stop(void);
  62. /**
  63. * @brief This function is used to deinit touch sensor's selection and disable touch.
  64. *
  65. * @param[in] sensorno is the touch sensor number from 1-15
  66. *
  67. * @retval 0:success
  68. *
  69. * @note if do not use touch sensor, user can deinit by this interface and configure this touch sensor as GPIO.
  70. */
  71. int tls_touchsensor_deinit(u32 sensorno);
  72. /**
  73. * @brief This function is used to set threshold per touch sensor.
  74. *
  75. * @param[in] sensorno is the touch sensor number from 1-15
  76. * @param[in] threshold is the sensorno's touch sensor threshold,max value is 127.
  77. *
  78. * @retval 0:success. minus value: parameter wrong.
  79. *
  80. * @note None
  81. */
  82. int tls_touchsensor_threshold_config(u32 sensorno, u8 threshold);
  83. /**
  84. * @brief This function is used to get touch sensor's count number.
  85. *
  86. * @param[in] sensorno is the touch sensor number from 1 to 15.
  87. *
  88. * @retval sensorno's count number .
  89. *
  90. * @note None
  91. */
  92. int tls_touchsensor_countnum_get(u32 sensorno);
  93. /**
  94. * @brief This function is used to enable touch sensor's irq.
  95. *
  96. * @param[in] sensorno is the touch sensor number from 1 to 15.
  97. *
  98. * @retval 0:successfully enable irq, -1:parameter wrong.
  99. *
  100. * @note None
  101. */
  102. int tls_touchsensor_irq_enable(u32 sensorno);
  103. /**
  104. * @brief This function is used to disable touch sensor's irq.
  105. *
  106. * @param[in] sensorno is the touch sensor number from 1 to 15.
  107. *
  108. * @retval 0:successfully disable irq, -1:parameter wrong.
  109. *
  110. * @note None
  111. */
  112. int tls_touchsensor_irq_disable(u32 sensorno);
  113. /**
  114. * @brief This function is used to register touch sensor's irq callback.
  115. *
  116. * @param[in] callback is call back for user's application.
  117. *
  118. * @retval None.
  119. *
  120. * @note None
  121. */
  122. void tls_touchsensor_irq_register(void (*callback)(u32 status));
  123. /**
  124. * @brief This function is used to get touch sensor's irq status.
  125. *
  126. * @param[in] sensorno is the touch sensor number from 1 to 15.
  127. *
  128. * @retval >=0:irq status, -1:parameter wrong.
  129. *
  130. * @note None
  131. */
  132. int tls_touchsensor_irq_status_get(u32 sensorno);