#ifndef __lcd_H
#define __lcd_H 

#include "ALL_Includes.h"

#define Bank1_LCD_D    ((u32)0x60020000)    //disp Data ADDR
#define Bank1_LCD_C    ((u32)0x60000000)	 //disp Reg ADDR

#define LLCD_WRITE_CMD(cmd)        *(volatile u16 *) (Bank1_LCD_C)= cmd
#define LLCD_WRITE_DATA(dataa)		 *(volatile u16 *) (Bank1_LCD_D)= dataa

#define LCD_WidthX  240
#define LCD_WidthY  320

#define TFT_BLK_PORT   	 GPIOC
#define TFT_BLK_Pin      GPIO_Pin_11
#define TFT_BLK_L        TFT_BLK_PORT->BSRRH=TFT_BLK_Pin
#define TFT_BLK_H        TFT_BLK_PORT->BSRRL=TFT_BLK_Pin

#define TFT_RST_PORT   	 GPIOB
#define TFT_RST_Pin      GPIO_Pin_15
#define TFT_RST_L        TFT_RST_PORT->BSRRH=TFT_RST_Pin
#define TFT_RST_H        TFT_RST_PORT->BSRRL=TFT_RST_Pin

//PB0~15,作为数据线
#define TFT_Data_PORT    GPIOA
#define TFT_Data_OUT     GPIOA->ODR //数据输出
#define TFT_Data_INT     TFT_Data_PORT->IDR  //数据输入


//画笔颜色
#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 //灰色


void LCD_init(void);
void LCD_setwindow(unsigned int x0,unsigned int y0,unsigned int x1,unsigned int y1);
void LCD_GPIO_Init(void);
void LCD_Reset(void);
void LCD_WriteReg(u8 LCD_Reg, u16 LCD_RegValue);
u16 LCD_RD_DATA(void);
void LCD_DisplayOn(void);
void LCD_DisplayOff(void);
void LCD_SetCursor(u16 Xpos, u16 Ypos);
void LCD_Fill(u16 sx,u16 sy,u16 ex,u16 ey,u16 color);
void TFT_FSMCConf(void);
void LCD_ShowString(unsigned int x, unsigned int y,const char *s, unsigned int color,unsigned int b_color);
void LCD_Showchar(unsigned int x, unsigned int y,unsigned char c, unsigned int color,unsigned int b_color);

#endif

