drv_adc.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /**************************************************************************//**
  2. *
  3. * @copyright (C) 2020 Nuvoton Technology Corp. All rights reserved.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0
  6. *
  7. * Change Logs:
  8. * Date Author Notes
  9. * 2021-4-7 Wayne First version
  10. *
  11. ******************************************************************************/
  12. #ifndef __DRV_ADC_H__
  13. #define __DRV_ADC_H__
  14. #include <rtthread.h>
  15. #include "nu_adc.h"
  16. #include "touch.h"
  17. #define TOUCH_MQ_LENGTH 128
  18. typedef enum
  19. {
  20. eAdc_MF, //0
  21. eAdc_KPEF, //1
  22. eAdc_PEDEF, //2
  23. eAdc_KPUEF, //3
  24. eAdc_PEUEF, //4
  25. eAdc_TF = 8, //8
  26. eAdc_ZF, //9
  27. eAdc_NACF, //10
  28. eAdc_VBF, //11
  29. eAdc_KPCF, //12
  30. eAdc_SELFTF, //13
  31. eAdc_INTKP = 16, //16
  32. eAdc_INTTC, //17
  33. eAdc_ISR_CNT //18
  34. } E_ADC_ISR_EVENT;
  35. typedef enum
  36. {
  37. eAdc_WKPEF,
  38. eAdc_WPEDEF,
  39. eAdc_WKISR_CNT
  40. } E_ADC_WKISR_EVENT;
  41. typedef struct
  42. {
  43. ADC_CALLBACK cbfunc;
  44. uint32_t private_data;
  45. } nu_adc_cb;
  46. typedef nu_adc_cb *nu_adc_cb_t;
  47. int32_t nu_adc_read_touch_xyz(uint16_t *bufX, uint16_t *bufY, uint16_t *bufZ0, uint16_t *bufZ1, int32_t dataCnt);
  48. rt_err_t nu_adc_touch_enable(rt_touch_t psRtTouch);
  49. rt_err_t nu_adc_touch_disable(void);
  50. void nu_adc_touch_detect(rt_bool_t bStartDetect);
  51. void nu_adc_touch_start_conv(void);
  52. void nu_adc_touch_update_caldata(int *psi32NewValue);
  53. void nu_adc_touch_reset_caldata(int *psi32NewValue);
  54. #endif /* __DRV_ADC_H__ */