Forum Rule: Always post complete source code & details to reproduce any issue!
Page 2 of 2 FirstFirst 1 2
Results 26 to 42 of 42

Thread: Optimized ILI9341 TFT Library

  1. #26
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,060
    Sorry, I am not sure about all of the things that are in or not in the GFX library. But I do see functions in adafruit GFX library like:
    drawRGBBitmap(int16_t x, int16_t y, const uint16_t bitmap[], int16_t w, int16_t h);

    But again this is nothing special, that is the code just does:
    Code:
    void Adafruit_GFX::drawRGBBitmap(int16_t x, int16_t y,
      const uint16_t bitmap[], int16_t w, int16_t h) {
        startWrite();
        for(int16_t j=0; j<h; j++, y++) {
            for(int16_t i=0; i<w; i++ ) {
                writePixel(x+i, y, pgm_read_word(&bitmap[j * w + i]));
            }
        }
        endWrite();
    }
    So it writes out one pixel at a time. So again it assumes you have the right size and it only updates that portion of the display that you specify.

    Sort of like writeRect.

    As for writeRect leaving stuff on screen? It all depends on how you use it. Obviously if your image that you are using is the size of the screen, you can then simply setup to have the whole image directly in an array of 16 bit values, which you go directly to the screen...

    writeRect(0,0, tft.width(), tft.height, bmpColors);

    Which again does something similar:
    Code:
    void ST7735_t3::writeRect(int16_t x, int16_t y, int16_t w, int16_t h, const uint16_t *pcolors)
    {
      beginSPITransaction();
      setAddr(x, y, x + w - 1, y + h - 1);
      writecommand(ST7735_RAMWR);
      for (y = h; y > 0; y--) {
        for (x = w; x > 1; x--) {
          writedata16(*pcolors++);
        }
        writedata16_last(*pcolors++);
      }
      endSPITransaction();
    }
    The main difference is how fast. That is the drawRGB... will output something like:
    (1+2+2+1+2+2+1+2) = 13 bytes per pixel

    The writeRect: will write the first part out (1+2+2+1+2+2+1) = 11 bytes for the start of rectangle and then 2 bytes for each pixel.

    As for what is shown on screen like white or the like. That you need to take care either way. They only touch the portion of the screen you tell it to do.

  2. #27
    I will try this tomorrow. Also, what file is the writeRect function in, and what line? I can't seem to find it in the files anywhere.

  3. #28
    Update: I tried it out and the text changes to orange when I use writeRect, but the program claims that the writeRect function is not in the ST7789_t3 library. If this is the best way to quickly draw my bitmap, then I want to use it. It would just appear that this particular function in not in the ST7789_t3 library.

  4. #29
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,060
    That function is not currently in released library, it is in my fork branch https://github.com/KurtE/ST7735_t3/t...ct_reset_delay

    Which is waiting on a pull request to main...

  5. #30
    Is there any kind of ETA for when that function will be released for the ST7789_t3 library?

  6. #31
    I hate to be a bother, but is there any kind of update on the situation. I do apologize if I am causing you any trouble.

  7. #32
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,060
    It is hard to say when @PaulStoffregen may pull in the Pull request into the released branch. Hopefully by the time of the next release.

    However in the mean time you can always download my branch off of Github and work with it.
    https://github.com/KurtE/ST7735_t3/t...ct_reset_delay

    You can simply clone it (or download a zip file), and put it into the folder: <Where your Arduino sketches go>/libraries/ST7735_t3

    And then Arduino should use that version instead of the one installed by Teensyduino...

  8. #33
    I did that, and everything works as it should except for the writeRect function. I'm finding some trouble with the format of the embedded bitmap file. I am seeing many different formats online, but I am not sure which is that one I'm looking for.
    i.e. const unsigned long, const long, const short, or const unsigned short

    Other than that I believe it comes down to the converter I am using to create my bitmap array.

  9. #34
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,060
    I am unsure, what you are saying, with except writeRect...

    Are you saying writeRect does not exist or are you saying, you're data is not displaying properly?

    If does not exist, than you probably did not choose the correct branch of my fork.

  10. #35
    I apologize for not being clear. I am saying that I do have the writeRect function in your fork of the library. As you know, it has the x coord, the y coord, the width, the height, and the actual bitmap file for the function arguments. I want to make sure I know how to properly enter the bitmap as the 5th argument. In other words, I am not exactly sure which type of data the bitmap array must be, other than an array type. You see, the code compiles correctly, but the image displayed on the screen is not my bitmap at all. I hope this helps clarify what I am looking for.

  11. #36
    When I say "which type of data", I am referring to the const, long, short, and unsigned definitions of the array. It would be best if you has some type of example code of how you yourself would actually use this function.

  12. #37
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,060
    The color array is setup to take the colors in the 16 bit color format: Each pixel has a 16 bit color associated with it, which I believe is the RGB: 5x6x5 bit format...

  13. #38
    Do you have any example arduino code of you using the function with an array?

  14. #39
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,060
    There are programs bouncing around that use it.

    Example: why added to this st7735_t3 code, is the uncannyEyes code. Which is bouncing around on several threads, including: https://forum.pjrc.com/threads/55735...l=1#post210168

  15. #40
    So after a lot of testing, I got the writeRect function wot work. However, I am getting a white background for the rest of the bitmap. Is there any way that I can get it to work with a transparent background? I could simply change all of the 16-bit white color values to the background color, but I would like to avoid that if possible. Any ideas? I have a picture linked so you can see my issue.

    https://drive.google.com/file/d/0BzH...ew?usp=sharing

  16. #41
    Also, is there any support for the usage of fonts in the ST7789_t3 library?

  17. #42
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,060
    Quote Originally Posted by luke.saber View Post
    Also, is there any support for the usage of fonts in the ST7789_t3 library?
    I have not tried it, but the class derives from the Adafruit_GFX library which has font support.

    So you should be able to use their stuff, which is described up at: https://learn.adafruit.com/adafruit-...ry/using-fonts

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •