PASII/CandeII_1.4/App/app_adc.c

39 lines
1.2 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*************************************************************************************************
**Filename: app_adc.c
**Version :
**Author :
**Date :
**Description:
**
*************************************************************************************************/
#include "app_adc.h"
#include "mcu_bsp.h"
/*************************************************************************************************
* Function Name:
* Description :
* Arguments :
* Return Value :
*************************************************************************************************/
void ADC_Config(void)
{
uint8_t trim = 0;
trim = GPADC_Get_Calibration(); //获取芯片内部测试阶段写入的校准值
if(trim==0)
{
GPADC_Manual_Calibration(0x12); //这里读到芯片内部的校准值为0表示当前批次没有写入校准值 这里写入0X12即可0x12是一个比较合理的值
}
else
{
GPADC_Manual_Calibration(trim); //如果芯片内部已经有校准值 这里可以字节写入芯片内部的校准值 该值和0x12不会偏差太多
}
GPADC_Init(ADCGP_CH,AVE_MODE); //电池电量采样通道设置
}
/*************************************************************************************************/