DOCUMENTATION DRIVERS SSD1351 display
Overview
Getting Started
BASE
Reference
Worker
Setup modules
COMMODETTO
Reference
Poco Renderer
Outlines
Creating Fonts
Crypt
Data
DEVICES
Moddable One
Moddable Two
Moddable Three
Moddable Four
Moddable Six
ESP32
ESP8266
nRF52
nRF52 Low Power Notes
Raspberry Pi Pico
M5Core Ink
M5Paper
Wasm
Zephyr
SiLabs Gecko
QCA4020
Moddable Zero
Moddable Display Developer Guide
DISPLAYS
Overview
Adafruit 1.8" ST7735
Adafruit OLED Display
BuyDisplay 2.8" CTP - ESP8266
Crystalfontz ePaper
DotStar
Generic 1.44"
Generic 2.4" & 2.8" (Resistive Touch) - ESP32
Generic 2.4" & 2.8" (Resistive Touch) - ESP8266
Generic 2.4" & 2.8" (Resistive Touch) - Pico
Sharp Memory
Sharp Memory Screen 1.3"
SparkFun TeensyView
Switch Science Reflective LCD
DRIVERS
DESTM32S display
DotStar display
ILI9341 display
LPM013M126A display
LS013B4DN04 display
MCP230XX GPIO expander
NeoStrand
SSD1306 display
SSD1351 display
ST7735 display
Files
IO
TC53 IO
Firmata
NETWORK
Reference
TLS (SecureSocket)
BLE
Ethernet
Web Things
PINS
Reference
Audio Output
PIU
Reference
Localization
Keyboard
Expanding Keyboard
Die Cut
Using After Effects Motion Data
TOOLS
Reference
Manifest
Defines in Manifests
Testing
XS
Handle
JavaScript language considerations on embedded devices using the XS engine
Mods – User Installed Extensions
ROM Colors
Using XS Preload to Optimize Applications
XS Conformance
XS Marshalling
XS Platforms
XS in C
XS linker warnings
xsbug
xst
XS Compartment
XS FFI
XS Profiler
XS Scopes

SSD1351 display driver

Copyright 2017 Moddable Tech, Inc.
Revised: September 10, 2024

The SSD1351 OLED display controller drives 16-bits per pixel (RGB565LE) displays. Displays are up to 128 pixels wide and 128 pixels high.

Adding SSD1351 to a project

To add the SSD1351 driver to a project, include its manifest:

"include": [
	/* other includes here */
	"$(MODULES)/drivers/ssd1351/manifest.json"
],

If using Commodetto or Piu, set the screen property of the config object in the manifest to ssd1351 to make SSD1351 the default display driver. Since there is no touch input, set the touch driver name to an empty string to disable it.

"config": {
	"screen": "ssd1351",
	"touch": ""
},

Pixel format

The SSD1351 driver requires 16-bit color pixels as input. When building with mcconfig, set the pixel format to rgb565le on the command line:

mcconfig -m -p esp -f rgb565le

Defines

In the defines object, declare the pixel width and height.

"defines": {
	"ssd1351": {
		"width": 128,
		"height": 128,
	}
}

The optional offset_column and offset_row properties offset the x and y position of the image within the display, which is useful for some configurations.

"defines": {
	"ssd1351": {
		/* other properties here */
		"offset_column": 4,
		"offset_row": 0
	}
}

The optional initialization property is used to override the default initialization of registers on the SSD1351.

"defines": {
	"ssd1351": {
		/* other properties here */
		"initialization": [
			"0xFD, 1, 0x12,"
			"0xFD, 1, 0xB1,"
			"0xAE, 0,"
			"0xB3, 1, 0xF1,"
			"0xCA, 1, 0x7F,"
			"0xA0, 1, 0x74,"
			"0x15, 2, 0x00, 0x7F,"
			"0x75, 2, 0x00, 0x7F,"
			"0xA1, 1, 0,"
			"0xA2, 1, 0x00,"
			"0xB5, 1, 0x00,"
			"0xAB, 1, 0x01,"
			"0xB1, 1, 0x32,"
			"0xBE, 1, 0x05,"
			"0xA6, 0,"
			"0xC1, 3, 0xC8, 0x80, 0xC8,"
			"0xC7, 1, 0x0F,"
			"0xB4, 3, 0xA0, 0xB5, 0x55,"
			"0xB6, 1, 0x01,"
			"0xAF, 0,"
			"0x00"
		]
	}
}

Configuring SPI

The defines object must contain the spi_port, along with the DC and CS pin numbers. If a RST pin is provided, the device will be reset when the constructor is invoked. If the cs_port, dc_port, or rst_port properties are not provided, they default to NULL.

"defines": {
	"ssd1351": {
		/* other properties here */
		"cs_pin": 4,
		"dc_pin": 2,
		"rst_pin": 0,
		"spi_port": "#HSPI"
	}
}

The hz property, when present, specifies the SPI bus speed. The default value is 10,000,000 Hz which is near the maximum SPI speed supported by the SSD1351.