示例#1
0
// Write cycle time requires at least a minimum of 66 ns for a write-strobe.
void LCD_strobeWriteLine(){
  LCD_negateWr();             // Make sure it is negated.
  LCD_assertWr();             // Assert it.
//  LCD_delay10Nanoseconds(4);  // Wait for 40 ns.
  LCD_negateWr();             // negate it.
//  LCD_delay10Nanoseconds(4);  // Wait for 40 ns.
}
示例#2
0
// Initialization common to both shield & breakout configs
void Adafruit_TFTLCD::init(void) {
//
//#ifdef USE_ADAFRUIT_SHIELD_PINOUT
//  CS_IDLE; // Set all control bits to idle state
//  WR_IDLE;
//  RD_IDLE;
//  CD_DATA;
//  digitalWrite(5, HIGH); // Reset line
//  pinMode(A3, OUTPUT);   // Enable outputs
//  pinMode(A2, OUTPUT);
//  pinMode(A1, OUTPUT);
//  pinMode(A0, OUTPUT);
//  pinMode( 5, OUTPUT);
//#endif
//
//  setWriteDir(); // Set up LCD data port(s) for WRITE operations
  LCD_negateWr();
  LCD_negateRd();
  LCD_setDataMode();
  LCD_setWriteDataDirection();
  rotation  = 0;
  cursor_y  = cursor_x = 0;
  textsize  = 1;
  textcolor = 0xFFFF;
  _width    = TFTWIDTH;
  _height   = TFTHEIGHT;
}
示例#3
0
// Reset pin is not connected so only the software writes occur. BLH
void Adafruit_TFTLCD::reset(void) {

//  CS_IDLE;
////  CD_DATA;
//  WR_IDLE;
//  RD_IDLE;
	LCD_setDataMode();
	LCD_negateWr();
	LCD_negateRd();
//
//#ifdef USE_ADAFRUIT_SHIELD_PINOUT
//  digitalWrite(5, LOW);
//  delay(2);
//  digitalWrite(5, HIGH);
//#else
//  if(_reset) {
//    digitalWrite(_reset, LOW);
//    delay(2);
//    digitalWrite(_reset, HIGH);
//  }
//#endif
//
//  // Data transfer sync
//  CS_ACTIVE;
//  CD_COMMAND;
  LCD_setCommandMode();
  LCD_write8(0x00);
  for(uint8_t i=0; i<3; i++)
	  //WR_STROBE; // Three extra 0x00s
	  LCD_strobeWriteLine();
//  CS_IDLE;
}
示例#4
0
// This init intializes all of the hardware that talks to the LCD panel.
void LCD_init() {
//  printf("LCD_init called.\n\r");
  if (initFlag)  // Check to see if init has already been called.
    return;      // Already initialized, just return.
  int status;    // First call, continue...
  status = XGpio_Initialize(&gpioTftControl, LCD_CONTROL_DEVICE_ID);  // Xilinx GPIO init call.
  if (status != XST_SUCCESS) {
    printf("XGPIO_Initialize (TFT) failed\n\r.");
  }
  status = XGpio_Initialize(&gpioTftDataBus, LCD_DATA_BUS_DEVICE_ID); // Xilinx GPIO init call.
  if (status != XST_SUCCESS) {
    printf("XGPIO_Initialize (TFT Data Bus) failed\n\r.");
  }
  // Set the direction for all signals to be outputs (0 = output, 1 = input).
  XGpio_SetDataDirection(&gpioTftControl, 1, 0);  // Control bits are always outputs.
  XGpio_SetDataDirection(&gpioTftDataBus, 1, 0);  // Set up data-bus direction as output (write).
  mio_init(true);
  LCD_negateRd();  // negate the RD control signal.
  LCD_negateWr();  // negate the WR control signal.
  initFlag = true; // Note that init has been invoked.
}
示例#5
0
// Writes 8 bits to the TFT controller.
void LCD_write8(uint8_t value){
  LCD_assertWr();               // Assert the WR line.
  LCD_writeData(value);         // Copy the data out to the MIO pins.
  LCD_negateWr();               // Negate WR.
}
示例#6
0
// Set the GPIO pins on the LCD data bus for read operations.
void LCD_setReadDataDirection() {
  LCD_negateWr();  // Negate the WR pin to be consistent.
  XGpio_SetDataDirection(&gpioTftDataBus, 1, 0xFF);  // LCD data bus is input from ZYNQ perspective.
}