The 320x240 display does not fully work with the Arduino_ST7789_Fast library

The bottom of the display should be black.
Please suggest a solution to the problem or the same fast library for my display.

Display:
https://m.aliexpress.ru/item/1005004237117445.html?sku_id=12000028482573872
(On the display is the controller st7789v.)

Library:
https://github.com/cbm80amiga/Arduino_ST7789_Fast

That library expects 240x240 as default.

#define CS_ALWAYS_LOW
...
#define ST7789_TFTWIDTH 	240
#define ST7789_TFTHEIGHT 	240
...
  void init(uint16_t width, uint16_t height);

Instead of using tft.begin() in setup() choose tft.init(240, 320);

Alternatively edit the library Arduino_ST7789_Fast.h file. e.g.

//#define CS_ALWAYS_LOW      // you have a proper CS pin.
...
#define ST7789_TFTWIDTH 	240
#define ST7789_TFTHEIGHT 	320
...

In which case you can use tft.begin() in the normal way.

Untested.

Your method helped to fix the problem but a new one appeared. The screen doesn't clear normally, just the top part, looks like it's overflowing. How to fix?

Please quote the library example by name.
Then I can replicate your problem.

Actually, I don't have a SPI 240x320 SPI screen. (I am expecting a Chinese Red SPI ST7789 display to arrive in the next day or two)

David.

The example is called ST7789_AdafruitBenchmark.
Only the top part is erased.

I suggest that you stick with 240x240 and CS_ALWAYS_LOW for the moment.
i.e. wire CS to GND.

I can only use 240x240 until my 240x320 arrives.
Pawel A. Hernik's library has some nice examples but there are one or two issues with 240x320
I would be happier with fixing them on a real 240x320 screen and offering "Pull Requests" to Pawel.

Alternatively you can use Adafruit_ST7789 library (which expects 240x320 and CS )

David.

I rewrote the library for myself. I rewrote fillRect now it calls writeMulti twice, each call to a different side of the screen and this prevents the uint16_t variable from overflowing. fillRect was used to erase the screen in the fillScreen function. When I say function I suspect a method.

Yes, that should solve the uint16_t problem in fillRect().

Does the scroll function work correctly in all directions ?

Pawel has some nice examples. Both for his TFT libraries and his Monochrome GLCD libraries.
I have only used the ILI9341 version with 240x320 displays.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.