/*********************************************************************
 * Module for Microchip Graphics Library
 * The header file joins all header files used in the graphics library
 * and contains compile options and defaults.
 *********************************************************************
 * FileName:        Graphics.h
 * Dependencies:    See INCLUDES section below
 * Processor:       PIC24F, PIC24H, dsPIC, PIC32
 * Compiler:        C30 V3.00/C32
 * Company:         Microchip Technology, Inc.
 *
 * Software License Agreement
 *
 * Copyright ?2008 Microchip Technology Inc.  All rights reserved.
 * Microchip licenses to you the right to use, modify, copy and distribute
 * Software only when embedded on a Microchip microcontroller or digital
 * signal controller, which is integrated into your product or third party
 * product (pursuant to the sublicense terms in the accompanying license
 * agreement).  
 *
 * You should refer to the license agreement accompanying this Software
 * for additional information regarding your rights and obligations.
 *
 * SOFTWARE AND DOCUMENTATION ARE PROVIDED “AS IS?WITHOUT WARRANTY OF ANY
 * KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY
 * OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR
 * PURPOSE. IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR
 * OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION,
 * BREACH OF WARRANTY, OR OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT
 * DAMAGES OR EXPENSES INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL,
 * INDIRECT, PUNITIVE OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA,
 * COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY
 * CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF),
 * OR OTHER SIMILAR COSTS.
 *
 * Author               Date        Comment
 *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 * Anton Alkhimenok     11/12/07	Version 1.0 release
 ********************************************************************/

/*
******************************************************************************
* Revision:
* This file modified for Solomon SSD1963 driver development
* Programmer: John Leung
* Company: TechToys Co.
* Web: www.TechToys.com.hk
* Date: 16th Jan 2010
* (1) Add 	support for the hardware platform PIC24/32 Eval Rev2C with
*			PIC32MX360F512L MCU onboard + SSD1963 Eval Rev2A.
*			TFT panels can be TY700TFT800480 (7" TFT), TY430TFT480272 (4.3" TFT),
*			LVC75Z779V1S (3.5" TFT) with #define in this file
******************************************************************************
*/

#ifndef _GRAPHICS_H
    #define _GRAPHICS_H

//////////////////// COMPILE OPTIONS AND DEFAULTS ////////////////////

///////////// GRAPHICS CONTROLLERS CODES FOR DRIVER LAYER ////////////
    #define CUSTOM_CONTROLLER       0
    #define SSD1906                 1
    #define SSD1926                 2
    #define SSD1928                 128	//TechToys
    #define SSD1963                 55	//TechToys
    #define S6D0129                 3
    #define S6D0139                 4
    #define LGDP4531                5
    #define R61505                  6
    #define SPFD5408                7
    #define SSD1339                 8
    #define ST7529                  9
    #define SH1101A                 10
    #define SSD1303                 11
    #define HIT1270                 12
    #define UC1610                  13
    #define ILI9320                 14
    #define SSD1289                 15
    #define HX8347                  16
    #define R61580                  17
    #define SSD2119                 18
    #define MCHP_DA210            	100
    #define NO_CONTROLLER_DEFINED   - 1

////////////// GRAPHICS DISPLAYS CODES FOR DRIVER LAYER //////////////
    #define TFT_G240320LTSW_118W_E      0
    #define TFT2N0369_E                 0
    #define DT032TFT_TS                 0
    #define DT032TFT                    0
    #define TFT_G320240DTSW_69W_TP_E    1
    #define _35QVW0T                    1
    #define PH480272T_005_I06Q          2
    #define PH480272T_005_I11Q          3
	#define TY700TFT800480				125	//TechToys 
	#define TY430TFT480272				126	//TechToys
	#define LVC75Z779V1S				127	//TechToys

////////////// GRAPHICS HARDWARE PLATFORM FOR DRIVER LAYER //////////////
    #define CUSTOM_PLATFORM				0xFFFF
    #define GFX_PICTAIL_V1      		1
    #define GFX_PICTAIL_V2      		2
    #define GFX_PICTAIL_V3      		3
    #define DA210_DEV_BOARD				4
	#define PIC_EVK_V2C					125	//TechToys

/////////////////////// GRAPHICS_LIBRARY_VERSION /////////////////////
// MSB is version, LSB is subversion
    #define GRAPHICS_LIBRARY_VERSION    0x0200

////////////////////////////// INCLUDES //////////////////////////////
    #include <stdlib.h>
    #include "GenericTypeDefs.h"
    #include "GraphicsConfig.h"
    #include "HardwareProfile.h"
    #include "DisplayDriver.h"  // Display driver layer
    #include "Primitive.h"      // Graphic primitives layer
    #include "ScanCodes.h"      // Scan codes for AT keyboard
    #include "GOL.h"            // GOL layer
    #if defined(USE_BUTTON) || defined(USE_BUTTON_MULTI_LINE)
        #include "Button.h"
    #endif
    #ifdef USE_WINDOW
        #include "Window.h"
    #endif
    #ifdef USE_GROUPBOX
        #include "GroupBox.h"
    #endif
    #ifdef USE_STATICTEXT
        #include "StaticText.h"
    #endif
    #ifdef USE_SLIDER
        #include "Slider.h"
    #endif
    #ifdef USE_CHECKBOX
        #include "CheckBox.h"
    #endif
    #ifdef USE_RADIOBUTTON
        #include "RadioButton.h"
    #endif
    #ifdef USE_PICTURE
        #include "Picture.h"
    #endif
    #ifdef USE_PROGRESSBAR
        #include "ProgressBar.h"
    #endif
    #ifdef USE_EDITBOX
        #include "EditBox.h"
    #endif
    #ifdef USE_LISTBOX
        #include "ListBox.h"
    #endif
    #ifdef USE_ROUNDDIAL
        #include "RoundDial.h"
    #endif
    #ifdef USE_METER
        #include "Meter.h"
    #endif
    #ifdef USE_GRID
        #include "Grid.h"
    #endif
    #ifdef USE_CHART
        #include "Chart.h"
    #endif
    #ifdef USE_TEXTENTRY
        #include "TextEntry.h"
    #endif
    #ifdef USE_DIGITALMETER
        #include "DigitalMeter.h"
    #endif
    #ifdef USE_CUSTOM

// Included for custom control demo
        #include "CustomControlDemo.h"
    #endif

/*********************************************************************
* Macros: RGB565CONVERT(red, green, blue)
*
* Overview: Converts true color into 5:6:5 RGB format.
*
* PreCondition: none
*
* Input: Red, Green, Blue components.
*
* Output: 5 bits red, 6 bits green, 5 bits blue color.
*
* Side Effects: none
*
********************************************************************/
    #define RGB565CONVERT(red, green, blue) (WORD) (((red >> 3) << 11) | ((green >> 2) << 5) | (blue >> 3))

/*********************************************************************
* Macros: RGB332CONVERT(red, green, blue)
*
* Overview: Converts true color into 5:6:5 RGB format.
*
* PreCondition: none
*
* Input: Red, Green, Blue components.
*
* Output: 5 bits red, 6 bits green, 5 bits blue color.
*
* Side Effects: none
*
********************************************************************/
    #define RGB332CONVERT(red, green, blue) (BYTE) ((red & 0xE0) | ((green & 0xE0) >> 3) | (blue >> 6))

#endif
