bc... [盗版]

LCD.h ( File view )

  • By Karma_w 2015-06-09
  • View(s):16
  • Download(s):1
  • Point(s): 1
			#ifndef __LCD_H
#define __LCD_H		
#include "sys.h"	 
#include "stdlib.h"
//////////////////////////////////////////////////////////////////////////////////	 
//本程序只供学习使用,未经作者许可,不得用于其它任何用途
//Mini STM32开发板
//2.4/2.8寸TFT液晶驱动	  
//支持驱动IC型号包括:ILI9341/ILI9325/RM68021/ILI9320/ILI9328/LGDP4531/LGDP4535/SPFD5408/SSD1289/1505/B505/C505等
//正点原子@ALIENTEK
//技术论坛:www.openedv.com
//创建日期:2011/1/13
//版本:V1.7
//版权所有,盗版必究。
//Copyright(C) 正点原子 2009-2019
//All rights reserved
//********************************************************************************
//V1.2修改说明
//支持了SPFD5408的驱动,另外把液晶ID直接打印成HEX格式.方便查看LCD驱动IC.
//V1.3
//加入了快速IO的支持
//修改了背光控制的极性(适用于V1.8及以后的开发板版本)
//对于1.8版本之前(不包括1.8)的液晶模块,请修改LCD_Init函数的LCD_LED=1;为LCD_LED=1;
//V1.4
//修改了LCD_ShowChar函数,使用画点功能画字符。
//加入了横竖屏显示的支持
//V1.5 20110730
//1,修改了B505液晶读颜色有误的bug.
//2,修改了快速IO及横竖屏的设置方式.
//V1.6 20111116
//1,加入对LGDP4535液晶的驱动支持
//V1.7 20120713
//1,增加LCD_RD_DATA函数
//2,增加对ILI9341的支持
//3,增加ILI9325的独立驱动代码
//4,增加LCD_Scan_Dir函数(慎重使用)	  
//6,另外修改了部分原来的函数,以适应9341的操作
//////////////////////////////////////////////////////////////////////////////////


/////////////////////////////////////用户配置区///////////////////////////////////	 
//以下2个宏定义,定义屏幕的显示方式及IO速度
#define USE_HORIZONTAL  0	//定义是否使用横屏 		0,不使用.1,使用.
#define LCD_FAST_IO     1 	//定义是否使用快速IO	0,不实用.1,使用
//////////////////////////////////////////////////////////////////////////////////	 


 
//TFTLCD部分外要调用的函数		   
extern u16  POINT_COLOR;//默认红色    
extern u16  BACK_COLOR; //背景颜色.默认为白色
//定义LCD的尺寸
#if USE_HORIZONTAL==1	//使用横屏
#define LCD_W 320
#define LCD_H 240
#else
#define LCD_W 240
#define LCD_H 320
#endif
////////////////////////////////////////////////////////////////////
//-----------------LCD端口定义---------------- 
#define	LCD_LED PCout(10) //LCD背光    		 PC10 
//如果使用快速IO,则定义下句,如果不使用,则去掉即可!
//使用快速IO,刷屏速率可以达到28帧每秒!
//普通IO,只能14帧每秒!   

#if LCD_FAST_IO==1 //快速IO

#define	LCD_CS_SET  GPIOC->BSRR=1<<9    //片选端口  	     PC9
#define	LCD_RS_SET	GPIOC->BSRR=1<<8    //数据/命令          PC8	   
#define	LCD_WR_SET	GPIOC->BSRR=1<<7    //写数据			 PC7
#define	LCD_RD_SET	GPIOC->BSRR=1<<6    //读数据			 PC6
								    
#define	LCD_CS_CLR  GPIOC->BRR=1<<9     //片选端口  	     PC9
#define	LCD_RS_CLR	GPIOC->BRR=1<<8     //数据/命令          PC8	   
#define	LCD_WR_CLR	GPIOC->BRR=1<<7     //写数据			 PC7
#define	LCD_RD_CLR	GPIOC->BRR=1<<6     //读数据			 PC6
								    
#else //慢速IO

#define	LCD_CS	PCout(9)  //片选端口  	     PC9
#define	LCD_RS	PCout(8)  //数据/命令        PC8	   
#define	LCD_WR	PCout(7)  //写数据			 PC7
#define	LCD_RD	PCout(6)  //读数据			 PC6
								    
#endif
//PB0~15,作为数据线
#define DATAOUT(x) GPIOB->ODR=x; //数据输出
#define DATAIN     GPIOB->IDR;   //数据输入
//////////////////////////////////////////////////////////////////////
//扫描方向定义
#define L2R_U2D  0 //从左到右,从上到下
#define L2R_D2U  1 //从左到右,从下到上
#define R2L_U2D  2 //从右到左,从上到下
#define R2L_D2U  3 //从右到左,从下到上

#define U2D_L2R  4 //从上到下,从左到右
#define U2D_R2L  5 //从上到下,从右到左
#define D2U_L2R  6 //从下到上,从左到右
#define D2U_R2L  7 //从下到上,从右到左

#define DFT_SCAN_DIR  L2R_U2D  //默认的扫描方向


//画笔颜色
#define WHITE         	 0xFFFF
#define BLACK         	 0x0000	  
#define BLUE         	 0x001F  
#define BRED             0XF81F
#define GRED 			 0XFFE0
#define GBLUE			 0X07FF
#define RED           	 0xF800
#define MAGENTA       	 0xF81F
#define GREEN         	 0x07E0
#define CYAN          	 0x7FFF
#define YELLOW        	 0xFFE0
#define BROWN 			 0XBC40 //棕色
#define BRRED 			 0XFC07 //棕红色
#define GRAY  			 0X8430 //灰色
//GUI颜色

#define DARKBLUE      	 0X01CF	//深蓝色
#define LIGHTBLUE      	 0X7D7C	//浅蓝色  
#define GRAYBLUE       	 0X5458 //灰蓝色
//以上三色为PANEL的颜色 
 
#define LIGHTGREEN     	 0X841F //浅绿色
//#define LIGHTGRAY        0XEF5B //浅灰色(PANNEL)
#define LGRAY 			 0XC618 //浅灰色(PANNEL),窗体背景色

#define LGRAYBLUE        0XA651 //浅灰蓝色(中间层颜色)
#define LBBLUE           0X2B12 //浅棕蓝色(选择条目的反色)
	    															  
extern u16 BACK_COLOR, POINT_COLOR ;  
void LCD_Init(void);
void LCD_DisplayOn(void);
void LCD_DisplayOff(void);
void LCD_Clear(u16 Color);	 
void LCD_SetCursor(u16 Xpos, u16 Ypos);
void LCD_Scan_Dir(u8 dir);
void LCD_DrawPoint(u16 x,u16 y);//画点
u16  LCD_ReadPoint(u16 x,u16 y); //读点
void Draw_Circle(u16 x0,u16 y0,u8 r);
void LCD_DrawLine(u16 x1, u16 y1, u16 x2, u16 y2);
void LCD_DrawRectangle(u16 x1, u16 y1, u16 x2, u16 y2);		   
void LCD_Fill(u16 sx,u16 sy,u16 ex,u16 ey,u16 color);
void LCD_ShowChar(u16 x,u16 y,u8 num,u8 size,u8 mode);//显示一个字符
void LCD_ShowNum(u16 x,u16 y,u32 num,u8 len,u8 size);  //显示一个数字
void LCD_Show2Num(u16 x,u16 y,u16 num,u8 len,u8 size,u8 mode);//显示2个数字
void LCD_ShowString(u16 x,u16 y,const u8 *p);		 //显示一个字符串,16字体

u16 LCD_RD_DATA(void);//读取LCD数据									    
void LCD_WriteReg(u8 LCD_Reg, u16 LCD_RegValue);
u16 LCD_ReadReg(u8 LCD_Reg);
void LCD_WriteRAM_Prepare(void);
void LCD_WriteRAM(u16 RGB_Code);
u16 LCD_ReadRAM(void);		   
u16 LCD_BGR2RGB(u16 c);

//写8位数据函数
//用宏定义,提高速度.
#if LCD_FAST_IO==1 //快速IO
#define LCD_WR_DATA(data){
\
LCD_RS_SET;\
LCD_CS_CLR;\
DATAOUT(data);\
LCD_WR_CLR;\
LCD_WR_SET;\
LCD_CS_SET;\

} 
#else//正常IO
#define LCD_WR_DATA(data){
\
LCD_RS=1;\
LCD_CS=0;\
DATAOUT(data);\
LCD_WR=0;\
LCD_WR=1;\
LCD_CS=1;\

} 	
#endif																				 
//9320/9325 LCD寄存器  
#define R0             0x00
#define R1             0x01
#define R2             0x02
#define R3             0x03
#define R4             0x04
#define R5             0x05
#define R6             0x06
#define R7             0x07
#define R8             0x08
#define R9             0x09
#define R10            0x0A
#define R12            0x0C
#define R13            0x0D
#define R14            0x0E
#define R15            0x0F
#define R16            0x10
#define R17            0x11
#define R18            0x12
#define R19            0x13
#define R20            0x14
#define R21            0x15
#define R22            0x16
#define R23            0x17
#define R24            0x18
#define R25            0x19
#define R26            0x1A
#define R27            0x1B
#define R28            0x1C
#define R29            0x1D
#define R30            0x1E
#define R31            0x1F
#define R32            0x20
#define R33            0x21
#define R34            0x22
#define R36            0x24
#define R37            0x25
#define R40            0x28
#define R41            0x29
#define R43            0x2B
#define R45            0x2D
#define R48            0x30
#define R49            0x31
#define R50            0x32
#define R51            0x33
#define R52            0x34
#define R53            0x35
#define R54            0x36
#define R55            0x37
#define R56            0x38
#define R57            0x39
#define R59            0x3B
#define R60            0x3C
#define R61            0x3D
#define R62            0x3E
#define R63            0x3F
#define R64            0x40
#define R65            0x41
#define R66            0x42
#define R67            0x43
#define R68            0x44
#define R69            0x45
#define R70            0x46
#define R71            0x47
#define R72            0x48
#define R73            0x49
#define R74            0x4A
#define R75            0x4B
#define R76            0x4C
#define R77            0x4D
#define R78            0x4E
#define R79            0x4F
#define R80            0x50
#define R81            0x51
#define R82            0x52
#define R83            0x53
#define R96            0x60
#define R97            0x61
#define R106           0x6A
#define R118           0x76
#define R128           0x80
#define R129           0x81
#define R130           0x82
#define R131           0x83
#define R132           0x84
#define R133           0x85
#define R134           0x86
#define R135           0x87
#define R136           0x88
#define R137           0x89
#define R139           0x8B
#define R140           0x8C
#define R141           0x8D
#define R143           0x8F
#define R144           0x90
#define R145           0x91
#define R146           0x92
#define R147           0x93
#define R148           0x94
#define R149           0x95
#define R150           0x96
#define R151           0x97
#define R152           0x98
#define R153           0x99
#define R154           0x9A
#define R157           0x9D
#define R192           0xC0
#define R193           0xC1
#define R229           0xE5							  		 
#endif  
	 
	 



			
...
Expand> <Close

Want complete source code? Download it here

Point(s): 1

Download
0 lines left, continue to read

File list

Tips: You can preview the content of files by clicking file names^_^
Name Size Date
01.97 kB
01.97 kB
01.97 kB
adc.c2.48 kB2015-06-03 11:04
adc.h693.00 B2011-01-12 21:19
01.97 kB
dma.c1.31 kB2010-06-07 16:30
dma.h378.00 B2010-06-07 16:30
01.97 kB
exti.c1.71 kB2011-01-12 20:50
exti.h628.00 B2011-01-12 20:51
01.97 kB
key.c1.73 kB2013-04-03 14:18
key.h839.00 B2011-01-12 20:46
01.97 kB
FONT.H15.78 kB2010-06-21 11:18
ILI93xx.c38.75 kB2012-10-25 23:18
LCD.h8.94 kB2012-10-25 22:28
01.97 kB
led.c910.00 B2013-04-03 14:18
led.h288.00 B2010-05-27 17:30
01.97 kB
FONT.H15.78 kB2010-03-19 17:16
oled.c6.70 kB2011-01-12 21:02
oled.h1.59 kB2011-01-12 21:02
01.97 kB
rtc.c7.75 kB2011-01-12 22:04
rtc.h1.35 kB2011-01-12 21:15
01.97 kB
timer.c2.10 kB2015-06-03 11:38
timer.h724.00 B2011-01-12 20:59
01.97 kB
wdg.c2.04 kB2011-01-12 20:56
wdg.h756.00 B2011-01-12 20:56
01.97 kB
wkup.c1.85 kB2011-01-12 21:18
wkup.h728.00 B2011-01-12 21:18
keilkilll.bat399.00 B2011-04-23 10:24
README.TXT377.00 B2012-07-19 22:20
01.97 kB
01.97 kB
delay.c2.02 kB2013-04-03 12:14
delay.h905.00 B2013-04-03 12:14
01.97 kB
cortexm3_macro.h2.17 kB2009-05-07 14:42
stm32f10x_conf.h6.05 kB2009-05-07 14:42
stm32f10x_it.h4.42 kB2012-12-18 12:35
stm32f10x_map.h27.63 kB2009-05-07 14:42
stm32f10x_nvic.h18.75 kB2009-05-07 14:42
stm32f10x_type.h3.31 kB2009-05-07 14:42
sys.c6.69 kB2013-04-03 12:13
sys.h3.78 kB2013-04-03 12:13
01.97 kB
usart.c3.35 kB2015-06-03 11:28
usart.h1,010.00 B2015-06-03 10:57
01.97 kB
adc.crf34.24 kB2015-06-03 11:04
adc.d298.00 B2015-06-03 11:04
adc.o39.02 kB2015-06-03 11:04
delay.crf31.84 kB2015-06-03 10:54
delay.d286.00 B2015-06-03 10:54
delay.o37.45 kB2015-06-03 10:54
ili93xx.crf80.82 kB2015-06-03 10:57
ili93xx.d592.00 B2015-06-03 10:57
ili93xx.o79.87 kB2015-06-03 10:57
JLinkLog.txt59.16 kB2015-06-03 11:43
JLinkSettings.ini578.00 B2013-04-03 14:19
key.crf34.17 kB2015-06-03 10:54
key.d332.00 B2015-06-03 10:54
key.o40.01 kB2015-06-03 10:54
led.crf33.41 kB2015-06-03 10:54
led.d298.00 B2015-06-03 10:54
led.o38.35 kB2015-06-03 10:54
modbus.c5.44 kB2015-06-03 11:38
modbus.crf40.08 kB2015-06-03 11:38
modbus.d478.00 B2015-06-03 11:38
modbus.h404.00 B2015-06-03 10:54
modbus.o47.92 kB2015-06-03 11:38
rtc.crf41.95 kB2015-06-03 10:57
rtc.d434.00 B2015-06-03 10:57
rtc.o48.63 kB2015-06-03 10:57
STM32F10x.d28.00 B2015-06-03 10:54
STM32F10x.lst34.54 kB2015-06-03 10:54
stm32f10x.o5.58 kB2015-06-03 10:54
STM32F10x.s11.04 kB2009-12-22 19:16
sys.crf35.34 kB2015-06-03 10:54
sys.d264.00 B2015-06-03 10:54
sys.o42.51 kB2015-06-03 10:54
TEST.axf37.47 kB2015-06-03 11:43
TEST.build_log.htm1.36 kB2015-06-03 11:44
test.c601.00 B2015-06-03 11:41
test.crf51.11 kB2015-06-03 11:41
test.d792.00 B2015-06-03 11:41
TEST.hex13.17 kB2015-06-03 11:43
TEST.htm43.73 kB2015-06-03 11:43
TEST.lnp339.00 B2015-06-03 11:43
TEST.map64.78 kB2015-06-03 11:43
test.o54.43 kB2015-06-03 11:41
TEST.Opt2.03 kB2013-04-03 14:21
TEST.plg249.00 B2014-03-16 19:17
TEST.sct479.00 B2014-02-21 11:13
TEST.tra1.38 kB2014-02-21 11:13
TEST.Uv23.21 kB2013-04-03 14:21
TEST.uvgui.Administrator69.44 kB2013-04-03 14:20
TEST.uvgui.wjc72.16 kB2015-06-03 11:44
TEST.uvgui.WuJiChao67.42 kB2014-03-16 19:17
TEST.uvgui_wjc.bak72.08 kB2015-06-03 11:42
TEST.uvgui_WuJiChao.bak67.35 kB2014-02-21 11:21
TEST.uvopt10.12 kB2015-06-03 11:44
TEST.uvproj16.86 kB2015-06-03 11:42
TEST_Target8.60 kB2015-06-03 11:43
TEST_uvopt.bak10.12 kB2015-06-03 11:42
TEST_uvproj.bak17.39 kB2015-06-02 14:35
timer.crf38.84 kB2015-06-03 11:38
timer.d462.00 B2015-06-03 11:38
timer.o43.37 kB2015-06-03 11:38
usart.crf38.59 kB2015-06-03 11:28
usart.d388.00 B2015-06-03 11:28
usart.o43.36 kB2015-06-03 11:28
wdg.crf34.45 kB2015-06-03 10:54
wdg.d330.00 B2015-06-03 10:54
wdg.o41.05 kB2015-06-03 10:54
wkup.crf34.14 kB2015-06-03 10:54
wkup.d378.00 B2015-06-03 10:54
wkup.o41.15 kB2015-06-03 10:54
...

LCD.h (571.52 kB)

Need 1 point
Your Point(s)

Your Point isn't enough.

Get point immediately by PayPal

More(Debit card / Credit card / PayPal Credit / Online Banking)

Submit your source codes. Get more point

LOGIN

Don't have an account? Register now
Need any help?
Mail to: support@codeforge.com

切换到中文版?

CodeForge Chinese Version
CodeForge English Version

Where are you going?

^_^"Oops ...

Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!
OK

Warm tip!

CodeForge to FavoriteFavorite by Ctrl+D