forked from gary/BCU
2
0
Fork 0
BCU/library/drv_stm32f4xx/drv_adc.h

77 lines
1.4 KiB
C
Raw Normal View History

2024-11-26 15:52:49 +08:00
/*******************************************************************************
**
** :WDog.h
**:2015.10.15
**:
**:
** :V1.0
** :
*******************************************************************************/
#ifndef _DRV_ADC_H_
#define _DRV_ADC_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "kit_macro.h"
typedef enum
{
kAdcDev_1,
kAdcDev_2,
kAdcDev_3,
kAdcDev_End,
}AdcDev;
typedef enum
{
kAdcChannel_0 = 0,
kAdcChannel_1,
kAdcChannel_2,
kAdcChannel_3,
kAdcChannel_4,
kAdcChannel_5,
kAdcChannel_6,
kAdcChannel_7,
kAdcChannel_8,
kAdcChannel_9,
kAdcChannel_10,
kAdcChannel_11,
kAdcChannel_12,
kAdcChannel_13,
kAdcChannel_14,
kAdcChannel_15,
kAdcChannel_16,
kAdcChannel_17,
kAdcChannel_End,
}AdcChannel;
typedef enum
{
kAdcSampleTime_3 = 0,
kAdcSampleTime_15,
kAdcSampleTime_28,
kAdcSampleTime_56,
kAdcSampleTime_84,
kAdcSampleTime_112,
kAdcSampleTime_144,
kAdcSampleTime_480,
kAdcSampleTime_End,
}AdcSampleTime;
typedef struct
{
AdcChannel channel;
AdcSampleTime cycle;
}AdcArray;
uint8_t drv_adc_init(AdcDev dev, const AdcArray *adc_arr, uint16_t len, uint16_t* dma_buf, uint8_t sample_cnt);
bool drv_adc_is_overflow(AdcDev dev);
uint16_t drv_adc_get_data(uint8_t idx);
#ifdef __cplusplus
}
#endif
#endif