Register / Login  |  Desktop view  |  Jump to bottom of page

tcMenu Arduinio library » How can I use SSD1306 on ESP32 (not AVR microcontrollers)?

Author: chirrindulari
28/01/2021 23:02:51
Hi members.

I'm trying to compile a simple example project (unoSsd1306Ascii) to begin using this library. The problem is that the OLED seems to be associated with AVR architecture and not for ESP32.

My environment is a virtual machine with Ubuntu 20, PlatformIO on VisualStudio and the hardware is an ESP32. The OLED is connected to the ESP32 via I2C.

Some errors I've found compiling the example...

.pio/libdeps/esp32dev/SSD1306Ascii/src/utility/AvrI2c.h: In member function 'void AvrI2c::begin(bool)':
.pio/libdeps/esp32dev/SSD1306Ascii/src/utility/AvrI2c.h:65:5: error: 'TWSR' was not declared in this scope

.pio/libdeps/esp32dev/SSD1306Ascii/src/utility/AvrI2c.h: In member function 'uint8_t AvrI2c::read(bool)':
.pio/libdeps/esp32dev/SSD1306Ascii/src/utility/AvrI2c.h:77:19: error: 'TWINT' was not declared in this scope


What should I do to handle this OLED (SSD1306) with ESP32?
Thanks for your help.

Author: davetcc
29/01/2021 08:05:46
I don’t think you can to be honest. But you should ask the library provider, as the errors are in their library. We just provide some glue code to make it work with tcMenu. On such a large processor why not u8g2 with an SPI OLED?

Author: davetcc
29/01/2021 08:13:45
 
What should I do to handle this OLED (SSD1306) with ESP32?


That is easier, use the u8g2 plugin.

Author: davetcc
29/01/2021 08:33:40
For the benefit of others too, I'll expand on this a little.

Apart from the OLED mbed support, where we provide a modified version of the AdafruitGFX library, all other display libraries are written by third parties, and we provide the glue code to allow you to use it in tcMenu without writing a line of code.

Along with the list below, you can look at the display plugins section here where there's a more complete list with associated documentation: https://www.thecoderscorner.com/products/arduino-libraries/tc-menu/

Arduino

Arduino: For OLEDs SSD1306, SH1106 and many other variants

On Uno and other ATMega328 based processors with limited memory - use SSD1306Ascii

On any other processor - use u8g2

For Colour and other monochrome TFTs

ESP32 and STM32 - For most larger color TFTs we are integrating the excellent TFT_eSPI library that provides much faster drawing than other options. Due in 1.8.

Other Arduino devices: Use AdafruitGFX in nearly all cases, almost invariably these displays will not be usable with an Uno / ATMega328. You're better with 32-bit boards for larger color displays, where the SPI speed can be boosted.

For 16x2, 20x4 and other LCD units

Use the inbuilt LiquidCrystal plugin.


Mbed

Mbed: For OLEDs SSD1306 and SH1106

Use the inbuilt AdafruitGFX fork in the designer.

For Colour and other monochrome TFTs

Due in 1.8 - for STM32 boards will be able to support the inbuilt frame buffer.

For 16x2, 20x4 and other LCD units

Use the inbuilt LiquidCrystal plugin.

Author: chirrindulari
29/01/2021 09:04:33
Thanks a lot for the explanation, Dave.




Register / Login  |  Desktop view  |  Jump to top of page