/*
*********************************************************************************************************
*
*	模块名称 :  
*	文件名称 :  
*	版    本 :  
*	说    明 :  所有菜单界面共享的变量

*	修改记录 :  
*	
*
*********************************************************************************************************
*/
#include "sys.h"


/*
*********************************************************************************************************
											宏定义
*********************************************************************************************************
*/
/* 菜单级别 */
#define	 MAIN_MENU       1
#define	 CW_MENU         2   
#define	 SWEEP_MENU      3
#define	 POWER_MENU      4
#define	 CONFIG_MENU     5
	                     
/* 输出切换 */	         
#define  OUT_HOLD  	     2    //输出保持，但不是无信号
#define  OUT_ON   	     1    //输出开启
#define  OUT_OFF   	     0    //输出关闭，无信号

/* PLL输出控制 */	
#define OUTB_ON   1
#define OUTB_OFF  0

#define OUTA_ON   1
#define OUTA_OFF  0

/* DDS电源控制 */	
#define  AD9912_Full_PD  0
#define  AD9912_DIG_PD   1
#define  AD9912_PLL_PD   2
#define  AD9912_DDS_PD   3

#define  POWER_DOWN      1
#define  POWER_UP        0
                         
#define  LMX2592_CHA     0
#define  LMX2592_CHB     1

#define  PLL_OUT_PWR_UP     0
#define  PLL_OUT_PWR_DOWN   1

#define  LO_LMX2582_CONFIG   0X66 //
#define  LO_LMX2592_CONFIG   0X77 //

#define  DDS_OUT    0
#define  PLL_OUT    1  //默认 

/* CW窗口属性 */
#define  READ_ONLY  	   0 //只读状态，无法编辑
#define  LABLE_SELECT      1 //标签选中状态
#define  EDIT_SELECT       2 //编辑选中状态
#define  EDIT              3 //数字编辑，仅限于数字

/* 编码器旋转方向 */
#define  COUNT_UP       0  //向上计数
#define  COUNT_DOWN     1  //向下计数

/* 编码器计数的起始值 */
#define  COUNT_STAR   0X8000  


/* 当前使用的检波器芯片 */
#define  DETECTOR  1   //0为AD8310，1位ADL5513检波芯片

/* LMX2592分频器控制 */
#define DIV_EN     1  //1使能PLL分频操作，0关闭


/* Ex Port 扩展端口使用*/
#define EX_PORT     1  //扩展端口用于另一个外部幅度控制




/*
*********************************************************************************************************
											变量
*********************************************************************************************************
*/
extern uint8_t Menu_Type;
extern uint8_t Menu_Type_buf;

extern uint8_t Device_Info[];

extern uint8_t CW_Display_flag;
extern uint8_t Power_Display_flag;

extern uint8_t Main_menu_S1_Name[];
extern uint8_t Main_menu_S2_Name[];
extern uint8_t Main_menu_S3_Name[];
extern uint8_t Main_menu_S4_Name[];

extern uint8_t CW_menu_S1_Name0[];
extern uint8_t CW_menu_S1_Name1[];
extern uint8_t CW_menu_S1_Name2[];

extern uint8_t CW_menu_S2_Name[];
extern uint8_t CW_menu_S3_Name[];
extern uint8_t CW_menu_S4_Name[];

extern uint8_t POWER_menu_S1_Name[] ;
extern uint8_t POWER_menu_S2_Name[] ;
extern uint8_t POWER_menu_S3_Name[] ;
extern uint8_t POWER_menu_S4_Name[] ; 

extern uint8_t Freq_Label[];
extern uint8_t Amp_Label[];
extern uint8_t Out_Label[];

extern uint8_t GHz_Label[];
extern uint8_t MHz_Label[];
extern uint8_t KHz_Label[];
extern uint8_t Hz_Label[];

extern uint8_t dBm_Label[];
extern uint8_t Vpp_Label[];
extern uint8_t Rms_Label[];

extern uint8_t DDS_Label[];
extern uint8_t RFLabel[];

extern int8_t CW_Freq_Show_Position;
extern uint8_t CW_Amp_Show_Position; 

extern uint8_t CW_Amp_Sign;//对数幅度的符号位，0为正，1位负
extern uint8_t CW_Out_Type;//out的通道类型
extern uint8_t CW_Edit_Sel;

extern float AD8310_dBm;
extern float AD8310_dBm_buf;
extern float ADL5513_dBm;    //ADL5513检测的幅度
extern float ADL5513_dBm_buf; //


extern uint32_t DDS_Freq_Hz; //DDS的初始频率
extern uint32_t DDS_Freq_Hz_Buf;;

extern uint64_t  PLL_Freq_Hz;    //PLL的频率
extern uint64_t  PLL_Freq_Hz_Buf;

extern uint8_t  oled_refresh;
extern uint8_t  oled_key_refresh;

extern uint8_t  EC11_Lock;
extern uint8_t  EC11_Ent_Count; //EC11按下按键的计数
extern uint8_t  EC11_Direct;

extern uint16_t Enc0Pos;
extern uint16_t Enc_PinDATLast;

extern uint16_t EC11_Count_LableSel ; //编码器计数对应标签选中下的计数
extern uint16_t EC11_Count_LableSel_Reg ;

extern uint16_t EC11_Count_EditSel ; //编码器计数对应编辑选中下的计数
extern uint16_t EC11_Count_EditSel_Reg;

extern uint16_t EC11_Count_EditNum ; //编码器计数对应数字编辑下的计数
extern uint16_t EC11_Count_EditNum_Reg;


extern uint16_t Key_S1_Down_Count; //按键按下的次数
extern uint8_t  tim_1s_count;

extern uint8_t BEEP_SW;

extern float   DDS_Amp_dBm; //DDS的初始幅度dBm单位
extern float   DDS_Amp_dBm_Buf;

extern float   PLL_Amp_dBm; //PLL的初始幅度dBm单位
extern float   PLL_Amp_dBm_Buf;

extern uint8_t CW_Freq_Uint;
extern uint8_t CW_Freq_Uint_Reg;
extern uint8_t CW_Amp_Uint;
extern uint8_t CW_Amp_Uint_Reg;
//extern float Cal_Bypass_ATT0[];

extern const uint8_t CW_Freq_Value_initial[13];
extern const uint8_t CW_Amp_Value_initial[8];

extern uint8_t   Out_State;
extern uint8_t   Out_State_Buf;


extern uint8_t  AD9912_Power_Flag;
extern uint8_t  AD9912_Power_Flag_Reg;

extern uint32_t AD9912_fre;
extern uint32_t AD9912_Freq_step;

extern uint8_t  Out_Process;//执行输出状态处理



extern uint8_t  CW_Freq_Show_Buf[16];      
extern uint8_t  CW_DDS_Freq_Show_Buf[16];    
extern uint8_t  CW_PLL_Freq_Show_Buf[16];  

extern uint8_t  CW_Freq_Show_Position_Anti[16];  

extern uint8_t  CW_Amp_Show_Buf[8];      
extern uint8_t  CW_Amp_Show_Last_buf[8];

extern const uint32_t LO_LMX2592_Default_Reg1[43];
extern const uint32_t LO_LMX2592_Default_Reg2[43];
extern const uint32_t LO_LMX2592_Default_Reg3[43];

extern uint32_t LMX2592_R0_Value;//
extern uint32_t LMX2592_R0_Value_Reg;//

extern uint32_t LMX2592_R23_Value;//
extern uint32_t LMX2592_R23_Value_Reg;//



extern  uint8_t  tim_1s_count;


/*
*********************************************************************************************************
											函数定义
*********************************************************************************************************
*/



