Please, can you give me the syntax of DisplayST7735_128x160x16_SPI ? It's not in the documentation and also not in the sourcecode, since this function inherits from other classes. So there is no simple list of variables.
This is the class-definition from lcd_st7735.h:
class DisplayST7735_128x160x16_SPI: public DisplayST7735_128x160x16<InterfaceST7735<PlatformSpi>>
{
public:
/**
* @brief Inits 128x160x16 lcd display over spi (based on ST7735 controller): 16-bit mode.
*
* Inits 128x160x16 lcd display over spi (based on ST7735 controller): 16-bit mode
* @param rstPin pin controlling LCD reset (-1 if not used)
* @param config platform spi configuration. Please refer to SPlatformSpiConfig.
*/
DisplayST7735_128x160x16_SPI( int8_t rstPin, const SPlatformSpiConfig &config = { -1, { -1 }, -1, 0, -1, -1 } )
: DisplayST7735_128x160x16(m_spi, rstPin)
, m_spi( *this, config.dc,
SPlatformSpiConfig{ config.busId,
{ config.cs },
config.dc,
config.frequency ?: 8000000,
config.scl,
config.sda } ) {}
However, in interface.h, I found this struct, which is used by the class, mentioned before:
typedef struct
{
/**
* bus id number. this parameter is valid for Linux, ESP32.
* If -1 is pointed, it defaults to platform specific i2c bus (Linux spidev1.X, esp32 VSPI_HOST).
*/
int8_t busId;
/**
* parameter is optional for all platforms, except Linux.
* If chip select pin is not used, it should be set to -1
* For Linux platform devId should be pointed, if -1, it defaults to spidevX.0
*/
union
{
int8_t cs;
int8_t devId;
};
/**
* Data command control pin number. This pin assignment is mandatory
*/
int8_t dc;
/**
* Frequency in HZ to run spi bus at. If 0, it defaults to max frequency, supported
* by platform
*/
uint32_t frequency;
/**
* Optional - spi clock pin number. -1 if to use default spi clock pin.
* This is required for ESP32 platform only.
*/
int8_t scl; // clk
/**
* Optional - spi data MOSI pin number. -1 if to use default spi MOSI pin.
* This is required for ESP32 platform only.
*/
int8_t sda; // mosi
} SPlatformSpiConfig;
So..was this syntax correct for the class DisplayST7735_128x160x16 ?:
DisplayST7735_128x160x16 (busId, TFT_CS-Pin, TFT_DC-Pin, frequency, clock, mosi)
busId was always -1 for default
frequency was always 0 for max speed
clock was always -1 for default pin
and mosi alwas -1 for default pin?
Well, than my line of code seems to be correct:
DisplayST7735_128x160x16_SPI display(TFT_RST,{-1, TFT_CS,TFT_DC,0,-1,-1});
...still not sure with the reset-pin, though...and why there are two curly braces...
I feel like a detective now, could you please...answer? I really believe your library is the answer to all my arduino-problems. It's propably the best graphics-library out there...if it was documented properly! Fast like hell with small memory-usage. That's perfect! Adafruit's graphics-library is causing flickering, ucg-lib needs over 80% of program-memory. Your library is the only alternative!
Update:
Still playing around with the line for the display-object. My display doesn't even turn-on. So there must be a problem with the initialization already.
Update 2:
OK, got it working now. It was my fault: I powered my display's backlight with a pwm-pin and forgot to set that up correctly. I can confirm the demo-script is running properly.