forked from SZV10X_Software/SZV103_FM33A0xxEV_SiZhu

jinlicong
2024-04-25 a12102b90bda2f409babc8c241bfc66118a8cb70
HARDWARE/ADC/ADC.h
@@ -1,37 +1,40 @@
#ifndef _ADC_H_
#define _ADC_H_
/******************************************************************************
 * Copyright (C) 2014-2015 HangZhou SiZhu Co.,LTD.
 *
 *-----------------------------------------------------------------------------
 * File:              adc.h
 * Description:      head file of adc.c ,use arm inner adc1 to sample given voltage
 * Author:           Lishoujian (867693272@qq.com)
 * Date:             Jan 9, 2015
 *****************************************************************************/
#include "define_all.h"
/* ----------------------- Platform includes --------------------------------*/
#ifndef __ADC_H
#define __ADC_H
#include "sys.h"
//ÄÚ²¿ÀÛ¼Ó
//#define const_adc_Slope    (*((uint16_t *)(0x1FFFFA84)))   //ADCбÂÊ£¬³ý1000ºóʹÓÃ
//#define const_adc_Offset    (*((int16_t *)(0x1FFFFA86)))   //ADC½Ø¾à£¬³ý100ºóʹÓ㬵¥Î»mV
#define      AD_LENGTH      500
//ÍⲿÀÛ¼Ó
#define const_adc_Slope    (*((uint16_t *)(0x1FFFFA88)))   //ADCбÂÊ£¬³ý1000ºóʹÓÃ
#define const_adc_Offset    (*((int16_t *)(0x1FFFFA8A)))   //ADC½Ø¾à£¬³ý100ºóʹÓ㬵¥Î»mV
#define      ADC_dianchi_PIN_NUM                   GPIO_Pin_3
#define      ADC_dianchi_PIN_GROUP                 GPIOC
//ÄÚ²¿ÀÛ¼Ó  Î¶È
#define const_T_30            *(uint16_t*) 0x1FFFFA92  //0X640  30¶¨±êÖµ
typedef struct ad_data_get
{
   u16     *ad_get_address_p;
   u32      ad_buffer_cnt;
   u8      ad_ch;
//ÍⲿÀÛ¼Ó  Î¶È
#define const_T_30_14BIT      *(uint16_t*) 0x1FFFFB54   //0XÍⲿÀÛ¼Ó 16383£¨14bit£©  30¶¨±êÖµ
}ad_data_s;
//ADC_IN4
#define LIT_ADC_PORT    GPIOD
#define LIT_ADC_PIN      GPIO_Pin_1
double Temp_GetBFiltedData(ad_data_s * data_p);
void  Adc_set(u8 tem_flag);
uint16 Get_vol_Average(u8 channel,u8 tem_flag);
extern volatile u16                        ad_data[1000];
u16 Get_val(u8 ch);
#endif
//ADC_IN8
#define ALK_ADC_PORT   GPIOB
#define ALK_ADC_PIN      GPIO_Pin_3
void ADC_LithIO_Init(void);
void ADC_AlkaIO_Init(void);
void ADC_IN5_Init(void);
void ADC_IN4_Init(void);
void ADC_IN8_Init(void);
void ADC_Temp_Init(void);
uint32_t Get_AdcValue(void);
float Get_AdcTempValue(void);
#endif