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

📄 mygui.c

📁 SmartARM2200开发平台光盘资料中的所有的源码和测试程序以及应用程序
💻 C
字号:
/****************************************Copyright (c)**************************************************
**                               Guangzou ZLG-MCU Development Co.,LTD.
**                                      graduate school
**                                 http://www.zlgmcu.com
**
**--------------File Info-------------------------------------------------------------------------------
** File name:			MyGUI.c
** Last modified Date:  2005-07-31
** Last Version:		1.0
** Descriptions:		Include Font and Oscilloscope Funtion
**
**------------------------------------------------------------------------------------------------------
** Created by:			Ganda
** Created date:		2005-07-31
** Version:				1.0
** Descriptions:		The original version
**
**------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
** Version:
** Descriptions:
**
********************************************************************************************************/

#include "config.h"

/*********************************************************************************************************
** Function name:			GUI_PrtChar
**
** Descriptions:			Print a character on the screen
**
** input parameters:		uint16 x,uint16 y   Position of the character
**                          char   data         ASCII Code of the character  
**                          uint16 FGND         Front color of the character   
**                          uint16 BGND         Background color of the character
** Returned value:			uint16              Width of the character 
**         
** Used global variables:	font, width
** Calling modules:			TftSetWindow
**                          TftSetWrite
**                          TftSendDat
**
** Created by:				Ganda
** Created Date:			2005-07-31
**-------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/
uint16 GUI_PrtChar(uint16 x, uint16 y, char data, uint16 FGND, uint16 BGND)
{   uint8 Buf[13];
    uint8 i,j;
    
    TftSetWindow(x,  y, 12+x, y+width[data-0x20]); 
    TftSetWrite(x,  y); 
    
    for(i=0; i<13; i++)
    {
        Buf[12-i] = font[offset[data-0x20]+i];
    }
    for(i=0; i<width[data-0x20]; i++)
    {
        for(j=0; j<13; j++)
        {
            if( (Buf[j]&0x80)!=0 )
            {
                TftSendDat(FGND);
            }
            else
            {
                TftSendDat(BGND);
            }
            Buf[j] = Buf[j] << 1;
        }
    }
    TftSetWindow(0,0, 239, 319); 
    return (width[data-0x20]);
}

/*********************************************************************************************************
** Function name:			GUI_PrtStr
**
** Descriptions:			Print a string on the screen
**
** input parameters:		uint16 x,uint16 y   Position of the string
**                          char  *p            Point of the string's array  
**                          uint16 FGND         Front color of the string  
**                          uint16 BGND         Background color of the string  
** Returned value:			None
**         
** Used global variables:	None
** Calling modules:			GUI_FontChar
**
** Created by:				Ganda
** Created Date:			2005-07-31
**-------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/
void GUI_PrtStr(uint16 x, uint16 y, char *p, uint16 FGND, uint16 BGND)
{   uint32  CharOffset = 0;

    while(*p != 0)
    {
        CharOffset += GUI_PrtChar(x, y+CharOffset, *p, FGND, BGND); 
        p++;
    }
}

/*********************************************************************************************************
** Function name:			GUI_PrtPic
**
** Descriptions:			Print a picture on the screen
**
** input parameters:		uint16 x1, uint16 y1    Position of the picture's down left corner
**                          uint16 x2, uint16 y2    Position of the picture's top right corner
**                          const uint8 *p          Point of the picture's array
** Returned value:			None
**         
** Used global variables:	None
** Calling modules:			TftSetWindow
**                          TftSetWrite
**                          TftSendDat
**
** Created by:				Ganda
** Created Date:			2005-07-31
**-------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/
void GUI_PrtPic(uint16 x1, uint16 y1, uint16 x2, uint16 y2, const uint8 *p)
{   uint32  i;
    uint32  m,n;

    TftSetWindow(x1, y1, x2, y2); 
    TftSetWrite(x1, y1);

    for(i=0; i<(x2-x1+1)*(y2-y1+1); i++)
    {  
        m = *p;
        p++;
        n = *p;
        p++;
        TftSendDat(n<<8 | m); 
    }
 
}

/*********************************************************************************************************
** Function name:			GUI_FillScr
**
** Descriptions:			Fill screen with specify color
**
** input parameters:		uint16 Color    Fill color
**
** Returned value:			None
**         
** Used global variables:	None
** Calling modules:			TftSetWindow
**                          TftSetWrite
**                          TftSendDat
**
** Created by:				Ganda
** Created Date:			2005-07-31
**-------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/
void GUI_FillScr(uint16 Color)
{   uint32  i;

    TftSetWindow(0,0, 239,319); 
    TftSetWrite(0, 0);
    for(i=0; i<320*240; i++)
    {  
        TftSendDat(Color);     
    }
}


/* 示波器轨迹消隐 */
void GUI_ClrTrack(void)
{   uint32 i, j;

    for(i=0; i<WaveTrackCnt; i++)              
    {   
        TftSetWrite(WaveTrackX[i], WaveTrackY[i]);
        j = (WaveTrackY[i]*240 + WaveTrackX[i]) << 1;
        TftSendDat((gImage_root01[j+1]<<8) | gImage_root01[j]);  
    }   
}

/* 示波器轨迹显示 */
void GUI_DispTrack(void)
{   uint32 y1, y2;
    uint32 i, j;
    uint32 OffsetX = 10, OffsetY = 28;

    WaveTrackCnt = 0;
    j = OffsetX;
    for(i=CH1Tpt1-125; i<CH1Tpt1+125; i++)              
    {   
        y1 = (CH1[i]*196>> 8) + OffsetY;   
        y2 = (CH1[i+1]*196 >> 8) + OffsetY;
        GUI_Line(y1, j, y2, j+1, 0xfee4);
        j++;
    }
}

⌨️ 快捷键说明

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