48 lines
1.0 KiB
C
48 lines
1.0 KiB
C
#ifndef __ADC_DRV_IF_H__
|
|
#define __ADC_DRV_IF_H__
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include <stdint.h>
|
|
#include <stdlib.h>
|
|
|
|
#define ADC0 (0x01 << 0)
|
|
#define ADC1 (0x01 << 1)
|
|
#define ADC2 (0x01 << 2)
|
|
#define ADC3 (0x01 << 3)
|
|
|
|
typedef enum
|
|
{
|
|
GAIN_0P625,
|
|
GAIN_1P000,
|
|
GAIN_1P200,
|
|
GAIN_1P250,
|
|
GAIN_1P500,
|
|
GAIN_2P000,
|
|
GAIN_2P500,
|
|
GAIN_3P000,
|
|
GAIN_6P000,
|
|
GAIN_12P000,
|
|
GAIN_24P000,
|
|
} adc_gain_t;
|
|
|
|
typedef struct
|
|
{
|
|
int (*init)(void);
|
|
int (*reset)(void);
|
|
int (*read)(uint32_t channel, int32_t *adc_val);
|
|
int (*read_milivolt)(uint32_t channel, float *p_val);
|
|
int (*read_multiple_milivolt_ex)(uint32_t *p_channels, float *p_val, uint32_t count, void (*preliminary_action));
|
|
int (*read_multiple_channels)(uint32_t *p_channels, int32_t *adc_val, uint32_t count);
|
|
int (*read_multiple_channels_ex)(uint32_t *p_channels, int32_t *adc_val, uint32_t count, void (*preliminary_action)(void));
|
|
int (*gain)(adc_gain_t gain);
|
|
} adc_drv_if_t;
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* ! __ADC_DRV_IF_H__ */
|