90 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			90 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
#include "base/define.h"
 | 
						|
#include "gpio_cfg.h"
 | 
						|
#include "adc_cfg.h"
 | 
						|
//#include "usartapp.h"
 | 
						|
//#include "console_usart.h"
 | 
						|
#include "base/delay.h"
 | 
						|
#include "power.h"
 | 
						|
//#include "database.h"
 | 
						|
#include "timer_cfg.h"
 | 
						|
#include "base/utility.h"
 | 
						|
//#include "yecan.h"
 | 
						|
#include "hardware/jw3425iic.h"
 | 
						|
BoartCheck_st board_st;
 | 
						|
BoardInfo_un  boardinfo_un;
 | 
						|
 | 
						|
void test_timer_function()
 | 
						|
{
 | 
						|
	static uint8_t   flag_ = 0;
 | 
						|
	LED1_Out = flag_;
 | 
						|
	flag_ ^= 0x01;
 | 
						|
}
 | 
						|
 | 
						|
//检测小板初始化
 | 
						|
void Ye_BoardInit(void)
 | 
						|
{
 | 
						|
 | 
						|
	AdcDef_Init();
 | 
						|
	DAC_Definit();
 | 
						|
//	ConsoleUsart_Init();
 | 
						|
//	YeCanInit();
 | 
						|
	CtrlGpio_DefInit();
 | 
						|
	DelayTimer_Init();
 | 
						|
	TimerCount_Init();
 | 
						|
	CurrentSampleR_Def
 | 
						|
	I2C_init();
 | 
						|
	delay_ms(500);
 | 
						|
	
 | 
						|
}
 | 
						|
/*
 | 
						|
 测试小板上电自检
 | 
						|
*/
 | 
						|
void Ye_BoardCheck(void)
 | 
						|
{
 | 
						|
	uint16_t aus_buf[AD_SCAN_COUNT];
 | 
						|
	board_st.app_run_flag = 1;
 | 
						|
	board_st.device_id = Gpio_GetDeivceAddr();
 | 
						|
	board_st.chip_temp =  (uint16_t)(Get_Temperature()*10);
 | 
						|
	board_st.soft_v = SoftVersion;
 | 
						|
	board_st.hard_v = boardinfo_un.boardinfo.hard_v;
 | 
						|
	board_st.resistor_diff = boardinfo_un.boardinfo.resistor_diff;
 | 
						|
	board_st.plan_id = *((uint32_t*)APP_TEST_PLAN_ADDR);
 | 
						|
	
 | 
						|
	
 | 
						|
	GetADC1_Value(VCC_1V25_CH,aus_buf,AD_SCAN_COUNT);
 | 
						|
	Bubble_Sort_u16(aus_buf,AD_SCAN_COUNT);
 | 
						|
	board_st.v1p25_adc = aus_buf[AD_SCAN_COUNT>>1];
 | 
						|
	
 | 
						|
	GetADC1_Value(VCC_2V5_CH,aus_buf,AD_SCAN_COUNT);
 | 
						|
	Bubble_Sort_u16(aus_buf,AD_SCAN_COUNT);
 | 
						|
	board_st.v2p5_adc = aus_buf[AD_SCAN_COUNT>>1];
 | 
						|
	
 | 
						|
	GetADC1_Value(ADC_Channel_16,aus_buf,AD_SCAN_COUNT);
 | 
						|
	Bubble_Sort_u16(aus_buf,AD_SCAN_COUNT);
 | 
						|
	board_st.adc_shake = aus_buf[AD_SCAN_COUNT-1] - aus_buf[0];
 | 
						|
	
 | 
						|
	
 | 
						|
	LED1_Out = 1;
 | 
						|
	if(0 != PowerCalPrapare())
 | 
						|
	{
 | 
						|
		board_st.v1p25_adc = 0;
 | 
						|
		LED1_Out = 0;
 | 
						|
	}
 | 
						|
	PowerCalibration_set(POWER_DEF_V,45);
 | 
						|
	delay_ms(100);
 | 
						|
	board_st.bus_5p5v = Power_GetHPowerV();
 | 
						|
//	
 | 
						|
#ifdef CHECKER_DEV
 | 
						|
	PowerCalibration_set(260,50);
 | 
						|
	delay_ms(100);
 | 
						|
#else
 | 
						|
	PowerCalibration_set(90,45);
 | 
						|
#endif
 | 
						|
 board_st.bus_26v = Power_GetHPowerV();
 | 
						|
//	
 | 
						|
	PowerCalibration_set(POWER_DEF_V,45);
 | 
						|
	
 | 
						|
	
 | 
						|
}
 | 
						|
 |