📄 lcd.c
字号:
/*************************************************************************/
/* FILE NAME : 346app.c */
/* VERSION : 0.9 */
/* DATE : 2003. 05. 13 */
/* DESCRIPTION */
/* Basic Library Functions for CLC346 */
/* */
/* DATA STRUCTURES */
/* */
/* FUNCTIONS : Basic Library Functions for CLC346 LCD Handling. */
/* Refer to clc346i.h */
/* DEPENDENCIES */
/* */
/* Revision History : */
/* 2003.05.13 kbs : First Revised */
/* */
/*************************************************************************/
#include "portab_new.h"
#include "camconfig.h"
#include "346reg.h"
#if(defined(RENESASHD_66789))
void LcdWriteCMD16Bit(U16 RegData)
{
U16 temp;
temp = (ESCPORT0) << CPU16BITDATA;
*(volatile U16*)(LCD_Base + temp) = RegData;
}
void LcdWriteDATA16Bit(U16 RegData)
{
U16 temp;
temp = ((ESCPORT1) << CPU16BITDATA);
*(volatile U16*)(LCD_Base + temp) = RegData;
}
void LcdReadDATA16Bit(U16 *data)
{
U16 temp;
temp = ((ESCPORT1) << CPU16BITDATA) ;
*data = *(volatile U16*)(LCD_Base + temp);
}
#if(defined(SUB_LCD_ENABLE))
void SubLcdWriteCMD16Bit(U16 RegAddress, U16 RegData)
{
U16 Command,temp;
Command = ((RegAddress << 8) | RegData);
temp = (ESCPORT0) << CPU16BITDATA;
*(volatile U16*)(LCD_SubBase + temp) = Command;
}
void SubLcdWriteDATA16Bit(U16 RegAddress, U16 RegData)
{
U16 Command,temp;
Command = ((RegAddress << 8) | RegData);
temp = ((ESCPORT1) << CPU16BITDATA) ;
*(volatile U16*)(LCD_SubBase + temp) = Command;
}
void SubLcdWriteCMD8Bit(U16 RegAddress, U16 RegData)
{
U16 temp;
temp = (ESCPORT0) << CPU16BITDATA;
*(volatile U16*)(LCD_SubBase + temp) = RegAddress;
*(volatile U16*)(LCD_SubBase + temp) = RegData;
}
void SubLcdWriteDATA8Bit(U16 RegAddress, U16 RegData)
{
U16 temp;
temp = ((ESCPORT1) << CPU16BITDATA);
*(volatile U16*)(LCD_SubBase + temp) = RegAddress;
*(volatile U16*)(LCD_SubBase + temp) = RegData;
}
void SubLcdReadDATA8Bit(U16 *data1, U16 *data2)
{
U16 temp;
temp = ((ESCPORT1) << CPU16BITDATA);
*data1 = *(volatile U16*)(LCD_Base + temp);
*data2 = *(volatile U16*)(LCD_Base + temp);
}
#endif
void CamMainLCDInit(void)
{
// Main LCD Type1(0x38)
CamMainLCDType1(0x3011);
// Main LCD type2(0x39)
CamMainLCDType2(0x0000);
// Main LCD Window Control(0x40)
// Total -> 0000 1000 0000 1101
CamMainLCDWindowControl(0x080d);
// Main LCD Window X Address(0x41)
CamMainLCDWindowXAddress(0x0044);
// Main LCD Window Y Address(0x42)
CamMainLCDWindowYAddress(0x0045);
// Main LCD GRAM Access Control(0x46)
CamMainLCDGRAMAccessControl(0x0389);
// Main LCD X/Y Address Command(0x47)
CamMainLCDXYAddressCommand(0x0021);
// Main LCD X/Y Address Parameter(0x49)
CamMainLCDXYAddressParameter(0x0000);
// Main LCD GRAM R/W Command(0x48)
CamMainLCDGRAMRWCommand(0x2222);
}
void CamLCDUpdateRectangle(UINT16 Startx, UINT16 Starty,UINT16 Endx, UINT16 Endy, UINT16*pData,UINT16 u16LineWidth )
{
UINT16 i,j;
UINT16 *pbuf;
LcdWriteCMD16Bit(0x0044);
LcdWriteDATA16Bit((Endx<<8)|Startx);
LcdWriteCMD16Bit(0x0045);
LcdWriteDATA16Bit(( Endy<<8)|Starty);
LcdWriteCMD16Bit(0x0021);
LcdWriteDATA16Bit((Starty<<8)|Startx);
LcdWriteCMD16Bit(0x0022);
pbuf = pData + Starty * u16LineWidth + Startx;
for(j=0;j<=Endy-Starty;j++)
{
for(i=0;i<=Endx-Startx;i++)
LcdWriteDATA16Bit(pbuf[i]);
pbuf += u16LineWidth;
}
}
#endif
#if (defined(SUB_LCD_ENABLE))
void CamSubLCDInit(void)
{
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -