/*
 * detect_errors_adc.h
 *
 *  Created on: 7 δεκ. 2020 γ.
 *      Author: star
 */

#ifndef SRC_MAIN_DETECT_ERRORS_ADC_H_
#define SRC_MAIN_DETECT_ERRORS_ADC_H_

#include <detect_error_3_phase.h>

typedef struct {
    SETUP_3_PHASE_PROTECT U_in;
    SETUP_3_PHASE_PROTECT I_out;

    _iq iqI_zpt;
    _iq iqI_break;

} ANALOG_PROTECT_LEVELS;

#define ANALOG_PROTECT_LEVELS_DEFAULTS { SETUP_3_PHASE_PROTECT_DEFAULTS, \
                                        SETUP_3_PHASE_PROTECT_DEFAULTS, \
                                        0,0}

typedef struct {
    DETECT_PROTECT_3_PHASE in_voltage[2];
    DETECT_PROTECT_3_PHASE out_I[2];

    _iq iqI_zpt_level;
    _iq iqI_break_level;
} ANALOG_ADC_PROTECT;

#define ANALOG_ADC_PROTECT_DEFAULTS { \
    {DETECT_PROTECT_3_PHASE_DEFAULTS,DETECT_PROTECT_3_PHASE_DEFAULTS},\
    {DETECT_PROTECT_3_PHASE_DEFAULTS,DETECT_PROTECT_3_PHASE_DEFAULTS},\
    0,0  }

void init_analog_protect_levels(void);
void detect_protect_adc (_iq teta_ch1, _iq teta_ch2);
void reinit_protect_I_and_U_settings(void);


extern ANALOG_ADC_PROTECT analog_protect;
#endif /* SRC_MAIN_DETECT_ERRORS_ADC_H_ */
