78 lines
1.3 KiB
C
78 lines
1.3 KiB
C
#ifndef __ADC_H
|
|
#define __ADC_H
|
|
|
|
#include "stm32f10x.h"
|
|
#include <stdbool.h>
|
|
|
|
enum sampling
|
|
{
|
|
ADC_TEMP1, //板载温度
|
|
TEMPL_AD, //枪座温度
|
|
CC_AD, //CC2电阻
|
|
VIN_AD, //KL30
|
|
AD_NUM,
|
|
};
|
|
|
|
typedef enum
|
|
{
|
|
Normal_operation,
|
|
AC_Charging,
|
|
DC_Charging,
|
|
}work_mode;
|
|
|
|
typedef struct
|
|
{
|
|
uint8_t Flag;
|
|
uint32_t Sum;
|
|
uint8_t Count;
|
|
float volt_data;
|
|
}Filter_variable;
|
|
|
|
typedef struct
|
|
{
|
|
float CC_Volt;
|
|
float KL30_Volt;
|
|
int16_t TEMP1_Data;
|
|
int16_t GUN_TempData;
|
|
int16_t BAT_B_Reverse_Voltage;
|
|
}Volt_sampldata;
|
|
extern Volt_sampldata Volt_SamplData;
|
|
|
|
typedef struct
|
|
{
|
|
int16_t TemperatureValue;
|
|
float R_Value;
|
|
}TempRes_TypeDef;
|
|
|
|
typedef struct
|
|
{
|
|
float Resistance_Value;
|
|
int16_t (*TEMP1)();
|
|
int16_t (*GUN_TEMP)();
|
|
float (*KL30_Volt)();
|
|
work_mode (*WorkMode)();
|
|
}get_sampl_data;
|
|
|
|
typedef struct
|
|
{
|
|
void (*CC_Voltag)();
|
|
void (*TEMP1_Voltage)();
|
|
void (*GUN_TEMP)();
|
|
void (*KL30_Voltage)();
|
|
}sampl_funtion;
|
|
|
|
/**************外设初始化****************/
|
|
void Adc_Init(void);
|
|
/**************对外调用循环采集*****************/
|
|
extern sampl_funtion Sampl_Funtion;
|
|
/**************对外调用获取数据*****************/
|
|
extern get_sampl_data Get_Sampl_Data;
|
|
/*************获取 插枪阻值**************/
|
|
float Get_R_Value(void);
|
|
void Scan_work(void);
|
|
#include "GUNDiscriminate.h"
|
|
|
|
|
|
|
|
#endif
|