/*******************************************************************************
* Device      : AD18F06A
* Author      : XAD Application Team
* Version     : V0.0.1
* Date        : 20201201
* Description :
********************************************************************************/


#ifndef __PERIPH_H__
#define __PERIPH_H__

#include <stdio.h>
#include "AD18F06A.h"
#include "periph.h"


#define   LED1          PB1

/****************************EXTERNAL FUNCTIONS*******************************/
void GPIO_OUT_Init();
void GPIO_IN_Init();

void Config_AD_GPIO(unsigned char TEMP_c);


/**********************************************TIMER*****************************************/

#define           AD_Vref_FVR           0
#define           AD_Vref_VCC           1
// #define           AD_Vref_OP0_OUT       2
// #define           AD_Vref_PB0           3

#define           AD_CH0_PB0            0   //ADC通道0 PB0
#define           AD_CH1_PB1            1   //ADC通道0 PB1
#define           AD_CH2_PB2            2   //ADC通道0 PB2
#define           AD_CH3_PB3            3   //ADC通道0 PB3
#define           AD_CH4_PB4            4   //ADC通道0 PB4
#define           AD_CH5_PB5            5   //ADC通道0 PB5
#define           AD_CH6_PB6            6   //ADC通道0 PB6
#define           AD_CH7_PB7            7   //ADC通道0 PB7
#define           AD_CH8_PC0            8   //ADC通道0 PC0
#define           AD_CH9_PC1            9   //ADC通道0 PC1
#define           AD_CH10_PC2  			10  //ADC通道0 PC2
#define           AD_CH11_PC3       	11  //ADC通道0 PC3
#define           AD_CH12_PD0	       	12  //ADC通道0 PD0
#define           AD_CH13_PD1	        13  //ADC通道0 PD1
#define           AD_CH14_PD2	      	14  //ADC通道0 PD2
#define           AD_CH15_PD3	      	15  //ADC通道0 PD3



#define           AD_1TAD               0   // 1TAD
#define           AD_3TAD               1   // 3TAD
#define           AD_5TAD               2   // 5TAD
#define           AD_7TAD               3   // 7TAD
#define           AD_9TAD               4   // 9TAD
#define           AD_11TAD              5   //11TAD
#define           AD_13TAD              6   //13TAD
#define           AD_15TAD              7   //15TAD

#define           INT_OFF                0






#endif

void Config_ADC(unsigned char Channel,unsigned char Vref_Volt,unsigned char AD_ACQT,unsigned char AD_CS,unsigned char AD_Pri_INT);



unsigned short ADC_SampleFilter(void);
void ADC1_init(void);
void ADC2_init(void);
void ADC3_init(void);
void ADC4_init(void);



