📄 tst3.cpp
字号:
/*//////////////////////////////////////////////////////////////////////////
Orgnization: Emtronix Incorporated
Filename: TST1.CPP
Compiler: BC3.1
Authors: Wang Ping
Date: April, 2001
Revised: ...
Description: This is a test routine for 128X64 DOT_LCD
///////////////////////////////////////////////////////////////////////////*/
#include <stdio.h>
#include <conio.h>
#include <dos.h>
#include <graphics.h>
#include <string.h>
#include <math.h>
#include "lcd_api.h"
#include "key.h"
#include "menu.h"
void ScreenWelcome( );
int main()
{
int status;
KEY key;
status = MENUManager.SysMenuInit( );
if( status < 0 ) return status;
ScreenWelcome( );
MENUManager.ShowMenu( 0 );
for(;;)
{
key = GetKey( );
switch( key )
{
case _Up:
MENUManager.MenuItemBarUp( );
break;
case _Down:
MENUManager.MenuItemBarDn( );
break;
case _Left:
MENUManager.MenuItemInc( );
break;
case _Right:
MENUManager.MenuItemDec( );
break;
case _Enter:
MENUManager.MenuDrivedManualPro( );
break;
case _Esc:
MENUManager.AbnormalPro( );
break;
case _Add:
MENUManager.MenuItemINC( );
break;
case _Minus:
MENUManager.MenuItemDEC( );
break;
}
}
return 0;
}
void ScreenWelcome( )
{
// goto graghic mode
int x, y;
/* initialize graphics mode */
LCD_Init( "mlib.chr", "ascii.chr" );
// show chinese char at center position
char BufStr[200];
strcpy( BufStr, "** 欢迎测试 **" );
x = (320-strlen(BufStr)*8)/2;
y = 48;
LCD_WriteString( x, y, BufStr, 1 );
//_Writestring( x, y, BufStr, LCD_BACK, LCD_DOT );
strcpy( BufStr, "嵌入式网络模块" );
x = (320-strlen(BufStr)*8)/2;
y = 80;
LCD_WriteString( x, y, BufStr, 0 );
strcpy( BufStr, "嵌入式网络模块12.34ABCDEFGHIJK汉字显示" );
x = (320-strlen(BufStr)*8)/2;
y = 148;
LCD_WriteString( x, y, BufStr, 1 );
// draw lines
LCD_DrawLine( 0, 182, 319, 182, 1 );
LCD_DrawLine( 0, 203, 319, 203, 1 );
// draw curve
for( x=0; x<319; x++ )
{
y = 193 - 10.0*sin( 2.0*M_PI*x/24.0 );
LCD_PutPixel( x, y, 1 );
}
for( x=0; x<319; x++ )
{
y = 193 - 10.0*sin( 2.0*M_PI*x/24.0 );
LCD_PutPixel( x, y, 0x81 );
}
strcpy( BufStr, "亮度测试" );
x = (320-strlen(BufStr)*8)/2;
y = 210;
LCD_WriteString( x, y, BufStr, 1 );
strcpy( BufStr, "亮度测试完毕" );
x = (320-strlen(BufStr)*8)/2;
y = 210;
LCD_WriteString( x, y, BufStr, 1 );
// exit
//getch( );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -