Skip to content
Switch branches/tags
Go to file
Cannot retrieve contributors at this time

LPM013M126A display driver

Copyright 2017 Moddable Tech, Inc.

Revised: December 29, 2017

Warning: These notes are preliminary. Omissions and errors are likely. If you encounter problems, please ask for assistance.

The LPM013M126A JDI (Japan Display Inc. Group) memory display controller drives 3-bit per pixel displays. The controller allows one bit of color information for the red, green, and blue channels, for a total of 8 colors.

Adding LPM013M126A to a project

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

"include": [
	/* other includes here */

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

"config": {
	"screen": "lpm013m126a",
	"touch": "",

Pixel format

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

mcconfig -m -p esp -f rgb332


There are no unique defines in the manifest apart from those described in the Dither and SPI sections below.


The LPM013M126A driver implements optional dithering. Dithering provides an approximation of more color levels. Enabling dithering uses about an additional 380 bytes of RAM and renders slower. Whether dithering is best for a given application depends on what it draws and the required frame rate. Dithering is disabled by default. To enable dithering, set the dither property to true in the defines section of the manifest.

"defines": {
	"lpm013m126a": {
		/* other properties here */
		"dither": true,

The driver's dithering implementation operates on eight rows of pixels at a time. Therefore, Poco must be configured to render in groups of eight pixels. To do this, set the pixels property in the dictionary passed to the constructor to 8 multiplied by the display width. When using Piu, also set the pixels property and it will be propagated to Poco. In the following example, pixels is set to 8 rows for a display with width of 176 pixels.

new Application(null, {displayListLength: 4096,
	touchCount: 0, pixels: 176 * 8 });

Configuring SPI

The defines object must contain the spi_port, along with the CS pin number. If the cs_port property is not provided, it defaults to NULL.

"defines": {
	"lpm013m126a": {
		/* other properties here */	
		"cs_pin": 4,
		"spi_port": "#HSPI",

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


The LPM013M126A driver always updates full scan lines, but can update arbitrary scan lines. This allows for partial updates of full rows. Piu automatically takes care of this, so script using Piu do not need to take this into account. Scripts using Poco need to ensure when calling poco.begin() that the x parameter is zero and the width parameter is equal to poco.width.