#include <hx8347lib.h>
#include <Adafruit_TFTLCD.h>
#include <Adafruit_GFX.h>
 
// The control pins for the LCD can be assigned to any digital or
// analog pins...but we'll use the analog pins as this allows us to
// double up the pins with the touch screen (see the TFT paint example).
#define LCD_CS A3 // Chip Select goes to Analog 3
#define LCD_CD A2 // Command/Data goes to Analog 2
#define LCD_WR A1 // LCD Write goes to Analog 1
#define LCD_RD A0 // LCD Read goes to Analog 0
#define LCD_RESET A4 // Can alternately just connect to Arduino's reset pin
 
// When using the BREAKOUT BOARD only, use these 8 data lines to the LCD:
// For the Arduino Uno, Duemilanove, Diecimila, etc.:
//   D0 connects to digital pin 8
//   D1 connects to digital pin 9
//   D2 connects to digital pin 2
//   D3 connects to digital pin 3
//   D4 connects to digital pin 4
//   D5 connects to digital pin 5
//   D6 connects to digital pin 6
//   D7 connects to digital pin 7
 
 
 
// Assign human-readable names to some common 16-bit color values:
#define BLACK   0x0000
#define BLUE    0x001F
#define RED     0xF800
#define GREEN   0x07E0
#define CYAN    0x07FF
#define MAGENTA 0xF81F
#define YELLOW  0xFFE0
#define WHITE   0xFFFF
 
Adafruit_TFTLCD tft(A3, A2, A1, A0, A4);
void setup(void)
 {
 
  Serial.begin(9600);
  tft.reset();
  tft.begin(0x7575); // 
}
 
void loop(void)
{
  for(uint8_t rotation=0; rotation<4; rotation++)
  {
    tft.setRotation(rotation);
    testText();
    delay(5000);
  }
}
 
unsigned long testFillScreen()
 {
  unsigned long start = micros();
  tft.fillScreen(BLACK);
  tft.fillScreen(RED);
  tft.fillScreen(GREEN);
  tft.fillScreen(BLUE);
  tft.fillScreen(BLACK);
}
 
unsigned long testText()
 {
  tft.fillScreen(RED);
  tft.setCursor(0, 0);
  tft.setTextColor(WHITE);  tft.setTextSize(1);
  //tft.println("Hello World!");
  tft.setTextColor(YELLOW); tft.setTextSize(2);
  tft.println(1234.56);
  tft.setTextColor(WHITE);    tft.setTextSize(2.5);
  tft.println("dr.mohammad");
  tft.println();
  tft.setTextColor(GREEN);
  tft.setTextSize(4);
  tft.println("himax hx8347g");
  tft.setTextSize(2);
  tft.println("this is a test");
  tft.setTextSize(1);
  tft.println("this is a test");
  tft.println("himax hx8347g");
  tft.println("Hello World");
}