Пример #1
0
void LCD_Draw_Rectangle(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2,
    uint16_t color, uint8_t fill) {
  if (fill) {
    uint16_t i;
    if (x1 > x2) {
      i = x2;
      x2 = x1;
    } else
      i = x1;
    for (; i <= x2; i++)
      LCD_Draw_Line(i, y1, i, y2, color);
    return;
  }
  LCD_Draw_Line(x1, y1, x1, y2, color);
  LCD_Draw_Line(x1, y2, x2, y2, color);
  LCD_Draw_Line(x2, y2, x2, y1, color);
  LCD_Draw_Line(x2, y1, x1, y1, color);
}
Пример #2
0
//模型参数调节菜单处理过程
u32 PageNorRevSet(u8 event)
{
	static u8 DrawMask;
	static u8 iFocus;
	
	if(event==PV_INIT)
	{
		LCD_Clr_All();//清屏
		DrawMask = PD_ALL;
		iFocus = 0;
		return 1;
	}
	
	if(event==PV_REDRAW)
	{
		LCD_Clr_All();//清屏
		DrawMask = PD_ALL;	
	}
	
	if(DrawMask)
	{
		if(DrawMask&PD_TITLE)
		{
			LCD_Fill_Rect(0,0,127,13,0);
			Disp_GB2312_String(0,3,(u8 *)TitleNorRevSet[TxSys.Language],0,0);
			LCD_Draw_Line(0,14,127,14,1);
			LCD_Draw_Line(0,15,127,15,1);
			
			Disp_NorRev(24,17);
			Disp_NorRev(92,17);
		}
		
		if(DrawMask&PD_IDX)
		{
			if(iFocus==0)	LcdDraw_RevBarArrow(ARROW_X1,ARROW_Y);
			else	LCD_Fill_Rect(ARROW_X1,ARROW_Y,ARROW_X1+6,ARROW_Y+8,0);
			
			if(iFocus==1)	LcdDraw_RevBarArrow(ARROW_X1,ARROW_Y+8);
			else	LCD_Fill_Rect(ARROW_X1,ARROW_Y+8,ARROW_X1+6,ARROW_Y+16,0);
			
			if(iFocus==2)	LcdDraw_RevBarArrow(ARROW_X1,ARROW_Y+16);
			else	LCD_Fill_Rect(ARROW_X1,ARROW_Y+16,ARROW_X1+6,ARROW_Y+24,0);
			
			if(iFocus==3)	LcdDraw_RevBarArrow(ARROW_X1,ARROW_Y+24);
			else	LCD_Fill_Rect(ARROW_X1,ARROW_Y+24,ARROW_X1+6,ARROW_Y+32,0);
			
			if(iFocus==4)	LcdDraw_RevBarArrow(ARROW_X1,ARROW_Y+32);
			else	LCD_Fill_Rect(ARROW_X1,ARROW_Y+32,ARROW_X1+6,ARROW_Y+40,0);
			
			if(iFocus==5)	LcdDraw_RevBarArrow(ARROW_X2,ARROW_Y);
			else	LCD_Fill_Rect(ARROW_X2,ARROW_Y,ARROW_X2+6,ARROW_Y+8,0);
			
			if(iFocus==6)	LcdDraw_RevBarArrow(ARROW_X2,ARROW_Y+8);
			else	LCD_Fill_Rect(ARROW_X2,ARROW_Y+8,ARROW_X2+6,ARROW_Y+16,0);
			
			if(iFocus==7)	LcdDraw_RevBarArrow(ARROW_X2,ARROW_Y+16);
			else	LCD_Fill_Rect(ARROW_X2,ARROW_Y+16,ARROW_X2+6,ARROW_Y+24,0);
			
			if(iFocus==8)	LcdDraw_RevBarArrow(ARROW_X2,ARROW_Y+24);
			else	LCD_Fill_Rect(ARROW_X2,ARROW_Y+24,ARROW_X2+6,ARROW_Y+32,0);
			
			if(iFocus==9)	LcdDraw_RevBarArrow(ARROW_X2,ARROW_Y+32);
			else	LCD_Fill_Rect(ARROW_X2,ARROW_Y+32,ARROW_X2+6,ARROW_Y+40,0);
		}
			
		if(DrawMask&PD_VALUE)	
		{
			LcdDrawMiniNum(REVBAR_X1,REVBAR_Y,LCD_MN_CHAR('C'),0);
			LcdDrawMiniNum(REVBAR_X1+4,REVBAR_Y,LCD_MN_CHAR('H'),0);
			LcdDrawMiniNum(REVBAR_X1+8,REVBAR_Y,1,0);
			Disp_RevBar(REVBAR_X1+12,REVBAR_Y,Model.Rev[0]);
			
			LcdDrawMiniNum(REVBAR_X1,REVBAR_Y+8,LCD_MN_CHAR('C'),0);
			LcdDrawMiniNum(REVBAR_X1+4,REVBAR_Y+8,LCD_MN_CHAR('H'),0);
			LcdDrawMiniNum(REVBAR_X1+8,REVBAR_Y+8,2,0);
			Disp_RevBar(REVBAR_X1+12,REVBAR_Y+8,Model.Rev[1]);
			
			LcdDrawMiniNum(REVBAR_X1,REVBAR_Y+16,LCD_MN_CHAR('C'),0);
			LcdDrawMiniNum(REVBAR_X1+4,REVBAR_Y+16,LCD_MN_CHAR('H'),0);
			LcdDrawMiniNum(REVBAR_X1+8,REVBAR_Y+16,3,0);
			Disp_RevBar(REVBAR_X1+12,REVBAR_Y+16,Model.Rev[2]);
			
			LcdDrawMiniNum(REVBAR_X1,REVBAR_Y+24,LCD_MN_CHAR('C'),0);
			LcdDrawMiniNum(REVBAR_X1+4,REVBAR_Y+24,LCD_MN_CHAR('H'),0);
			LcdDrawMiniNum(REVBAR_X1+8,REVBAR_Y+24,4,0);
			Disp_RevBar(REVBAR_X1+12,REVBAR_Y+24,Model.Rev[3]);
			
			LcdDrawMiniNum(REVBAR_X1,REVBAR_Y+32,LCD_MN_CHAR('C'),0);
			LcdDrawMiniNum(REVBAR_X1+4,REVBAR_Y+32,LCD_MN_CHAR('H'),0);
			LcdDrawMiniNum(REVBAR_X1+8,REVBAR_Y+32,5,0);
			Disp_RevBar(REVBAR_X1+12,REVBAR_Y+32,Model.Rev[4]);
			
			LcdDrawMiniNum(REVBAR_X2,REVBAR_Y,LCD_MN_CHAR('C'),0);
			LcdDrawMiniNum(REVBAR_X2+4,REVBAR_Y,LCD_MN_CHAR('H'),0);
			LcdDrawMiniNum(REVBAR_X2+8,REVBAR_Y,6,0);
			Disp_RevBar(REVBAR_X2+12,REVBAR_Y,Model.Rev[5]);
			
			LcdDrawMiniNum(REVBAR_X2,REVBAR_Y+8,LCD_MN_CHAR('C'),0);
			LcdDrawMiniNum(REVBAR_X2+4,REVBAR_Y+8,LCD_MN_CHAR('H'),0);
			LcdDrawMiniNum(REVBAR_X2+8,REVBAR_Y+8,7,0);
			Disp_RevBar(REVBAR_X2+12,REVBAR_Y+8,Model.Rev[6]);
			
			LcdDrawMiniNum(REVBAR_X2,REVBAR_Y+16,LCD_MN_CHAR('C'),0);
			LcdDrawMiniNum(REVBAR_X2+4,REVBAR_Y+16,LCD_MN_CHAR('H'),0);
			LcdDrawMiniNum(REVBAR_X2+8,REVBAR_Y+16,8,0);
			Disp_RevBar(REVBAR_X2+12,REVBAR_Y+16,Model.Rev[7]);
			
			LcdDrawMiniNum(REVBAR_X2,REVBAR_Y+24,LCD_MN_CHAR('C'),0);
			LcdDrawMiniNum(REVBAR_X2+4,REVBAR_Y+24,LCD_MN_CHAR('H'),0);
			LcdDrawMiniNum(REVBAR_X2+8,REVBAR_Y+24,9,0);
			Disp_RevBar(REVBAR_X2+12,REVBAR_Y+24,Model.Rev[8]);
			
			LcdDrawMiniNum(REVBAR_X2-4,REVBAR_Y+32,LCD_MN_CHAR('C'),0);
			LcdDrawMiniNum(REVBAR_X2,REVBAR_Y+32,LCD_MN_CHAR('H'),0);
			LcdDrawMiniNum(REVBAR_X2+4,REVBAR_Y+32,1,0);
			LcdDrawMiniNum(REVBAR_X2+8,REVBAR_Y+32,0,0);
			Disp_RevBar(REVBAR_X2+12,REVBAR_Y+32,Model.Rev[9]);
		}
		DrawMask = 0;
	}
		
	if(KeyTstDown(KEY_ENT))
	{
		Model.Rev[iFocus] = !Model.Rev[iFocus];
		DrawMask = PD_VALUE;
	}
	
	//上下按键处理
	if(KeyTstDown(KEY_DOWN))
	{
		if(iFocus<9)	iFocus++;
		else	iFocus = 0;
		DrawMask = PD_IDX;
	}
	if(KeyTstDown(KEY_UP))
	{
		if(iFocus>0)	iFocus--;
		else	iFocus = 9;
		DrawMask = PD_IDX;
	}
	
	//返回键处理
	if(KeyTstDown(KEY_EXT))
	{
		PageReturn(PV_INIT);
	}

	KeyClearDown(KEY_MENUALL);

	
	return 0;
}