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

📄 2410lcd.c

📁 wince lcd driver dai ma
💻 C
字号:
#include "def.h"
#include "2410addr.h"
#include "2410lib.h"
#include "2410slib.h"
#include "uart.h"
#include "timer.h"
#include "PowerManage.h"
#include "mmu.h"
#include "lcd_gui.h"
#include "config.h"

#define  LCM_LEDCON	 	0x00400000

// 一个单色图标的数据,宽度x高度=40x40
uint8 const ICO1[] = 
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x07,0x00,0xE0,0x00,0x00,0x18,
0x00,0x18,0x00,0x00,0x30,0x00,0x0C,0x00,0x00,0x40,0x00,0x02,0x00,0x00,0x80,0x00,
0x01,0x00,0x01,0x00,0x00,0x00,0x80,0x03,0x00,0x00,0x00,0xC0,0x02,0x01,0x81,0x80,
0x40,0x04,0x03,0xC3,0xC0,0x20,0x04,0x03,0xC3,0xC0,0x20,0x04,0x03,0xC3,0xC0,0x20,
0x08,0x03,0xC3,0xC0,0x10,0x08,0x03,0xC3,0xC0,0x10,0x08,0x01,0x81,0x80,0x10,0x08,
0x08,0x00,0x10,0x10,0x08,0x08,0x00,0x10,0x10,0x08,0x10,0x00,0x08,0x10,0x08,0xF0,
0x00,0x0F,0x10,0x08,0x08,0x00,0x10,0x10,0x04,0x04,0x00,0x20,0x20,0x04,0x06,0x00,
0x60,0x20,0x04,0x03,0x81,0xC0,0x20,0x02,0x01,0x7E,0x80,0x40,0x03,0x00,0x81,0x00,
0xC0,0x01,0x00,0x42,0x00,0x80,0x00,0x80,0x3C,0x01,0x00,0x00,0x40,0x00,0x02,0x00,
0x00,0x30,0x00,0x0C,0x00,0x00,0x18,0x00,0x18,0x00,0x00,0x07,0x00,0xE0,0x00,0x00,
0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};

// 样条曲线的4个端点
PointXY log_pin[] = { {80,  30},
                      {120, 60},
                      {160, 30},
                      {200, 60}
                    };

// 封闭多边形的各个顶点                    
uint32  const poly6[] = {150,110, 170,80, 180,95, 200,85, 230,110, 150,110};
int  pos_x=30,pos_y=50,last_x,last_y;
#define BACKGROUND 0x00
uint8 ICO_CLEAR[1600];
int    stepflag=0;
void MoveTheIcon(U32 i)
{
	 
	 if(pos_x==30&&pos_y==50){
	 	GUI_LoadPic(pos_x,pos_y, (uint8 *)ICO1, 40, 40);	// 显示40×40的图标
	 }else{
	 	GUI_LoadPic(last_x,last_y, (uint8 *)ICO_CLEAR, 40, 40);	// 显示40×40的图标
	 	GUI_LoadPic(pos_x,pos_y, (uint8 *)ICO1, 40, 40);	// 显示40×40的图标
	 	
	 }
	 last_x=pos_x;last_y=pos_y;
	 if(pos_x<=200&&pos_y<=200&&stepflag==0){
	 	pos_x+=10;
	 }else{
	 	if(pos_y<=200&&pos_x>=200)
	 	{
	 		pos_y+=10;
		 }else{
	 		if(pos_x>10&&pos_y>=200)
	 		{
	 			pos_x-=10;
	 		}else{
	 			if(pos_x<=10&&pos_y>=50)
	 			{
	 				pos_y-=10;
	 				stepflag=1;
	 			}else{
	 				stepflag=0;
	 			}
	 			
	 		}
	 	}
	 }
	 
  
}

