#include <stdio.h>

//#include "ite/itp.h"	//for all ith driver (include GPIO) & MACRO


#define ATTEN_0DB  0
#define ATTEN_0_5DB  0.5
#define ATTEN_1DB  1
#define ATTEN_2DB  2
#define ATTEN_4DB  4
#define ATTEN_8DB  8
#define ATTEN_16DB  16
#define ATTEN_31DB  31
#define ATTEN_31_5DB  31.5

#define QPC6614_ATTEN_0DB_VAL  0x3F
#define QPC6614_ATTEN_0_5DB_VAL  0x3E
#define QPC6614_ATTEN_1DB_VAL  0x3D
#define QPC6614_ATTEN_2DB_VAL  0x3B
#define QPC6614_ATTEN_4DB_VAL  0x37
#define QPC6614_ATTEN_8DB_VAL  0x2F
#define QPC6614_ATTEN_16DB_VAL  0x1F
#define QPC6614_ATTEN_30DB_VAL  0x03
#define QPC6614_ATTEN_31_5DB_VAL  0x00

#define HMC939_ATTEN_0DB_VAL  0x1F
#define HMC939_ATTEN_1DB_VAL  0x1E
#define HMC939_ATTEN_2DB_VAL  0x1D
#define HMC939_ATTEN_4DB_VAL  0x1B
#define HMC939_ATTEN_8DB_VAL  0x17
#define HMC939_ATTEN_16DB_VAL  0x0F
#define HMC939_ATTEN_30DB_VAL  0x01
#define HMC939_ATTEN_31DB_VAL  0x00


#define ADRF5720_ATTEN_31_5DB_VAL  0x3F
#define ADRF5720_ATTEN_30DB_VAL  0x3E
#define ADRF5720_ATTEN_16DB_VAL  0x20
#define ADRF5720_ATTEN_8DB_VAL  0x10
#define ADRF5720_ATTEN_4DB_VAL  0x08
#define ADRF5720_ATTEN_2DB_VAL  0x04
#define ADRF5720_ATTEN_1DB_VAL  0x02
#define ADRF5720_ATTEN_0_5DB_VAL  0x01
#define ADRF5720_ATTEN_0DB_VAL  0x00

#define CHSET_UARTDATA_LENGTH  4
#define CHSET_UART_LENGTH  9



typedef struct{
    uint8_t Atten_Ach_Alarm_150M;
    uint8_t Atten_Ach_Alarm_WIFI;
    uint8_t Atten_Ach_Alarm_30G;
    uint8_t Atten_Bch_Alarm_150M;
    uint8_t Atten_Bch_Alarm_WIFI;
    uint8_t Atten_Bch_Alarm_30G;
}Atten_Alarm_t;

typedef struct {
	uint16_t LE_PIN;
	uint16_t Clock_PIN;
	uint16_t Data_PIN;
    GPIO_TypeDef * Port;
}atten_ctrl;
typedef struct {
    uint16_t ATT_P0;
    uint16_t ATT_P1;
    uint16_t ATT_P2;    
    uint16_t ATT_P3;    
    uint16_t ATT_P4;    
    uint16_t ATT_P5;    
    uint16_t ATT_ENABLE;    
}HMC939atten_ctrl;
/*******************************************BLUECELL ENUM*******************************************/
typedef enum{
    Bluecell_STX    = 0,
    Bluecell_Type   = 1,
    Bluecell_Length = 2,
    Bluecell_DATA   = 3,
}Protocol_t;
typedef enum{
     ATT_AB_CH_Read = 0x00,
     ATT_A_CH_150M = 0x01,
     ATT_A_CH_WIFI2_4Ghz = 0x02,
     ATT_A_CH_WIFI5_8Ghz = 0x03,
     ATT_A_CH_30G_28_28_5 = 0x04,
     ATT_A_CH_30G_28_5_29 = 0x05,
     ATT_A_CH_30G_29_29_5 = 0x06,
     ATT_A_CH_30G_29_5_30 = 0x07,
     ATT_B_CH_150M = 0x08,
     ATT_B_CH_WIFI2_4Ghz = 0x09,
     ATT_B_CH_WIFI5_8Ghz = 0x0A,
     ATT_B_CH_30G_28_28_5 = 0x0B,
     ATT_B_CH_30G_28_5_29 = 0x0C,
     ATT_B_CH_30G_29_29_5 = 0x0D,
     ATT_B_CH_30G_29_5_30 = 0x0E,
     ATT_A_EN_150M = 0x10,
     ATT_A_EN_WIFI1_2_4Ghz = 0x11,
     ATT_A_EN_WIFI2_2_4Ghz = 0x12,
     ATT_A_EN_WIFI3_2_4Ghz = 0x13,
     ATT_A_EN_WIFI4_2_4Ghz = 0x14,
     ATT_A_EN_WIFI1_5_8Ghz = 0x15,
     ATT_A_EN_WIFI2_5_8Ghz = 0x16,
     ATT_A_EN_WIFI3_5_8Ghz = 0x17,
     ATT_A_EN_WIFI4_5_8Ghz = 0x18,
     ATT_A_EN_30G1_28_28_5Ghz = 0x19,
     ATT_A_EN_30G2_28_28_5Ghz = 0x1A,
     ATT_A_EN_30G3_28_28_5Ghz = 0x1E,
     ATT_A_EN_30G1_28_5_29Ghz = 0x1F,
     ATT_A_EN_30G2_28_5_29Ghz = 0x20,
     ATT_A_EN_30G3_28_5_29Ghz   = 0x21,
     ATT_A_EN_30G1_29_29_5Ghz   = 0x22,
     ATT_A_EN_30G2_29_29_5Ghz   = 0x23,
     ATT_A_EN_30G3_29_29_5Ghz   = 0x24,
     ATT_A_EN_30G1_29_5_30Ghz   = 0x25,
     ATT_A_EN_30G2_29_5_30Ghz   = 0x26,
     ATT_A_EN_30G3_29_5_30Ghz   = 0x27,
     ATT_B_EN_150M              = 0x28,
     ATT_B_EN_WIFI1_2_4Ghz      = 0x29,
     ATT_B_EN_WIFI2_2_4Ghz      = 0x2A,
     ATT_B_EN_WIFI3_2_4Ghz      = 0x2B,
     ATT_B_EN_WIFI4_2_4Ghz      = 0x2C,
     ATT_B_EN_WIFI1_5_8Ghz      = 0x2D,
     ATT_B_EN_WIFI2_5_8Ghz      = 0x2E,
     ATT_B_EN_WIFI3_5_8Ghz      = 0x2F,
     ATT_B_EN_WIFI4_5_8Ghz      = 0x30,
     ATT_B_EN_30G1_28_28_5Ghz   = 0x31,
     ATT_B_EN_30G2_28_28_5Ghz   = 0x32,
     ATT_B_EN_30G3_28_28_5Ghz   = 0x33,
     ATT_B_EN_30G1_28_5_29Ghz   = 0x34,
     ATT_B_EN_30G2_28_5_29Ghz   = 0x35,
     ATT_B_EN_30G3_28_5_29Ghz   = 0x36,
     ATT_B_EN_30G1_29_29_5Ghz   = 0x37,
     ATT_B_EN_30G2_29_29_5Ghz   = 0x38,
     ATT_B_EN_30G3_29_29_5Ghz   = 0x39,
     ATT_B_EN_30G1_29_5_30Ghz   = 0x3A,
     ATT_B_EN_30G2_29_5_30Ghz   = 0x3B,
     ATT_B_EN_30G3_29_5_30Ghz   = 0x3C,
     ATT_A_EN_150M_R            = 0x40,
     ATT_A_EN_WIFI1_2_4Ghz_R    = 0x41,
     ATT_A_EN_WIFI2_2_4Ghz_R    = 0x42,
     ATT_A_EN_WIFI3_2_4Ghz_R    = 0x43,
     ATT_A_EN_WIFI4_2_4Ghz_R    = 0x44,
     ATT_A_EN_WIFI1_5_8Ghz_R    = 0x45,
     ATT_A_EN_WIFI2_5_8Ghz_R    = 0x46,
     ATT_A_EN_WIFI3_5_8Ghz_R    = 0x47,
     ATT_A_EN_WIFI4_5_8Ghz_R    = 0x48,
     ATT_A_EN_30G1_28_28_5Ghz_R	= 0x49,
     ATT_A_EN_30G2_28_28_5Ghz_R	= 0x4A,
     ATT_A_EN_30G3_28_28_5Ghz_R	= 0x4E,
     ATT_A_EN_30G1_28_5_29Ghz_R	= 0x4F,
     ATT_A_EN_30G2_28_5_29Ghz_R	= 0x50,
     ATT_A_EN_30G3_28_5_29Ghz_R	= 0x51,
     ATT_A_EN_30G1_29_29_5Ghz_R	= 0x52,
     ATT_A_EN_30G2_29_29_5Ghz_R	= 0x53,
     ATT_A_EN_30G3_29_29_5Ghz_R	= 0x54,
     ATT_A_EN_30G1_29_5_30Ghz_R	= 0x55,
     ATT_A_EN_30G2_29_5_30Ghz_R	= 0x56,
     ATT_A_EN_30G3_29_5_30Ghz_R	= 0x57,
     ATT_B_EN_150M_R            = 0x58,
     ATT_B_EN_WIFI1_2_4Ghz_R    = 0x59,
     ATT_B_EN_WIFI2_2_4Ghz_R    = 0x5A,
     ATT_B_EN_WIFI3_2_4Ghz_R    = 0x5B,
     ATT_B_EN_WIFI4_2_4Ghz_R    = 0x5C,
     ATT_B_EN_WIFI1_5_8Ghz_R    = 0x5D,
     ATT_B_EN_WIFI2_5_8Ghz_R    = 0x5E,
     ATT_B_EN_WIFI3_5_8Ghz_R    = 0x5F,
     ATT_B_EN_WIFI4_5_8Ghz_R    = 0x60,
     ATT_B_EN_30G1_28_28_5Ghz_R	= 0x61,
     ATT_B_EN_30G2_28_28_5Ghz_R	= 0x62,
     ATT_B_EN_30G3_28_28_5Ghz_R	= 0x63,
     ATT_B_EN_30G1_28_5_29Ghz_R	= 0x64,
     ATT_B_EN_30G2_28_5_29Ghz_R	= 0x65,
     ATT_B_EN_30G3_28_5_29Ghz_R	= 0x66,
     ATT_B_EN_30G1_29_29_5Ghz_R	= 0x67,
     ATT_B_EN_30G2_29_29_5Ghz_R	= 0x68,
     ATT_B_EN_30G3_29_29_5Ghz_R	= 0x69,
     ATT_B_EN_30G1_29_5_30Ghz_R	= 0x6A,
     ATT_B_EN_30G2_29_5_30Ghz_R	= 0x6B,
     ATT_B_EN_30G3_29_5_30Ghz_R	= 0x6C,
     ATT_AB_ALARM_READ      	= 0x6D,     
 }AttenType_t;
typedef enum{
     ATT_A_150M_ALARM=3,
     ATT_A_WIFI_ALARM,
     ATT_A_30G_ALARM,
     ATT_B_150M_ALARM,
     ATT_B_WIFI_ALARM,
     ATT_B_30G_ALARM,    
     ATT_A_CH_150M_NUM,
     ATT_A_CH_WIFI2_4Ghz_NUM,
     ATT_A_CH_WIFI5_8Ghz_NUM,
     ATT_A_CH_30G_28_28_5_NUM,
     ATT_A_CH_30G_28_5_29_NUM,
     ATT_A_CH_30G_29_29_5_NUM,
     ATT_A_CH_30G_29_5_30_NUM,
     ATT_B_CH_150M_NUM,
     ATT_B_CH_WIFI2_4Ghz_NUM,
     ATT_B_CH_WIFI5_8Ghz_NUM,
     ATT_B_CH_30G_28_28_5_NUM,
     ATT_B_CH_30G_28_5_29_NUM,
     ATT_B_CH_30G_29_29_5_NUM,
     ATT_B_CH_30G_29_5_30_NUM,//Value : 16 Cnt : 14
}AttenLength_t;

/*******************************************BLUECELL struct*******************************************/     

 typedef struct {
    uint8_t ATT_A_150M_ALARM;
    uint8_t ATT_A_WIFI_ALARM;
    uint8_t ATT_A_30G_ALARM;
    uint8_t ATT_B_150M_ALARM;
    uint8_t ATT_B_WIFI_ALARM;
    uint8_t ATT_B_30G_ALARM;
    uint8_t ATT_A_CH_150M;            
    uint8_t ATT_A_CH_WIFI2_4Ghz_QPC6614_1;
    uint8_t ATT_A_CH_WIFI2_4Ghz_QPC6614_2;
    uint8_t ATT_A_CH_WIFI2_4Ghz_QPC6614_3;
    uint8_t ATT_A_CH_WIFI2_4Ghz_QPC6614_4;
    uint8_t ATT_A_CH_WIFI5_8Ghz_QPC6614_1;
    uint8_t ATT_A_CH_WIFI5_8Ghz_QPC6614_2;
    uint8_t ATT_A_CH_WIFI5_8Ghz_QPC6614_3;
    uint8_t ATT_A_CH_WIFI5_8Ghz_QPC6614_4;    
    uint8_t ATT_A_CH_30G_28_28_5_HMC939_1;
    uint8_t ATT_A_CH_30G_28_28_5_HMC939_2;
    uint8_t ATT_A_CH_30G_28_28_5_ADRF5720_1;
    uint8_t ATT_A_CH_30G_28_5_29_HMC939_1;
    uint8_t ATT_A_CH_30G_28_5_29_HMC939_2;
    uint8_t ATT_A_CH_30G_28_5_29_ADRF5720_1;
    uint8_t ATT_A_CH_30G_29_29_5_HMC939_1;
    uint8_t ATT_A_CH_30G_29_29_5_HMC939_2;
    uint8_t ATT_A_CH_30G_29_29_5_ADRF5720_1;
    uint8_t ATT_A_CH_30G_29_5_30_HMC939_1;
    uint8_t ATT_A_CH_30G_29_5_30_HMC939_2;
    uint8_t ATT_A_CH_30G_29_5_30_ADRF5720_1;
    uint8_t ATT_B_CH_150M;            
    uint8_t ATT_B_CH_WIFI2_4Ghz_QPC6614_1;
    uint8_t ATT_B_CH_WIFI2_4Ghz_QPC6614_2;
    uint8_t ATT_B_CH_WIFI2_4Ghz_QPC6614_3;
    uint8_t ATT_B_CH_WIFI2_4Ghz_QPC6614_4;    
    uint8_t ATT_B_CH_WIFI5_8Ghz_QPC6614_1;
    uint8_t ATT_B_CH_WIFI5_8Ghz_QPC6614_2;
    uint8_t ATT_B_CH_WIFI5_8Ghz_QPC6614_3;
    uint8_t ATT_B_CH_WIFI5_8Ghz_QPC6614_4;    
    uint8_t ATT_B_CH_30G_28_28_5_HMC939_1;
    uint8_t ATT_B_CH_30G_28_28_5_HMC939_2;
    uint8_t ATT_B_CH_30G_28_28_5_ADRF5720_1;
    uint8_t ATT_B_CH_30G_28_5_29_HMC939_1;
    uint8_t ATT_B_CH_30G_28_5_29_HMC939_2;
    uint8_t ATT_B_CH_30G_28_5_29_ADRF5720_1;
    uint8_t ATT_B_CH_30G_29_29_5_HMC939_1;
    uint8_t ATT_B_CH_30G_29_29_5_HMC939_2;
    uint8_t ATT_B_CH_30G_29_29_5_ADRF5720_1;
    uint8_t ATT_B_CH_30G_29_5_30_HMC939_1;
    uint8_t ATT_B_CH_30G_29_5_30_HMC939_2;
    uint8_t ATT_B_CH_30G_29_5_30_ADRF5720_1;
    
}Atten_AB_Val_t;
typedef struct{
    uint8_t ATT_A_CH_CURR_150M;
    uint8_t ATT_A_CH_CURR_WIFI_1;
    uint8_t ATT_A_CH_CURR_WIFI_2;
    uint8_t ATT_A_CH_CURR_WIFI_3;
    uint8_t ATT_A_CH_CURR_WIFI_4;    
    uint8_t ATT_A_CH_CURR_30G_1;
    uint8_t ATT_A_CH_CURR_30G_2;
    uint8_t ATT_A_CH_CURR_30G_3;    
    uint8_t ATT_B_CH_CURR_150M;
    uint8_t ATT_B_CH_CURR_WIFI_1;
    uint8_t ATT_B_CH_CURR_WIFI_2;
    uint8_t ATT_B_CH_CURR_WIFI_3;
    uint8_t ATT_B_CH_CURR_WIFI_4;    
    uint8_t ATT_B_CH_CURR_30G_1;
    uint8_t ATT_B_CH_CURR_30G_2;
    uint8_t ATT_B_CH_CURR_30G_3;  
}Atten_Curr_Val_t;

typedef struct{
    uint8_t Atten_Table_31_5dB_Value;
    uint8_t Atten_Table_31dB_Value;
    uint8_t Atten_Table_30_5dB_Value;
    uint8_t Atten_Table_30dB_Value;
    uint8_t Atten_Table_29_5dB_Value;
    uint8_t Atten_Table_29dB_Value;
    uint8_t Atten_Table_28_5dB_Value;
    uint8_t Atten_Table_28dB_Value;
    uint8_t Atten_Table_27_5dB_Value;
    uint8_t Atten_Table_27dB_Value;
    uint8_t Atten_Table_26_5dB_Value;
    uint8_t Atten_Table_26dB_Value;
    uint8_t Atten_Table_25_5dB_Value;
    uint8_t Atten_Table_25dB_Value;
    uint8_t Atten_Table_24_5dB_Value;
    uint8_t Atten_Table_24dB_Value;
    uint8_t Atten_Table_23_5dB_Value;
    uint8_t Atten_Table_23dB_Value;
    uint8_t Atten_Table_22_5dB_Value;
    uint8_t Atten_Table_22dB_Value;
    uint8_t Atten_Table_21_5dB_Value;
    uint8_t Atten_Table_21dB_Value;
    uint8_t Atten_Table_20_5dB_Value;
    uint8_t Atten_Table_20dB_Value;
    uint8_t Atten_Table_19_5dB_Value;
    uint8_t Atten_Table_19dB_Value;
    uint8_t Atten_Table_18_5dB_Value;
    uint8_t Atten_Table_18dB_Value;
    uint8_t Atten_Table_17_5dB_Value;
    uint8_t Atten_Table_17dB_Value;
    uint8_t Atten_Table_16_5dB_Value;
    uint8_t Atten_Table_16dB_Value;
    uint8_t Atten_Table_15_5dB_Value;
    uint8_t Atten_Table_15dB_Value;
    uint8_t Atten_Table_14_5dB_Value;
    uint8_t Atten_Table_14dB_Value;
    uint8_t Atten_Table_13_5dB_Value;
    uint8_t Atten_Table_13dB_Value;
    uint8_t Atten_Table_12_5dB_Value;
    uint8_t Atten_Table_12dB_Value;
    uint8_t Atten_Table_11_5dB_Value;
    uint8_t Atten_Table_11dB_Value;
    uint8_t Atten_Table_10_5dB_Value;
    uint8_t Atten_Table_10dB_Value;
    uint8_t Atten_Table_9_5dB_Value ;
    uint8_t Atten_Table_9dB_Value ;
    uint8_t Atten_Table_8_5dB_Value ;
    uint8_t Atten_Table_8dB_Value ;
    uint8_t Atten_Table_7_5dB_Value ;
    uint8_t Atten_Table_7dB_Value ;
    uint8_t Atten_Table_6_5dB_Value ;
    uint8_t Atten_Table_6dB_Value ;
    uint8_t Atten_Table_5_5dB_Value ;
    uint8_t Atten_Table_5dB_Value ;
    uint8_t Atten_Table_4_5dB_Value ;
    uint8_t Atten_Table_4dB_Value ;
    uint8_t Atten_Table_3_5dB_Value ;
    uint8_t Atten_Table_3dB_Value ;
    uint8_t Atten_Table_2_5dB_Value ;
    uint8_t Atten_Table_2dB_Value ;
    uint8_t Atten_Table_1_5dB_Value ;
    uint8_t Atten_Table_1dB_Value;
    uint8_t Atten_Table_0_5dB_Value;
    uint8_t Atten_Table_0dB_Value;   
}Atten_Table_Value_t;//64

typedef enum{
    QPC6614_Atten_31_5dB_num    =       0x00    ,
    QPC6614_Atten_31dB_num      =       0x01    ,
    QPC6614_Atten_30_5dB_num    =       0x02    ,
    QPC6614_Atten_30dB_num      =       0x03    ,
    QPC6614_Atten_29_5dB_num    =       0x04    ,
    QPC6614_Atten_29dB_num      =       0x05    ,
    QPC6614_Atten_28_5dB_num    =       0x06    ,
    QPC6614_Atten_28dB_num      =       0x07    ,
    QPC6614_Atten_27_5dB_num    =       0x08    ,
    QPC6614_Atten_27dB_num      =       0x09    ,
    QPC6614_Atten_26_5dB_num    =       0x0a    ,
    QPC6614_Atten_26dB_num      =       0x0b    ,
    QPC6614_Atten_25_5dB_num    =       0x0c    ,
    QPC6614_Atten_25dB_num      =       0x0d    ,
    QPC6614_Atten_24_5dB_num    =       0x0e    ,
    QPC6614_Atten_24dB_num      =       0x0f    ,
    QPC6614_Atten_23_5dB_num    =       0x10    ,
    QPC6614_Atten_23dB_num      =       0x11    ,
    QPC6614_Atten_22_5dB_num    =       0x12    ,
    QPC6614_Atten_22dB_num      =       0x13    ,
    QPC6614_Atten_21_5dB_num    =       0x14    ,
    QPC6614_Atten_21dB_num      =       0x15    ,
    QPC6614_Atten_20_5dB_num    =       0x16    ,
    QPC6614_Atten_20dB_num      =       0x17    ,
    QPC6614_Atten_19_5dB_num    =       0x18    ,
    QPC6614_Atten_19dB_num      =       0x19    ,
    QPC6614_Atten_18_5dB_num    =       0x1a    ,
    QPC6614_Atten_18dB_num      =       0x1b    ,
    QPC6614_Atten_17_5dB_num    =       0x1c    ,
    QPC6614_Atten_17dB_num      =       0x1d    ,
    QPC6614_Atten_16_5dB_num    =       0x1e    ,
    QPC6614_Atten_16dB_num      =       0x1f    ,
    QPC6614_Atten_15_5dB_num    =       0x20    ,
    QPC6614_Atten_15dB_num      =       0x21    ,
    QPC6614_Atten_14_5dB_num    =       0x22    ,
    QPC6614_Atten_14dB_num      =       0x23    ,
    QPC6614_Atten_13_5dB_num    =       0x24    ,
    QPC6614_Atten_13dB_num      =       0x25    ,
    QPC6614_Atten_12_5dB_num    =       0x26    ,
    QPC6614_Atten_12dB_num      =       0x27    ,
    QPC6614_Atten_11_5dB_num    =       0x28    ,
    QPC6614_Atten_11dB_num      =       0x29    ,
    QPC6614_Atten_10_5dB_num    =       0x2a    ,
    QPC6614_Atten_10dB_num      =       0x2b    ,
    QPC6614_Atten_9_5dB_num     =       0x2c    ,
    QPC6614_Atten_9dB_num       =       0x2d    ,
    QPC6614_Atten_8_5dB_num     =       0x2e    ,
    QPC6614_Atten_8dB_num       =       0x2f    ,
    QPC6614_Atten_7_5dB_num     =       0x30    ,
    QPC6614_Atten_7dB_num       =       0x31    ,
    QPC6614_Atten_6_5dB_num     =       0x32    ,
    QPC6614_Atten_6dB_num       =       0x33    ,
    QPC6614_Atten_5_5dB_num     =       0x34    ,
    QPC6614_Atten_5dB_num       =       0x35    ,
    QPC6614_Atten_4_5dB_num     =       0x36    ,
    QPC6614_Atten_4dB_num       =       0x37    ,
    QPC6614_Atten_3_5dB_num     =       0x38    ,
    QPC6614_Atten_3dB_num       =       0x39    ,
    QPC6614_Atten_2_5dB_num     =       0x3a    ,
    QPC6614_Atten_2dB_num       =       0x3b    ,
    QPC6614_Atten_1_5dB_num     =       0x3c    ,
    QPC6614_Atten_1dB_num       =       0x3d    ,
    QPC6614_Atten_0_5dB_num     =       0x3e    ,
    QPC6614_Atten_0dB_num       =       0x3f    ,

}QPC6614_Atten_Table_num_t;
typedef enum{
    ADRF5720_Atten_31_5dB_num    =       0x3f    ,
    ADRF5720_Atten_31dB_num      =       0x3e    ,
    ADRF5720_Atten_30_5dB_num    =       0x3d    ,
    ADRF5720_Atten_30dB_num      =       0x3c    ,
    ADRF5720_Atten_29_5dB_num    =       0x3b    ,
    ADRF5720_Atten_29dB_num      =       0x3a    ,
    ADRF5720_Atten_28_5dB_num    =       0x39    ,
    ADRF5720_Atten_28dB_num      =       0x38    ,
    ADRF5720_Atten_27_5dB_num    =       0x37    ,
    ADRF5720_Atten_27dB_num      =       0x36    ,
    ADRF5720_Atten_26_5dB_num    =       0x35    ,
    ADRF5720_Atten_26dB_num      =       0x34    ,
    ADRF5720_Atten_25_5dB_num    =       0x33    ,
    ADRF5720_Atten_25dB_num      =       0x32    ,
    ADRF5720_Atten_24_5dB_num    =       0x31    ,
    ADRF5720_Atten_24dB_num      =       0x30    ,
    ADRF5720_Atten_23_5dB_num    =       0x2f    ,
    ADRF5720_Atten_23dB_num      =       0x2e    ,
    ADRF5720_Atten_22_5dB_num    =       0x2d    ,
    ADRF5720_Atten_22dB_num      =       0x2c    ,
    ADRF5720_Atten_21_5dB_num    =       0x2b    ,
    ADRF5720_Atten_21dB_num      =       0x2a    ,
    ADRF5720_Atten_20_5dB_num    =       0x29    ,
    ADRF5720_Atten_20dB_num      =       0x28    ,
    ADRF5720_Atten_19_5dB_num    =       0x27    ,
    ADRF5720_Atten_19dB_num      =       0x26    ,
    ADRF5720_Atten_18_5dB_num    =       0x25    ,
    ADRF5720_Atten_18dB_num      =       0x24    ,
    ADRF5720_Atten_17_5dB_num    =       0x23    ,
    ADRF5720_Atten_17dB_num      =       0x22    ,
    ADRF5720_Atten_16_5dB_num    =       0x21    ,
    ADRF5720_Atten_16dB_num      =       0x20    ,
    ADRF5720_Atten_15_5dB_num    =       0x1f    ,
    ADRF5720_Atten_15dB_num      =       0x1e    ,
    ADRF5720_Atten_14_5dB_num    =       0x1d    ,
    ADRF5720_Atten_14dB_num      =       0x1c    ,
    ADRF5720_Atten_13_5dB_num    =       0x1b    ,
    ADRF5720_Atten_13dB_num      =       0x1a    ,
    ADRF5720_Atten_12_5dB_num    =       0x19    ,
    ADRF5720_Atten_12dB_num      =       0x18    ,
    ADRF5720_Atten_11_5dB_num    =       0x17    ,
    ADRF5720_Atten_11dB_num      =       0x16    ,
    ADRF5720_Atten_10_5dB_num    =       0x15    ,
    ADRF5720_Atten_10dB_num      =       0x14    ,
    ADRF5720_Atten_9_5dB_num     =       0x13    ,
    ADRF5720_Atten_9dB_num       =       0x12    ,
    ADRF5720_Atten_8_5dB_num     =       0x11    ,
    ADRF5720_Atten_8dB_num       =       0x10    ,
    ADRF5720_Atten_7_5dB_num     =       0x0f    ,
    ADRF5720_Atten_7dB_num       =       0x0e    ,
    ADRF5720_Atten_6_5dB_num     =       0x0d    ,
    ADRF5720_Atten_6dB_num       =       0x0c    ,
    ADRF5720_Atten_5_5dB_num     =       0x0b    ,
    ADRF5720_Atten_5dB_num       =       0x0a    ,
    ADRF5720_Atten_4_5dB_num     =       0x09    ,
    ADRF5720_Atten_4dB_num       =       0x08    ,
    ADRF5720_Atten_3_5dB_num     =       0x07    ,
    ADRF5720_Atten_3dB_num       =       0x06    ,
    ADRF5720_Atten_2_5dB_num     =       0x05    ,
    ADRF5720_Atten_2dB_num       =       0x04    ,
    ADRF5720_Atten_1_5dB_num     =       0x03    ,
    ADRF5720_Atten_1dB_num       =       0x02    ,
    ADRF5720_Atten_0_5dB_num     =       0x01    ,
    ADRF5720_Atten_0dB_num       =       0x00    ,
}ADRF5720_Atten_Table_num_t;
    typedef enum{
    HMC939_Atten_31_5dB_num   =        0xFF    ,
    HMC939_Atten_31dB_num      =       0x00    ,  
    HMC939_Atten_30_5dB_num    =       0xFF    ,  
    HMC939_Atten_30dB_num      =       0x01    , 
    HMC939_Atten_29_5dB_num    =       0xFF    , 
    HMC939_Atten_29dB_num      =       0x02    , 
    HMC939_Atten_28_5dB_num    =       0xFF    , 
    HMC939_Atten_28dB_num      =       0x03    , 
    HMC939_Atten_27_5dB_num    =       0xFF    , 
    HMC939_Atten_27dB_num      =       0x04    , 
    HMC939_Atten_26_5dB_num    =       0xFF    , 
    HMC939_Atten_26dB_num      =       0x05    , 
    HMC939_Atten_25_5dB_num    =       0xFF    , 
    HMC939_Atten_25dB_num      =       0x06    , 
    HMC939_Atten_24_5dB_num    =       0xFF    , 
    HMC939_Atten_24dB_num      =       0x07    , 
    HMC939_Atten_23_5dB_num    =       0xFF    , 
    HMC939_Atten_23dB_num      =       0x08    , 
    HMC939_Atten_22_5dB_num    =       0xFF    , 
    HMC939_Atten_22dB_num      =       0x09    , 
    HMC939_Atten_21_5dB_num    =       0xFF    , 
    HMC939_Atten_21dB_num      =       0x0A    , 
    HMC939_Atten_20_5dB_num    =       0xFF    , 
    HMC939_Atten_20dB_num      =       0x0B    , 
    HMC939_Atten_19_5dB_num    =       0xFF    , 
    HMC939_Atten_19dB_num      =       0x0C    , 
    HMC939_Atten_18_5dB_num    =       0xFF    , 
    HMC939_Atten_18dB_num      =       0x0D    , 
    HMC939_Atten_17_5dB_num    =       0xFF    , 
    HMC939_Atten_17dB_num      =       0x0E    , 
    HMC939_Atten_16_5dB_num    =       0xFF    , 
    HMC939_Atten_16dB_num      =       0x0F    , 
    HMC939_Atten_15_5dB_num    =       0xFF    , 
    HMC939_Atten_15dB_num      =       0x10    ,
    HMC939_Atten_14_5dB_num    =       0xFF    ,
    HMC939_Atten_14dB_num      =       0x11    ,
    HMC939_Atten_13_5dB_num    =       0xFF    ,
    HMC939_Atten_13dB_num      =       0x12    ,
    HMC939_Atten_12_5dB_num    =       0xFF    ,
    HMC939_Atten_12dB_num      =       0x13    ,
    HMC939_Atten_11_5dB_num    =       0xFF    ,
    HMC939_Atten_11dB_num      =       0x14    ,
    HMC939_Atten_10_5dB_num    =       0xFF    ,
    HMC939_Atten_10dB_num      =       0x15    ,
    HMC939_Atten_9_5dB_num     =       0xFF    ,
    HMC939_Atten_9dB_num       =       0x16    ,
    HMC939_Atten_8_5dB_num     =       0xFF    ,
    HMC939_Atten_8dB_num       =       0x17    ,
    HMC939_Atten_7_5dB_num     =       0xFF    ,
    HMC939_Atten_7dB_num       =       0x18    ,
    HMC939_Atten_6_5dB_num     =       0xFF    ,
    HMC939_Atten_6dB_num       =       0x19    ,
    HMC939_Atten_5_5dB_num     =       0xFF    ,
    HMC939_Atten_5dB_num       =       0x1A    ,
    HMC939_Atten_4_5dB_num     =       0xFF    ,
    HMC939_Atten_4dB_num       =       0x1B    ,
    HMC939_Atten_3_5dB_num     =       0xFF    ,
    HMC939_Atten_3dB_num       =       0x1C    ,
    HMC939_Atten_2_5dB_num     =       0xFF    ,
    HMC939_Atten_2dB_num       =       0x1D    ,
    HMC939_Atten_1_5dB_num     =       0xFF    ,
    HMC939_Atten_1dB_num       =       0x1E    ,
    HMC939_Atten_0_5dB_num     =       0xFF    ,
    HMC939_Atten_0dB_num       =       0x1F    ,
}HMC939_Atten_Table_num_t;

