Code Monkey home page Code Monkey logo

adafruit-st7735-library's Introduction

This is a library for several Adafruit displays based on ST77* drivers.

  Works with the Adafruit 1.8" TFT Breakout w/SD card
    ----> http://www.adafruit.com/products/358
  The 1.8" TFT shield
    ----> https://www.adafruit.com/product/802
  The 1.44" TFT breakout
    ----> https://www.adafruit.com/product/2088
  as well as Adafruit raw 1.8" TFT display
    ----> http://www.adafruit.com/products/618
 
Check out the links above for our tutorials and wiring diagrams.
These displays use SPI to communicate, 4 or 5 pins are required to
interface (RST is optional).

Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!

Written by Limor Fried/Ladyada for Adafruit Industries.
MIT license, all text above must be included in any redistribution.

Recent Arduino IDE releases include the Library Manager for easy installation. Otherwise, to download, click the DOWNLOAD ZIP button, uncompress and rename the uncompressed folder Adafruit_ST7735. Confirm that the Adafruit_ST7735 folder contains Adafruit_ST7735.cpp, Adafruit_ST7735.h and related source files. Place the Adafruit_ST7735 library folder your ArduinoSketchFolder/Libraries/ folder. You may need to create the Libraries subfolder if its your first library. Restart the IDE.

Also requires the Adafruit_GFX library for Arduino.

adafruit-st7735-library's People

Contributors

adrianotiger avatar aray avatar bfiset avatar caternuson avatar driverblock avatar evaherrada avatar gerripeach avatar gojimmypi avatar hathach avatar jersagfast avatar kattni avatar kevinfrei avatar kurte avatar ladyada avatar lucadentella avatar makermelissa avatar marcmerlin avatar mikeysklar avatar paintyourdragon avatar paulstoffregen avatar process1183 avatar sajattack avatar selenefg avatar siddacious avatar slav-at-attachix avatar tablatronix avatar tdicola avatar tyeth avatar wa5znu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adafruit-st7735-library's Issues

setRowColStart method cannot be seen

  • Arduino board: Arduino Nano

  • Arduino IDE version (found in Arduino -> About Arduino menu): 1.8.7

  • error message:
    graphicstest:78:7: error: 'class Adafruit_ST7735' has no member named 'setRowColStart'

    tft.setRowColStart(32, 2);

     ^
    

exit status 1
'class Adafruit_ST7735' has no member named 'setRowColStart'

'class Adafruit_ST7789' has no member named 'initR'

  1. Install using Arduino library manager
  2. comment-out the 7735 line, and uncomment the 7789 lib
  3. fails to build

Hopefully easy to fix - someone musta changed something without testing both displays... tch tch tch...

testlines demo cause wdt exceptions on esp8266

Hello! ST77xx TFT Test
Initialized
74

Soft WDT reset

ctx: cont 
sp: 3ffef6e0 end: 3ffef9e0 offset: 01b0

>>>stack>>>
3ffef890:  016e3600 00000001 3ffee938 40203679  
3ffef8a0:  00000061 00000061 3ffee938 402037fd  
3ffef8b0:  0000003c 00000062 3ffee938 40203a66  
3ffef8c0:  00000061 00000008 3ffee938 4010655d  
3ffef8d0:  016e3600 0000ffe0 3ffee938 0000009f  
3ffef8e0:  00000061 0000ffe0 3ffee938 40203aef  
3ffef8f0:  00000067 0000009f 00000090 40204c60  
3ffef900:  00000080 0000009f 3ffee938 40204be9  
3ffef910:  00000001 00000001 0000ffe0 00000013  
3ffef920:  3ffee938 00000048 3ffee938 40203679  
3ffef930:  00000001 00000050 3ffee938 0000ffe0  
3ffef940:  0000003c 00000000 3ffee938 40204ee8  
3ffef950:  0000004f 0000009f 3ffee938 40204e60  
3ffef960:  000000a2 0000ffe0 3ffee938 40204e60  
3ffef970:  00420000 0000ffe0 3ffee938 402021c0  
3ffef980:  00000050 00000050 40204488 3ffee9c0  
3ffef990:  40201356 000001f4 000001f4 0000ffe0  
3ffef9a0:  40203aac 3ffee988 3ffee938 40202966  
3ffef9b0:  feefeffe feefeffe feefeffe 3ffee9ac  
3ffef9c0:  3fffdad0 00000000 3ffee9a4 402044cc  
3ffef9d0:  feefeffe feefeffe 3ffee9c0 401006d5  
<<<stack<<<

 ets Jan  8 2013,rst cause:2, boot mode:(1,7)


 ets Jan  8 2013,rst cause:4, boot mode:(1,7)

wdt reset

I added yields to each loop to stabilize it.

Zero DMA support

Hello folks,
The display works fine with the Arduino Zero and this library, however after trying a different library (https://github.com/pantata/TFT9341SPI) it turned out that the latter was much faster usind DMA transfer on the ATSAMD21 chip. I tried incorporating the DMA-relevant functions into the Adafruit library but got stuck.
Do you think it's possible to add Zero DMA support into your lib?
I think many people would be grateful.
Greetings,
AJ

Using multiple, smaller than fullscreen BMPs

When I try to use smaller than fullscreen BMPs instead of a single fullscreen BMP, the image data is drawn as a multicolorpixel block. I tried to re-scan the bmpheader and adjusted the bmpdraw function so that it includes the file width/height, etc. in a flexible manner,but couldn't adapt the code so that the bmp would be drawn correctly.

Could you adjust the code to support variable image size and location?

It would greatly help to optimize some animations as the screen redraw rate is fairly slow.

Include Gards missing

Includes Guards are missing in headers files, causing class redefinition error when compiling.

spitftbitmap is backwards

Here's a picture from the tutorial of the parrot: http://www.ladyada.net/images/18tftbreakout/18tftlcdparrot_LRG.jpg
Here's the parrot.bmp file itself: http://www.ladyada.net/images/18tftbreakout/parrot.bmp
Notice that the parrot faces left in the bmp and right on the TFT.

The example code has this:

// tft.setRotation()

// tft.drawPixel(i, j, p)
tft.pushColor(p);

If you use drawPixel, it comes out 90 degrees off. If you do
tft.setRotation(3)
first AND use tft.drawPixel then it comes out matching the BMP. It's just terribly slow.

The code comment says
// bitmaps are stored with the BOTTOM line first so we have to move 'up'

It seems like there's some other issue as well.

Any ideas how to get BMPs to come out right, or should we just reverse them on the SD card?
If so, the tutorial should say to do that.

selectable hardware SPI for M0

hey guys tried forums but couldnt get an answer. so im using feather m0 and trying to use additional hardware spi pins for st 7735 display. so far followed this tutorial here https://learn.adafruit.com/using-atsamd21-sercom-to-add-more-spi-i2c-serial-ports/creating-a-new-spi but couldnt figure out the proper constructor for the 0.96 display with custom spi pins.
here https://github.com/adafruit/Adafruit-ST7735-Library/blob/master/Adafruit_ST7735.cpp you can define selectable hardware SPI for ESP8266 but can anybody help me for the feather M0?

Multiple displays tft.initR() conflict

Hi, I'm using NodeMCU with a bunch of ST7735 displays, and while with single display everything works fine, when I connect several displays to the SPI bus, the initR for one display seems to "override" another one, so if I in setup() I use two initR(), only the display which was intialised last will work, the other one will stay blank and white. For instance in this case:
tft.initR(INITR_BLACKTAB); // initialize a ST7735S chip, black tab
tft2.initR(INITR_BLACKTAB); // initialize a ST7735S chip, black tab
In this case only the tft2 will work. Here's the full code that I use for a test:

`#include <Adafruit_GFX.h>
#include <Adafruit_ST7735.h>
#include <SPI.h>

#define TFT_CS D8
#define TFT_CS_2 D1
#define TFT_RST D0
#define TFT_DC D4

Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);
Adafruit_ST7735 tft2 = Adafruit_ST7735(TFT_CS_2, TFT_DC, TFT_RST);

void setup(void) {
Serial.begin(115200);
Serial.print("Hello! ST7735 TFT Test");
tft.initR(INITR_BLACKTAB); // initialize a ST7735S chip, black tab
tft2.initR(INITR_BLACKTAB); // initialize a ST7735S chip, black tab

tft.fillScreen(ST7735_BLACK);
tft2.fillScreen(ST7735_BLACK);

delay(500);

tft.fillScreen(ST7735_BLACK);
tft2.fillScreen(ST7735_BLACK);
testdrawtext("Lorem. In vestibulum purus a tortor imperdiet posuere. ", ST7735_WHITE);
testdrawtext2("OH MY GOD ITS WORKING", ST7735_RED);
while(true){delay(10);}
}
void loop() {
}

void testdrawtext(char *text, uint16_t color) {
tft.setCursor(0, 0);
tft.setTextColor(color);
tft.setTextWrap(true);
tft.print(text);
}
void testdrawtext2(char *text, uint16_t color) {
tft2.setCursor(0, 0);
tft2.setTextColor(color);
tft2.setTextWrap(true);
tft2.print(text);
}
`
Thank you!

rotationtest.ino fails in modes 2/3 on 1.54" TFT ST7789

  • Arduino board: Tested on Teensy 3.2

  • Arduino IDE version (found in Arduino -> About Arduino menu): 1.8.5

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too):

The default rotationtest.ino example does not handle rotation modes 2 and 3 correctly on the 1.54" TFT ST7789 board. These two modes are offset by 80 and are not centered.

Adding a second _rowstart2 property provides a fix for this particular board. (I believe this is the same issue noted here: #39 though I don't have that board on hand to test this fix.)

Can't use ports 11, 12, 13 ?

If I use option 2, such as:

Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST);

I can't use pins 11, 12, 13 for some reason...how to solve?

Problem With NodeMCU ESP8266 12E

Hi, the library is not working with my NodeMCU ESP8266 12E v3 CP2102 board. It is working well with Arduino, but in NodeMCU, the board restarts again and again (Watchdog issue). Here is the error log -

Exception (28):
epc1=0x402045c0 epc2=0x00000000 epc3=0x00000000 excvaddr=0x000000c0 depc=0x00000000

>>>stack>>>

ctx: cont
sp: 3ffffdc0 end: 3fffffc0 offset: 01a0
3fffff60:  3fffdad0 4023c0c2 3ffee468 3ffee528  
3fffff70:  3fffdad0 00000002 3ffee468 40204ad0  
3fffff80:  3fffdad0 3ffee4d0 3ffee468 40202e38  
3fffff90:  feefeffe feefeffe feefeffe 3ffee528  
3fffffa0:  3fffdad0 00000000 3ffee4f8 40205c0c  
3fffffb0:  feefeffe feefeffe 3ffe84f8 40100a0d  

Tiny bug in spitftbitmap.pde, bmpDraw

The r and b colours are read from the bmp file incorrectly:

            // Convert pixel from BMP to TFT format, push to display
            b = sdbuffer[buffidx++];
            g = sdbuffer[buffidx++];
            r = sdbuffer[buffidx++];

should be

            // Convert pixel from BMP to TFT format, push to display
            r = sdbuffer[buffidx++];
            g = sdbuffer[buffidx++];
            b = sdbuffer[buffidx++];

You can't see this easily in the picture of the parrot!

Compilation fail with recent GCC due to deprecation of prog_uchar

The exacct error message:
Adafruit_ST7735/Adafruit_ST7735.h:130:24: error: 'prog_uchar' has not been declared

relevant piece of informations from prgspace.h:

This typedef is now deprecated because the usage of the progmem
attribute on a type is not supported in GCC. However, the use of the
progmem attribute on a variable declaration is supported, and this is
now the recommended usage.

The typedef is only visible if the macro PROG_TYPES_COMPAT
has been defined before including <avr/pgmspace.h> (either by a
#define directive, or by a -D compiler option.)

Is there any interest in supporting Deek Robot TFT Esplora compatible module?

Hi. I did some modifications to calibrate the zero position and colors. It mixes the color of the blacktab with colstart/rowstart of the greentab. I am still doing some better tests, because this is my first experience with TFT LCD and Anduino.

If you are interested, I can do a proper pull request.

If it really works without any consequences, I will fork it anyway.


void Adafruit_ST7735::initR(uint8_t options) {
...
} else if(options == INITR_DEEKROBOT) {
commandList(Rcmd2red);
colstart = 2;
rowstart = 1;
...
// if black, change MADCTL color filter
if ((options == INITR_BLACKTAB) || (options == INITR_MINI160x80) || (options == INITR_DEEKROBOT)) {
writecommand(ST7735_MADCTL);
writedata(0xC0);
}

ST7789 Compatibility issues with Teensy 3.2

  • Arduino board: Teensy 3.2

  • Arduino IDE version (found in Arduino -> About Arduino menu): 1.8.9

  • example code graphicstest.ino results in a black display on Adafruit 3787 1.54" 240x240 Wide Angle TFT LCD Display with MicroSD - ST7789 on library versions 1.26 or later (works on 1.25)

A small delay, around 10uS, needs to be added between SPI_CS_HIGH() and SPI_CS_LOW() in the displayInit method to account for the fast IO speed in the Teensy series

Background on the issue can be found here: https://forum.pjrc.com/threads/55317-New-adafruit-GFX-1-4-x-libs-doesn-t-work-for-me?p=202762&viewfull=1#post202762

Compile in larger project

To get the library to compile in a larger project I had to add:

ifndef __ADAFRUIT_ST7735H

define __ADAFRUIT_ST7735H

......

endif

and:

if ARDUINO >= 100

#include "Arduino.h"
#include "Print.h"

else

#include "WProgram.h"

endif

(print.h)
to the .h file of the library.

1.8" st7735 tft lcd library not work on arduino 1.6.5 ide for nodemcu board

1.8" st7735 tft lcd library not work on arduino 1.6.5 ide for nodemcu board

graphicstest.ino: In function 'void setup()':
graphicstest.ino:71:397: warning: deprecated conversion from string constant to 'char_' [-Wwrite-strings]
In file included from C:\Program Files (x86)\Arduino\libraries\Adafruit_GFX\Adafruit_GFX.cpp:35:0:
C:\Program Files (x86)\Arduino\libraries\Adafruit_GFX\glcdfont.c:8:0: warning: "PROGMEM" redefined [enabled by default]
#define PROGMEM
^
In file included from C:\Users\TAO13\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.4-673-g8cd3697\cores\esp8266/Arduino.h:38:0,
from C:\Program Files (x86)\Arduino\libraries\Adafruit_GFX\Adafruit_GFX.h:5,
from C:\Program Files (x86)\Arduino\libraries\Adafruit_GFX\Adafruit_GFX.cpp:34:
C:\Users\TAO13\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.4-673-g8cd3697\cores\esp8266/pgmspace.h:15:0: note: this is the location of the previous definition
#define PROGMEM ICACHE_RODATA_ATTR
^
C:\Program Files (x86)\Arduino\libraries\Adafruit_GFX\Adafruit_GFX.cpp:39:0: warning: "pgm_read_byte" redefined [enabled by default]
#define pgm_read_byte(addr) (_(const unsigned char _)(addr))
^
In file included from C:\Users\TAO13\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.4-673-g8cd3697\cores\esp8266/Arduino.h:38:0,
from C:\Program Files (x86)\Arduino\libraries\Adafruit_GFX\Adafruit_GFX.h:5,
from C:\Program Files (x86)\Arduino\libraries\Adafruit_GFX\Adafruit_GFX.cpp:34:
C:\Users\TAO13\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.4-673-g8cd3697\cores\esp8266/pgmspace.h:63:0: note: this is the location of the previous definition
#define pgm_read_byte(addr)
^
C:\Program Files (x86)\Arduino\libraries\Adafruit_ST7735\Adafruit_ST7735.cpp: In constructor 'Adafruit_ST7735::Adafruit_ST7735(int8_t, int8_t, int8_t, int8_t, int8_t)':
C:\Program Files (x86)\Arduino\libraries\Adafruit_ST7735\Adafruit_ST7735.cpp:39:3: error: '_cs' was not declared in this scope
_cs = cs;
^
C:\Program Files (x86)\Arduino\libraries\Adafruit_ST7735\Adafruit_ST7735.cpp:40:3: error: '_rs' was not declared in this scope
_rs = rs;
^
C:\Program Files (x86)\Arduino\libraries\Adafruit_ST7735\Adafruit_ST7735.cpp:41:3: error: '_sid' was not declared in this scope
_sid = sid;
^
C:\Program Files (x86)\Arduino\libraries\Adafruit_ST7735\Adafruit_ST7735.cpp:42:3: error: '_sclk' was not declared in this scope
_sclk = sclk;
^
C:\Program Files (x86)\Arduino\libraries\Adafruit_ST7735\Adafruit_ST7735.cpp:43:3: error: '_rst' was not declared in this scope
_rst = rst;
^
C:\Program Files (x86)\Arduino\libraries\Adafruit_ST7735\Adafruit_ST7735.cpp: In constructor 'Adafruit_ST7735::Adafruit_ST7735(int8_t, int8_t, int8_t)':
C:\Program Files (x86)\Arduino\libraries\Adafruit_ST7735\Adafruit_ST7735.cpp:52:3: error: '_cs' was not declared in this scope
_cs = cs;
^
C:\Program Files (x86)\Arduino\libraries\Adafruit_ST7735\Adafruit_ST7735.cpp:53:3: error: '_rs' was not declared in this scope
_rs = rs;
^
C:\Program Files (x86)\Arduino\libraries\Adafruit_ST7735\Adafruit_ST7735.cpp:54:3: error: '_rst' was not declared in this scope
_rst = rst;
^
C:\Program Files (x86)\Arduino\libraries\Adafruit_ST7735\Adafruit_ST7735.cpp:56:3: error: '_sid' was not declared in this scope
_sid = _sclk = 0;
^
C:\Program Files (x86)\Arduino\libraries\Adafruit_ST7735\Adafruit_ST7735.cpp:56:11: error: '_sclk' was not declared in this scope
_sid = sclk = 0;
^
C:\Program Files (x86)\Arduino\libraries\Adafruit_ST7735\Adafruit_ST7735.cpp: In member function 'void Adafruit_ST7735::commonInit(const uint8_t
)':
C:\Program Files (x86)\Arduino\libraries\Adafruit_ST7735\Adafruit_ST7735.cpp:322:3: error: 'colstart' was not declared in this scope
colstart = rowstart = 0; // May be overridden in init func
^
C:\Program Files (x86)\Arduino\libraries\Adafruit_ST7735\Adafruit_ST7735.cpp:322:15: error: 'rowstart' was not declared in this scope
colstart = rowstart = 0; // May be overridden in init func
^
C:\Program Files (x86)\Arduino\libraries\Adafruit_ST7735\Adafruit_ST7735.cpp:324:11: error: '_rs' was not declared in this scope
pinMode(_rs, OUTPUT);
^
C:\Program Files (x86)\Arduino\libraries\Adafruit_ST7735\Adafruit_ST7735.cpp:325:11: error: '_cs' was not declared in this scope
pinMode(_cs, OUTPUT);
^
C:\Program Files (x86)\Arduino\libraries\Adafruit_ST7735\Adafruit_ST7735.cpp:334:3: error: 'cspinmask' was not declared in this scope
cspinmask = digitalPinToBitMask(_cs);
^
C:\Program Files (x86)\Arduino\libraries\Adafruit_ST7735\Adafruit_ST7735.cpp:335:3: error: 'rspinmask' was not declared in this scope
rspinmask = digitalPinToBitMask(_rs);
^
C:\Program Files (x86)\Arduino\libraries\Adafruit_ST7735\Adafruit_ST7735.cpp:350:13: error: '_sclk' was not declared in this scope
pinMode(_sclk, OUTPUT);
^
C:\Program Files (x86)\Arduino\libraries\Adafruit_ST7735\Adafruit_ST7735.cpp:351:13: error: '_sid' was not declared in this scope
pinMode(_sid , OUTPUT);
^
C:\Program Files (x86)\Arduino\libraries\Adafruit_ST7735\Adafruit_ST7735.cpp:360:5: error: 'clkpinmask' was not declared in this scope
clkpinmask = digitalPinToBitMask(_sclk);
^
C:\Program Files (x86)\Arduino\libraries\Adafruit_ST7735\Adafruit_ST7735.cpp:361:5: error: 'datapinmask' was not declared in this scope
datapinmask = digitalPinToBitMask(_sid);
^
C:\Program Files (x86)\Arduino\libraries\Adafruit_ST7735\Adafruit_ST7735.cpp:379:7: error: '_rst' was not declared in this scope
if (_rst) {
^
C:\Program Files (x86)\Arduino\libraries\Adafruit_ST7735\Adafruit_ST7735.cpp: In member function 'void Adafruit_ST7735::initR(uint8_t)':
C:\Program Files (x86)\Arduino\libraries\Adafruit_ST7735\Adafruit_ST7735.cpp:404:5: error: 'colstart' was not declared in this scope
colstart = 2;
^
C:\Program Files (x86)\Arduino\libraries\Adafruit_ST7735\Adafruit_ST7735.cpp:405:5: error: 'rowstart' was not declared in this scope
rowstart = 1;
^
C:\Program Files (x86)\Arduino\libraries\Adafruit_ST7735\Adafruit_ST7735.cpp:409:5: error: 'colstart' was not declared in this scope
colstart = 2;
^
C:\Program Files (x86)\Arduino\libraries\Adafruit_ST7735\Adafruit_ST7735.cpp:410:5: error: 'rowstart' was not declared in this scope
rowstart = 3;
^
C:\Program Files (x86)\Arduino\libraries\Adafruit_ST7735\Adafruit_ST7735.cpp: In member function 'void Adafruit_ST7735::setAddrWindow(uint8_t, uint8_t, uint8_t, uint8_t)':
C:\Program Files (x86)\Arduino\libraries\Adafruit_ST7735\Adafruit_ST7735.cpp:432:16: error: 'colstart' was not declared in this scope
writedata(x0+colstart); // XSTART
^
C:\Program Files (x86)\Arduino\libraries\Adafruit_ST7735\Adafruit_ST7735.cpp:438:16: error: 'rowstart' was not declared in this scope
writedata(y0+rowstart); // YSTART
^
Error compiling.

Lack of SLEEP and WAKE functions

Hi and Best regards to the creators.
here are functions which are useful for battery saving mode:

void sleep(void) { writecommand(ST77XX_SLPIN); }
void wake(void) { writecommand(ST77XX_SLPOUT); }

please add it.

filled circle problem

Hello, there is a problem when using fillCircle().
Here is the test code:

include <Adafruit_GFX.h>

include <Adafruit_ST7735.h>

include <SPI.h>

Adafruit_ST7735 tft = Adafruit_ST7735(10, 8, 9);

void setup() {
Serial.begin(9600);
tft.initR(INITR_BLACKTAB);
tft.fillScreen(ST7735_BLACK);
tft.fillCircle(90, 120, 30, ST7735_RED);
tft.fillCircle(0, 80, 30, ST7735_RED);
tft.fillCircle(60, 0, 30, ST7735_RED);
}

void loop() { }

The circle with location x=0,y=80 will be distorted, image here:
http://imgur.com/oyS8L6R

I believe this is because we don't handle negative positions correctly, and using setAddrWindow() + Adafruit_ST7735::drawFastVLine() doesn't do what's expected, ST7735 doesn't allow negative positions for CASET and RASET

I fixed this by adjusting the following lines in Adafruit_GFX::fillCircleHelper() function, not in this lib though, but GFX lib is a dependency for ST7735 lib.
I changed this:
if (cornername & 0x2) {
drawFastVLine(x0-x, y0-y, 2_y+1+delta, color);
drawFastVLine(x0-y, y0-x, 2_x+1+delta, color);
}
to this:
if (cornername & 0x2) {
if (x0-x >= 0) drawFastVLine(x0-x, y0-y, 2_y+1+delta, color);
if (x0-y >= 0) drawFastVLine(x0-y, y0-x, 2_x+1+delta, color);
}

Have not noticed any other problems, so this is a issue and a crappy fix for it! :D

Feather M0 with st7735 over sercom SPI

hello, im trying to run tft ST7735 with sercom SPI with no luck so far. i carefully followed the instructions in here https://learn.adafruit.com/using-atsamd ... -a-new-spi and tried implement the required code to a very basic ''hello world'' code to test it.

things to note : if i use regular hw SPI constructor with default MOSI SCK pins screen works perfectly fine. i only move those two pins to sercom SPI pins and use corresponding constructor but i get nothing.
while wired for sercom SPI i changed the constructor to use software SPI again screen works with those pins intended for sercom SPI. like this;
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST);
along with
#define TFT_MOSI 11
#define TFT_SCLK 12

so i think my wiring is ok.

if i keep the code above for softwareSPI and also keep the sercom declaration along with pinperipheral for pins 11 and 12 screen still works in software SPI. while all this is happening i get very fast count from 0 to 255 in serial monitor which i believe is a sign at least mySPI is alive.

can anybody please look at the code and see if im doing something wrong. thank you

#include <Adafruit_GFX.h>    
#include <Adafruit_ST7735.h> 
#include <SPI.h>
#include "wiring_private.h"  //essential for pinperipheral function

#define TFT_CS        6
#define TFT_RST       9 
#define TFT_DC        10

SPIClass mySPI (&sercom1, 13, 12, 11, SPI_PAD_0_SCK_3, SERCOM_RX_PAD_1);  // sercom spi definition


Adafruit_ST7735 tft = Adafruit_ST7735(&mySPI, TFT_CS, TFT_DC, TFT_RST);  // st7735 constructor

void setup() {
  Serial.begin(115200);
  
  mySPI.begin();
  
  pinPeripheral(11, PIO_SERCOM);   //defining pin 11, 12, 13 to be used as sercom pins.
  pinPeripheral(12, PIO_SERCOM);
  pinPeripheral(13, PIO_SERCOM);
  
 tft.initR(INITR_MINI160x80);  

 tft.fillScreen(ST7735_WHITE);  

 tft.setTextWrap(false); 

 tft.setCursor(0, 0); 
 tft.setTextColor(ST7735_BLACK); 
 tft.setTextSize(3); 
 tft.println("Hello");
}
uint8_t i=0;
void loop()     
{
  Serial.println(i);
  mySPI.beginTransaction(SPISettings(8000000, MSBFIRST, SPI_MODE0));     // copied this part from adafruit spi example 
  mySPI.transfer(i++);
  mySPI.endTransaction();
}

ST7735_DISPOFF

ST7735.h, lines 20 and 21 read:

#define ST7735_DISPON 0x28
#define ST7735_DISPON 0x29

I believe they should be:

#define ST7735_DISPOFF 0x28
#define ST7735_DISPON 0x29

ADD SUPPORT for the new Adafruit 1.54" 240x240 - ST7789

Thank you for opening an issue on an Adafruit Arduino library repository. To
improve the speed of resolution please review the following guidelines and
common troubleshooting steps below before creating the issue:

  • Do not use GitHub issues for troubleshooting projects and issues. Instead use
    the forums at http://forums.adafruit.com to ask questions and troubleshoot why
    something isn't working as expected. In many cases the problem is a common issue
    that you will more quickly receive help from the forum community. GitHub issues
    are meant for known defects in the code. If you don't know if there is a defect
    in the code then start with troubleshooting on the forum first.

  • If following a tutorial or guide be sure you didn't miss a step. Carefully
    check all of the steps and commands to run have been followed. Consult the
    forum if you're unsure or have questions about steps in a guide/tutorial.

  • For Arduino projects check these very common issues to ensure they don't apply:

    • For uploading sketches or communicating with the board make sure you're using
      a USB data cable and not a USB charge-only cable. It is sometimes
      very hard to tell the difference between a data and charge cable! Try using the
      cable with other devices or swapping to another cable to confirm it is not
      the problem.

    • Be sure you are supplying adequate power to the board. Check the specs of
      your board and plug in an external power supply. In many cases just
      plugging a board into your computer is not enough to power it and other
      peripherals.

    • Double check all soldering joints and connections. Flakey connections
      cause many mysterious problems. See the guide to excellent soldering for examples of good solder joints.

    • Ensure you are using an official Arduino or Adafruit board. We can't
      guarantee a clone board will have the same functionality and work as expected
      with this code and don't support them.

If you're sure this issue is a defect in the code and checked the steps above
please fill in the following fields to provide enough troubleshooting information.
You may delete the guideline and text above to just leave the following details:

  • Arduino board: Arduino Uno, ESP8266, ESP32 and Particle Photon

  • Arduino IDE version (found in Arduino -> About Arduino menu): 1.85

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too): Repo graphicstest.ino

Reported on the Adafruit forum:
https://forums.adafruit.com/viewtopic.php?f=19&t=134421

https://forums.adafruit.com/download/file.php?mode=view&id=57159

As reported on the forum, well at least I and another user are having issues to use the library with the new screen. Since this is an official Adafruit product I expected some kind of support at least.

What the are issues:
1. No support for the resolution A workaround found is to change the resolution values on the library or declare them.
2. Incorrect rotation Only Rotation "2" and "3" seems to work.
3. No Color table Experience at least by me the colors are off, especially the green. I tried all the options. At least on my screen the that does not look like the primary green.
4. Inverted colors The colors are inverted by default.

Cannot change speed when using hardware SPI

  • Arduino board: Arduino Mega (2560)

  • Arduino IDE version (found in Arduino -> About Arduino menu): 1.8.1

Changing setClockDivider on line 334 in function 'commonInit' of 'Adafruit_ST7735.cpp' has no effect on SPI clock speed. I verified this with an oscilloscope. I have used the correct constructor to enable hwSPI.

Does not compile anymore

Does not compile on debian, following errors given:
/usr/share/arduino/libraries/LCD18/Adafruit_ST7735.cpp:100:8: error: variable ‘Bcmd’ must be const in order to be put into read-only section by means of ‘attribute((progmem))’
/usr/share/arduino/libraries/LCD18/Adafruit_ST7735.cpp:159:9: error: variable ‘Rcmd1’ must be const in order to be put into read-only section by means of ‘attribute((progmem))’
/usr/share/arduino/libraries/LCD18/Adafruit_ST7735.cpp:196:14: error: variable ‘Rcmd2green’ must be const in order to be put into read-only section by means of ‘attribute((progmem))’
/usr/share/arduino/libraries/LCD18/Adafruit_ST7735.cpp:204:12: error: variable ‘Rcmd2red’ must be const in order to be put into read-only section by means of ‘attribute((progmem))’
/usr/share/arduino/libraries/LCD18/Adafruit_ST7735.cpp:213:9: error: variable ‘Rcmd3’ must be const in order to be put into read-only section by means of ‘attribute((progmem))’

Arduino 1.0.1
gcc-avr Version: 1:4.7.0-2
avr-libc Version: 1:1.8.0-2

If I declare these variables const there are a lot more errors.

Support YELLOWTAB displays

For some reason two displays I received with yellow tabs print in mirror mode. After playing with all of the various rotations I found the combination that works. Here are my suggestions. You'll see they don't match any of the existing configurations.

Adafruit_ST7735.h
#define INITR_YELLOWTAB 0x8 //for the goofy backwards displays

Adafruit_ST7735.cpp
Line 199: if ((options == INITR_BLACKTAB) || (options == INITR_MINI160x80) || (options == INITR_YELLOWTAB)) {

Line 219 (Case 0):
} else if(tabcolor == INITR_YELLOWTAB) {
writedata(ST77XX_MADCTL_MX | ST77XX_MADCTL_RGB);

Line 239 (Case 1):
} else if(tabcolor == INITR_YELLOWTAB) {
writedata(ST77XX_MADCTL_MX | ST77XX_MADCTL_MV | ST77XX_MADCTL_MY | ST77XX_MADCTL_RGB);

Line 259 (Case 2):
} else if(tabcolor == INITR_YELLOWTAB) {
writedata(ST77XX_MADCTL_MY | ST77XX_MADCTL_RGB);

Line 279 (Case 3):
} else if(tabcolor == INITR_YELLOWTAB) {
writedata(ST77XX_MADCTL_MV | ST77XX_MADCTL_RGB);

drawBMP issue with ST7735 library later than 1.1.0

  • Arduino board: Arduino Uno

  • Arduino IDE version (found in Arduino -> About Arduino menu): 1.8.7

Using the spitbmp example with the most recent ST7753 library no longer works correctly. Only the top 20 or so pixels of the bmp go on the screen. Additionally, if you use rotation, no BMP at all is displayed. It's like the working canvas of the screen is only the top, even though HEIGHT and WIDTH show 160x128 respectfully.

Reverting back to 1.1.0 allowed the spitbmp to work and my code works again.

Hardware is Arduino Uno + Adafruit 1.8 TFT 160x128 breakout with Micro SD

Hey, i have an arduino 101 and iam trying to run it with the adafruit st7735 tft and iam getting some errors while compiling

Thank you for opening an issue on an Adafruit Arduino library repository. To
improve the speed of resolution please review the following guidelines and
common troubleshooting steps below before creating the issue:

  • Do not use GitHub issues for troubleshooting projects and issues. Instead use
    the forums at http://forums.adafruit.com to ask questions and troubleshoot why
    something isn't working as expected. In many cases the problem is a common issue
    that you will more quickly receive help from the forum community. GitHub issues
    are meant for known defects in the code. If you don't know if there is a defect
    in the code then start with troubleshooting on the forum first.

  • If following a tutorial or guide be sure you didn't miss a step. Carefully
    check all of the steps and commands to run have been followed. Consult the
    forum if you're unsure or have questions about steps in a guide/tutorial.

  • For Arduino projects check these very common issues to ensure they don't apply:

    • For uploading sketches or communicating with the board make sure you're using
      a USB data cable and not a USB charge-only cable. It is sometimes
      very hard to tell the difference between a data and charge cable! Try using the
      cable with other devices or swapping to another cable to confirm it is not
      the problem.

    • Be sure you are supplying adequate power to the board. Check the specs of
      your board and plug in an external power supply. In many cases just
      plugging a board into your computer is not enough to power it and other
      peripherals.

    • Double check all soldering joints and connections. Flakey connections
      cause many mysterious problems. See the guide to excellent soldering for examples of good solder joints.

    • Ensure you are using an official Arduino or Adafruit board. We can't
      guarantee a clone board will have the same functionality and work as expected
      with this code and don't support them.

If you're sure this issue is a defect in the code and checked the steps above
please fill in the following fields to provide enough troubleshooting information.
You may delete the guideline and text above to just leave the following details:

  • Arduino board: INSERT ARDUINO BOARD NAME/TYPE HERE

  • Arduino IDE version (found in Arduino -> About Arduino menu): INSERT ARDUINO
    VERSION HERE

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too): LIST REPRO STEPS BELOW

Version 105 of the Adafruit-ST7735 library breaks the uncanny eyes script

Version 105 of the Adafruit-ST7735 breaks the uncannyEyes sketch. I was posting about the TFT version of uncanny eyes in:
https://forums.adafruit.com/viewtopic.php?f=8&t=81387

I noticed that there had been new updates recently to the Adafruit-ST7735. I thought I had grabbed the current version (122) but my version was older (104). I built the sketch as I mentioned in the forums, and it worked.

Because my version of the uncanny eyes sketch has been heavily hacked, I decided to download everything fresh, and try compiling it with minimal changes (just changing the pins to the pins I'm using, and switching back to the TFT display). When I did this, and compiled it for Teensy 3.2 using the Teensyduino 1.42 overlay (using the Adafruit version of ST7735, not the PJRC version), I get:

/rock/shared/arduino/teensy-1.42-1.8.5/hardware/teensy/avr/libraries/Adafruit_ST7735/Adafruit_ST7735.cpp: In member function 'virtual void Adafruit_ST7735::setRotation(uint8_t)':
/rock/shared/arduino/teensy-1.42-1.8.5/hardware/teensy/avr/libraries/Adafruit_ST7735/Adafruit_ST7735.cpp:236:6: error: '_xstart' was not declared in this scope
_xstart = _colstart;
^
/rock/shared/arduino/teensy-1.42-1.8.5/hardware/teensy/avr/libraries/Adafruit_ST7735/Adafruit_ST7735.cpp:237:6: error: '_ystart' was not declared in this scope
_ystart = _rowstart;
^
Error compiling for board Teensy 3.2 / 3.1.

So I used subversion to get older versions of the library. I discovered that the 104 version of the library built the sketch, but the 105 version does not build it.

would you add a method that allows for up to 4 writes at a time together?

it is unrolled a bit so some unconventional steps are used to make it more manageable, such as '#define' used to create complex commands.
this code takes a large rectangle area, and subdivides it into 4 areas that can have different color values. while(!(SPSR & (1<<SPIF) )) is used as a safety check but should normally run thru without loop back or jmp performance tax, unless spi is at a lower speed. within this function spi is burst at about 80-100% increase speed from normal at max spi data rate, and overhead of pixel location and window size is reduced by 4x!

void Adafruit_ST77xx::fillRectFast4colors(int16_t x, int16_t y, int16_t w, int16_t h,
uint16_t color0,uint16_t color1,uint16_t color2,uint16_t color3) {
//this is needed for text but not fills with solid color!
// rudimentary clipping (drawChar w/big text requires this)
// if((x >= _width) || (y >= _height)) return;
// if((x + w - 1) >= _width) w = _width - x;
// if((y + h - 1) >= _height) h = _height - y;

setAddrWindow(x, y, x+w-1, y+h-1);

SPI_BEGIN_TRANSACTION();
//created complex commands in #define so code can be a lot cleaner
//this is a complex command that complexspi= hi[0] value
#define complexspi SPCRbackup = SPCR; SPCR = mySPCR; SPDR
//this is small delay
#define shortSpiDelay asm("nop\n\t");// asm("nop\n\t");// asm("nop\n\t");
//last comment out ';' not needed here, but can be added in commands later
#define longSpiDelay asm("nop\n\t"); asm("nop\n\t");asm("nop\n\t"); asm("nop\n\t"); asm("nop\n\t"); asm("nop\n\t"); asm("nop\n\t"); asm("nop\n\t"); asm("nop\n\t"); asm("nop\n\t"); asm("nop\n\t");// asm("nop\n\t");// asm("nop\n\t");// asm("nop\n\t");// asm("nop\n\t")

digitalWriteFast(TFT_DC,HIGH);// old DC_HIGH();
digitalWriteFast(TFT_CS,LOW);// old CS_LOW();

// y=h;
uint16_t countx;//we use these to understand what to draw!
uint16_t county;

SPCR = SPCRbackup; //we place at top for next loop iteration
county=h/2;

while (county !=0 ){countx=w/2;while (countx !=0) {while(!(SPSR & (1<<SPIF) ));;complexspi = highByte(color0);longSpiDelay;while(!(SPSR & (1<<SPIF) ));
complexspi =lowByte(color0) ;shortSpiDelay;countx--;}
while(!(SPSR & (1<<SPIF) ));

countx=w/2; while (countx !=0) {while(!(SPSR & (1<<SPIF) ));;complexspi =highByte(color1);longSpiDelay;while(!(SPSR & (1<<SPIF) ));
complexspi=lowByte(color1);shortSpiDelay;countx--;}
while(!(SPSR & (1<<SPIF) ));

county--; }//end of first half of rectange [0][1] drawn!
county=h/2;
while (county !=0){countx=w/2;while (countx !=0) {while(!(SPSR & (1<<SPIF) ));;complexspi = highByte(color2);longSpiDelay;while(!(SPSR & (1<<SPIF) ));
complexspi =lowByte(color2);shortSpiDelay;countx--;}
while(!(SPSR & (1<<SPIF) ));

countx=w/2;while (countx !=0) {while(!(SPSR & (1<<SPIF) ));;complexspi = highByte(color3);longSpiDelay;while(!(SPSR & (1<<SPIF) ));
complexspi =lowByte(color3);shortSpiDelay; countx--;}
county--; }//end of first half of rectange [2][3] drawn!
while(!(SPSR & (1<<SPIF) ));
digitalWriteFast(TFT_DC,HIGH);// old DC_HIGH();
digitalWriteFast(TFT_CS,HIGH);//old CS_HIGH();
SPI_END_TRANSACTION();
}

Identifying three versions of ST7735 panels

I wrote the st7735fb Linux driver hosted at https://github.com/ohporter/linux-koen/commits/linux-ti33x-psp-3.2-r6c+gitr09e9651bcf2ee8d86685f2a8075bc6557b1d3b91-st7735fb back in the November timeframe from the tutorial code at the time. Recently somebody using the driver had problems that caused me to come back and see that we have two other breakout board versions now.

My issue is, how can we visually identify which one we have? I see the code mentioning ST7735R (green or red tab) and ST7735B. I'd like people to be able to select one of them visibly if the green or red tab refers to something.

From a photo sent to me, I see no identifying difference that would help people to choose which of the 3 variants. Any thoughts? I know from the code here that I have the "green tab" version so it would help to know what that means. R versus B is pretty clear at least, though I'm wishing that the PCB carried an identifying sticker so people know what they have. Any help is appreciated.

ESP32 ST7735 change SPI pins not working

  • Arduino board: ESP32

  • Arduino IDE version (found in Arduino -> About Arduino menu): 1.9.0 beta

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too): LIST REPRO STEPS BELOW

I'm using this Library on an ESP32 with a lcd ST7735. it works well with default SPI pins
(SPI_SCK->18, SPI_MOSI->23, SPI_MISO->19 and other pins : TFT_CS->15 ;TFT_RST->4; TFT_DC->27)

but when I try to change the SPI pins, it doesn't work anymore
(SPI_SCK->36, SPI_MOSI->34, SPI_MISO->19 and other pins : TFT_CS->26 ;TFT_RST->32; TFT_DC->33)

I tryed to use this :
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, SPI_MOSI, SPI_SCK, TFT_RST);
but still not work.

is there an other way to change pin ?
maybe by forcing software SPI ?

thanks

Rotation breaks MADCTL color filter workaround for INITR_BLACKTAB and INITR_MINI160x80

  • Arduino board: Pro Mini

  • Arduino IDE version (found in Arduino -> About Arduino menu): 1.8.7

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too): LIST REPRO STEPS BELOW

/***************************************************
  This is a library for the Adafruit 1.8" SPI display.

This library works with the Adafruit 1.8" TFT Breakout w/SD card
  ----> http://www.adafruit.com/products/358
The 1.8" TFT shield
  ----> https://www.adafruit.com/product/802
The 1.44" TFT breakout
  ----> https://www.adafruit.com/product/2088
as well as Adafruit raw 1.8" TFT display
  ----> http://www.adafruit.com/products/618

  Check out the links above for our tutorials and wiring diagrams
  These displays use SPI to communicate, 4 or 5 pins are required to
  interface (RST is optional)
  Adafruit invests time and resources providing this open source code,
  please support Adafruit and open-source hardware by purchasing
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.
  MIT license, all text above must be included in any redistribution
 ****************************************************/

#include <Adafruit_GFX.h>    // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library for ST7735
//#include <Adafruit_ST7789.h> // Hardware-specific library for ST7789
#include <SPI.h>


// For the breakout, you can use any 2 or 3 pins
// These pins will also work for the 1.8" TFT shield
#define TFT_RST  7
#define TFT_CS   9
#define TFT_DC   8

// Option 1 (recommended): must use the hardware SPI pins
// (for UNO thats sclk = 13 and sid = 11) and pin 10 must be
// an output. This is much faster - also required if you want
// to use the microSD card (see the image drawing example)

// For 1.44" and 1.8" TFT with ST7735 use
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS,  TFT_DC, TFT_RST);

// For 1.54" TFT with ST7789
//Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS,  TFT_DC, TFT_RST);

// Option 2: use any pins but a little slower!
//#define TFT_SCLK 13   // set these to be whatever pins you like!
//#define TFT_MOSI 11   // set these to be whatever pins you like!
//Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST);


float p = 3.1415926;

void setup(void) {
  Serial.begin(9600);
  Serial.print("Hello! ST77xx TFT Test");

  // Use this initializer (uncomment) if you're using a 0.96" 180x60 TFT
  tft.initR(INITR_MINI160x80);   // initialize a ST7735S chip, mini display

  Serial.println("Initialized");
  tft.setRotation(3);
  uint16_t time = millis();
  tft.fillScreen(ST77XX_BLACK);
  
  tft.setCursor(0,0);
  tft.setTextColor(ST77XX_RED);
  tft.setTextSize(1);
  tft.println("This text is red");

  tft.setTextColor(ST77XX_GREEN);
  tft.setTextSize(1);
  tft.println("This text is green");

  tft.setTextColor(ST77XX_BLUE);
  tft.setTextSize(1);
  tft.println("This text is blue");
}

void loop() {

}

Following this simple test sketch with a generic ST7735 (160x80) using the setRotation command breaks the workaround for the color filter found in Adafruit_ST7735.cpp

Code snipped from void Adafruit_ST7735::initR(uint8_t options) {:

  // if black, change MADCTL color filter
  if ((options == INITR_BLACKTAB) || (options == INITR_MINI160x80)) {
    startWrite();
    writeCommand(ST77XX_MADCTL);
    spiWrite(0xC0);
    endWrite();
  }

See the setRotation function in the same file sets the RGB-Bit to one as opposed in the initialisation snipped above.

void Adafruit_ST7735::setRotation(uint8_t m) {
  uint8_t madctl = 0;

  rotation = m % 4; // can't be higher than 3

  switch (rotation) {
   case 0:
     if ((tabcolor == INITR_BLACKTAB) || (tabcolor == INITR_MINI160x80)) {
       madctl = ST77XX_MADCTL_MX | ST77XX_MADCTL_MY | ST77XX_MADCTL_RGB;
     } else {
       madctl = ST77XX_MADCTL_MX | ST77XX_MADCTL_MY | ST7735_MADCTL_BGR;
     }

I have no idea if RGB and BGR are just mixed up.

Correcting the code to:

   case 3:
     if ((tabcolor == INITR_BLACKTAB) || (tabcolor == INITR_MINI160x80)) {
       madctl = ST77XX_MADCTL_MX | ST77XX_MADCTL_MV | ST7735_MADCTL_BGR;
     } else {
       madctl = ST77XX_MADCTL_MX | ST77XX_MADCTL_MV | ST7735_MADCTL_BGR;
     }

solves the issues for me.

In the example, the BMP does not display

  • Arduino board: Metro M0 Express

  • Other devices: 1.8" TFT shield version 2

  • Arduino IDE version: 1.8.5

  • Library versions:
    Adafruit ST7735 and ST7789 Library version=1.2.2
    Adafruit GFX Library version=1.2.9
    SD version=1.2.2
    Adafruit seesaw Library version=1.1.3

Issue:
Using the shieldtest.ino example for the 1.8" TFT shield version 2, the BMP file does not appear.

Initializing SD card...
Loading image 'parrot.bmp'
File size: 61496
Image Offset: 54
Header size: 40
Bit Depth: 24
Image size: 128x160
Loaded in 1074 ms

However, the last pixel drawn* before the final SELECT goes through all the colors of the bitmap. It looks like the position of the bitmap pixel to be drawn is not set correctly by the drawing routine.

*= Pressing a button prints a string, the last character of this string, the last pixel of that character.

Thanks everyone!
Martin

Significant increase in memory usage from previous versions

This bears particular interest to myself due to the fact that I'm using a ST7735R screen with my Digibadge Mini, and with that project I'm pushing the ATMega328p to its absolute maximums.

The older version of the library that I have been using is the version 1.0.8 - After this, the Arduino library manager didn't see that the "ST7735 and ST7789" library was formerly known as the "ST7735" library. A user notified me that they were unable to get the program to compile.

I took a look and updated all of my libraries, and after updating this library to 1.2.1, I found that it was using an additional 1074 bytes over what it had been using in 1.0.8.

A basic progam, written below, uses 8792 bytes of memory using version 1.2.1 and 1.2.0. It uses 7805 in 1.1.0 and 7764 in 1.0.8

#include <Adafruit_ST7735.h>


Adafruit_ST7735 tft = Adafruit_ST7735(10, 9, -1);

void setup() {
  // put your setup code here, to run once:
  tft.initR(INITR_BLACKTAB);
  tft.fillScreen(ST7735_BLACK);

}

void loop() {
  // put your main code here, to run repeatedly:
  delay(100);
}```

With a memory usage increase of about 13% between 1.1 and 1.2, I'm wondering if it would be possible to have some define set to choose between speed and memory compactness.

Using a background color for text

Has it been considered to add a background color, so when printing text (drawChar) it prints the background as well, to overwrite old text properly. Would improve the text update functionality quite a bit (for e.g. updates on my 3D printer display)

My crude change for black background only looks like this:

void Adafruit_ST7735::drawChar(uint8_t x, uint8_t y, char c,
uint16_t color, uint8_t size) {
for (uint8_t i =0; i<5; i++ ) {
uint8_t line = pgm_read_byte(font+(c_5)+i);
for (uint8_t j = 0; j<8; j++) {
if (line & 0x1) {
if (size == 1) // default size
drawPixel(x+i, y+j, color);
else { // big size
fillRect(x+i_size, y+j*size, size, size, color);
}

  •  } else {
    
  •    if (size == 1) // default size
    
  •      drawPixel(x+i, y+j, ST7735_BLACK);
    
  •    else {  // big size
    
  •      fillRect(x+i_size, y+j_size, size, size, ST7735_BLACK);
    
  •    } 
    
    }
    line >>= 1;
    }
    }
    }

1.3 ST7789 doesnt work after 1.2.5 release.

Hello, wanted to report an issue with st7789 library. i tried to run it for the first time with my feather m0 and i had a blank screen i thought my display is the issue but downgrading the st7735/89 library to version to 1.2.5 made it work like a charm any other version after that like 1.2.6.. etc gives a blank screen.

1.44 SPI 128x128 Green Tab

I have a Chinese board labelled 1.44' SPI 128*128 V1.1 with a green tab on the protective film.
When using this library, the text and rectangles are drawn off-screen.

To make it work, I modified void Adafruit_ST7735::initR() and changed the colstart from 2 to 0 and rowstart from 3 to 32:

else if(options == INITR_144GREENTAB) {
  _height = ST7735_TFTHEIGHT_144;
  commandList(Rcmd2green144);
  colstart = 0;
  rowstart = 32;
}

Does anyone else have a green tab and can confirm this on their board?

multiple displays

Hi ; I would like to have many st7735 tft screens in my project and was wondering how I could do it (with spi)...

I figure the clk, miso and mosi could be on the same pin, cs would not... don't know for the others

Has multiple instanciation of the tft object been tried?

thanks

Some screens have non-standard col/row start values

I received a 1.8" 128x160 LCD from China (ST7735) and tried using the library, but it missed a couple of pixels around the edges (2 rows and 1 column on the top and right sides respectively).

I tried using every possible value in initR, but it either left the same edges or the colors were off.

To solve this issue I made "setColRowStart" public and set the values to 2 and 1.

I'm curious why this function isn't public to begin with. It could solve problems like this very easily.

Mirror TFT screen on Y axis direction

Hi!
I've just bought a TFT 1.8 screen and I'm trying out ST7735 library and Adafruit GFX and all works very well. The problem is that I need to mirror the screen on Y axis.
I found this addresses searching on internet:

ST7735_cmd(0x36); // Memory data access control:
// MY MX MV ML RGB MH - -
// ST7735_data(0x00); // Normal: Top to Bottom; Left to Right; RGB
// ST7735_data(0x80); // Y-Mirror: Bottom to top; Left to Right; RGB
// ST7735_data(0x40); // X-Mirror: Top to Bottom; Right to Left; RGB
// ST7735_data(0xc0); // X-Mirror,Y-Mirror: Bottom to top; Right to left; RGB
// ST7735_data(0x20); // X-Y Exchange: X and Y changed positions
// ST7735_data(0xA0); // X-Y Exchange,Y-Mirror
// ST7735_data(0x60); // X-Y Exchange,X-Mirror
// ST7735_data(0xE0); // X-Y Exchange,X-Mirror,Y-Mirror

What should I modify on the library in order to mirror my screen?

Thank you!!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.