📄 lcd.c
字号:
#include "..\44blibs\lcd.h"
#include "..\inc\bmp.h"
#include "..\inc\44b.h"
#include <stdarg.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include "sysloader.h"
//VGA 显示40*30 一屏可显示15行,30列英文字符
#define VGA_X_MAX 40
#define VGA_Y_MAX 15
unsigned int VGA_X = 0; // 0 ~ 39
unsigned int VGA_Y = 0; // 0 ~ 14
unsigned int DC[240][320/4]; //显示缓冲1
unsigned int HWDC[240][320/4]; //显示缓冲2
//*****************************************************************
// 功能描述:初始化LCD控制器
//*****************************************************************
void Lcd_Init (void *pDC)
{
int i, j;
int time = 10000*2;
//INT32U *plcdbu;
INT32U *plcdbu = (unsigned int*)pDC;
rLCDCON1=(0x0)|(2<<5)|(MVAL_USED<<7)|(0x3<<8)|(0x3<<10)|(CLKVAL_COLOR<<12);
// disable,8B_SNGL_SCAN,WDLY=8clk,WLH=8clk,
rLCDCON2=(LINEVAL)|(HOZVAL_COLOR<<10)|(10<<21);
//LINEBLANK=10 (without any calculation)
rLCDSADDR1= (0x3<<27) | ( ((unsigned int)plcdbu>>22)<<21 ) | M5D((unsigned int)plcdbu>>1);
// 256-color, LCDBANK, LCDBASEU
rLCDSADDR2= M5D((((unsigned int)plcdbu+(SCR_XSIZE*LCD_YSIZE))>>1)) | (MVAL<<21);
rLCDSADDR3= (LCD_XSIZE/2) | ( ((SCR_XSIZE-LCD_XSIZE)/2)<<9 );
//The following value has to be changed for better display.
rREDLUT =0xfdb96420;
rGREENLUT=0xfdb96420;
rBLUELUT =0xfb40;
rDITHMODE=0x0;
rDP1_2 =0xa5a5;
rDP4_7 =0xba5da65;
rDP3_5 =0xa5a5f;
rDP2_3 =0xd6b;
rDP5_7 =0xeb7b5ed;
rDP3_4 =0x7dbe;
rDP4_5 =0x7ebdf;
rDP6_7 =0x7fdfbfe;
rLCDCON1=(0x1)|(2<<5)|(MVAL_USED<<7)|(0x3<<8)|(0x3<<10)|(CLKVAL_COLOR<<12);
rPDATE=0xfe;
}
void disselet (void *pDC)
{
INT32U *plcdbu = (unsigned int*)pDC;
rLCDSADDR1= (0x3<<27) | ( ((unsigned int)plcdbu>>22)<<21 ) | M5D((unsigned int)plcdbu>>1);
rLCDSADDR2= M5D((((unsigned int)plcdbu+(SCR_XSIZE*LCD_YSIZE))>>1)) | (MVAL<<21);
}
void San_speed (INT8U speed)
{
if (speed == height)
{
rLCDCON1=rLCDCON1&0x00fff;
rLCDCON1=rLCDCON1|((CLKVAL_COLOR)<<12);
}
else if(speed == low)
{
rLCDCON1=rLCDCON1&0x00fff;
rLCDCON1=rLCDCON1|((CLKVAL_COLOR+4)<<12);
}
}
//*****************************************************************
//** 函数名:void Lcd_Clr(void)
//** 输 入: backdrop
//** 输 出:
//** 功能描述:以背景色(backdrop)清槠
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -