2021-05-12 19:15:17 +08:00
|
|
|
/**************************************************************************//**
|
|
|
|
*
|
|
|
|
* @copyright (C) 2020 Nuvoton Technology Corp. All rights reserved.
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
|
|
|
* Change Logs:
|
|
|
|
* Date Author Notes
|
|
|
|
* 2021-4-7 Wayne First version
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __DRV_ADC_H__
|
|
|
|
#define __DRV_ADC_H__
|
|
|
|
|
|
|
|
#include <rtthread.h>
|
|
|
|
#include "nu_adc.h"
|
2022-03-12 07:00:53 +08:00
|
|
|
|
2022-01-16 18:43:27 +08:00
|
|
|
#if defined(BSP_USING_ADC_TOUCH)
|
2023-03-24 23:47:28 +08:00
|
|
|
#include <rtdevice.h>
|
2022-01-16 18:43:27 +08:00
|
|
|
#endif
|
2021-05-12 19:15:17 +08:00
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
eAdc_MF, //0
|
|
|
|
eAdc_KPEF, //1
|
|
|
|
eAdc_PEDEF, //2
|
|
|
|
eAdc_KPUEF, //3
|
|
|
|
eAdc_PEUEF, //4
|
|
|
|
eAdc_TF = 8, //8
|
|
|
|
eAdc_ZF, //9
|
|
|
|
eAdc_NACF, //10
|
|
|
|
eAdc_VBF, //11
|
|
|
|
eAdc_KPCF, //12
|
|
|
|
eAdc_SELFTF, //13
|
|
|
|
eAdc_INTKP = 16, //16
|
|
|
|
eAdc_INTTC, //17
|
|
|
|
eAdc_ISR_CNT //18
|
|
|
|
} E_ADC_ISR_EVENT;
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
eAdc_WKPEF,
|
|
|
|
eAdc_WPEDEF,
|
|
|
|
eAdc_WKISR_CNT
|
|
|
|
} E_ADC_WKISR_EVENT;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
ADC_CALLBACK cbfunc;
|
|
|
|
uint32_t private_data;
|
|
|
|
} nu_adc_cb;
|
|
|
|
|
|
|
|
typedef nu_adc_cb *nu_adc_cb_t;
|
|
|
|
|
2022-01-16 18:43:27 +08:00
|
|
|
#if defined(BSP_USING_ADC_TOUCH)
|
2022-03-12 07:00:53 +08:00
|
|
|
void nu_adc_touch_detect(rt_bool_t bStartDetect);
|
|
|
|
int32_t nu_adc_touch_read_xyz(uint32_t *bufX, uint32_t *bufY, uint32_t *bufZ0, uint32_t *bufZ1, int32_t dataCnt);
|
|
|
|
rt_err_t nu_adc_touch_enable(rt_touch_t psRtTouch);
|
|
|
|
rt_err_t nu_adc_touch_disable(void);
|
2022-01-16 18:43:27 +08:00
|
|
|
#endif
|
2021-05-12 19:15:17 +08:00
|
|
|
|
|
|
|
#endif /* __DRV_ADC_H__ */
|