⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 display_switchmode_65k320240.c

📁 可以学习
💻 C
📖 第 1 页 / 共 2 页
字号:
/*--------------------------------------------------------------------------
*主界面显示模块
--------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------
*INCLUDES
--------------------------------------------------------------------------*/
#include "SwitchMode_bmp.h"
#include "Interface.h"


/*--------------------------------------------------------------------------
* EXTERNAL Variable ,constant or function
--------------------------------------------------------------------------*/
const U8 SwitchMode_Table[SWITCHMODE_MAINITEM_COUNT]=
{
	SwitchMode_Id_Video,
	SwitchMode_Id_Swf,
	SwitchMode_Id_Photo,	
	SwitchMode_Id_Game,
	SwitchMode_Id_Ebook,
	SwitchMode_Id_En_to_Ch,		
	SwitchMode_Id_Mp3,
	SwitchMode_Id_FM,
	SwitchMode_Id_Record,
	SwitchMode_Id_Explorer,
	SwitchMode_Id_Extend,
	SwitchMode_Id_Menu,
};

/*--------------------------------------------------------------------------
* Variable ,constant or function
--------------------------------------------------------------------------*/
//主界面图标显示位置
static const U16 SwitchMode_Icon_Pos[][2]=
{//y,x
	53,0,
	
	53,78,
	
	53,155,
	
	117,0,
	
	117,78,
	
	117,155,
	
	183,0,
	
	183,78,
	
	183,155,
	
	247,0,
	
	247,78,
	
	247,155
};

//学习机和扩展功能图标显示位置
static const U16 Learn_Extend_Icon_Pos[][2]=
{//y,x
	86,17,
	86,86,
	86,155,
	
	156,17,
	156,86,
	156,155,
	
	226,17,
	226,86,
	226,155
};



//主界面电量图标
static const U8 SWITCHMODE_BATTERY[4][18]=
{
	//电量空
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	//电量1
	0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,0x00,0x0F,
	//电量2
	0x03,0xCF,0x03,0xCF,0x03,0xCF,0x03,0xCF,0x03,0xCF,0x03,0xCF,0x03,0xCF,0x03,0xCF,0x03,0xCF,
	//电量3
	0xF3,0xCF,0xF3,0xCF,0xF3,0xCF,0xF3,0xCF,0xF3,0xCF,0xF3,0xCF,0xF3,0xCF,0xF3,0xCF,0xF3,0xCF
};


static const U8 SWITCHMODE_WEEK[][36]=
{
	//SUN
	0x78,0x00,0x00,0x00,0xC8,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0xE1,0xDC,0xEE,0x00,
	0x78,0xCC,0x76,0x00,0x1C,0xCC,0x66,0x00,0x8C,0xCC,0x66,0x00,0x8C,0xCC,0x66,0x00,
	0xF8,0xFE,0xF7,0x00,
	//MON
	0xE0,0x70,0x00,0x00,0x70,0xE0,0x00,0x00,0x70,0xE0,0x00,0x00,0x59,0x63,0xCE,0xE0,
	0x59,0x66,0x67,0x60,0x4D,0x66,0x66,0x60,0x4E,0x66,0x66,0x60,0x46,0x66,0x66,0x60,
	0xE6,0xF3,0xCF,0x70,
	//TUE
	0xFF,0x00,0x00,0x00,0x99,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x18,0x77,0x1C,0x00,
	0x18,0x33,0x36,0x00,0x18,0x33,0x3E,0x00,0x18,0x33,0x30,0x00,0x18,0x33,0x38,0x00,
	0x3C,0x3F,0x9E,0x00,
	//WED
	0x00,0x00,0x0E,0x00,0xCC,0xC0,0x06,0x00,0xCC,0xC0,0x06,0x00,0x4C,0x8E,0x1E,0x00,
	0x6D,0x9B,0x26,0x00,0x7F,0x9F,0x66,0x00,0x33,0x18,0x66,0x00,0x33,0x1C,0x66,0x00,
	0x33,0x0F,0x3F,0x00,
	//THU
	0xFF,0x70,0x00,0x00,0x99,0x30,0x00,0x00,0x18,0x30,0x00,0x00,0x18,0x37,0x77,0x00,
	0x18,0x3B,0x33,0x00,0x18,0x33,0x33,0x00,0x18,0x33,0x33,0x00,0x18,0x33,0x33,0x00,
	0x3C,0x7B,0xBF,0x80,
	//FRI
	0xFE,0x00,0x60,0x00,0x62,0x00,0x60,0x00,0x60,0x00,0x00,0x00,0x64,0x74,0xE0,0x00,
	0x7C,0x38,0x60,0x00,0x64,0x30,0x60,0x00,0x60,0x30,0x60,0x00,0x60,0x30,0x60,0x00,
	0xF0,0x78,0xF0,0x00,
	//SAT
	0x78,0x00,0x00,0x00,0xC8,0x01,0x80,0x00,0xC0,0x01,0x80,0x00,0xE0,0xF3,0xC0,0x00,
	0x78,0x31,0x80,0x00,0x1C,0xF1,0x80,0x00,0x8D,0xB1,0x80,0x00,0x8D,0xB1,0x80,0x00,
	0xF9,0xF9,0xC0,0x00
};



//外接卡图标取模数据  W=12 H=8
static const U8 CARD[]=
{
	0x3F,0xF0,0x7F,0xF0,0xE6,0x30,0xDE,0xD0,0xE6,0xD0,0xFA,0xD0,0xC6,0x30,0xFF,0xF0
};


/*-----------------------------------------------------------------------------
* 函数:	DisplaySwitchMode_Refresh
* 功能:	模式切换模块SwitchMode的显示程序
* 参数:	FocusItemNo	当前焦点
* 返回:	none
*----------------------------------------------------------------------------*/
void DisplaySwitchMode_Refresh(void)
{
	SwitchMode_Id_e	SwitchModeId;
	U8 FocusItemNo;
	U8 languageIndex;
	RECT Rect;
	U32 bmpOffset;
	STRING string;
	U8  pstring[3];
	static U8 FlashTime=0;
	U32 i,j;

	Hyc_DisplaySpecial_Cancel();
	Hyc_SetColumnLimit(cLCD_TOTAL_COLUMN);

	SwitchModeId=Hyc_GetSwitchModeId();
	FocusItemNo=Hyc_GetSwitchMode_FocusItemNo();
	
	languageIndex = tSwitchModeInfo[SwitchModeId].u8TotalItemNum&(~cSWITCHMODE_HAVE_CHILD);
	languageIndex=Hyc_GetLanguageIndex()*languageIndex;//获得焦点项字符串序号
		
	if(Hyc_GetSwitchModeRefreshMode()==NOT)
	{
		 if((FlashTime%8)==0&&0==Hyc_GetDialogState()&& SwitchModeId==SwitchMode_Id_Main )
	     {
		     Rect.h = cSWITCHMODE_ICON_H;
		     Rect.w = cSWITCHMODE_ICON_W;
	         Rect.y = SwitchMode_Icon_Pos[FocusItemNo][0];
	         Rect.x = SwitchMode_Icon_Pos[FocusItemNo][1];
		     bmpOffset=cOFFSET_SWITCHMODE_ICON + (3*FocusItemNo+FlashTime/8)*cBMPSIZE_SWITCHMODE_ICON;
		     Hyc_WriteBMPFromNand((U32)bmpOffset, &Rect);
		
             Hyc_RefreshScreen();	
	     }
		 
	     if(SwitchModeId==SwitchMode_Id_Main&&0==Hyc_GetDialogState())
	     {	
		     FlashTime++;
		     FlashTime %= 24;
	     }
	}
	
	if(Hyc_GetSwitchModeRefreshMode()==PART)
	{//部分刷新
	
		U8 FocusItemNo_Last;		
		
		FocusItemNo_Last=Hyc_GetSwitchMode_FocusItemNoLast();
		
		for(i=0,j=0; i<FocusItemNo_Last; i++)
		{
			if(Hyc_CheckNotDisplay(SwitchModeId, i) == TRUE) j++;
			
		}
		
		FocusItemNo_Last -= j;
		
		for(i=0,j=0; i<FocusItemNo; i++)
		{
			if(Hyc_CheckNotDisplay(SwitchModeId, i) == TRUE) j++;
			
		}
		
		FocusItemNo -= j;
		
		if(SwitchModeId==SwitchMode_Id_Main)
		{//处于主菜单界面

			Rect.h = cSWITCHMODE_ICON_H;
			Rect.w = cSWITCHMODE_ICON_W;
			Rect.y = SwitchMode_Icon_Pos[FocusItemNo_Last][0];
			Rect.x = SwitchMode_Icon_Pos[FocusItemNo_Last][1];
			Hyc_Background2DisplayMemory(&Rect);	
			
			Rect.h = cSWITCHMODE_ICON_H;
			Rect.w = cSWITCHMODE_ICON_W;
			Rect.y = SwitchMode_Icon_Pos[FocusItemNo][0];
			Rect.x = SwitchMode_Icon_Pos[FocusItemNo][1];
			bmpOffset = cOFFSET_SWITCHMODE_ICON + (FocusItemNo*3*cBMPSIZE_SWITCHMODE_ICON);			
			Hyc_WriteBMPFromNand((U32)bmpOffset, &Rect);

			languageIndex=Hyc_GetLanguageIndex();
			if(languageIndex>2)languageIndex=0;//如果当前语言不是英语、中文、繁体中文,则显示英文标题

			Rect.h = cSWITCHMODE_BMPST_H;
			Rect.w = cSWITCHMODE_BMPST_W;
			Rect.y = cSWITCHMODE_BMPST_Y;
			Rect.x = cSWITCHMODE_BMPST_X;
			bmpOffset=cOFFSET_SWITCHMODE_ENGLISH_ICON
			 + languageIndex*cBMPSIZE_SWITCHMODE_LANGUAGE + FocusItemNo*cBMPSIZE_SWITCHMODE_BMPSTR;
			Hyc_WriteBMPFromNand((U32)bmpOffset, &Rect);
		}
		else if(SwitchModeId==SwitchMode_Id_Learn)
		{//处于学习机界面

			Rect.h = cSWITCHMODE_LEARN_ICON_H;
			Rect.w = cSWITCHMODE_LEARN_ICON_W;
			Rect.y = Learn_Extend_Icon_Pos[FocusItemNo_Last][0];
			Rect.x = Learn_Extend_Icon_Pos[FocusItemNo_Last][1];
			bmpOffset=cOFFSET_SWITCHMODE_LEARN_ICON+(FocusItemNo_Last*2)*cBMPSIZE_SWITCHMODE_LEARN_ICON;
			Hyc_WriteBMPFromNand((U32)bmpOffset, &Rect);
					
			Rect.h = cSWITCHMODE_LEARN_ICON_H;
			Rect.w = cSWITCHMODE_LEARN_ICON_W;
			Rect.y = Learn_Extend_Icon_Pos[FocusItemNo][0];
			Rect.x = Learn_Extend_Icon_Pos[FocusItemNo][1];
			bmpOffset=cOFFSET_SWITCHMODE_LEARN_ICON+(FocusItemNo*2+1)*cBMPSIZE_SWITCHMODE_LEARN_ICON;
			Hyc_WriteBMPFromNand((U32)bmpOffset, &Rect);
			
			Rect.h = 16;
			Rect.w = 160;
			Rect.y = cSWITCHMODE_STR2_Y;
			Rect.x = cSWITCHMODE_STR2_X;
			Hyc_Background2DisplayMemory(&Rect);
						
			string.pstring=(U8*)tSwitchModeInfo[SwitchModeId].pItemString[languageIndex+FocusItemNo];
			string.y=cSWITCHMODE_STR2_Y;
			string.x=12;
			string.attribute=FONTSIZE8X16;
			string.FrontColor=COLOR_BLACK;
			string.BackColor=COLOR_BLACK;
			Hyc_DisplayString(&string);
		}
		else if(SwitchModeId==SwitchMode_Id_Extend)
		{//处于扩展功能界面

			Rect.h = cSWITCHMODE_EXTEND_ICON_H;
			Rect.w = cSWITCHMODE_EXTEND_ICON_W;
			Rect.y = Learn_Extend_Icon_Pos[FocusItemNo_Last][0];
			Rect.x = Learn_Extend_Icon_Pos[FocusItemNo_Last][1];
			bmpOffset=cOFFSET_SWITCHMODE_EXTEND_ICON+(FocusItemNo_Last*2)*cBMPSIZE_SWITCHMODE_EXTEND_ICON;
			Hyc_WriteBMPFromNand((U32)bmpOffset, &Rect);
			
			Rect.h = cSWITCHMODE_EXTEND_ICON_H;
			Rect.w = cSWITCHMODE_EXTEND_ICON_W;
			Rect.y = Learn_Extend_Icon_Pos[FocusItemNo][0];
			Rect.x = Learn_Extend_Icon_Pos[FocusItemNo][1];
			bmpOffset=cOFFSET_SWITCHMODE_EXTEND_ICON+(FocusItemNo*2+1)*cBMPSIZE_SWITCHMODE_EXTEND_ICON;
			Hyc_WriteBMPFromNand((U32)bmpOffset, &Rect);
					
			Rect.h = 16;
			Rect.w = 160;
			Rect.y = cSWITCHMODE_STR2_Y;
			Rect.x = cSWITCHMODE_STR2_X;
			Hyc_Background2DisplayMemory(&Rect);
			
			string.pstring=(U8*)tSwitchModeInfo[SwitchModeId].pItemString[languageIndex+FocusItemNo];
			string.y=cSWITCHMODE_STR2_Y;
			string.x=12;
			string.attribute=FONTSIZE8X16;
			string.FrontColor=COLOR_BLACK;
			string.BackColor=COLOR_BLACK;
			Hyc_DisplayString(&string);
		}
		else if(SwitchModeId == SwitchMode_Id_Vidicon || SwitchModeId == SwitchMode_Id_Camera)
		{
			
			Rect.h = cDISP_SELECT_BAR_H*3;
			Rect.w = cDISP_SELECT_BAR_W;
			Rect.y = cDISP_SELECT_BAR_Y;
			Rect.x = cDISP_SELECT_BAR_X;
			Hyc_Background2DisplayMemory(&Rect);
			
			
			Rect.h = cDISP_SELECT_BAR_H;
			Rect.w = cDISP_SELECT_BAR_W;
			Rect.y = cDISP_SELECT_BAR_Y+FocusItemNo*cDISP_SELECT_BAR_STEP_Y;
			Rect.x = cDISP_SELECT_BAR_X;
			
			bmpOffset=cOFFSET_SELECT_BAR;
			Hyc_WriteBMPFromNand((U32)bmpOffset, &Rect);
			
			string.pstring=(U8*)tSwitchModeInfo[SwitchModeId].pItemString[languageIndex+FocusItemNo];
			string.y=cDISP_SELECT_BAR_Y+FocusItemNo*cDISP_SELECT_BAR_STEP_Y+2;
			string.x=cSWITCHMODE_STR2_Y;
			string.attribute=FONTSIZE8X16;
			string.FrontColor=COLOR_BLACK;
			string.BackColor=COLOR_BLACK;
			Hyc_DisplayString(&string);
			
			string.pstring=(U8*)tSwitchModeInfo[SwitchModeId].pItemString[languageIndex+FocusItemNo_Last];
			string.y=cDISP_SELECT_BAR_Y+FocusItemNo_Last*cDISP_SELECT_BAR_STEP_Y+2;
			string.x=cDISPLAY_STRINGLIST_X;
			string.attribute=FONTSIZE8X16;
			string.FrontColor=COLOR_BLACK;
			string.BackColor=COLOR_BLACK;
			Hyc_DisplayString(&string);
			
		}
		
	}
	else if(Hyc_GetSwitchModeRefreshMode()==ALL)
	{//获得标题字符串序号
		
		U8 Refresh_Item,TotalNum,FatherTotal;
		
		TotalNum=tSwitchModeInfo[SwitchModeId].u8TotalItemNum & ~cSWITCHMODE_HAVE_CHILD;
		
		FatherTotal = tSwitchModeInfo[SwitchModeId].u8PreTotalItemNum;
		
		Refresh_Item=Hyc_GetLanguageIndex()*FatherTotal+(U8)SwitchModeId-1 ;

		//背景刷新
		if(SwitchModeId==SwitchMode_Id_Main)
		{//主菜单背景
			
			Rect.h = cLCD_TOTAL_ROW;
			Rect.w = cLCD_TOTAL_COLUMN;
			Rect.y = 0;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -