Files
checker_slave/source/elec_det/hardware/adc_cfg.h

112 lines
2.9 KiB
C
Raw Normal View History

#ifndef ADC_CFG_H_
#define ADC_CFG_H_
#include "base/define.h"
#define AN_UA_CH ADC_Channel_12 //AD2
#define AN_MAL_CH ADC_Channel_13 //AD2
#define RAD_01_CH ADC_Channel_2 //AD2
#define AN_CAP_AD_CH ADC_Channel_15 //AD2
#define VCC_2V5_CH ADC_Channel_1 //AD1
#define VCC_1V25_CH ADC_Channel_3 //AD1
#define V_LA_M_CH ADC_Channel_6 //AD1
#define V_LA_H_CH ADC_Channel_7 //AD1
#define AD_OUTA_CH ADC_Channel_10 //AD1
#define AD_OUTB_CH ADC_Channel_11 //AD1
#define ADC_CURR_DE ADC2
#define AD_SCAN_COUNT 16
#define AD_SCAN_SAMPLE 8
#define FIREBUS_ADC_BUF_LEN 160
extern volatile uint16_t FireBus_ADC_Buf[FIREBUS_ADC_BUF_LEN];
#define ADC_SPEED_SLOW ADC_SampleTime_239Cycles5
#define ADC_SPEED_MIDLE ADC_SampleTime_71Cycles5
#define ADC_SPEED_HIGH ADC_SampleTime_13Cycles5
#define ADC_SPEED_HFAST ADC_SampleTime_7Cycles5
void AdcDef_Init(void);
void StartADC2Channel(uint32_t channel, uint32_t speed);
#define ADC_CurChnnelSet(channel,speed) StartADC2Channel(channel,speed)
//桥丝电阻测量通道
#define ADC_ResistorChannelSet(speed) StartADC2Channel(RAD_01_CH,speed);
//电容电压测量
#define ADC_CAPVolChannelSet(speed) StartADC2Channel(AN_CAP_AD_CH,speed);
void StartADC1Channel(uint32_t channel);
void StartADC2ChannelV2(uint32_t channel);
uint32_t GetADC2_Fast(void);
//电流采集通道
#define ADC_GetCurADCFast() GetADC2_Fast()
//桥丝电阻采集通道
#define ADC_GetResistorADCFast() GetADC2_Fast()
//电容电压采集通道
#define ADC_GetCAPVolADCFast() GetADC2_Fast()
uint32_t GetADC1_Fast(void);
uint32_t GetADC2_Value(uint32_t channel);
2023-10-31 18:12:21 +08:00
#define ADC_GetCurADC(channel) GetADC2_Value(channel)
void GetADC1_Value(uint32_t channel,uint16_t* buf,uint16_t len);
float Get_Temperature(void);
/*
@brief 线
@rtv 0.1uA
*/
uint16_t ADC_Comm1p6mA_EndCur(void);
/*
@brief 线
*/
uint16_t ADC_GetBaseStableCur(void);
/*
@brief
@param
@param end_adv 线
@param ad
@param
@rtv 0.1ms
*/
uint16_t AD_GetChgEnergy(uint16_t sample_timeout, uint16_t end_adv,uint16_t* max_cul,uint16_t *shake_adv);
/*
@brief
@param 0.1ms
@rtv AD值
*/
uint16_t AD_CurMonitor(uint32_t us_times);
/*
使ADC触发一次采样StartADC0Channel(ch)
*/
uint16_t GetADC_Fast(ADC_TypeDef* adc_periph);
/*获取桥丝电阻*/
void AD_SampleResistor(uint16_t* channels_re);
/*测量电容电压*/
uint16_t AD_SampleCap(uint16_t delay);
2023-10-31 18:12:21 +08:00
/*
@brief 线
@param0 线AD值
@param1 0.01ms
@rtv
*/
uint16_t AD_GetBusCurUp(uint16_t ad_line ,uint16_t time_out);
void adc_start(ADC_TypeDef *adc);
uint16_t adc_get_value(ADC_TypeDef *adc);
#endif