Anyway, I don’t understand something. Here is the code from the example:
U8GLIB_SSD1306_128X64 u8g (4, 5, 6, 7, 8); // SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7, RES = 8
I had to add the RES pin to make the display work. This code works.
in the ui.cpp file, I brought the lines to the following form:
#if UI_DISPLAY_TYPE == DISPLAY_U8G
// u8glib
#if defined (U8GLIB_ST7920) || defined (U8GLIB_SSD1306_SW_SPI)
#define UI_SPI_SCK UI_DISPLAY_D4_PIN
#define UI_SPI_MOSI UI_DISPLAY_ENABLE_PIN
#define UI_SPI_CS UI_DISPLAY_RS_PIN
#define UI_SPI_DC UI_DISPLAY_D5_PIN
#endif
.........
#ifndef UI_DISPLAY_RESET_PIN
#define UI_DISPLAY_RESET_PIN UI_DISPLAY_D7_PIN
#endif
.........
#ifdef U8GLIB_SSD1306_SW_SPI
u8g_InitSPI (& u8g, & u8g_dev_ssd1306_128x64_sw_spi, UI_DISPLAY_D4_PIN, UI_DISPLAY_ENABLE_PIN, UI_DISPLAY_RS_PIN, UI_DISPLAY_D5_PIN, UI_DISPLAY_D7_PIN);
#endif
.........
In the uiconfig.h file, I uncommented:
#define U8GLIB_SSD1306_SW_SPI
The code compiles successfully, but the screen still doesn't work. What am I doing wrong?