48 lines
1.3 KiB
C
48 lines
1.3 KiB
C
#ifndef __ADC_DRV_H__
|
|
#define __ADC_DRV_H__
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include "app_config.h"
|
|
#include "adc_drv_if.h"
|
|
|
|
#define ADC_DRV_ERROR (-1)
|
|
#define ADC_DRV_SUCCESS (0)
|
|
|
|
#define AIN0 0
|
|
#define AIN1 1
|
|
#define AIN2 2
|
|
#define AIN3 3
|
|
#define AIN4 4
|
|
#define AIN5 5
|
|
#define AIN6 6
|
|
#define AIN7 7
|
|
|
|
#if (DEF_ADC_DRV_ENABLED)
|
|
int adc_init(void);
|
|
int adc_reset(void);
|
|
int adc_gain(adc_gain_t gain);
|
|
int adc_read(uint32_t channel, int32_t *adc_val);
|
|
int adc_read_milivolt(uint32_t channel, float *mv);
|
|
int adc_read_mutiple_channels(uint32_t *p_channel, int32_t *p_adc_val, uint32_t cnt);
|
|
int adc_read_mutiple_channels_ex(uint32_t *p_channel, int32_t *p_adc_val, uint32_t cnt, void (*preliminary_action)(void));
|
|
int adc_read_multiple_milivolt_ex(uint32_t *p_channel, float *p_val, uint32_t cnt, void (*preliminary_action)(void));
|
|
#else
|
|
#define adc_init()
|
|
#define adc_reset()
|
|
#define adc_gain(x)
|
|
#define adc_read(x, y)
|
|
#define adc_read_milivolt(x, y)
|
|
#define adc_read_mutiple_channels(x, y, z)
|
|
#define adc_read_mutiple_channels_ex(x, y, z, a)
|
|
#define adc_read_multiple_milivolt_ex(x, y, z, a)
|
|
#endif /* ! DEF_ADC_DRV_ENABLED */
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* ! __ADC_DRV_H__ */
|