#ifndef _Motor_ADC_H__ // ֹظͷļ
#define _Motor_ADC_H__

#include "general_def.h"
#include "bsp_adc.h" //  ADC ͷļ

#define ADC_HSPI (hadc1) // ȡSPI;

//  ADC ƫýṹ壬ڴ洢ƫֵ
typedef struct
{
    ADC_HandleTypeDef *hadc;    // ADC 
    float Temp_Result;          // ¶
    float Ia_offset;            // Ia ƫ
    float Ib_offset;            // Ib ƫ
    float Ic_offset;            // Ic ƫ
    float current_offset_sum_a; // Ia ƫú
    float current_offset_sum_b; // Ib ƫú
    float current_offset_sum_c; // Ic ƫú
} CURRENT_DATA;

extern CURRENT_DATA current_data;

/* adcֶͨ壬Լʹ */
typedef enum
{
    adc1_ch1 = 0,
    adc1_ch2 = 1,
    adc1_ch3 = 2,
    adc1_ch4 = 3
} adc1_num;

typedef enum
{
    adc2_ch12 = 0,
} adc2_num;

void GetTempNtc(uint16_t value_adc, float *value_temp);
uint16_t adc1_median_filter(uint8_t channel);
uint16_t adc1_avg_filter(uint8_t channel);
uint16_t adc2_median_filter(uint8_t channel);
uint16_t adc2_avg_filter(uint8_t channel);
#endif // _Motor_ADC_H__
