#ifndef _ADC_H
#define _ADC_H

#include "stm32f10x_adc.h"

// definice adress pro DMA
#define ADC1_DR_Address     0x4001244C				// adresa na ktere je datovy registr ADC - vysledek konverze

// Pojmenovani kanalu
#define ADC_CH_LED1			ADC_Channel_13
#define ADC_CH_LED2			ADC_Channel_12
#define ADC_CH_LED3			ADC_Channel_11
#define ADC_CH_LED4			ADC_Channel_10
#define ADC_CH_LED5			ADC_Channel_14
#define ADC_CH_VBAT			ADC_Channel_15
#define ADC_CH_TEMP			ADC_Channel_TempSensor

// Pojmenovani indexu v poli pro vysledky
#define ADC_VALUE_LED1		0
#define ADC_VALUE_LED2		1
#define ADC_VALUE_LED3		2
#define ADC_VALUE_LED4		3
#define ADC_VALUE_LED5		4
#define ADC_VALUE_VBAT		5
#define ADC_VALUE_TEMP		5

// Definice prevzate z stm32f10x_adc.c
#define CR2_RSTCAL_Set      ((uint32_t)0x00000008)	/* ADC RSTCAL mask */
#define CR2_CAL_Set         ((uint32_t)0x00000004)	/* ADC CAL mask */
#define CR2_ADON_Set        ((uint32_t)0x00000001)	/* ADC ADON mask */

// Definice prevzate z stm32f10x_adc.c
#define CR2_DMA_Set         ((uint32_t)0x00000100)	// Zapnuti DMA zadosti od ADC
#define CR2_DMA_Reset       ((uint32_t)0xFFFFFEFF)	// Vypnuti DMA zadosti od ADC
#define CR2_EXTTRIG_SWSTART_Set     ((uint32_t)0x00500000)
#define CR2_EXTTRIG_SWSTART_Reset   ((uint32_t)0xFFAFFFFF)

// Definice prevzate z stm32f10x_dma.c
#define  DMA_CCR1_EN        ((uint16_t)0x0001)            // Zapnuti DMA kanalu

// Globalni promenne


// Prototypy funkci
void AD_Init(void);
uint16_t ADC_ConvertTomA(uint16_t hodnota);
uint16_t ADC_GetTempMCU(void);
void ADC_DisableInterupt(void);
void ADC_EnableInterupt(void);
#endif
