![]() |
SparkFun SSD168x Library
v1.0.2
Library for SSD1680 / SSD1681 e-paper displays on SPI
|
A library to support SSD1680/1 e-paper displays on SPI. We wrote it to support the GDEM0097T61 e-Paper display on the new SparkFun RockBLOCK 9604 Shield, but you can adapt the examples to run on any platform.
This library is based heavily on the SparkFun Qwiic OLED Arduino Library and includes the same fonts and graphics support.
It has been tested on the GoodDisplay GDEY0154D67 1.54" (200 x 200) and GDEM0097T61 0.97" (184 x 88) e-paper displays.
This library builds both as an Arduino Library and as an Espressif ESP-IDF Component:
idf.py add-dependency "sparkfun/sparkfun_ssd168x_library". The examples are in /idf_examples. ESP-IDF v5.3 or later is requiredThe platform is selected automatically (see src/sfe_platform.h). The SPI hardware interface is abstracted into sfe_platform.h and sfe_bus.h / sfe_bus.cpp (Arduino) / sfe_bus_esp_idf.h / sfe_bus_esp_idf.cpp (ESP-IDF), using the same approach as the SparkFun u-blox GNSS v4 Library. Debug messages are printed by the same sfe_debug class.
The SSD1680/1 uses a 4-wire SPI interface plus two GPIO pins:
| Display pin | Function | RockBLOCK 9604 Shield (ESP32-S3) |
|---|---|---|
| SCL / SCLK | SPI clock | GPIO12 |
| SDA / SDIN | SPI data in (PICO / MOSI) | GPIO11 |
| CS# | Chip select - active low | GPIO15 |
| D/C# | Data / command select | GPIO7 |
| RES# | Reset - active low. Optional: pass -1 if not connected and a software reset is used instead | GPIO6 |
| BUSY | High while the display is busy | GPIO5 |
The display does not use POCI (MISO). The SPI bus can be shared with other devices (e.g. a microSD card) - make sure their chip selects are high (deselected). On the RockBLOCK 9604 Shield, VP_EN (GPIO4) must be driven high to power the display.
The pins are passed to begin(). Arduino:
ESP-IDF:
The supported displays are:
| Class | Display |
|---|---|
SSD1680SPI184x88 | 184 x 88 SSD1680 (e.g. GoodDisplay GDEM0097T61) - portrait (88 pixels wide, 184 high) |
SSD1680SPI184x88Rotated | 184 x 88 SSD1680 (e.g. GoodDisplay GDEM0097T61) - landscape (184 pixels wide, 88 high) |
SSD1681SPI200x200 | 200 x 200 SSD1681 (e.g. GoodDisplay GDEY0154D67) |
SSD1680SPICustom | Custom size SSD1680 - call setDisplayWidth() etc. before begin() |
SSD1681SPICustom | Custom size SSD1681 - call setDisplayWidth() etc. before begin() |
Call enableDebugging() to see debug messages on Serial (Arduino) or the console (ESP-IDF).
The examples in this library were written for and have been tested on the SparkFun RockBLOCK 9604 Shield, which uses the GoodDisplay 0.97" 184x88 pixel GDEM0097T61 e-Paper display.
The examples have also been tested on GoodDisplay's ESP32-L Dev Kit, with their DESPI-C02 24-pin FPC adapter (for the 1.54" GDEY0154D67) and the extra CV0097 24-pin to 18-pin FPC adapter (for the 0.97" GDEM0097T61). Together, these three parts are called the ESP32-L(C097) evaluation kit.
Examples 01 and 05 need the 1.54" 200x200 GDEY0154D67 display. The other examples need the 0.97" 184x88 GDEM0097T61 display.
The ESP32-L Dev Kit uses a classic ESP32 (not an ESP32-S3) and the e-Paper display is connected to different pins:
| Signal | RockBLOCK 9604 Shield (ESP32-S3) | ESP32-L Dev Kit (ESP32) |
|---|---|---|
| SCLK | GPIO12 | GPIO18 |
| SDIN (PICO / MOSI) | GPIO11 | GPIO23 |
| CS# | GPIO15 | GPIO27 |
| D/C# | GPIO7 | GPIO14 |
| RES# | GPIO6 | GPIO12 |
| BUSY | GPIO5 | GPIO13 |
| POCI (MISO) | GPIO13 (microSD) | Not used |
| VP_EN (peripheral power) | GPIO4 | Not used |
| microSD CS# | GPIO10 | Not used |
| External SPI CS#1 / CS#2 | GPIO1 / GPIO2 | Not used |
The Dev Kit pins are the ones used in GoodDisplay's own ESP32 example code. Their code uses the Arduino analog pin names A14 (BUSY), A15 (RES), A16 (D/C) and A17 (CS): on the ESP32 these are GPIO13, GPIO12, GPIO14 and GPIO27.
Important: do not run the examples on the Dev Kit with the Shield pins. On the classic ESP32, GPIO6 - GPIO11 are connected to the SPI flash and GPIO1 is the UART0 (Serial) TX pin. The examples drive GPIO10, GPIO11 and GPIO1 on the Shield. On the Dev Kit, this would crash the ESP32 or stop the Serial output.
Each Arduino example has a board switch near the top of the file:
Find the "Adjust these values according to your configuration" section and uncomment the ESP32_L_DEV_KIT define:
This selects the Dev Kit pins. The Shield-only pins (VP_EN, the microSD and external SPI chip selects) are set to -1 and are not used. POCI (MISO) is -1 too: the display does not need it
The example passes the pins to the library in the normal way:
In the ESP-IDF examples, the board is selected automatically by the target. Each example has an "Example Configuration" menu with a "Board" choice (CONFIG_ROCKBLOCK_9604_SHIELD or CONFIG_ESP32_L_DEV_KIT) which sets the default pins:
idf.py set-target esp32 selects the GoodDisplay ESP32-L Dev Kit (and the settings in sdkconfig.defaults.esp32)idf.py set-target esp32s3 selects the SparkFun RockBLOCK 9604 Shield (and the settings in sdkconfig.defaults.esp32s3: 16MB flash, USB Serial/JTAG console)To run an example on the Dev Kit:
idf.py set-target deletes sdkconfig, so the pins are always set correctly when you change target. If you change the board or pins in menuconfig instead, delete sdkconfig (or run idf.py set-target again) when you change board, so that the pin defaults are updated.
The example passes the pins to the library in the normal way:
The GoodDisplay GDEY0154D67 (1.54", 200 x 200, SSD1681) and GDEM0097T61 (0.97", 184 x 88, SSD1680) e-paper displays both use SSD168x Ping-Pong Mode. If you read the OTP Display Option using command 0x2D, you will find that Bit 6 of Byte F is set, indicating ping-pong mode is enabled. We believe this is to allow the displays to better support partial updates. The RAM banks are used to identify which pixels have changed from the previous update. It causes some interesting issues...
If you 'clear' the display - (e.g.) set all the pixels white and do a full update - the white pixels are written to both BW RAM and RED RAM. GoodDisplay calls this the "BaseMap" or "background color function". If you then set a group of pixels black and do a partial update, those pixels are displayed - as you would expect. If you then set a different group of pixels black and do a second partial update, only the second group are displayed - the first group are hidden. If you then set a third group of pixels black and do a third partial update, the first and third groups are displayed - the second group is hidden. We believe this is caused by the SSD168x "ping-pong" mode - automatic switching of the RAM banks.
One solution is to re-write all pixels before each partial update. But that takes time.
This library is based on the concept of "dirty pixels". Only pixel areas which have actually changed are written to the display. This means the ping-pong mode can cause some interesting 'blinking' or 'flashing' effects.
Our solution is to record which group(s) of pixels have changed for the current partial update, and to record which group(s) were changed during the previous partial update. The "dirty pixel" areas are expanded to cover both the latest changes (m_pageState) and the previous changes (m_pagePrevious).
This product is open source!
Please review the LICENSE.md file for license information.
If you have any questions or concerns on licensing, please contact technical support on our SparkFun forums.
Distributed as-is; no warranty is given.
_<COLLABORATION CREDIT>_