Adafruit GFX Extension

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
User91827
 
Posts: 5
Joined: Fri Jul 23, 2021 11:09 pm

Adafruit GFX Extension

Post by User91827 »

I am working on making the Adafruit GFX Library (https://github.com/adafruit/Adafruit-GFX-Library) work with a TFT display using the ILI9613C controller.

I used a logic analyzer to grab the various codes. It all seems to be working except for one last thing. When I go to draw a pixel with

Code: Select all

tft.drawPixel(tft.width()/2, tft.height()/2, 0x07E0);
It sends the column and page info correctly from the "setAddrWindow" which I implemented. The last thing I do in the setAddrWindow method is to send the "Memory Write" command using "writeCommand". The problem is that the CS line is never going low. I inspected what the Adafruit lib is using (which works when using "sendCommand"). Then tried calling it myself in the overridden method. Then tried just using "digitalWrite" to set the pin state. None of them will drop the CS line low. I'm running out of ideas.

Code: Select all

void AdaGFX_ILI9163C::startWrite(void) {
  Serial.println("start write");
  Adafruit_SPITFT::startWrite();
  digitalWrite(4, LOW);
  SPI_CS_LOW();
}

void AdaGFX_ILI9163C::endWrite(void) {
  Serial.println("end write");
  Adafruit_SPITFT::endWrite();
  SPI_CS_HIGH();
  digitalWrite(4, HIGH);
}
See a screen grab of the logic analyzer attached.
Screen Shot 2021-08-20 at 12.04.00 PM.png
Screen Shot 2021-08-20 at 12.04.00 PM.png (44.36 KiB) Viewed 247 times

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Adafruit GFX Extension

Post by adafruit_support_mike »

Hmm.. have you made a class for your display that’s a subclass of Adafruit_SPITFT?

The GFX library implements all of its graphics primitives in terms of .writePixel(), which is supplied by Adafruit_SPITFT. Subclassing Adafruit_SPITFT lets you do device-specific setup that makes the display functional, then the existing code in the GFX library handle the graphics stuff.

User avatar
User91827
 
Posts: 5
Joined: Fri Jul 23, 2021 11:09 pm

Re: Adafruit GFX Extension

Post by User91827 »

Yes. I made a sub class. I was unable to get it to work. I was able to find a library which has the basics working ( https://github.com/sumotoy/TFT_ILI9163C ) . I adapted it significantly and am now in business.

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Adafruit GFX Extension

Post by adafruit_support_mike »

Glad to hear you got it working. Happy hacking!

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”