#ifndef __LQ035Q1DH02_H__
#define __LQ035Q1DH02_H__

#include "lcd_buffers.h"

#define TMODE_PWMOUT		0x0001

/* list of colors in RGB565 format */
#define	    RGB565_BLACK  		        0x0000
#define	    RGB565_RED 	    	        0xF800
#define     RGB565_GREEN 		        0x07E0
#define     RGB565_BLUE     	        0x001F
#define     RGB565_YELLOW 		        0xFFE0
#define     RGB565_CYAN 		        0x07FF
#define     RGB565_MAGENTA  	        0xF81F
#define     RGB565_WHITE 		        0xFFFF

/* Define LCD Boundary color */
#define     LCD_BOUNDARY_COLOR			RGB565_BLACK
#define     LCD_BORDER_COLOR			RGB565_RED

/* this is used when converting from RGB888 to RGB565 */
#define	    LCD_DATA_PER_PIXEL     	3


/* HS nad VS timinf parameters (all in numner of PPI clk ticks) */
#define H_ACTPIX	320				/* active horizontal pixel */
#define H_PERIOD	336				/* HS period */
#define H_PULSE		2				/* HS pulse width */
#define H_START		7				/* horizontal start position( In TX modes there is a 1 cycle delay beyond this value ) */

#if defined(__ADSPBF548__)	/* __ADSPBF548__ */
#define	V_LINES		240 				/* total vertical lines */
#else
#define	V_LINES		245 				/* total vertical lines */
#endif
#define V_PULSE		2					/* VS pulse width */
#define V_PERIOD	(H_PERIOD * V_LINES)/* VS period */

#define PPI_TX_MODE			0x2
#define PPI_XFER_TYPE_11	0xC
#define PPI_PORT_CFG_01		0x10
#define PPI_PACK_EN			0x80
#define PPI_POLS_1			0x8000
#define DLEN_16				0x3800


#define COMMON_SPI_SETTINGS (SPE|MSTR)	// SPI enable, Master, 8 bit

#define TIMOD01 (0x01)		//sets the SPI to work with core instructions

#define SPI_DELAY 2000
#define BAUD_DIV	4

extern void LQ035Q1DH02_Init_PPI_Ints(void);
extern void LQ035Q1DH02_Init_DMA(void *);
extern void LQ035Q1DH02_Init_PPI(void);
extern void LQ035Q1DH02_Enable_DMA (void);
extern void LQ035Q1DH02_Enable_PPI (void);
extern void LQ035Q1DH02_Disable_PPI (void);
extern void LQ035Q1DH02_Init_TIMER0 (void);
extern void LQ035Q1DH02_Enable_TIMER0 (void);
extern void LQ035Q1DH02_Init_TIMER1 (void);
extern void LQ035Q1DH02_Enable_TIMER1 (void);
extern void LQ035Q1DH02_Disable_Timers (void);
extern void LQ035Q1DH02_Disable_DMA (void);

void Select_LQ035Q1DH02_Register(unsigned char LCDReg);
void Write_LQ035Q1DH02_Data(unsigned short data);

#endif /* _LQ035Q1DH02_H_ */
