Init
This commit is contained in:
commit
213d24ee39
Binary file not shown.
|
|
@ -0,0 +1,71 @@
|
|||
//
|
||||
// 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
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
//
|
||||
// Created by ilya on 20.06.24.
|
||||
//
|
||||
|
||||
#ifndef AMPLIFIER_AW87579_ADDRES_H
|
||||
#define AMPLIFIER_AW87579_ADDRES_H
|
||||
|
||||
/*
|
||||
* AW87579 Address
|
||||
*/
|
||||
|
||||
#ifdef AW87579_ADPinConnectToGND
|
||||
#define AW87579_Addres 0x58
|
||||
#endif
|
||||
|
||||
#ifdef AW87579_ADPinConnectToSCL
|
||||
#define AW87579_Addres 0x59
|
||||
#endif
|
||||
|
||||
#ifdef AW87579_ADPinConnectToSDA
|
||||
#define AW87579_Addres 0x5A
|
||||
#endif
|
||||
|
||||
#ifdef AW87579_ADPinConnectToVDD
|
||||
#define AW87579_Addres 0x5B
|
||||
#endif
|
||||
|
||||
#ifndef AW87579_Addres
|
||||
#define AW87579_Addres 0x58
|
||||
#endif
|
||||
|
||||
#define AW87579_Addres_Write ((AW87579_Addres<<1)|0)
|
||||
#define AW87579_Addres_Read ((AW87579_Addres<<1)|1)
|
||||
|
||||
|
||||
#endif //AMPLIFIER_AW87579_ADDRES_H
|
||||
|
|
@ -0,0 +1,275 @@
|
|||
//
|
||||
// Created by ilya on 20.06.24.
|
||||
//
|
||||
|
||||
#ifndef AMPLIFIER_AW87579_ENUM_H
|
||||
#define AMPLIFIER_AW87579_ENUM_H
|
||||
|
||||
|
||||
/*
|
||||
* Battery safe guard deglitch time.
|
||||
*/
|
||||
typedef enum {
|
||||
BAT_SFGD_DEGLITCH_1ms = 0b00,
|
||||
BAT_SFGD_DEGLITCH_500us = 0b01,
|
||||
BAT_SFGD_DEGLITCH_200us = 0b10,
|
||||
BAT_SFGD_DEGLITCH_Disable = 0b11
|
||||
}eBAT_SFGD_DEGLITCH;
|
||||
|
||||
|
||||
/*
|
||||
* Battery voltage when enter into battery safe_guard
|
||||
* mode.
|
||||
*/
|
||||
typedef enum {
|
||||
BAT_SFGD_VTH_3_3V = 0b00,
|
||||
BAT_SFGD_VTH_3_4V = 0b01,
|
||||
BAT_SFGD_VTH_3_5V = 0b10,
|
||||
BAT_SFGD_VTH_3_6V = 0b11
|
||||
}eBAT_SFGD_VTH;
|
||||
|
||||
|
||||
/*
|
||||
* Maxim output level when enter into battery safe_guard
|
||||
* mode
|
||||
*/
|
||||
typedef enum {
|
||||
BAT_SFGD_LEVEL_5V = 0b00,
|
||||
BAT_SFGD_LEVEL_5_5V = 0b01,
|
||||
BAT_SFGD_LEVEL_6V = 0b10,
|
||||
BAT_SFGD_LEVEL_6_5V = 0b11
|
||||
}eBAT_SFGD_LEVEL;
|
||||
|
||||
|
||||
/*
|
||||
* BOOST OUTPUT VOLTAGE set
|
||||
*/
|
||||
typedef enum {
|
||||
BST_VOUT_6_5V = 0b00000,
|
||||
BST_VOUT_6_75V = 0b00001,
|
||||
BST_VOUT_7V = 0b00010,
|
||||
BST_VOUT_7_25V = 0b00011,
|
||||
BST_VOUT_7_5V = 0b00100,
|
||||
BST_VOUT_7_75V = 0b00101,
|
||||
BST_VOUT_8V = 0b00110,
|
||||
BST_VOUT_8_25V = 0b00111,
|
||||
BST_VOUT_8_5V = 0b01000,
|
||||
BST_VOUT_8_75V = 0b01001,
|
||||
BST_VOUT_9V = 0b01010,
|
||||
BST_VOUT_9_25V = 0b01011,
|
||||
BST_VOUT_9_5V = 0b01100,
|
||||
BST_VOUT_9_75V = 0b01101,
|
||||
BST_VOUT_10V = 0b01110,
|
||||
BST_VOUT_10_25V = 0b01111,
|
||||
BST_VOUT_10_5V = 0b10000,
|
||||
BST_VOUT_10_75V = 0b10001,
|
||||
BST_VOUT_11V = 0b10010,
|
||||
BST_VOUT_11_25V = 0b10011,
|
||||
BST_VOUT_11_5V = 0b10100,
|
||||
BST_VOUT_11_75V = 0b10101,
|
||||
BST_VOUT_12V = 0b10110,
|
||||
}eBST_VOUT;
|
||||
|
||||
|
||||
/*
|
||||
* BOOST peak current limit
|
||||
*/
|
||||
typedef enum {
|
||||
BST_IPEAK_2A = 0b0010,
|
||||
BST_IPEAK_2_25A = 0b0011,
|
||||
BST_IPEAK_2_5A = 0b0100,
|
||||
BST_IPEAK_2_75A = 0b0101,
|
||||
BST_IPEAK_3A = 0b0110,
|
||||
BST_IPEAK_3_25A = 0b0111,
|
||||
BST_IPEAK_3_5A = 0b1000,
|
||||
BST_IPEAK_3_75A = 0b1001,
|
||||
BST_IPEAK_4A = 0b1010,
|
||||
BST_IPEAK_4_25A = 0b1011,
|
||||
BST_IPEAK_4_5A = 0b1100,
|
||||
}eBST_IPEAK;
|
||||
|
||||
|
||||
/*
|
||||
* Speaker Protection output Power Leve
|
||||
*/
|
||||
typedef enum {
|
||||
AGC3OP_0_5W_8ohm_OR_0_67W_6ohm = 0b0000,
|
||||
AGC3OP_0_6W_8ohm_OR_0_8W_6ohm = 0b0001,
|
||||
AGC3OP_0_7W_8ohm_OR_0_93W_6ohm = 0b0010,
|
||||
AGC3OP_0_8W_8ohm_OR_1_07W_6ohm = 0b0011,
|
||||
AGC3OP_0_9W_8ohm_OR_1_2W_6ohm = 0b0100,
|
||||
AGC3OP_1W_8ohm_OR_1_33W_6ohm = 0b0101,
|
||||
AGC3OP_1_1W_8ohm_OR_1_47W_6ohm = 0b0110,
|
||||
AGC3OP_1_2W_8ohm_OR_1_6W_6ohm = 0b0111,
|
||||
AGC3OP_1_3W_8ohm_OR_1_73W_6ohm = 0b1000,
|
||||
AGC3OP_1_4W_8ohm_OR_1_87W_6ohm = 0b1001,
|
||||
AGC3OP_1_5W_8ohm_OR_2W_6ohm = 0b1010,
|
||||
AGC3OP_1_6W_8ohm_OR_2_13W_6ohm = 0b1011,
|
||||
AGC3OP_1_7W_8ohm_OR_2_27W_6ohm = 0b1100,
|
||||
AGC3OP_1_8W_8ohm_OR_2_4W_6ohm = 0b1101,
|
||||
AGC3OP_1_9W_8ohm_OR_2_53W_6ohm = 0b1110,
|
||||
AGC3OP_2W_8ohm_OR_2_67W_6ohm = 0b1111,
|
||||
}AGC3_OUTPUT_POWER;
|
||||
|
||||
typedef enum {
|
||||
PA_GAIN_0dB = 0b00000,
|
||||
PA_GAIN_1_5dB = 0b00001,
|
||||
PA_GAIN_3dB = 0b00010,
|
||||
PA_GAIN_4_5dB = 0b00011,
|
||||
PA_GAIN_6dB = 0b00100,
|
||||
PA_GAIN_7_5dB = 0b00101,
|
||||
PA_GAIN_9dB = 0b00110,
|
||||
PA_GAIN_10_5dB = 0b00111,
|
||||
PA_GAIN_12dB = 0b01000,
|
||||
PA_GAIN_13_5dB = 0b01001,
|
||||
PA_GAIN_15dB = 0b01010,
|
||||
PA_GAIN_16_5dB = 0b01011,
|
||||
PA_GAIN_18dB = 0b01100,
|
||||
PA_GAIN_19_5dB = 0b01101,
|
||||
PA_GAIN_21dB = 0b01110,
|
||||
PA_GAIN_22_5dB = 0b01111,
|
||||
PA_GAIN_24dB = 0b10000,
|
||||
PA_GAIN_25_5dB = 0b10001,
|
||||
PA_GAIN_27dB = 0b10010,
|
||||
}PA_GAIN;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Total 13.5dB release time
|
||||
*/
|
||||
typedef enum {
|
||||
AGC3_REL_TIME_5_12ms_dB = 0b000,
|
||||
AGC3_REL_TIME_10_24ms_dB = 0b001,
|
||||
AGC3_REL_TIME_20_48ms_dB = 0b010,
|
||||
AGC3_REL_TIME_40_56ms_dB = 0b011,
|
||||
AGC3_REL_TIME_81_92ms_dB = 0b100,
|
||||
AGC3_REL_TIME_163_84ms_dB = 0b101,
|
||||
AGC3_REL_TIME_327_68ms_dB = 0b110,
|
||||
AGC3_REL_TIME_655_36ms_dB = 0b111,
|
||||
}eAGC3_REL_TIME;
|
||||
|
||||
|
||||
/*
|
||||
* Total 13.5dB attack time
|
||||
*/
|
||||
typedef enum {
|
||||
AGC3_ATT_TIME_1_28ms_dB = 0b000,
|
||||
AGC3_ATT_TIME_2_56ms_dB = 0b001,
|
||||
AGC3_ATT_TIME_10_24ms_dB = 0b010,
|
||||
AGC3_ATT_TIME_40_96ms_dB = 0b011,
|
||||
AGC3_ATT_TIME_82ms_dB = 0b100,
|
||||
AGC3_ATT_TIME_164ms_dB = 0b101,
|
||||
AGC3_ATT_TIME_328ms_dB = 0b110,
|
||||
AGC3_ATT_TIME_656ms_dB = 0b111,
|
||||
}eAGC3_ATT_TIME;
|
||||
|
||||
|
||||
/*
|
||||
* AGC2 Protection output Power Leve
|
||||
*/
|
||||
typedef enum {
|
||||
AGC2OP_1W_8ohm_OR_1_33W_6ohm = 0b0000,
|
||||
AGC2OP_1_2W_8ohm_OR_1_6W_6ohm = 0b0001,
|
||||
AGC2OP_1_4W_8ohm_OR_1_87W_6ohm = 0b0010,
|
||||
AGC2OP_1_6W_8ohm_OR_2_13W_6ohm = 0b0011,
|
||||
AGC2OP_1_8W_8ohm_OR_2_4W_6ohm = 0b0100,
|
||||
AGC2OP_2W_8ohm_OR_2_67W_6ohm = 0b0101,
|
||||
AGC2OP_2_2W_8ohm_OR_2_93W_6ohm = 0b0110,
|
||||
AGC2OP_2_4W_8ohm_OR_3_2W_6ohm = 0b0111,
|
||||
AGC2OP_2_6W_8ohm_OR_3_47W_6ohm = 0b1000,
|
||||
AGC2OP_2_8W_8ohm_OR_3_73W_6ohm = 0b1001,
|
||||
AGC2OP_3W_8ohm_OR_4W_6ohm = 0b1010,
|
||||
AGC2OP_OFF = 0b1011,
|
||||
}AGC2_OUTPUT_POWER;
|
||||
|
||||
|
||||
/*
|
||||
* AGC2 total attack time
|
||||
*/
|
||||
typedef enum {
|
||||
AGC2_ATT_TIME_0_16ms_dB = 0b000,
|
||||
AGC2_ATT_TIME_0_32ms_dB = 0b001,
|
||||
AGC2_ATT_TIME_0_64ms_dB = 0b010,
|
||||
AGC2_ATT_TIME_2_56ms_dB = 0b011,
|
||||
AGC2_ATT_TIME_10_24ms_dB = 0b100,
|
||||
AGC2_ATT_TIME_40_96ms_dB = 0b101,
|
||||
AGC2_ATT_TIME_82ms_dB = 0b110,
|
||||
AGC2_ATT_TIME_164ms_dB = 0b111,
|
||||
}eAGC2_ATT_TIME;
|
||||
|
||||
|
||||
/*
|
||||
* Fastest Level AGC attack time control
|
||||
*/
|
||||
typedef enum {
|
||||
AGC1_ATT_TIME_0_04ms_dB = 0b00,
|
||||
AGC1_ATT_TIME_0_08ms_dB = 0b01,
|
||||
AGC1_ATT_TIME_0_16ms_dB = 0b10,
|
||||
AGC1_ATT_TIME_0_32ms_dB = 0b11,
|
||||
}eAGC1_ATT_TIME;
|
||||
|
||||
|
||||
/*
|
||||
* BOOST_MODE
|
||||
*/
|
||||
typedef enum {
|
||||
ADPBOOST_MODE_PassThrough = 0b000,
|
||||
ADPBOOST_MODE_ForceBOOST = 0b001,
|
||||
ADPBOOST_MODE_MD1 = 0b010,
|
||||
ADPBOOST_MODE_MD2 = 0b011
|
||||
}eADPBOOST_MODE;
|
||||
|
||||
|
||||
/*
|
||||
* Duration time Po less than Po2
|
||||
*/
|
||||
typedef enum {
|
||||
ADP_BST_TIME_20ms = 0b0101,
|
||||
ADP_BST_TIME_30ms = 0b0110,
|
||||
ADP_BST_TIME_40ms = 0b0111,
|
||||
ADP_BST_TIME_65ms = 0b1000,
|
||||
ADP_BST_TIME_80ms = 0b1001,
|
||||
ADP_BST_TIME_100ms = 0b1010,
|
||||
ADP_BST_TIME_120ms = 0b1011,
|
||||
ADP_BST_TIME_140ms = 0b1100,
|
||||
ADP_BST_TIME_160ms = 0b1101,
|
||||
ADP_BST_TIME_320ms = 0b1110,
|
||||
ADP_BST_TIME_480ms = 0b1111,
|
||||
}eADP_BST_TIME;
|
||||
|
||||
|
||||
/*
|
||||
* ADP BOOST mode2 first step set BOOST_OUT<4:0>
|
||||
*/
|
||||
typedef enum {
|
||||
ADP_LOW_STEP_1st_BST_OUT_6_5V = 0b00,
|
||||
ADP_LOW_STEP_1st_BST_OUT_6_75V = 0b01,
|
||||
ADP_LOW_STEP_1st_BST_OUT_7V = 0b10,
|
||||
ADP_LOW_STEP_1st_BST_OUT_7_25V = 0b11,
|
||||
}eADP_LOW_STEP;
|
||||
|
||||
|
||||
/*
|
||||
* Boost threshold Po2
|
||||
*/
|
||||
typedef enum {
|
||||
SET_BOOST_VTH2_1_2W = 0b000,
|
||||
SET_BOOST_VTH2_1_4W = 0b001,
|
||||
SET_BOOST_VTH2_1_6W = 0b010,
|
||||
SET_BOOST_VTH2_1_8W = 0b011,
|
||||
SET_BOOST_VTH2_2_0W = 0b100,
|
||||
SET_BOOST_VTH2_2_2W = 0b101,
|
||||
}eSET_BOOST_VTH2;
|
||||
|
||||
|
||||
/*
|
||||
* Boost threshold Po1
|
||||
*/
|
||||
typedef enum {
|
||||
SET_BOOST_VTH1_0_1W = 0b000,
|
||||
SET_BOOST_VTH1_0_2W = 0b001,
|
||||
SET_BOOST_VTH1_0_3W = 0b010,
|
||||
SET_BOOST_VTH1_0_4W = 0b011,
|
||||
}eSET_BOOST_VTH1;
|
||||
#endif //AMPLIFIER_AW87579_ENUM_H
|
||||
|
|
@ -0,0 +1,232 @@
|
|||
//
|
||||
// Created by ilya on 20.06.24.
|
||||
//
|
||||
|
||||
#ifndef AMPLIFIER_AW87579_LIST_H
|
||||
#define AMPLIFIER_AW87579_LIST_H
|
||||
#include "Amplifier_AW87579_enum.h"
|
||||
/*
|
||||
* Default data
|
||||
*/
|
||||
|
||||
#define AW87579_ID_DEFAULT 0x5A
|
||||
#define AW87579_SYSCTRL_DEFAULT 0x38
|
||||
#define AW87579_BATSAFE_DEFAULT 0x09
|
||||
#define AW87579_BSTOVR_DEFAULT 0x0C
|
||||
#define AW87579_BSTCPR2_DEFAULT 0x08
|
||||
#define AW87579_PAGR_DEFAULT 0x10
|
||||
#define AW87579_PAGC3OPR_DEFAULT 0x43
|
||||
#define AW87579_PAGC3PR_DEFAULT 0x4E
|
||||
#define AW87579_PAGC2OPR_DEFAULT 0x03
|
||||
#define AW87579_PAGC2PR_DEFAULT 0x08
|
||||
#define AW87579_PAGC1PR_DEFAULT 0x4A
|
||||
#define AW87579_ADP_MODE_DEFAULT 0x03
|
||||
#define AW87579_ADPBST_TIME1_DEFAULT 0xDD
|
||||
#define AW87579_ADPBST_VTH_DEFAULT 0x23
|
||||
|
||||
/*
|
||||
* List
|
||||
*/
|
||||
#define def_id 0
|
||||
#define def_sysctr 1
|
||||
#define def_batsafe 2
|
||||
#define def_bstvout 3
|
||||
#define def_bstcpr2 5
|
||||
#define def_pagr 6
|
||||
#define def_pagc3Opr 7
|
||||
#define def_pagc3Pr 8
|
||||
#define def_pagc2Opr 9
|
||||
#define def_pagc2Pr 10
|
||||
#define def_pagc1Pr 11
|
||||
#define def_adpMode 12
|
||||
#define def_adpbstTime1 13
|
||||
#define def_adpbstVth 14
|
||||
|
||||
|
||||
// CHIP ID REGISTER
|
||||
typedef struct {
|
||||
uint8_t IDCODE:7; // Chip ID will be returned after reading.
|
||||
}tAW87579_ChipId;
|
||||
|
||||
|
||||
// SYSTEM CONTROL (SYSCTR) REGISTER
|
||||
typedef union {
|
||||
uint8_t data:8;
|
||||
struct __attribute__((packed)){
|
||||
bool EN_HVBAT: 1; // Enable high voltage battery
|
||||
uint8_t res: 1;
|
||||
bool RCV_MODE: 1; // Receiver mode
|
||||
bool EN_PA: 1; // PA Enable.
|
||||
bool EN_BOOST: 1; //Boost Enable.
|
||||
uint8_t : 1;
|
||||
bool EN_SW: 1; //Chip software Enable
|
||||
uint8_t : 1;
|
||||
};
|
||||
}tAW87579_SYSCTR;
|
||||
#define SYSCTR_SET_RESERV(RES) RES = 0b1
|
||||
|
||||
|
||||
// BATTERY SAFEGUARD (BATSAFE) REGISTER
|
||||
typedef union {
|
||||
uint8_t data:8;
|
||||
struct __attribute__((packed)){
|
||||
eBAT_SFGD_LEVEL BAT_SFGD_LEVEL: 2; // Maxim output level when enter into battery safe_guard mode
|
||||
bool EN_BAT_SFGD: 1; // Software control battery safeguard
|
||||
eBAT_SFGD_VTH BAT_SFGD_VTH: 2; // Battery voltage when enter into battery safe_guard mode.
|
||||
eBAT_SFGD_DEGLITCH BAT_SFGD_DEGLITCH: 2; // Battery safe guard deglitch time.
|
||||
uint8_t : 1;
|
||||
};
|
||||
}tAW87579_BATSAFE;
|
||||
|
||||
|
||||
// BOOST OUTPUT VOLTAGE (BSTVOUT) REGISTER
|
||||
typedef union {
|
||||
uint8_t data:8;
|
||||
struct __attribute__((packed)){
|
||||
eBST_VOUT BST_VOUT: 5; // BOOST output voltage set
|
||||
uint8_t : 3;
|
||||
};
|
||||
}tAW87579_BSTVOUT;
|
||||
|
||||
|
||||
// BOOSTBOOST CONTROL (BSTCPR2)REGISTER
|
||||
typedef union {
|
||||
uint8_t data:8;
|
||||
struct __attribute__((packed)){
|
||||
eBST_IPEAK BST_IPEAK: 4; // BOOST peak current limit
|
||||
uint8_t : 4;
|
||||
};
|
||||
}tAW87579_BSTCPR2;
|
||||
|
||||
|
||||
// CLASS D GAIN CONTROL (PAGR) REGISTER
|
||||
/*
|
||||
* PA Input SignalGain
|
||||
* when RCV_MODE=1 PA_GAIN must be set to 00000~00111
|
||||
* (0dB~9dB)
|
||||
* when RCV_MODE=0 PA_GAIN must be set to 01000~10010
|
||||
* (12dB~27dB)
|
||||
*/
|
||||
typedef union {
|
||||
uint8_t data:8;
|
||||
struct __attribute__((packed)){
|
||||
uint8_t PA_GAIN: 5;
|
||||
uint8_t : 3;
|
||||
};
|
||||
}tAW87579_PAGR;
|
||||
|
||||
#define PA_GAIN_SET__dB_RCV_MODE_EN(DB) (DB<1.5?0b00000:(DB>10.5?0b00111:(uint8_t)(DB/1.5)))
|
||||
#define PA_GAIN_SET__dB_RCV_MODE_DIS(DB) (DB<12?0b01000:(DB>27?0b10010:(uint8_t)(DB/1.5)))
|
||||
#define PA_GAIN_SET__dB(RCV_MODE,DB) RCV_MODE == false?PA_GAIN_SET__dB_RCV_MODE_DIS(DB):PA_GAIN_SET__dB_RCV_MODE_EN(DB)
|
||||
|
||||
|
||||
// CLASS D AGC3 OUTPUT POWER (AGC3_Po)(PAGC3OPR) REGISTER
|
||||
typedef union {
|
||||
uint8_t data:8;
|
||||
struct __attribute__((packed)){
|
||||
AGC3_OUTPUT_POWER AGC3_OUTPUT_POWER: 4; // Speaker Protection output Power Level
|
||||
bool PD_AGC3: 1; // Disable AGC3
|
||||
uint8_t res: 3;
|
||||
};
|
||||
}tAW87579_PAGC3OPR;
|
||||
#define PAGC3OPR_SET_RESERV(RES) RES = 0b010
|
||||
|
||||
|
||||
|
||||
// CLASS D AGC3 PARAMETER REGISTER
|
||||
typedef union {
|
||||
uint8_t data:8;
|
||||
struct __attribute__((packed)){
|
||||
uint8_t res: 2;
|
||||
eAGC3_ATT_TIME AGC3_ATT_TIME: 3; // Total 13.5dB attack time
|
||||
eAGC3_REL_TIME AGC3_REL_TIME: 3; // Total 13.5dB release time
|
||||
};
|
||||
}tAW87579_PAGC3PR;
|
||||
#define PAGC3PR_SET_RESERV(RES) RES = 0b10
|
||||
|
||||
|
||||
|
||||
// CLASS D AGC2 OUTPUT POWER (AGC2_Po) REGISTER
|
||||
typedef union {
|
||||
uint8_t data:8;
|
||||
struct __attribute__((packed)){
|
||||
AGC2_OUTPUT_POWER AGC2_OUTPUT_POWER: 4; // Speaker Protection output Power Level
|
||||
uint8_t res: 4;
|
||||
};
|
||||
}tAW87579_PAGC2OPR;
|
||||
|
||||
|
||||
|
||||
// CLASS D AGC2 PARAMETER REGISTER
|
||||
typedef union {
|
||||
uint8_t data:8;
|
||||
struct __attribute__((packed)){
|
||||
uint8_t : 2;
|
||||
eAGC2_ATT_TIME AGC2_ATT_TIME: 3; // AGC2 total attack time
|
||||
uint8_t : 3;
|
||||
};
|
||||
}tAW87579_PAGC2PR;
|
||||
|
||||
|
||||
// CLASS D AGC1 PARAMETER (AGC1) REGISTER
|
||||
typedef union {
|
||||
uint8_t data:8;
|
||||
struct __attribute__((packed)){
|
||||
bool PD_AGC1: 1; // Disable fastest Level AGC
|
||||
eAGC1_ATT_TIME AGC1_ATT_TIME: 2; //Fastest Level AGC attack time control
|
||||
uint8_t res: 5;
|
||||
};
|
||||
}tAW87579_PAGC1PR;
|
||||
#define PAGC1PR_SET_RESERV(RES) RES = 0b01001
|
||||
|
||||
|
||||
// ADP MODE PARAMETER REGISTER
|
||||
typedef union {
|
||||
uint8_t data:8;
|
||||
struct __attribute__((packed)){
|
||||
eADPBOOST_MODE ADPBOOST_MODE: 3; // BOOST MODE
|
||||
bool AGC1_ATT_TIMEA: 1; // Fastest Levl AGC attack time control, Refer to 0x0B register
|
||||
uint8_t : 4;
|
||||
};
|
||||
}tAW87579_ADP_MODE;
|
||||
|
||||
|
||||
// ADP BOOST PARAMETER REGISTER
|
||||
typedef union {
|
||||
uint8_t data:8;
|
||||
struct __attribute__((packed)){
|
||||
eADP_BST_TIME ADP_BST_TIME1: 4; // Duration time Po less than Po1
|
||||
eADP_BST_TIME ADP_BST_TIME2: 4; // Duration time Po less than Po2
|
||||
};
|
||||
}tAW87579_ADPBST_TIME1;
|
||||
|
||||
|
||||
// ADP BOOST PARAMETER REGISTER
|
||||
typedef union {
|
||||
uint8_t data:8;
|
||||
struct __attribute__((packed)){
|
||||
eSET_BOOST_VTH1 SET_BOOST_VTH1: 3; // Boost threshold Po1
|
||||
eSET_BOOST_VTH2 SET_BOOST_VTH2: 3; // Boost threshold Po2
|
||||
eADP_LOW_STEP ADP_LOW_STEP: 2; // ADP BOOST mode2 first step set BOOST_OUT<4:0>
|
||||
};
|
||||
|
||||
}tAW87579_ADPBST_VTH;
|
||||
|
||||
// AW87579 ALL LIST
|
||||
typedef struct __attribute__((packed)) {
|
||||
tAW87579_SYSCTR sysctr;
|
||||
tAW87579_BATSAFE batsafe;
|
||||
tAW87579_BSTVOUT bstvout;
|
||||
tAW87579_BSTCPR2 bstcpr2;
|
||||
tAW87579_PAGR pagr;
|
||||
tAW87579_PAGC3OPR pagc3Opr;
|
||||
tAW87579_PAGC3PR pagc3Pr;
|
||||
tAW87579_PAGC2OPR pagc2Opr;
|
||||
tAW87579_PAGC2PR pagc2Pr;
|
||||
tAW87579_PAGC1PR pagc1Pr;
|
||||
tAW87579_ADP_MODE adpMode;
|
||||
tAW87579_ADPBST_TIME1 adpbstTime1;
|
||||
tAW87579_ADPBST_VTH adpbstVth;
|
||||
}tAW87579_RegsList;
|
||||
|
||||
#endif //AMPLIFIER_AW87579_LIST_H
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
//
|
||||
// Created by ilya on 20.06.24.
|
||||
//
|
||||
|
||||
#ifndef AMPLIFIER_AW87579_REGS_H
|
||||
#define AMPLIFIER_AW87579_REGS_H
|
||||
|
||||
/*
|
||||
* Address registers
|
||||
*/
|
||||
|
||||
#define AW87579_REG_ID 0x00
|
||||
#define AW87579_REG_SYSCTRL 0x01
|
||||
#define AW87579_REG_BATSAFE 0x02
|
||||
#define AW87579_REG_BSTOVR 0x03
|
||||
#define AW87579_REG_BSTCPR2 0x05
|
||||
#define AW87579_REG_PAGR 0x06
|
||||
#define AW87579_REG_PAGC3OPR 0x07
|
||||
#define AW87579_REG_PAGC3PR 0x08
|
||||
#define AW87579_REG_PAGC2OPR 0x09
|
||||
#define AW87579_REG_PAGC2PR 0x0A
|
||||
#define AW87579_REG_PAGC1PR 0x0B
|
||||
#define AW87579_REG_ADP_MODE 0x0C
|
||||
#define AW87579_REG_ADPBST_TIME1 0x0D
|
||||
#define AW87579_REG_ADPBST_VTH 0x0F
|
||||
|
||||
#define AW87579_TOTAL_REG_COUNT 0x0D
|
||||
|
||||
#endif //AMPLIFIER_AW87579_REGS_H
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
Адрес устройства настраивается одним из четырех define:
|
||||
|
||||
AW87579_ADPinConnectToGND
|
||||
|
||||
AW87579_ADPinConnectToSCL
|
||||
|
||||
AW87579_ADPinConnectToSDA
|
||||
|
||||
AW87579_ADPinConnectToVDD
|
||||
|
||||
По умолчанию адрес устанавливается AW87579_ADPinConnectToGND
|
||||
|
||||
Пример использования драйвера:
|
||||
|
||||
tAW87579_RegsList list = {
|
||||
.sysctr.EN_SW = true,
|
||||
.sysctr.EN_PA = true,
|
||||
.sysctr.EN_BOOST = true,
|
||||
.sysctr.RCV_MODE = false,
|
||||
.sysctr.EN_HVBAT = false,
|
||||
|
||||
.batsafe.EN_BAT_SFGD = true,
|
||||
.batsafe.BAT_SFGD_LEVEL = BAT_SFGD_LEVEL_6_5V,
|
||||
.batsafe.BAT_SFGD_VTH = BAT_SFGD_VTH_3_6V,
|
||||
.batsafe.BAT_SFGD_DEGLITCH = BAT_SFGD_DEGLITCH_1ms,
|
||||
|
||||
.bstvout.BST_VOUT = BST_VOUT_8V,
|
||||
|
||||
.bstcpr2.BST_IPEAK = BST_IPEAK_3A,
|
||||
|
||||
.pagr.PA_GAIN = PA_GAIN_SET__dB(false,27),
|
||||
|
||||
.pagc3Opr.PD_AGC3 = false,
|
||||
.pagc3Opr.AGC3_OUTPUT_POWER = AGC3OP_2W_8ohm_OR_2_67W_6ohm,
|
||||
|
||||
.pagc3Pr.AGC3_REL_TIME = AGC3_REL_TIME_40_56ms_dB,
|
||||
.pagc3Pr.AGC3_ATT_TIME = AGC3_ATT_TIME_82ms_dB,
|
||||
|
||||
.pagc2Opr.AGC2_OUTPUT_POWER = AGC2OP_3W_8ohm_OR_4W_6ohm,
|
||||
|
||||
.pagc2Pr.AGC2_ATT_TIME = AGC2_ATT_TIME_0_32ms_dB,
|
||||
|
||||
.pagc1Pr.PD_AGC1 = false,
|
||||
.pagc1Pr.AGC1_ATT_TIME = AGC1_ATT_TIME_0_16ms_dB,
|
||||
|
||||
.adpMode.AGC1_ATT_TIMEA = false,
|
||||
.adpMode.ADPBOOST_MODE = ADPBOOST_MODE_PassThrough,
|
||||
|
||||
.adpbstTime1.ADP_BST_TIME1 = ADP_BST_TIME_160ms,
|
||||
.adpbstTime1.ADP_BST_TIME2 = ADP_BST_TIME_140ms,
|
||||
|
||||
.adpbstVth.ADP_LOW_STEP = ADP_LOW_STEP_1st_BST_OUT_6_5V,
|
||||
.adpbstVth.SET_BOOST_VTH1 = SET_BOOST_VTH1_0_1W,
|
||||
.adpbstVth.SET_BOOST_VTH2 = SET_BOOST_VTH2_2_2W
|
||||
};
|
||||
|
||||
xAmplifierAW87579_SetAll(env->ampl, list);
|
||||
|
||||
Для отправки данных на адрес устройства и для их чтения
|
||||
используются:
|
||||
|
||||
#define xAmplifierAW87579_I2cWrite(I2C,I2CPack,I2CPackLen)
|
||||
|
||||
#define xAmplifierAW87579_I2cRead(I2C,I2CPack,I2CPackLen)
|
||||
|
|
@ -0,0 +1,251 @@
|
|||
//
|
||||
// Created by ilya on 20.06.24.
|
||||
//
|
||||
#include <string.h>
|
||||
#include "Amplifier_AW87579.h"
|
||||
#include "SystemDelayInterface.h"
|
||||
|
||||
#define IfNotOkRet(FUN) if(FUN == false){return false;}
|
||||
|
||||
bool xAmplifierAW87579_SetSistemControl(tI2cIO *i2c, tAW87579_SYSCTR values){
|
||||
uint8_t I2C_Out[2] = {0};
|
||||
I2C_Out[0] = AW87579_REG_SYSCTRL;
|
||||
I2C_Out[1] = 0x00|
|
||||
((values.EN_SW & 0b1) << 6)|
|
||||
(0b1<<5)|
|
||||
((values.EN_BOOST & 0b1) << 4)|
|
||||
((values.EN_PA & 0b1) << 3)|
|
||||
((values.RCV_MODE & 0b1) << 2)|
|
||||
(values.EN_HVBAT & 0b1) << 0;
|
||||
bool res = I2cWrite(i2c,AW87579_Addres_Write,I2C_Out,2,AW87579_IO_TIMEOUT);
|
||||
SystemDelayMs(10);
|
||||
return res;
|
||||
}
|
||||
|
||||
bool xAmplifierAW87579_SetBatterySafeguard(tI2cIO *i2c, tAW87579_BATSAFE values){
|
||||
uint8_t I2C_Out[3] = {0};
|
||||
I2C_Out[0] = AW87579_REG_BATSAFE;
|
||||
I2C_Out[1] = 0x00|
|
||||
((values.BAT_SFGD_DEGLITCH & 0b11) << 5)|
|
||||
((values.BAT_SFGD_VTH & 0b11) << 3)|
|
||||
((values.EN_BAT_SFGD & 0b1) << 2)|
|
||||
(values.BAT_SFGD_LEVEL & 0b11) << 0;
|
||||
bool res = I2cWrite(i2c,AW87579_Addres_Write,I2C_Out,2,AW87579_IO_TIMEOUT);
|
||||
SystemDelayMs(10);
|
||||
return res;
|
||||
}
|
||||
|
||||
bool xAmplifierAW87579_SetBoostOutputVoltage(tI2cIO *i2c, tAW87579_BSTVOUT values){
|
||||
uint8_t I2C_Out[3] = {0};
|
||||
I2C_Out[0] = AW87579_REG_BSTOVR;
|
||||
I2C_Out[1] = 0x00|
|
||||
((values.BST_VOUT & 0b11111) << 0);
|
||||
bool res = I2cWrite(i2c,AW87579_Addres_Write,I2C_Out,2,AW87579_IO_TIMEOUT);
|
||||
SystemDelayMs(10);
|
||||
return res;
|
||||
}
|
||||
|
||||
bool xAmplifierAW87579_SetBoostControl(tI2cIO *i2c, tAW87579_BSTCPR2 values){
|
||||
uint8_t I2C_Out[3] = {0};
|
||||
I2C_Out[0] = AW87579_REG_BSTCPR2;
|
||||
I2C_Out[1] = 0x00|
|
||||
((values.BST_IPEAK & 0b1111) << 0);
|
||||
bool res = I2cWrite(i2c,AW87579_Addres_Write,I2C_Out,2,AW87579_IO_TIMEOUT);
|
||||
SystemDelayMs(10);
|
||||
return res;
|
||||
}
|
||||
|
||||
bool xAmplifierAW87579_SetGainControl(tI2cIO *i2c, tAW87579_PAGR values){
|
||||
uint8_t I2C_Out[3] = {0};
|
||||
I2C_Out[0] = AW87579_REG_PAGR;
|
||||
I2C_Out[1] = 0x00|
|
||||
((values.PA_GAIN & 0b11111) << 0);
|
||||
bool res = I2cWrite(i2c,AW87579_Addres_Write,I2C_Out,2,AW87579_IO_TIMEOUT);
|
||||
SystemDelayMs(10);
|
||||
return res;
|
||||
}
|
||||
|
||||
bool xAmplifierAW87579_SetAGC3OutputPower(tI2cIO *i2c, tAW87579_PAGC3OPR values){
|
||||
uint8_t I2C_Out[3] = {0};
|
||||
I2C_Out[0] = AW87579_REG_PAGC3OPR;
|
||||
I2C_Out[1] = 0x00|
|
||||
(0b010 << 5)|
|
||||
((values.PD_AGC3 & 0b1) << 4)|
|
||||
((values.AGC3_OUTPUT_POWER & 0b1111) << 0);
|
||||
bool res = I2cWrite(i2c,AW87579_Addres_Write,I2C_Out,2,AW87579_IO_TIMEOUT);
|
||||
SystemDelayMs(10);
|
||||
return res;
|
||||
}
|
||||
|
||||
bool xAmplifierAW87579_SetAGC3Parameter(tI2cIO *i2c, tAW87579_PAGC3PR values){
|
||||
uint8_t I2C_Out[3] = {0};
|
||||
I2C_Out[0] = AW87579_REG_PAGC3PR;
|
||||
I2C_Out[1] = 0x00|
|
||||
((values.AGC3_REL_TIME & 0b111) << 5)|
|
||||
((values.AGC3_ATT_TIME & 0b111) << 2)|
|
||||
(0b10 << 0);
|
||||
bool res = I2cWrite(i2c,AW87579_Addres_Write,I2C_Out,2,AW87579_IO_TIMEOUT);
|
||||
SystemDelayMs(10);
|
||||
return res;
|
||||
}
|
||||
|
||||
bool xAmplifierAW87579_SetAG2OutputPower(tI2cIO *i2c, tAW87579_PAGC2OPR values){
|
||||
uint8_t I2C_Out[3] = {0};
|
||||
I2C_Out[0] = AW87579_REG_PAGC2OPR;
|
||||
I2C_Out[1] = 0x00|
|
||||
((values.AGC2_OUTPUT_POWER & 0b1111) << 0);
|
||||
bool res = I2cWrite(i2c,AW87579_Addres_Write,I2C_Out,2,AW87579_IO_TIMEOUT);
|
||||
SystemDelayMs(10);
|
||||
return res;
|
||||
}
|
||||
|
||||
bool xAmplifierAW87579_SetAGC2Parameter(tI2cIO *i2c, tAW87579_PAGC2PR values){
|
||||
uint8_t I2C_Out[3] = {0};
|
||||
I2C_Out[0] = AW87579_REG_PAGC2PR;
|
||||
I2C_Out[1] = 0x00|
|
||||
((values.AGC2_ATT_TIME & 0b111) << 2);
|
||||
bool res = I2cWrite(i2c,AW87579_Addres_Write,I2C_Out,2,AW87579_IO_TIMEOUT);
|
||||
SystemDelayMs(10);
|
||||
return res;
|
||||
}
|
||||
|
||||
bool xAmplifierAW87579_SetAGC1Parameter(tI2cIO *i2c, tAW87579_PAGC1PR values){
|
||||
uint8_t I2C_Out[3] = {0};
|
||||
I2C_Out[0] = AW87579_REG_PAGC1PR;
|
||||
I2C_Out[1] = 0x00|
|
||||
(0b01001 << 3)|
|
||||
((values.AGC1_ATT_TIME & 0b11) << 1)|
|
||||
((values.PD_AGC1 & 0b1) << 0);
|
||||
bool res = I2cWrite(i2c,AW87579_Addres_Write,I2C_Out,2,AW87579_IO_TIMEOUT);
|
||||
SystemDelayMs(10);
|
||||
return res;
|
||||
}
|
||||
|
||||
bool xAmplifierAW87579_SetADPMode(tI2cIO *i2c, tAW87579_ADP_MODE values){
|
||||
uint8_t I2C_Out[3] = {0};
|
||||
I2C_Out[0] = AW87579_REG_ADP_MODE;
|
||||
I2C_Out[1] = 0x00|
|
||||
((values.AGC1_ATT_TIMEA & 0b1) << 3)|
|
||||
((values.ADPBOOST_MODE & 0b111) << 0);
|
||||
bool res = I2cWrite(i2c,AW87579_Addres_Write,I2C_Out,2,AW87579_IO_TIMEOUT);
|
||||
return res;
|
||||
}
|
||||
|
||||
bool xAmplifierAW87579_SetADPBoost(tI2cIO *i2c, tAW87579_ADPBST_TIME1 values){
|
||||
uint8_t I2C_Out[3] = {0};
|
||||
I2C_Out[0] = AW87579_REG_ADPBST_TIME1;
|
||||
I2C_Out[1] = 0x00|
|
||||
((values.ADP_BST_TIME2 & 0b1111) << 4)|
|
||||
((values.ADP_BST_TIME1 & 0b1111) << 0);
|
||||
bool res = I2cWrite(i2c,AW87579_Addres_Write,I2C_Out,2,AW87579_IO_TIMEOUT);
|
||||
SystemDelayMs(10);
|
||||
return res;
|
||||
}
|
||||
|
||||
bool xAmplifierAW87579_SetADPBoostVTH(tI2cIO *i2c, tAW87579_ADPBST_VTH values){
|
||||
uint8_t I2C_Out[3] = {0};
|
||||
I2C_Out[0] = AW87579_REG_ADPBST_VTH;
|
||||
I2C_Out[1] = 0x00|
|
||||
((values.ADP_LOW_STEP & 0b11) << 6)|
|
||||
((values.SET_BOOST_VTH2 & 0b111) << 3)|
|
||||
((values.SET_BOOST_VTH1 & 0b111) << 0);
|
||||
bool res = I2cWrite(i2c,AW87579_Addres_Write,I2C_Out,2,AW87579_IO_TIMEOUT);
|
||||
SystemDelayMs(10);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void xAmplifierAW87579_GetGainControlReg(tI2cIO *i2c, uint8_t *res){
|
||||
uint8_t reg = AW87579_REG_PAGR;
|
||||
I2cWrite( i2c, AW87579_Addres_Write | 0, ®, 1, AW87579_IO_TIMEOUT);
|
||||
I2cRead(i2c, AW87579_Addres_Read | 1, res, 1, AW87579_IO_TIMEOUT);
|
||||
}
|
||||
|
||||
void xAmplifierAW87579_GetBoostOutputVoltageReg(tI2cIO *i2c, uint8_t *res){
|
||||
uint8_t reg=AW87579_REG_BSTOVR;
|
||||
I2cWrite( i2c, AW87579_Addres_Write | 0, ®, 1, AW87579_IO_TIMEOUT);
|
||||
I2cRead(i2c, AW87579_Addres_Read | 1, res, 1, AW87579_IO_TIMEOUT);
|
||||
reg=AW87579_REG_BSTOVR;
|
||||
}
|
||||
|
||||
void xAmplifierAW87579_GetBoostControlReg(tI2cIO *i2c, uint8_t *res){
|
||||
uint8_t reg = AW87579_REG_BSTCPR2;
|
||||
I2cWrite( i2c, AW87579_Addres_Write | 0, ®, 1, AW87579_IO_TIMEOUT);
|
||||
I2cRead(i2c, AW87579_Addres_Read | 1, res, 1, AW87579_IO_TIMEOUT);
|
||||
reg=AW87579_REG_BSTCPR2;
|
||||
}
|
||||
|
||||
void xAmplifierAW87579_GetADPBoostVthReg(tI2cIO *i2c, uint8_t *res){
|
||||
uint8_t reg = AW87579_REG_ADPBST_VTH;
|
||||
I2cWrite( i2c, AW87579_Addres_Write | 0, ®, 1, AW87579_IO_TIMEOUT);
|
||||
I2cRead(i2c, AW87579_Addres_Read | 1, res, 1, AW87579_IO_TIMEOUT);
|
||||
reg=AW87579_REG_ADPBST_VTH;
|
||||
}
|
||||
|
||||
void xAmplifierAW87579_GetADPBoostModeReg(tI2cIO *i2c, uint8_t *res){
|
||||
uint8_t reg = AW87579_REG_ADP_MODE;
|
||||
I2cWrite( i2c, AW87579_Addres_Write | 0, ®, 1, AW87579_IO_TIMEOUT);
|
||||
I2cRead(i2c, AW87579_Addres_Read | 1, res, 1, AW87579_IO_TIMEOUT);
|
||||
reg=AW87579_REG_ADP_MODE;
|
||||
}
|
||||
|
||||
void xAmplifierAW87579_GetADG1ModeReg(tI2cIO *i2c, uint8_t *res){
|
||||
uint8_t reg = AW87579_REG_PAGC1PR;
|
||||
I2cWrite( i2c, AW87579_Addres_Write | 0, ®, 1, AW87579_IO_TIMEOUT);
|
||||
I2cRead(i2c, AW87579_Addres_Read | 1, res, 1, AW87579_IO_TIMEOUT);
|
||||
reg=AW87579_REG_PAGC1PR;
|
||||
}
|
||||
|
||||
void xAmplifierAW87579_GetADG3ModeOpReg(tI2cIO *i2c, uint8_t *res){
|
||||
uint8_t reg = AW87579_REG_PAGC3OPR;
|
||||
I2cWrite( i2c, AW87579_Addres_Write | 0, ®, 1, AW87579_IO_TIMEOUT);
|
||||
I2cRead(i2c, AW87579_Addres_Read | 1, res, 1, AW87579_IO_TIMEOUT);
|
||||
reg=AW87579_REG_PAGC3OPR;
|
||||
}
|
||||
|
||||
void xAmplifierAW87579_GetADG3ModeReg(tI2cIO *i2c, uint8_t *res){
|
||||
uint8_t reg = AW87579_REG_PAGC3PR;
|
||||
I2cWrite( i2c, AW87579_Addres_Write | 0, ®, 1, AW87579_IO_TIMEOUT);
|
||||
I2cRead(i2c, AW87579_Addres_Read | 1, res, 1, AW87579_IO_TIMEOUT);
|
||||
reg=AW87579_REG_PAGC3PR;
|
||||
}
|
||||
|
||||
void XfcProtMethod_GetAGC2OprParamModeReg(tI2cIO *i2c, uint8_t *res){
|
||||
uint8_t reg = AW87579_REG_PAGC2OPR;
|
||||
I2cWrite( i2c, AW87579_Addres_Write | 0, ®, 1, AW87579_IO_TIMEOUT);
|
||||
I2cRead(i2c, AW87579_Addres_Read | 1, res, 1, AW87579_IO_TIMEOUT);
|
||||
reg=AW87579_REG_PAGC2OPR;
|
||||
}
|
||||
|
||||
void XfcProtMethod_GetEnBoostReg(tI2cIO *i2c, uint8_t *res){
|
||||
uint8_t reg = AW87579_REG_SYSCTRL;
|
||||
I2cWrite( i2c, AW87579_Addres_Write | 0, ®, 1, AW87579_IO_TIMEOUT);
|
||||
I2cRead(i2c, AW87579_Addres_Read | 1, res, 1, AW87579_IO_TIMEOUT);
|
||||
reg=AW87579_REG_SYSCTRL;
|
||||
}
|
||||
|
||||
void XfcProtMethod_GetAGC2ParamModeReg(tI2cIO *i2c, uint8_t *res){
|
||||
uint8_t reg = AW87579_REG_PAGC2PR;
|
||||
I2cWrite( i2c, AW87579_Addres_Write | 0, ®, 1, AW87579_IO_TIMEOUT);
|
||||
I2cRead(i2c, AW87579_Addres_Read | 1, res, 1, AW87579_IO_TIMEOUT);
|
||||
reg=AW87579_REG_PAGC2PR;
|
||||
}
|
||||
|
||||
|
||||
bool xAmplifierAW87579_SetAll(tI2cIO *i2c, tAW87579_RegsList list){
|
||||
IfNotOkRet(xAmplifierAW87579_SetSistemControl(i2c,list.sysctr))
|
||||
IfNotOkRet(xAmplifierAW87579_SetBatterySafeguard(i2c, list.batsafe))
|
||||
IfNotOkRet(xAmplifierAW87579_SetBoostOutputVoltage(i2c, list.bstvout))
|
||||
IfNotOkRet(xAmplifierAW87579_SetBoostControl(i2c, list.bstcpr2))
|
||||
IfNotOkRet(xAmplifierAW87579_SetGainControl(i2c, list.pagr))
|
||||
IfNotOkRet(xAmplifierAW87579_SetAGC3OutputPower(i2c,list.pagc3Opr))
|
||||
IfNotOkRet(xAmplifierAW87579_SetAGC3Parameter(i2c, list.pagc3Pr))
|
||||
IfNotOkRet(xAmplifierAW87579_SetAG2OutputPower(i2c, list.pagc2Opr))
|
||||
IfNotOkRet(xAmplifierAW87579_SetAGC2Parameter(i2c, list.pagc2Pr))
|
||||
IfNotOkRet(xAmplifierAW87579_SetAGC1Parameter(i2c, list.pagc1Pr))
|
||||
IfNotOkRet(xAmplifierAW87579_SetADPMode(i2c,list.adpMode))
|
||||
IfNotOkRet(xAmplifierAW87579_SetADPBoost(i2c, list.adpbstTime1))
|
||||
IfNotOkRet(xAmplifierAW87579_SetADPBoostVTH(i2c, list.adpbstVth))
|
||||
return true;
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"dep": [
|
||||
{
|
||||
"type": "git",
|
||||
"provider": "Smart_Components_Aurus",
|
||||
"repo": "I2cPortInterface"
|
||||
}
|
||||
],
|
||||
"cmake": {
|
||||
"inc_dirs": [
|
||||
"Inc"
|
||||
],
|
||||
"srcs": [
|
||||
"Src/**.c"
|
||||
]
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue