touch_pad.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503
  1. // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. // http://www.apache.org/licenses/LICENSE-2.0
  7. //
  8. // Unless required by applicable law or agreed to in writing, software
  9. // distributed under the License is distributed on an "AS IS" BASIS,
  10. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. // See the License for the specific language governing permissions and
  12. // limitations under the License.
  13. #ifndef _DRIVER_TOUCH_PAD_H_
  14. #define _DRIVER_TOUCH_PAD_H_
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. #include "esp_intr.h"
  19. #include "esp_err.h"
  20. #include "esp_intr_alloc.h"
  21. #include "soc/touch_channel.h"
  22. typedef enum {
  23. TOUCH_PAD_NUM0 = 0, /*!< Touch pad channel 0 is GPIO4 */
  24. TOUCH_PAD_NUM1, /*!< Touch pad channel 1 is GPIO0 */
  25. TOUCH_PAD_NUM2, /*!< Touch pad channel 2 is GPIO2 */
  26. TOUCH_PAD_NUM3, /*!< Touch pad channel 3 is GPIO15*/
  27. TOUCH_PAD_NUM4, /*!< Touch pad channel 4 is GPIO13*/
  28. TOUCH_PAD_NUM5, /*!< Touch pad channel 5 is GPIO12*/
  29. TOUCH_PAD_NUM6, /*!< Touch pad channel 6 is GPIO14*/
  30. TOUCH_PAD_NUM7, /*!< Touch pad channel 7 is GPIO27*/
  31. TOUCH_PAD_NUM8, /*!< Touch pad channel 8 is GPIO33*/
  32. TOUCH_PAD_NUM9, /*!< Touch pad channel 9 is GPIO32*/
  33. TOUCH_PAD_MAX,
  34. } touch_pad_t;
  35. typedef enum {
  36. TOUCH_HVOLT_KEEP = -1, /*!<Touch sensor high reference voltage, no change */
  37. TOUCH_HVOLT_2V4 = 0, /*!<Touch sensor high reference voltage, 2.4V */
  38. TOUCH_HVOLT_2V5, /*!<Touch sensor high reference voltage, 2.5V */
  39. TOUCH_HVOLT_2V6, /*!<Touch sensor high reference voltage, 2.6V */
  40. TOUCH_HVOLT_2V7, /*!<Touch sensor high reference voltage, 2.7V */
  41. TOUCH_HVOLT_MAX,
  42. } touch_high_volt_t;
  43. typedef enum {
  44. TOUCH_LVOLT_KEEP = -1, /*!<Touch sensor low reference voltage, no change */
  45. TOUCH_LVOLT_0V5 = 0, /*!<Touch sensor low reference voltage, 0.5V */
  46. TOUCH_LVOLT_0V6, /*!<Touch sensor low reference voltage, 0.6V */
  47. TOUCH_LVOLT_0V7, /*!<Touch sensor low reference voltage, 0.7V */
  48. TOUCH_LVOLT_0V8, /*!<Touch sensor low reference voltage, 0.8V */
  49. TOUCH_LVOLT_MAX,
  50. } touch_low_volt_t;
  51. typedef enum {
  52. TOUCH_HVOLT_ATTEN_KEEP = -1, /*!<Touch sensor high reference voltage attenuation, no change */
  53. TOUCH_HVOLT_ATTEN_1V5 = 0, /*!<Touch sensor high reference voltage attenuation, 1.5V attenuation */
  54. TOUCH_HVOLT_ATTEN_1V, /*!<Touch sensor high reference voltage attenuation, 1.0V attenuation */
  55. TOUCH_HVOLT_ATTEN_0V5, /*!<Touch sensor high reference voltage attenuation, 0.5V attenuation */
  56. TOUCH_HVOLT_ATTEN_0V, /*!<Touch sensor high reference voltage attenuation, 0V attenuation */
  57. TOUCH_HVOLT_ATTEN_MAX,
  58. } touch_volt_atten_t;
  59. typedef enum {
  60. TOUCH_PAD_SLOPE_0 = 0, /*!<Touch sensor charge / discharge speed, always zero */
  61. TOUCH_PAD_SLOPE_1 = 1, /*!<Touch sensor charge / discharge speed, slowest */
  62. TOUCH_PAD_SLOPE_2 = 2, /*!<Touch sensor charge / discharge speed */
  63. TOUCH_PAD_SLOPE_3 = 3, /*!<Touch sensor charge / discharge speed */
  64. TOUCH_PAD_SLOPE_4 = 4, /*!<Touch sensor charge / discharge speed */
  65. TOUCH_PAD_SLOPE_5 = 5, /*!<Touch sensor charge / discharge speed */
  66. TOUCH_PAD_SLOPE_6 = 6, /*!<Touch sensor charge / discharge speed */
  67. TOUCH_PAD_SLOPE_7 = 7, /*!<Touch sensor charge / discharge speed, fast */
  68. TOUCH_PAD_SLOPE_MAX,
  69. } touch_cnt_slope_t;
  70. typedef enum {
  71. TOUCH_TRIGGER_BELOW = 0, /*!<Touch interrupt will happen if counter value is less than threshold.*/
  72. TOUCH_TRIGGER_ABOVE = 1, /*!<Touch interrupt will happen if counter value is larger than threshold.*/
  73. TOUCH_TRIGGER_MAX,
  74. } touch_trigger_mode_t;
  75. typedef enum {
  76. TOUCH_TRIGGER_SOURCE_BOTH = 0, /*!< wakeup interrupt is generated if both SET1 and SET2 are "touched"*/
  77. TOUCH_TRIGGER_SOURCE_SET1 = 1, /*!< wakeup interrupt is generated if SET1 is "touched"*/
  78. TOUCH_TRIGGER_SOURCE_MAX,
  79. } touch_trigger_src_t;
  80. typedef enum {
  81. TOUCH_PAD_TIE_OPT_LOW = 0, /*!<Initial level of charging voltage, low level */
  82. TOUCH_PAD_TIE_OPT_HIGH = 1, /*!<Initial level of charging voltage, high level */
  83. TOUCH_PAD_TIE_OPT_MAX,
  84. } touch_tie_opt_t;
  85. typedef enum {
  86. TOUCH_FSM_MODE_TIMER = 0, /*!<To start touch FSM by timer */
  87. TOUCH_FSM_MODE_SW, /*!<To start touch FSM by software trigger */
  88. TOUCH_FSM_MODE_MAX,
  89. } touch_fsm_mode_t;
  90. typedef intr_handle_t touch_isr_handle_t;
  91. #define TOUCH_PAD_SLEEP_CYCLE_DEFAULT (0x1000) /*!<The timer frequency is RTC_SLOW_CLK (can be 150k or 32k depending on the options), max value is 0xffff */
  92. #define TOUCH_PAD_MEASURE_CYCLE_DEFAULT (0xffff) /*!<The timer frequency is 8Mhz, the max value is 0xffff */
  93. #define TOUCH_FSM_MODE_DEFAULT (TOUCH_FSM_MODE_TIMER) /*!<The touch FSM my be started by the software or timer */
  94. #define TOUCH_TRIGGER_MODE_DEFAULT (TOUCH_TRIGGER_BELOW) /*!<Interrupts can be triggered if sensor value gets below or above threshold */
  95. #define TOUCH_TRIGGER_SOURCE_DEFAULT (TOUCH_TRIGGER_SOURCE_SET1) /*!<The wakeup trigger source can be SET1 or both SET1 and SET2 */
  96. #define TOUCH_PAD_BIT_MASK_MAX (0x3ff)
  97. /**
  98. * @brief Initialize touch module.
  99. * @return
  100. * - ESP_OK Success
  101. * - ESP_FAIL Touch pad init error
  102. */
  103. esp_err_t touch_pad_init();
  104. /**
  105. * @brief Un-install touch pad driver.
  106. * @return
  107. * - ESP_OK Success
  108. * - ESP_FAIL Touch pad driver not initialized
  109. */
  110. esp_err_t touch_pad_deinit();
  111. /**
  112. * @brief Configure touch pad interrupt threshold.
  113. * @param touch_num touch pad index
  114. * @param threshold interrupt threshold,
  115. * @return
  116. * - ESP_OK Success
  117. * - ESP_ERR_INVALID_ARG if argument wrong
  118. * - ESP_FAIL if touch pad not initialized
  119. */
  120. esp_err_t touch_pad_config(touch_pad_t touch_num, uint16_t threshold);
  121. /**
  122. * @brief get touch sensor counter value.
  123. * Each touch sensor has a counter to count the number of charge/discharge cycles.
  124. * When the pad is not 'touched', we can get a number of the counter.
  125. * When the pad is 'touched', the value in counter will get smaller because of the larger equivalent capacitance.
  126. * User can use this function to determine the interrupt trigger threshold.
  127. *
  128. * @param touch_num touch pad index
  129. * @param touch_value pointer to accept touch sensor value
  130. * @return
  131. * - ESP_OK Success
  132. * - ESP_ERR_INVALID_ARG Touch pad error
  133. * - ESP_FAIL Touch pad not initialized
  134. */
  135. esp_err_t touch_pad_read(touch_pad_t touch_num, uint16_t * touch_value);
  136. /**
  137. * @brief get filtered touch sensor counter value by IIR filter.
  138. * @note touch_pad_filter_start has to be called before calling touch_pad_read_filtered.
  139. * This function can be called from ISR
  140. *
  141. * @param touch_num touch pad index
  142. * @param touch_value pointer to accept touch sensor value
  143. * @return
  144. * - ESP_OK Success
  145. * - ESP_ERR_INVALID_ARG Touch pad error
  146. * - ESP_FAIL Touch pad not initialized
  147. */
  148. esp_err_t touch_pad_read_filtered(touch_pad_t touch_num, uint16_t *touch_value);
  149. /**
  150. * @brief Register touch-pad ISR,
  151. * @note Deprecated function, users should replace this with touch_pad_isr_register,
  152. * because RTC modules share a same interrupt index.
  153. * @param fn Pointer to ISR handler
  154. * @param arg Parameter for ISR
  155. * @param unused Reserved, not used
  156. * @param handle_unused Reserved, not used
  157. * @return
  158. * - ESP_OK Success ;
  159. * - ESP_ERR_INVALID_ARG GPIO error
  160. */
  161. esp_err_t touch_pad_isr_handler_register(void(*fn)(void *), void *arg, int unused, intr_handle_t *handle_unused) __attribute__ ((deprecated));
  162. /**
  163. * @brief Register touch-pad ISR.
  164. * The handler will be attached to the same CPU core that this function is running on.
  165. * @param fn Pointer to ISR handler
  166. * @param arg Parameter for ISR
  167. * @return
  168. * - ESP_OK Success ;
  169. * - ESP_ERR_INVALID_ARG GPIO error
  170. */
  171. esp_err_t touch_pad_isr_register(intr_handler_t fn, void* arg);
  172. /**
  173. * @brief Deregister the handler previously registered using touch_pad_isr_handler_register
  174. * @param fn handler function to call (as passed to touch_pad_isr_handler_register)
  175. * @param arg argument of the handler (as passed to touch_pad_isr_handler_register)
  176. * @return
  177. * - ESP_OK on success
  178. * - ESP_ERR_INVALID_STATE if a handler matching both fn and
  179. * arg isn't registered
  180. */
  181. esp_err_t touch_pad_isr_deregister(void(*fn)(void *), void *arg);
  182. /**
  183. * @brief Set touch sensor measurement and sleep time
  184. * @param sleep_cycle The touch sensor will sleep after each measurement.
  185. * sleep_cycle decide the interval between each measurement.
  186. * t_sleep = sleep_cycle / (RTC_SLOW_CLK frequency).
  187. * The approximate frequency value of RTC_SLOW_CLK can be obtained using rtc_clk_slow_freq_get_hz function.
  188. * @param meas_cycle The duration of the touch sensor measurement.
  189. * t_meas = meas_cycle / 8M, the maximum measure time is 0xffff / 8M = 8.19 ms
  190. * @return
  191. * - ESP_OK on success
  192. */
  193. esp_err_t touch_pad_set_meas_time(uint16_t sleep_cycle, uint16_t meas_cycle);
  194. /**
  195. * @brief Get touch sensor measurement and sleep time
  196. * @param sleep_cycle Pointer to accept sleep cycle number
  197. * @param meas_cycle Pointer to accept measurement cycle count.
  198. * @return
  199. * - ESP_OK on success
  200. */
  201. esp_err_t touch_pad_get_meas_time(uint16_t *sleep_cycle, uint16_t *meas_cycle);
  202. /**
  203. * @brief Set touch sensor reference voltage, if the voltage gap between high and low reference voltage get less,
  204. * the charging and discharging time would be faster, accordingly, the counter value would be larger.
  205. * In the case of detecting very slight change of capacitance, we can narrow down the gap so as to increase
  206. * the sensitivity. On the other hand, narrow voltage gap would also introduce more noise, but we can use a
  207. * software filter to pre-process the counter value.
  208. * @param refh the value of DREFH
  209. * @param refl the value of DREFL
  210. * @param atten the attenuation on DREFH
  211. * @return
  212. * - ESP_OK on success
  213. * - ESP_ERR_INVALID_ARG if argument is wrong
  214. */
  215. esp_err_t touch_pad_set_voltage(touch_high_volt_t refh, touch_low_volt_t refl, touch_volt_atten_t atten);
  216. /**
  217. * @brief Get touch sensor reference voltage,
  218. * @param refh pointer to accept DREFH value
  219. * @param refl pointer to accept DREFL value
  220. * @param atten pointer to accept the attenuation on DREFH
  221. * @return
  222. * - ESP_OK on success
  223. */
  224. esp_err_t touch_pad_get_voltage(touch_high_volt_t *refh, touch_low_volt_t *refl, touch_volt_atten_t *atten);
  225. /**
  226. * @brief Set touch sensor charge/discharge speed for each pad.
  227. * If the slope is 0, the counter would always be zero.
  228. * If the slope is 1, the charging and discharging would be slow, accordingly, the counter value would be small.
  229. * If the slope is set 7, which is the maximum value, the charging and discharging would be fast, accordingly, the
  230. * counter value would be larger.
  231. * @param touch_num touch pad index
  232. * @param slope touch pad charge/discharge speed
  233. * @param opt the initial voltage
  234. * @return
  235. * - ESP_OK on success
  236. * - ESP_ERR_INVALID_ARG if argument is wrong
  237. */
  238. esp_err_t touch_pad_set_cnt_mode(touch_pad_t touch_num, touch_cnt_slope_t slope, touch_tie_opt_t opt);
  239. /**
  240. * @brief Get touch sensor charge/discharge speed for each pad
  241. * @param touch_num touch pad index
  242. * @param slope pointer to accept touch pad charge/discharge slope
  243. * @param opt pointer to accept the initial voltage
  244. * @return
  245. * - ESP_OK on success
  246. * - ESP_ERR_INVALID_ARG if argument is wrong
  247. */
  248. esp_err_t touch_pad_get_cnt_mode(touch_pad_t touch_num, touch_cnt_slope_t *slope, touch_tie_opt_t *opt);
  249. /**
  250. * @brief Initialize touch pad GPIO
  251. * @param touch_num touch pad index
  252. * @return
  253. * - ESP_OK on success
  254. * - ESP_ERR_INVALID_ARG if argument is wrong
  255. */
  256. esp_err_t touch_pad_io_init(touch_pad_t touch_num);
  257. /**
  258. * @brief Set touch sensor FSM mode, the test action can be triggered by the timer,
  259. * as well as by the software.
  260. * @param mode FSM mode
  261. * @return
  262. * - ESP_OK on success
  263. * - ESP_ERR_INVALID_ARG if argument is wrong
  264. */
  265. esp_err_t touch_pad_set_fsm_mode(touch_fsm_mode_t mode);
  266. /**
  267. * @brief Get touch sensor FSM mode
  268. * @param mode pointer to accept FSM mode
  269. * @return
  270. * - ESP_OK on success
  271. */
  272. esp_err_t touch_pad_get_fsm_mode(touch_fsm_mode_t *mode);
  273. /**
  274. * @brief Trigger a touch sensor measurement, only support in SW mode of FSM
  275. * @return
  276. * - ESP_OK on success
  277. */
  278. esp_err_t touch_pad_sw_start();
  279. /**
  280. * @brief Set touch sensor interrupt threshold
  281. * @param touch_num touch pad index
  282. * @param threshold threshold of touchpad count, refer to touch_pad_set_trigger_mode to see how to set trigger mode.
  283. * @return
  284. * - ESP_OK on success
  285. * - ESP_ERR_INVALID_ARG if argument is wrong
  286. */
  287. esp_err_t touch_pad_set_thresh(touch_pad_t touch_num, uint16_t threshold);
  288. /**
  289. * @brief Get touch sensor interrupt threshold
  290. * @param touch_num touch pad index
  291. * @param threshold pointer to accept threshold
  292. * @return
  293. * - ESP_OK on success
  294. * - ESP_ERR_INVALID_ARG if argument is wrong
  295. */
  296. esp_err_t touch_pad_get_thresh(touch_pad_t touch_num, uint16_t *threshold);
  297. /**
  298. * @brief Set touch sensor interrupt trigger mode.
  299. * Interrupt can be triggered either when counter result is less than
  300. * threshold or when counter result is more than threshold.
  301. * @param mode touch sensor interrupt trigger mode
  302. * @return
  303. * - ESP_OK on success
  304. * - ESP_ERR_INVALID_ARG if argument is wrong
  305. */
  306. esp_err_t touch_pad_set_trigger_mode(touch_trigger_mode_t mode);
  307. /**
  308. * @brief Get touch sensor interrupt trigger mode
  309. * @param mode pointer to accept touch sensor interrupt trigger mode
  310. * @return
  311. * - ESP_OK on success
  312. */
  313. esp_err_t touch_pad_get_trigger_mode(touch_trigger_mode_t *mode);
  314. /**
  315. * @brief Set touch sensor interrupt trigger source. There are two sets of touch signals.
  316. * Set1 and set2 can be mapped to several touch signals. Either set will be triggered
  317. * if at least one of its touch signal is 'touched'. The interrupt can be configured to be generated
  318. * if set1 is triggered, or only if both sets are triggered.
  319. * @param src touch sensor interrupt trigger source
  320. * @return
  321. * - ESP_OK on success
  322. * - ESP_ERR_INVALID_ARG if argument is wrong
  323. */
  324. esp_err_t touch_pad_set_trigger_source(touch_trigger_src_t src);
  325. /**
  326. * @brief Get touch sensor interrupt trigger source
  327. * @param src pointer to accept touch sensor interrupt trigger source
  328. * @return
  329. * - ESP_OK on success
  330. */
  331. esp_err_t touch_pad_get_trigger_source(touch_trigger_src_t *src);
  332. /**
  333. * @brief Set touch sensor group mask.
  334. * Touch pad module has two sets of signals, 'Touched' signal is triggered only if
  335. * at least one of touch pad in this group is "touched".
  336. * This function will set the register bits according to the given bitmask.
  337. * @param set1_mask bitmask of touch sensor signal group1, it's a 10-bit value
  338. * @param set2_mask bitmask of touch sensor signal group2, it's a 10-bit value
  339. * @param en_mask bitmask of touch sensor work enable, it's a 10-bit value
  340. * @return
  341. * - ESP_OK on success
  342. * - ESP_ERR_INVALID_ARG if argument is wrong
  343. */
  344. esp_err_t touch_pad_set_group_mask(uint16_t set1_mask, uint16_t set2_mask, uint16_t en_mask);
  345. /**
  346. * @brief Get touch sensor group mask.
  347. * @param set1_mask pointer to accept bitmask of touch sensor signal group1, it's a 10-bit value
  348. * @param set2_mask pointer to accept bitmask of touch sensor signal group2, it's a 10-bit value
  349. * @param en_mask pointer to accept bitmask of touch sensor work enable, it's a 10-bit value
  350. * @return
  351. * - ESP_OK on success
  352. */
  353. esp_err_t touch_pad_get_group_mask(uint16_t *set1_mask, uint16_t *set2_mask, uint16_t *en_mask);
  354. /**
  355. * @brief Clear touch sensor group mask.
  356. * Touch pad module has two sets of signals, Interrupt is triggered only if
  357. * at least one of touch pad in this group is "touched".
  358. * This function will clear the register bits according to the given bitmask.
  359. * @param set1_mask bitmask touch sensor signal group1, it's a 10-bit value
  360. * @param set2_mask bitmask touch sensor signal group2, it's a 10-bit value
  361. * @param en_mask bitmask of touch sensor work enable, it's a 10-bit value
  362. * @return
  363. * - ESP_OK on success
  364. * - ESP_ERR_INVALID_ARG if argument is wrong
  365. */
  366. esp_err_t touch_pad_clear_group_mask(uint16_t set1_mask, uint16_t set2_mask, uint16_t en_mask);
  367. /**
  368. * @brief To clear the touch status register, usually use this function in touch ISR to clear status.
  369. * @return
  370. * - ESP_OK on success
  371. */
  372. esp_err_t touch_pad_clear_status();
  373. /**
  374. * @brief Get the touch sensor status, usually used in ISR to decide which pads are 'touched'.
  375. * @return
  376. * - touch status
  377. */
  378. uint32_t touch_pad_get_status();
  379. /**
  380. * @brief To enable touch pad interrupt
  381. * @return
  382. * - ESP_OK on success
  383. */
  384. esp_err_t touch_pad_intr_enable();
  385. /**
  386. * @brief To disable touch pad interrupt
  387. * @return
  388. * - ESP_OK on success
  389. */
  390. esp_err_t touch_pad_intr_disable();
  391. /**
  392. * @brief set touch pad filter calibration period, in ms.
  393. * Need to call touch_pad_filter_start before all touch filter APIs
  394. * @param new_period_ms filter period, in ms
  395. * @return
  396. * - ESP_OK Success
  397. * - ESP_ERR_INVALID_STATE driver state error
  398. * - ESP_ERR_INVALID_ARG parameter error
  399. */
  400. esp_err_t touch_pad_set_filter_period(uint32_t new_period_ms);
  401. /**
  402. * @brief get touch pad filter calibration period, in ms
  403. * Need to call touch_pad_filter_start before all touch filter APIs
  404. * @param p_period_ms pointer to accept period
  405. * @return
  406. * - ESP_OK Success
  407. * - ESP_ERR_INVALID_STATE driver state error
  408. * - ESP_ERR_INVALID_ARG parameter error
  409. */
  410. esp_err_t touch_pad_get_filter_period(uint32_t* p_period_ms);
  411. /**
  412. * @brief start touch pad filter function
  413. * This API will start a filter to process the noise in order to prevent false triggering
  414. * when detecting slight change of capacitance.
  415. * Need to call touch_pad_filter_start before all touch filter APIs
  416. *
  417. * If filter is not initialized, this API will initialize the filter with given period.
  418. * If filter is already initialized, this API will update the filter period.
  419. * @note This filter uses FreeRTOS timer, which is dispatched from a task with
  420. * priority 1 by default on CPU 0. So if some application task with higher priority
  421. * takes a lot of CPU0 time, then the quality of data obtained from this filter will be affected.
  422. * You can adjust FreeRTOS timer task priority in menuconfig.
  423. * @param filter_period_ms filter calibration period, in ms
  424. * @return
  425. * - ESP_OK Success
  426. * - ESP_ERR_INVALID_ARG parameter error
  427. * - ESP_ERR_NO_MEM No memory for driver
  428. * - ESP_ERR_INVALID_STATE driver state error
  429. */
  430. esp_err_t touch_pad_filter_start(uint32_t filter_period_ms);
  431. /**
  432. * @brief stop touch pad filter function
  433. * Need to call touch_pad_filter_start before all touch filter APIs
  434. * @return
  435. * - ESP_OK Success
  436. * - ESP_ERR_INVALID_STATE driver state error
  437. */
  438. esp_err_t touch_pad_filter_stop();
  439. /**
  440. * @brief delete touch pad filter driver and release the memory
  441. * Need to call touch_pad_filter_start before all touch filter APIs
  442. * @return
  443. * - ESP_OK Success
  444. * - ESP_ERR_INVALID_STATE driver state error
  445. */
  446. esp_err_t touch_pad_filter_delete();
  447. #ifdef __cplusplus
  448. }
  449. #endif
  450. #endif/*_DRIVER_TOUCH_PAD_H_*/