/** ****************************************************************************** * @file VAPC-meter/lib/adc.h * @author "Vladimir N. Shilov" * @version V1 * @date 24-March-2016 * @brief This file contains the headers of the ADC functions. ****************************************************************************** */ /* Define to prevent recursive inclusion -------------------------------------*/ #pragma once #ifndef __ADC_H #define __ADC_H /* Includes ------------------------------------------------------------------*/ #include "stm8l15x.h" /* Exported types ------------------------------------------------------------*/ /* Exported defines ----------------------------------------------------------*/ #define VOLTAGE_CHANNEL ADC_Channel_17 #define CURRENT_CHANNEL ADC_Channel_18 #define ADC1_DR_ADDRESS ((uint16_t)0x5344) #define ADC_BUFFER_SIZE ((uint8_t) 3) #define ADC_BUFFER_ADDRESS ((uint16_t)(&ADC_Buffer)) #define FAST_BUFFER_SIZE ((uint8_t) 16) /* ADC_RATIO = (( 3.3 * 1000 * 1000 ) + 2048 ) / 4095 */ #define ADC_RATIO 806UL #define ADC_VOLT_RATIO 8864UL // (Частота МК (16 МHz) / Предделитель таймера (32) * Нужное время в секундах (0.00125)) - 1 #define TIM_PERIOD ((uint16_t)624) #define TIM_PRESCALER TIM2_Prescaler_32 /* Exported constants --------------------------------------------------------*/ /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ void Init_ADC(void); #endif /* __ADC_H */ /************************ (C) Vladimir N. Shilov *****END OF FILE****/