// GPB1/TOUT1 for Backlight control(PWM)
#define GPB1_TO_OUT()   (rGPBUP &= 0xfffd, rGPBCON &= 0xfffffff3, rGPBCON |= 0x00000004)
#define GPB1_TO_1()     (rGPBDAT |= 0x0002)
#define GPB1_TO_0()     (rGPBDAT &= 0xfffd)
    
	//qjy: special power on timing, please research it!
extern void Lcd_Port_Init(void);
extern void Lcd_Init(void);

volatile int PwrKeyChkEnd;
U32	Console_Uart = 0;
U32	Console_Baud = 115200;
extern void Test_Lcd_LTV350QVF05(void);
/******************************************************************************
【功能说明】系统主函数
******************************************************************************/
int Main(U32 RstStat)
{
	int i;
	int curr_x,curr_y;
	char code;
//	ChangeClockDivider(1, 1);	// 1:2:4
//	ChangeMPllValue(172,4,1);	//FCLK=180.0Mhz
	SetClockDivider(1, 1);
	SetSysFclk(FCLK_200M);		//to save power, use 50M
	Port_Init();
	Uart_Init(0, Console_Baud);
	Uart_Select(0);	
	for(i=0;i<1600;i++)	ICO_CLEAR[i]=BACKGROUND;
	
#if 0			//bank0 modified to RO_START
	MMU_Init();	//MMU should be reconfigured or turned off for the debugger, 
	//After downloading, MMU should be turned off for the MMU based program,such as WinCE.	
#else
	MMU_EnableICache();
#endif
	
	//enable GPIO,UART0,PWM TIMER,NAND FLASH module clock
//	DisableModuleClock(CLOCK_ALL);
	EnableModuleClock(CLOCK_ALL);	

	LcdBackLightOff();
	putch('\n');

	PwrKeyChkInit();

	rMISCCR &= ~(0x3007);		//USB port0,1 = normal, D0~D31 pull-up enable

	Set_Tout1_Pwm( 60 ) ;
	
	
	//turn on the LCD blacklight!
    GPB1_TO_OUT();
    GPB1_TO_1();
    
	//special power on timing, please research it!
    Lcd_Port_Init();
    Lcd_Init();

	Beep( 2000, 1000 ) ;
	
	RequestBiosTimerEvent(30, Led4Flash);	//when request, auto open bios timer
	RequestBiosTimerEvent(20, MoveTheIcon);
	
//	OpenOsTimer(100);
	
	Test_Lcd_LTV350QVF05();
	Lcd_ClearScr(BACKGROUND);     //clear screen
	
	// GUI_Initialize();				// 初始化LCM 
   GUI_SetColor(0xf800, BACKGROUND);				// 设置前景色及背景色
  // GUI_LoadPic(30,50, (uint8 *)ICO1, 40, 40);	// 显示40×40的图标
   GUI_Spline(log_pin, 4, 0xf800); 					// 画样条曲线

   GUI_FloodFill(160,100, 0xf800);					// 填充多边形
   
   GUI_PutString(30,100,"WWW.FITTING.COM");		// 显示字符串
   display_string(10,10,"汉字显示测试-飞腾科技有限公司",strlen("汉字显示测试-飞腾科技有限公司"),0xf800);		// 显示字符串
     display_string(10,300,"汉字显示测试-飞腾科技有限公司",strlen("汉字显示测试-飞腾科技有限公司"),0xf800);		// 显示字符串

	printf("<*******************************************>\n");
	printf("<*                                         *>\n");
	printf("<*         S3C2410 Board BIOS V2006        *>\n");
	printf("<*******************************************>\n");
	curr_x=20;
	curr_y=156;
	while(1)
	{
		if(code=Uart_Getch(0)){
			printf("%c",code);
			
			display_char(curr_x,curr_y,code,0xf800);
			curr_x+=8;
			if(curr_x>=240){curr_x=20;curr_y+=16;}
		}
		
	}
	return;
}

⌨️ 快捷键说明

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