//
// Created by ilya on 20.06.24.
//

#ifndef AMPLIFIER_AW87579_H
#define AMPLIFIER_AW87579_H
#include "stdbool.h"
#include "stdint.h"

#include "Amplifier_AW87579_addres.h"
#include "Amplifier_AW87579_regs.h"
#include "Amplifier_AW87579_list.h"
#include "I2cIO.h"

#define AW87579_IO_TIMEOUT 0xFFFF

#define xAmplifierAW87579_I2cWrite(I2C,I2CPack,I2CPackLen) I2cWrite(I2C,AW87579_Addres_Write,I2CPack,I2CPackLen,AW87579_IO_TIMEOUT)
#define xAmplifierAW87579_I2cRead(I2C,I2CPack,I2CPackLen) I2cRead(I2C,AW87579_Addres_Read,I2CPack,I2CPackLen,AW87579_IO_TIMEOUT)

bool xAmplifierAW87579_SetSistemControl(tI2cIO *i2c, tAW87579_SYSCTR values);

bool xAmplifierAW87579_SetBatterySafeguard(tI2cIO *i2c, tAW87579_BATSAFE values);

bool xAmplifierAW87579_SetBoostOutputVoltage(tI2cIO *i2c, tAW87579_BSTVOUT values);

bool xAmplifierAW87579_SetBoostControl(tI2cIO *i2c, tAW87579_BSTCPR2 values);

bool xAmplifierAW87579_SetGainControl(tI2cIO *i2c, tAW87579_PAGR values);

bool xAmplifierAW87579_SetAGC3OutputPower(tI2cIO *i2c, tAW87579_PAGC3OPR values);

bool xAmplifierAW87579_SetAGC3Parameter(tI2cIO *i2c, tAW87579_PAGC3PR values);

bool xAmplifierAW87579_SetAG2OutputPower(tI2cIO *i2c, tAW87579_PAGC2OPR values);

bool xAmplifierAW87579_SetAGC2Parameter(tI2cIO *i2c, tAW87579_PAGC2PR values);

bool xAmplifierAW87579_SetAGC1Parameter(tI2cIO *i2c, tAW87579_PAGC1PR values);

bool xAmplifierAW87579_SetADPMode(tI2cIO *i2c, tAW87579_ADP_MODE values);

bool xAmplifierAW87579_SetADPBoost(tI2cIO *i2c, tAW87579_ADPBST_TIME1 values);

bool xAmplifierAW87579_SetADPBoostVTH(tI2cIO *i2c, tAW87579_ADPBST_VTH values);



void xAmplifierAW87579_GetGainControlReg(tI2cIO *i2c, uint8_t *res);

void xAmplifierAW87579_GetBoostOutputVoltageReg(tI2cIO *i2c, uint8_t *res);

void xAmplifierAW87579_GetBoostControlReg(tI2cIO *i2c, uint8_t *res);

void xAmplifierAW87579_GetADPBoostVthReg(tI2cIO *i2c, uint8_t *res);

void xAmplifierAW87579_GetADPBoostModeReg(tI2cIO *i2c, uint8_t *res);

void xAmplifierAW87579_GetADG1ModeReg(tI2cIO *i2c, uint8_t *res);

void xAmplifierAW87579_GetADG3ModeOpReg(tI2cIO *i2c, uint8_t *res);

void xAmplifierAW87579_GetADG3ModeReg(tI2cIO *i2c, uint8_t *res);

void XfcProtMethod_GetAGC2OprParamModeReg(tI2cIO *i2c, uint8_t *res);

void XfcProtMethod_GetAGC2ParamModeReg(tI2cIO *i2c, uint8_t *res);

void XfcProtMethod_GetEnBoostReg(tI2cIO *i2c, uint8_t *res);

bool xAmplifierAW87579_SetAll(tI2cIO *i2c, tAW87579_RegsList list);
#endif //AMPLIFIER_AW87579_H
