📄 lcdlogdrvtest.c
字号:
/*
*********************************************************************************************************
* uC/OS-II
* The Real-Time Kernel
*
* (c) Copyright 2000, Jean J. Labrosse, Weston, FL
* All Rights Reserved
*
* V2.00
*
* EXAMPLE #1
*********************************************************************************************************
*/
#include "gui.h"
#include "LCD_LOG_DRV.h"
#include "lcd.h"
#include "intrz80.h"
#include "os_cpu.h"
void debug(void);
#pragma memory=dataseg(SD_TBF)
#pragma memory=default
#pragma memory=constseg(SDC_TBF)
#pragma memory=default
#pragma codeseg(LCM_RCODE)
char OS_Enter_Sum = 0;//只为测试时用
void TestLCMOnOff(void);
void TestLCMStandby(void);
void TestLCMDrawPoint(void);
void TestLCMDrawLine(void);
void TestLCMDrawRect(void);
void TestLCMOtherFun(void);
void TestFont(void);
extern char pictab[];
#pragma memory=dataseg(TMPBUF)
int databuffer[1024];
#pragma memory=default
#pragma memory=constseg(FONTCONST)
extern GUI_FLASH const GUI_FONT GUI_DUMMY;
#pragma memory=default
void delay11(void)
{
unsigned int i;
for(i=0;i<0xffff; i++);
return;
}
void fillbuffer(int *buffer, int cnt, int data)
{
int i;
for (i=0; i<cnt; i++)
{
buffer[i]=data;
}
}
char testram1 = 0;
void main(void)
{
output8(0x5, 0xf7);
testram1 = 1;
LCD_L0_Init();
testram1 = 2;
// TestLCMOnOff();
testram1 = 3;
// TestLCMStandby();
TestFont();
while(1);
testram1 = 4;
TestLCMDrawPoint();
testram1 = 5;
TestLCMDrawLine();
testram1 = 6;
TestLCMDrawRect();
testram1 = 7;
TestLCMOtherFun();
testram1 = 8;
debug();
}
void TestFont(void)
{
LCD_L0_SetFont(&GUI_DUMMY);
LCD_L0_SetTextPos(0,20);
LCD_L0_PutS("display test",50);
LCD_L0_DrawFullBMP16BPP(0, 0, 0x20, 0x20, pictab);
}
void TestLCMOnOff(void)
{
delay11();
LCD_L0_On();
delay11();
LCD_L0_Off();
delay11();
LCD_L0_On();
delay11();
LCD_L0_Off();
delay11();
LCD_L0_On();
delay11();
}
void TestLCMStandby(void)
{
delay11();
LCD_L0_Standby(0x1); //go to standby
delay11();
LCD_L0_Standby(0x0); //exit standby
delay11();
}
void TestLCMDrawPoint(void)
{
int i,j;
for(j=0;j<0x3f;j++)
{
for(i=0;i<0x5f;i++)
LCD_L0_SetPixelIndex(i,j,0xf800);
}
delay11();
for(i=0;i<0x5f;i++)
{
for(j=0;j<0x3f;j++)
LCD_L0_SetPixelIndex(i,j,0x7e0);
}
delay11();
for(j=0;j<0x3f;j++)
{
for(i=0;i<0x5f;i++)
LCD_L0_SetPixelIndex(i,j,0x1f);
}
delay11();
for(i=0;i<0x5f;i++)
for(j=0;j<0x3f;j++)
LCD_L0_XorPixel(i,j);
delay11();
}
void TestLCMDrawLine(void)
{
delay11();
LCD_L0_SetBGColor(0x0);
LCD_L0_SetPenColor(0xf800);
LCD_L0_DrawVLine(0x00,0x00,120);
delay11();
LCD_L0_SetBGColor(0x0);
LCD_L0_SetPenColor(0x7e0);
LCD_L0_DrawHLine(0x00,0x10,0x50);
delay11();
LCD_L0_SetBGColor(0x0);
LCD_L0_SetPenColor(0x1f);
LCD_L0_DrawHLine(0x00,0x20,0x50);
delay11();
}
void TestLCMDrawRect(void)
{
LCD_L0_SetPenColor(0xf800);
LCD_L0_FillRect (5, 5, 60, 60);
delay11();
LCD_L0_SetPenColor(0x7e0);
LCD_L0_FillRect (5, 5, 35, 35);
delay11();
LCD_L0_SetBGColor(0xffff);
LCD_L0_SetPenColor(0xf800);
LCD_L0_DrawRect(1, 1, 60, 60);
delay11();
}
void TestLCMDirectTrans(void)
{
LCD_RECT rect1;
fillbuffer(databuffer, 0x60*0x10, 0x00f0);//红色
rect1.x0=0x00;
rect1.x1=0x5f;
rect1.y0=0x00;
rect1.y1=0x0f;
LCD_L0_SetWindow(&rect1);
LCD_L0_BuffDataTrans((char *)databuffer,0x60*0x10*2,0);
fillbuffer(databuffer, 0x60*0x10, 0xe007);//蓝色
rect1.y0=0x10;
rect1.y1=0x1f;
LCD_L0_SetWindow(&rect1);
LCD_L0_BuffDataTrans((char *)databuffer,0x60*0x10*2,0);
fillbuffer(databuffer, 0x60*0x10, 0x1f00);//绿色
rect1.y0=0x20;
rect1.y1=0x2f;
LCD_L0_SetWindow(&rect1);
LCD_L0_BuffDataTrans((char *)databuffer,0x60*0x10*2,0);
fillbuffer(databuffer, 0x60*0x10, 0xffff);//白色
rect1.y0=0x30;
rect1.y1=0x3f;
LCD_L0_SetWindow(&rect1);
LCD_L0_BuffDataTrans((char *)databuffer,0x60*0x10*2,0);
}
void TestLCMOtherFun(void)
{
int i,j;
while(1)
{
for(i=0;i<0xff;i++)
{
LCD_L0_SetContrast(i);
for(j=0;j<0x7ff;j++);
}
}
}
void debug(void)
{
while(1);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -