📄 display.h
字号:
#include "./System.h"
#include "./Component/Include/FS/typedef.h" //使用文件系统的typedef文件,2008-8-25 PM by edu_xy
/*
There are eight categories of instructions that:
Specify the index
Read the status
Control the display
Control power management
Process the graphics data
Set internal DDRAM addresses
Transfer data to and from the internal DDRAM
*/
/*
0+-----x0--------------x1--------->H
|
y0
|
|
|
|
y1
|
|
V
//*/
#ifndef __NT7553E_H__
#define __NT7553E_H__
#define IR //Index
#define SR //Status read
#define R00 0x0000 //W:Start oscillation & R:Device code(0x7553) read
#define R01 0x0001 //Drive output control
#define R02 0x0002 //LCD Drive-waveform conctrol
#define R03 0x0003 //Power control 1
#define R04 0x0004 //Contrast control
#define R05 0x0005 //Entry mode
#define R06 0x0006 //Compare register
#define R07 0x0007 //Display control
#define R0B 0x000b //Frame frequency control
#define R0C 0x000c //Power control 2
#define R0D 0x000d //MTP setting
#define R0E 0x000e //MTP programming
#define R11 0x0011 //Vertical scroll control
#define R14 0x0014 //1st screen driving position
#define R15 0x0015 //2nd screen driving position
#define R16 0x0016 //Horizontal RAM address position
#define R17 0x0017 //Vertical RAM address position
#define R20 0x0020 //RAM write data mask
#define R21 0x0021 //RAM address set
#define R22 0x0022 //RAM data write / read
#define R30 0x0030 //Grayscale palette control 1
#define R31 0x0031 //Grayscale palette control 2
#define R32 0x0032 //Grayscale palette control 3
#define R33 0x0033 //Grayscale palette control 4
#define R34 0x0034 //Grayscale palette control 5
#define R35 0x0035 //Grayscale palette control 6
#define R36 0x0036 //Grayscale palette control 7
#define R37 0x0037 //Grayscale palette control 8
#define R38 0x0038 //Grayscale palette control 9
#define R39 0x0039 //Grayscale palette control 10
#define R3A 0x003a //Grayscale palette control 11
#define R3B 0x003b //Grayscale palette control 12
#define R3C 0x003c //Grayscale palette control 13
#define R3D 0x003d //Grayscale palette control 14
#define R3E 0x003e //Grayscale palette control 15
#define R3F 0x003f //Grayscale palette control 16
#define NT7553E_IR 0x00 //索引寄存器写地址
#define NT7553E_SR 0x00 //状态寄存器读地址
#define NT7553E_RW 0x01 //其它寄存器读写地址
//#define NT7553E_CS 0x330000
//#define LCD_CS 0x330000 //液晶片选地址
#define LCD_CMD 0x2f0000 //液晶指令端口
#define LCD_DAT 0x2f0001 //液晶数据端口
#define NT7553E_CMD_WR(Rxx) *((volatile unsigned int *)(LCD_CMD))=Rxx //写命令
#define NT7553E_SR_RD(var) var=*(volatile unsigned int *)(LCD_CMD) //读状态
#define NT7553E_DAT_WR(dat) *((volatile unsigned int *)(LCD_DAT))=dat //写数据
#define NT7553E_DAT_RD(var) var=*(volatile unsigned int *)(LCD_DAT) //读数据
void NT7553E_TEST(void);
void NT7553E_RST(void);
void NT7553E_INITIAL(UINT16 CC);
void NT7553E_GRAY(UINT16 Gray);
#define NT7553E_BLACK() NT7553E_GRAY(31)
#define NT7553E_WHITE() NT7553E_GRAY(0)
void Text_2_Screen_16(UINT16 row, UINT16 col, const void *str, UINT16 ForeColor, UINT16 BackColor);
#endif
//变量声明
#ifndef __ST7529_H__
#define __ST7529_H__
#ifdef DOWNLOAD_2_SRAM //add by edu 2009-2-5 15:09:08
#define LCD_COMMAND 0x2f0000 //液晶指令端口,DownLoad SRAN + NorFlash
#define LCD_DATA 0x2f0001 //液晶数据端口
#else
#define LCD_COMMAND 0x280000 //液晶指令端口,DownLoad NorFlash
#define LCD_DATA 0x280001 //液晶数据端口
#endif
#define LcdCMDWrite(dat) *(volatile unsigned int *)(LCD_COMMAND)=(dat) //写命令
#define LcdDatWrite(dat) *(volatile unsigned int *)(LCD_DATA)=(dat) //写数据
#define LcdDATRead() *(volatile unsigned int *)(LCD_DATA) //读数据
#define ROW_CNT_16 7 //16点阵显示时的行数
#define COL_CNT_16 14 //16点阵显示时的列数
#define ROW_CNT_12 9 //12点阵显示时的行数
#define COL_CNT_12 42 //12点阵显示时的列数
#define ROW_MAX_16 (ROW_CNT_16-1) //16点阵显示时的最大行号
#define COL_MAX_16 (COL_CNT_16-1) //16点阵显示时的最大列号
#define ROW_MAX_12 (ROW_CNT_12-1) //12点阵显示时的最大行号
#define COL_MAX_12 (COL_CNT_12-1) //12点阵显示时的最大列号
//初始化ST7529,软件复位
void ST7529_Init(UINT16 Light, UINT16 Frequency);
//亮度设置
void LightUpdate(UINT16 lightStep);
//刷新频率设置
void FreqUpdate(UINT16 FreqStep);
#ifdef __NT7553E_H__
void Clr_12_Line(UINT16 row, UINT16 c0, UINT16 c1,UINT16 gray);
#define LcdClear(mode) NT7553E_GRAY((mode==0)?0:31)
#define ClrLine(row,c0,c1) Clr_12_Line(row,c0,c1,0)
#else
//清屏幕内容
void LcdClear(UINT16 mode);
//清除1行的若干字符
void ClrLine(UINT16 row, UINT16 c0, UINT16 c1);
#endif
//清(或反色)屏幕上的一个矩形区域
void RectangleClr(UINT16 X0, UINT16 Y0, UINT16 X1, UINT16 Y1, UINT16 MODE);
//显示1点(From Sunplus)
extern void PutPoint(int x, int y, int data);
//清屏幕部分"行",不包括结束行
void LcdPartClear(UINT16 startrow, UINT16 endrow, UINT16 mode);
//画一条水平线
void Horizontal_Line(UINT16 y, UINT16 x0, UINT16 x1, UINT16 Gray);
//画一条竖直线
void Vertical_Line(UINT16 x, UINT16 y0, UINT16 y1, UINT16 Gray);
void Vertical_Line1(UINT16 y0, UINT16 x0, UINT16 x1);
//显示一个矩形
void Rectangle(UINT16 X0, UINT16 X1, UINT16 Y0, UINT16 Y1);
//2B3P模式,在液晶屏ST7529上显示1个Word处理好的数据
void Show1Word(UINT16 Data, UINT16 ForeColor, UINT16 BackColor);
//在液晶屏上显示1个12x6的ASCII码点阵
void Font_12x6(UINT16 row, UINT16 col, UINT16 *pattern, UINT16 ForeColor, UINT16 BackColor);
//设定显示位置,并将准备好的1个16x8的ASCII码字模送到LCD显示
void Font_16x8(UINT16 row, UINT16 col, UINT16 *pattern, UINT16 ForeColor, UINT16 BackColor);
//设定显示位置,并将准备好的12x12点阵的汉字字模数据送到LCD显示
void Font12x12(UINT16 row, UINT16 col, UINT16 *pattern, UINT16 ForeColor, UINT16 BackColor);
//设定显示位置,并将准备好的16x16点阵的汉字字模数据送到LCD显示
void Font_16x16(UINT16 row, UINT16 col, UINT16 *pattern, UINT16 ForeColor, UINT16 BackColor);
//显示一个12*6的ASCII码字符(每字符16行*9列)
void YWXS_12x6(UINT16 row, UINT16 col, UINT16 ISN, UINT16 ForeColor, UINT16 BackColor);
//显示一个16*8的ASCII码字符(每字符16行*9列)
void YWXS_16x8(UINT16 row, UINT16 col, UINT16 ISN, UINT16 ForeColor, UINT16 BackColor);
//以不同的方式显示汉字,每个汉字占2列
void HZXS_12x12(UINT16 row, UINT16 col, UINT16 ISN, UINT16 ForeColor, UINT16 BackColor);
//16X16点阵的汉字显示。
void HZXS_16x16(UINT16 row, UINT16 col, UINT16 ISN, UINT16 ForeColor, UINT16 BackColor);
//显示"爱丁数码"的240*128点阵logo图片
void DispPic(UINT16 ForeColor, UINT16 BackColor);
//将液晶屏幕上指定的数据备份到SRAM
void Backup_LCD_RAM(UINT16 X0, UINT16 Y0, UINT16 width, UINT16 height, UINT32 Addr);
//恢复之前备份过的LCD数据(用于窗口恢复)
void Resume_LCD_RAM(UINT16 X0, UINT16 Y0, UINT16 width, UINT16 height, UINT32 Addr);
//显示文本(汉字+ASCII码)
void Text_2_Screen_12(UINT16 row, UINT16 col, const void *str, UINT16 ForeColor, UINT16 BackColor);
//任意位置显示任意大小的灰度图片
void Show_One_Picture(UINT16 X0, UINT16 Y0, UINT16 width, UINT16 height, UINT32 Addr, UINT16 Mode);
//任意位置显示缩略图(原图1/3大小)
void Show_One_Thumbnail(UINT16 X0, UINT16 Y0, UINT16 width, UINT16 height, UINT32 Addr, UINT16 Mode);
//显示在RAM中的图片数据,图片大小为72x45
void DispWord_Pic(UINT16 row, UINT16 col, UINT16 length, UINT16 width, UINT32 ramadd);
//在指定的行列位置顯示字符(+汉字)串(直到标志位)
void DisplayString(UINT16 Lin, UINT16 Col, UINT32 Addr, UINT16 EOT, UINT16 ForeColor, UINT16 BackColor);
//在指定的行列位置顯示字符(+汉字)串(直到标志位)(全角方式)
void DisplayString_INT(UINT16 Lin, UINT16 Col, UINT32 Addr, UINT16 EOT, UINT16 ForeColor, UINT16 BackColor);
//显示外部RAM中指定地址的以固定字符开始和以固定字符结束的一段字符
void DispCharWithRes(UINT16 row, UINT16 col, UINT32 ramadd, UINT16 startchar, UINT16 endchar, UINT16 FontFormat, INT16 mode);
//在指定行列显示16进制数
void DispHEX(UINT16 row, UINT16 col, UINT16 hexnum);
//在指定行列显示一个两位数
void DispASCII(UINT16 row, UINT16 col, UINT16 asciinum, UINT16 mode);
//在指定位置显示一个无符号整数
void DisplayShu(UINT16 row, UINT16 column, UINT16 number);
//在指定位置显示小数
void DispNum_2dot1(UINT16 row, UINT16 col, double num, UINT16 ForeColor, UINT16 BackColor);
//显示选择时的图标
void DispSle_Pic(UINT16 row, UINT16 col, UINT16 mode);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -