123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- /**
- ******************************************************************************
- * File Name : ADC.h
- * Description : This file provides code for the configuration
- * of the ADC instances.
- ******************************************************************************
- * @attention
- *
- * <h2><center>© Copyright (c) 2020 STMicroelectronics.
- * All rights reserved.</center></h2>
- *
- * This software component is licensed by ST under Ultimate Liberty license
- * SLA0044, the "License"; You may not use this file except in compliance with
- * the License. You may obtain a copy of the License at:
- * www.st.com/SLA0044
- *
- ******************************************************************************
- */
- /* Define to prevent recursive inclusion -------------------------------------*/
- #ifndef __adc_H
- #define __adc_H
- #ifdef __cplusplus
- extern "C" {
- #endif
- /* Includes ------------------------------------------------------------------*/
- #include "main.h"
- /* USER CODE BEGIN Includes */
- #include <math.h>
- /* USER CODE END Includes */
- extern ADC_HandleTypeDef hadc1;
- extern ADC_HandleTypeDef hadc2;
- extern ADC_HandleTypeDef hadc3;
- /* USER CODE BEGIN Private defines */
- #define ADC1_CHANEL_COUNT 1
- #define ADC1_SAMPLE_COUNT 1000
- #define ADC2_CHANEL_COUNT 2
- #define ADC2_SAMPLE_COUNT 256
- #define ADC3_CHANEL_COUNT 5
- #define ADC3_SAMPLE_COUNT 180
- #define LIMIT_MOVE_FILTER 8
- #define CURRENT_LIMIT_MOVE_FILTER 4
- #define VOLTAGE_LIMIT_MOVE_FILTER 8
- typedef struct{
- uint16_t idx_put;
- uint32_t buffer[LIMIT_MOVE_FILTER];
- uint32_t value;
- }MOVE_AVG_FILTER;
- /* USER CODE END Private defines */
- void MX_ADC1_Init(void);
- void MX_ADC2_Init(void);
- void MX_ADC3_Init(void);
- /* USER CODE BEGIN Prototypes */
- extern uint8_t filter_move_avg(MOVE_AVG_FILTER *data, uint32_t value);
- extern uint8_t Current_filter_move_avg(MOVE_AVG_FILTER *data, uint32_t value) ;
- extern uint8_t Voltage_filter_move_avg(MOVE_AVG_FILTER *data, uint32_t value) ;
- //extern uint16_t vRms_cal(uint16_t *data, uint16_t length);
- extern uint16_t cRms_cal(uint16_t *data, uint16_t length);
- extern uint16_t GFRms_cal(uint16_t *data, uint16_t length);
- extern uint16_t avg_cal(uint16_t *data, uint16_t length);
- #ifdef FUNC_TEMP_SENSOR_WITH_NEG_VALUE
- extern int16_t getTemperature(uint16_t adc_raw);
- #else
- extern uint16_t getTemperature(uint16_t adc_raw);
- #endif
- extern uint16_t vRms_cal2(uint16_t *data, uint16_t length) ;
- //extern uint16_t cRms_cal2(uint16_t *data, uint16_t length) ;
- extern uint16_t RlyVmax_cal(uint16_t *data, uint16_t length) ;
- extern uint16_t avg_v_cal(uint16_t *data, uint16_t length) ;
- extern uint32_t ADC1_Buffer[ADC1_CHANEL_COUNT*ADC1_SAMPLE_COUNT];
- extern uint32_t ADC2_Buffer[ADC2_CHANEL_COUNT*ADC2_SAMPLE_COUNT];
- extern uint16_t ADC2_Buffer_Each[ADC2_CHANEL_COUNT][ADC2_SAMPLE_COUNT];
- extern uint32_t ADC3_Buffer[ADC3_CHANEL_COUNT*ADC3_SAMPLE_COUNT];
- extern uint16_t ADC3_Buffer_Each[ADC3_CHANEL_COUNT][ADC3_SAMPLE_COUNT];
- extern uint8_t isDMAEnd_ADC1;
- extern uint8_t isDMAEnd_ADC2;
- extern uint8_t isDMAEnd_ADC3;
- struct ADC_VALUE{
- MOVE_AVG_FILTER ADC3_IN9_Voltage_L1;
- MOVE_AVG_FILTER ADC3_IN14_UL_1998;
- MOVE_AVG_FILTER ADC3_IN15_Temp;
- MOVE_AVG_FILTER ADC3_IN4_GMI_VL1;
- MOVE_AVG_FILTER ADC3_IN5_Current_L2;
- MOVE_AVG_FILTER ADC3_IN6_Current_L3;
- MOVE_AVG_FILTER ADC3_IN7_Current_L1;
- MOVE_AVG_FILTER ADC3_IN8_Voltage_L2;
- MOVE_AVG_FILTER ADC3_IN10_Voltage_L3;
- MOVE_AVG_FILTER ADC1_IN4_CP;
- MOVE_AVG_FILTER ADC2_IN5_Welding;
- MOVE_AVG_FILTER ADC2_IN6_GF;
- };
- extern struct ADC_VALUE adc_value;
- extern uint16_t ADCWDGHighThreshold;
- extern uint16_t ADCWDGLowThreshold;
- extern uint8_t is60Hz;
- /* USER CODE END Prototypes */
- #ifdef __cplusplus
- }
- #endif
- #endif /*__ adc_H */
- /**
- * @}
- */
- /**
- * @}
- */
- /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|