wm_touchsensor.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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 deinit touch sensor's selection and disable touch.
  26. *
  27. * @param[in] sensorno is the touch sensor number from 1-15
  28. *
  29. * @retval 0:success
  30. *
  31. * @note if do not use touch sensor, user can deinit by this interface and configure this touch sensor as GPIO.
  32. */
  33. int tls_touchsensor_deinit(u32 sensorno);
  34. /**
  35. * @brief This function is used to set threshold per touch sensor.
  36. *
  37. * @param[in] sensorno is the touch sensor number from 1-15
  38. * @param[in] threshold is the sensorno's touch sensor threshold,max value is 127.
  39. *
  40. * @retval 0:success. minus value: parameter wrong.
  41. *
  42. * @note None
  43. */
  44. int tls_touchsensor_threshold_config(u32 sensorno, u8 threshold);
  45. /**
  46. * @brief This function is used to get touch sensor's count number.
  47. *
  48. * @param[in] sensorno is the touch sensor number from 1 to 15.
  49. *
  50. * @retval sensorno's count number .
  51. *
  52. * @note None
  53. */
  54. int tls_touchsensor_countnum_get(u32 sensorno);
  55. /**
  56. * @brief This function is used to enable touch sensor's irq.
  57. *
  58. * @param[in] sensorno is the touch sensor number from 1 to 15.
  59. *
  60. * @retval 0:successfully enable irq, -1:parameter wrong.
  61. *
  62. * @note None
  63. */
  64. int tls_touchsensor_irq_enable(u32 sensorno);
  65. /**
  66. * @brief This function is used to disable touch sensor's irq.
  67. *
  68. * @param[in] sensorno is the touch sensor number from 1 to 15.
  69. *
  70. * @retval 0:successfully disable irq, -1:parameter wrong.
  71. *
  72. * @note None
  73. */
  74. int tls_touchsensor_irq_disable(u32 sensorno);
  75. /**
  76. * @brief This function is used to register touch sensor's irq callback.
  77. *
  78. * @param[in] callback is call back for user's application.
  79. *
  80. * @retval None.
  81. *
  82. * @note None
  83. */
  84. void tls_touchsensor_irq_register(void (*callback)(u32 status));
  85. /**
  86. * @brief This function is used to get touch sensor's irq status.
  87. *
  88. * @param[in] sensorno is the touch sensor number from 1 to 15.
  89. *
  90. * @retval >=0:irq status, -1:parameter wrong.
  91. *
  92. * @note None
  93. */
  94. int tls_touchsensor_irq_status_get(u32 sensorno);