lcdwiki / LCDWIKI_SPI

driver for SPI-Bus TFT Displays
MIT License
19 stars 17 forks source link

LCDWIKI_SPI does not compile on an esp32 #2

Open Greenstreem opened 5 years ago

Greenstreem commented 5 years ago

Compiling the display_string example on an esp32 produces the following output:

Compiling .pio\build\esp32dev\FrameworkArduino\stdlib_noniso.c.o

C:\Users\green.platformio\lib\LCDWIKI_SPI\LCDWIKI_SPI.cpp: In constructor 'LCDWIKI_SPI::LCDWIKI_SPI(uint16_t, int8_t, int8_t, int8_t, int8_t, int8_t, int8_t, int8_t)':

C:\Users\green.platformio\lib\LCDWIKI_SPI\LCDWIKI_SPI.cpp:74:12: error: cannot convert 'volatile uint32_t {aka volatile unsigned int}' to 'volatile uint8_t {aka volatile unsigned char}' in assignment

spicsPort = portOutputRegister(digitalPinToPort(_cs));

prenticedavid commented 5 years ago

You can try my Forks e.g. https://github.com/prenticedavid/LCDWIKI_SPI and associated https://github.com/prenticedavid/LCDWIKI_GUI

I offered a Pull Request several months ago with no response. I would be especially interested in how the SSD1283A target works because I do not have this display.

In principle, the LCDWIKI_xxx code could work on ESP8266. However the library operation is very SLOW. So you have to insert lots of yield() calls to prevent the ESP8266 crashing.

David.

Edit. A member on Arduino Forum has SSD1283A board and reports success with a Uno https://forum.arduino.cc/index.php?topic=635926.0

Greenstreem commented 5 years ago

Thanks @prenticedavid. Your library works great with an ESP32 and the SSD1283A. I am using this display: https://www.amazon.com/gp/product/B07GSL66HS/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1

Do you know if we can change the font with this library?

prenticedavid commented 5 years ago

It does not look as if you can change the font in these libraries.

If you are prepared to do the testing, I could put a SSD1283A driver on my ST7789_kbv library. Since ST7789_kbv is an Adafruit_GFX style library, you get all the GFX features automatically. e.g. FreeFonts.

Likewise, Bodmer might add a SSD1283A driver to his TFT_eSPI library. He has even more graphics methods.

However I suspect that both Bodmer and I would be reluctant. The SSD1283A hardware is not a MIPI-tyle controller. And there seems little point in complex fonts on a tiny 130x130 display screen.

If you are interested, please make an Issue in prenticedavid/ST7789_kbv instead of lcdwiki's site.

David.

prenticedavid commented 5 years ago

I have added a "test_9225" Branch to prenticedavid/ST7789_kbv library to support SSD1283A and ILI9225

If you are interested, please raise an Issue In prenticedavid/ST7789_kbv

David.

eagl1 commented 2 years ago

Hi,

I have both ESP32 devkit and the ST7796S.

When I first compiled the LCDWIKI I got errors, so I had to add some mods here and there until I got it to work.

Like:

I added ESP32 definition in LCDWIKI_SPI.cpp:

#if defined(ARDUINO_ARCH_ESP8266) || defined(ESP32)
#define USE_HWSPI_ONLY
#endif

Also here in LCDWIKI_SPI.h

#ifdef __AVR__
#include <avr/pgmspace.h>
#elif defined(ESP8266) || defined(ESP32)
  #include <pgmspace.h>
#else
#define pgm_read_byte(addr) (*(const unsigned char *)(addr))
#define pgm_read_word(addr) (*(const unsigned short *)(addr))
#endif

LCDWIKI_GUI.h

#ifdef __AVR__
#include <avr/pgmspace.h>
#elif defined(ESP8266) || defined(ESP32)
  #include <pgmspace.h>
#else
#define pgm_read_byte(addr) (*(const unsigned char *)(addr))
#define pgm_read_word(addr) (*(const unsigned short *)(addr))
#endif
prenticedavid commented 2 years ago

What is your point?

Yes, you can edit LCDWIKI to make it compile and run on an ESP32.

But what are you going to do with a badly spelled library ? On any target ?

It is much wiser to use Bodmer's TFT_eSPI.h library for ESP32, ESP8266, STM32, RP2040. The class methods are all spelled correctly. The examples all work properly. You can port projects very easily because it uses Adafruit_GFX style graphics.

eagl1 commented 2 years ago

It is much wiser to use Bodmer's TFT_eSPI.h library for ESP32, ESP8266, STM32, RP2040.

I've downloaded and going to check this library, it's really a big library I'm already getting %157 usage of the Arduino nano flash memory with one of the examples.

But I can cut things up for all boards or displays that I don't have and probably not willing of have at least the near future.