 #ifndef LCD_2000_9225_H
#define LCD_2000_9225_H

#if ARDUINO >= 100
 #include "Arduino.h"
 #include "Print.h"
#else
 #include "WProgram.h"
#endif
#include "utility/Adafruit_GFX.h"
#include <avr/pgmspace.h>


#define LCD_2000_9225_TFTWIDTH 176
#define LCD_2000_9225_TFTHEIGHT 220


class LCD_2000_9225 : public Adafruit_GFX 
{
	public:
		LCD_2000_9225(uint8_t cs,uint8_t wr ,uint8_t rs , uint8_t rest  ,uint8_t pmw ,uint8_t le);
		LCD_2000_9225(uint8_t cs,uint8_t wr ,uint8_t rs , uint8_t rest  ,uint8_t le);
		LCD_2000_9225(uint8_t cs,uint8_t wr ,uint8_t rs ,uint8_t le);
		void write_spi(const uint8_t data);
		void drawPixel(int16_t x, int16_t y, uint16_t color);
		void setdatapin(uint8_t b0,uint8_t b1, uint8_t b2 , uint8_t b3,
													uint8_t b4, uint8_t b5, uint8_t b6, uint8_t b7);
		void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, 
		uint16_t color);
		
		void setbracklight(uint8_t pmw);
		void begin();
		
		void drawbitmap(uint16_t* data, uint16_t x ,uint16_t y,uint16_t with , uint16_t height);
		
//fuction
	private:
		void set_window(uint8_t x1,uint8_t y1,uint8_t x2,uint8_t y2);
		void write_wr_reg(uint16_t data);
		void write_wr_data(uint16_t data);
		void write_cmd(uint16_t cmd ,uint16_t data);
//value	
	//private:
	
		#if 0 //defined(ARDUINO_ARCH_SAM)
			void write_delay();
		#else
			#define write_delay()
		#endif

		#if defined(ARDUINO_ARCH_SAM)
		uint32_t _cs;
		uint32_t _pmw;
		uint32_t _wr;
		uint32_t _rs;
		uint32_t _rest;
		uint32_t _le;
		
		volatile uint32_t *csport;
		volatile uint32_t *pmwport;
		volatile uint32_t *wrport;
		volatile uint32_t *rsport;
		volatile uint32_t *restport;
		volatile uint32_t *leport;
		
		uint32_t cspinmask;
		uint32_t pmwpinmask;
		uint32_t wrpinmask;
		uint32_t rspinmask;
		uint32_t restpinmask;
		uint32_t lepinmask;
		
		volatile uint32_t data[16];
		volatile uint32_t datapinmask[16];
		volatile uint32_t* dataport[16];		
				
		#else
		uint8_t _cs;
		uint8_t _pmw;
		uint8_t _wr;
		uint8_t _rs;
		uint8_t _rest;
		uint8_t _le;
		
		volatile uint8_t *csport;
		volatile uint8_t *pmwport;
		volatile uint8_t *wrport;
		volatile uint8_t *rsport;
		volatile uint8_t *restport;
		volatile uint8_t *leport;
		
		uint8_t cspinmask;
		uint8_t pmwpinmask;
		uint8_t wrpinmask;
		uint8_t rspinmask;
		uint8_t restpinmask;
		uint8_t lepinmask;
		
		volatile uint8_t data[16];
		volatile uint8_t datapinmask[16];
		volatile uint8_t* dataport[16];

		#endif
};

uint16_t RGB(uint16_t r,uint16_t g , uint16_t b);


#endif 