/* 
 * File:   TFT.h
 * Author: Attila
 *
 * Created on 2016. szeptember 12., 7:16
 */

#ifndef TFT_H
#define	TFT_H

#ifdef	__cplusplus
extern "C" {
#endif


    
/****************************
 *         INKLÚDOK
 ****************************/    
#include <xc.h>
#include "../tipusok.h"
    
/****************************
 *    KIJELZŐ BEÁLLÍTÁSA
 ****************************/
#define DISP_CONTROLLER R61581
#define HOR_RES 480
#define VER_RES 320
#define DISP_MIRROR_ENABLE 1  

/****************************
 *       VEZÉRLŐLÁBAK
 ****************************/ 
#define TFT_CS LATFbits.LATF4
#define TFT_WR LATGbits.LATG7
#define TFT_RST LATFbits.LATF5
#define TFT_RS LATGbits.LATG6
#define TFT_RD LATGbits.LATG8
#define TFT_DATA LATB
    
/*****************************
 *         SZÍNEK
 *****************************/
#define Black           0x0000      /*   0,   0,   0 */
#define Navy            0x000F      /*   0,   0, 128 */
#define DarkGreen       0x03E0      /*   0, 128,   0 */
#define DarkCyan        0x03EF      /*   0, 128, 128 */
#define Maroon          0x7800      /* 128,   0,   0 */
#define Purple          0x780F      /* 128,   0, 128 */
#define Olive           0x7BE0      /* 128, 128,   0 */
#define LightGrey       0xC618      /* 192, 192, 192 */
#define DarkGrey        0x7BEF      /* 128, 128, 128 */
#define Blue            0x001F      /*   0,   0, 255 */
#define Green           0x07E0      /*   0, 255,   0 */
#define Cyan            0x07FF      /*   0, 255, 255 */
#define Red             0xF800      /* 255,   0,   0 */
#define Magenta         0xF81F      /* 255,   0, 255 */
#define Yellow          0xFFE0      /* 255, 255,   0 */
#define White           0xFFFF      /* 255, 255, 255 */
#define Orange          0xFD20      /* 255, 165,   0 */
#define GreenYellow     0xAFE5      /* 173, 255,  47 */
#define Pink                        0xF81F    

/*****************************
 *   GLOBÁLIS PROTOTÍPUSOK
 *****************************/
void TFTInit(void);
void TFTEn(void);
void TFTDis(void);
void TFTSetAddress(s16 , s16 , s16 , s16 );
void TFTWriteCmd(u16 cmd);
void TFTWriteData(u16 data);
void TFTWriteStrobe(void);


    
#ifdef	__cplusplus
}
#endif

#endif	/* TFT_H */