/*******************************************BLUECELL Variable*******************************************/     


extern Atten_AB_Val_t Atten_ABChannel_Data;
extern Atten_Table_Value_t ATT_A_EN_150M_Table;
extern Atten_Table_Value_t ATT_A_EN_WIFI1_2_4Ghz_Table;
extern Atten_Table_Value_t ATT_A_EN_WIFI2_2_4Ghz_Table;
extern Atten_Table_Value_t ATT_A_EN_WIFI3_2_4Ghz_Table;
extern Atten_Table_Value_t ATT_A_EN_WIFI4_2_4Ghz_Table;
extern Atten_Table_Value_t ATT_A_EN_WIFI1_5_8Ghz_Table;
extern Atten_Table_Value_t ATT_A_EN_WIFI2_5_8Ghz_Table;
extern Atten_Table_Value_t ATT_A_EN_WIFI3_5_8Ghz_Table;
extern Atten_Table_Value_t ATT_A_EN_WIFI4_5_8Ghz_Table;
extern Atten_Table_Value_t ATT_A_EN_30G1_28_28_5Ghz_Table;
extern Atten_Table_Value_t ATT_A_EN_30G2_28_28_5Ghz_Table;
extern Atten_Table_Value_t ATT_A_EN_30G3_28_28_5Ghz_Table;
extern Atten_Table_Value_t ATT_A_EN_30G1_28_5_29Ghz_Table;
extern Atten_Table_Value_t ATT_A_EN_30G2_28_5_29Ghz_Table;
extern Atten_Table_Value_t ATT_A_EN_30G3_28_5_29Ghz_Table;
extern Atten_Table_Value_t ATT_A_EN_30G1_29_29_5Ghz_Table;
extern Atten_Table_Value_t ATT_A_EN_30G2_29_29_5Ghz_Table;
extern Atten_Table_Value_t ATT_A_EN_30G3_29_29_5Ghz_Table;
extern Atten_Table_Value_t ATT_A_EN_30G1_29_5_30Ghz_Table;
extern Atten_Table_Value_t ATT_A_EN_30G2_29_5_30Ghz_Table;
extern Atten_Table_Value_t ATT_A_EN_30G3_29_5_30Ghz_Table;
extern Atten_Table_Value_t ATT_B_EN_150M_Table;
extern Atten_Table_Value_t ATT_B_EN_WIFI1_2_4Ghz_Table;
extern Atten_Table_Value_t ATT_B_EN_WIFI2_2_4Ghz_Table;
extern Atten_Table_Value_t ATT_B_EN_WIFI3_2_4Ghz_Table;
extern Atten_Table_Value_t ATT_B_EN_WIFI4_2_4Ghz_Table;
extern Atten_Table_Value_t ATT_B_EN_WIFI1_5_8Ghz_Table;
extern Atten_Table_Value_t ATT_B_EN_WIFI2_5_8Ghz_Table;
extern Atten_Table_Value_t ATT_B_EN_WIFI3_5_8Ghz_Table;
extern Atten_Table_Value_t ATT_B_EN_WIFI4_5_8Ghz_Table;
extern Atten_Table_Value_t ATT_B_EN_30G1_28_28_5Ghz_Table;
extern Atten_Table_Value_t ATT_B_EN_30G2_28_28_5Ghz_Table;
extern Atten_Table_Value_t ATT_B_EN_30G3_28_28_5Ghz_Table;
extern Atten_Table_Value_t ATT_B_EN_30G1_28_5_29Ghz_Table;
extern Atten_Table_Value_t ATT_B_EN_30G2_28_5_29Ghz_Table;
extern Atten_Table_Value_t ATT_B_EN_30G3_28_5_29Ghz_Table;
extern Atten_Table_Value_t ATT_B_EN_30G1_29_29_5Ghz_Table;
extern Atten_Table_Value_t ATT_B_EN_30G2_29_29_5Ghz_Table;
extern Atten_Table_Value_t ATT_B_EN_30G3_29_29_5Ghz_Table;
extern Atten_Table_Value_t ATT_B_EN_30G1_29_5_30Ghz_Table;
extern Atten_Table_Value_t ATT_B_EN_30G2_29_5_30Ghz_Table;
extern Atten_Table_Value_t ATT_B_EN_30G3_29_5_30Ghz_Table;
extern Atten_Curr_Val_t    ATT_Curr_Value;
extern Atten_AB_Val_t Atten_Setting;

void gpio_output_set(uint8_t gpioPin);
void Atten_GpioInit(void);
void QPC6614_atten_ctrl(uint8_t data,uint8_t);
void HMC939_atten_ctrl(uint8_t data,uint8_t);
void ADRF5720_atten_ctrl(uint8_t data);
Atten_Alarm_t Atten_Alarm_Read(void);
void Uart_Data_Send(uint8_t* data,uint8_t size);
void Atten_Init(void);

extern void Atten_150M_DataSet(float value,uint8_t type);
extern void Atten_Wifi_DataSet(float value,uint8_t type);
extern void Atten_30G_DataSet(float value,uint8_t type);


