12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- /**
- ******************************************************************************
- * @file VAPC-meter/lib/adc.h
- * @author "Vladimir N. Shilov" <shilow@ukr.net>
- * @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****/
|