Skip to content

Commit 6b21dd1

Browse files
phoddiemkellner
authored andcommitted
lpm013m126a display driver thrash: clean-up code, add manifest and docs
1 parent a36ed61 commit 6b21dd1

File tree

6 files changed

+251
-107
lines changed

6 files changed

+251
-107
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# LPM013M126A display driver
2+
Copyright 2017 Moddable Tech, Inc.
3+
4+
Revised: December 29, 2017
5+
6+
**Warning**: These notes are preliminary. Omissions and errors are likely. If you encounter problems, please ask for assistance.
7+
8+
The [LPM013M126A](http://www.j-display.com/product/pdf/Datasheet/4LPM013M126A_specification_Ver02.pdf) JDI (Japan Display Inc. Group) memory display controller drives 3-bit per pixel displays. The controller allows one bit of color information per channel, for a total of 8 colors.
9+
10+
### Adding LPM013M126A to a project
11+
To add the LPM013M126A driver to a project, include its manifest:
12+
13+
"include": [
14+
/* other includes here */
15+
"$(MODULES)/drivers/lpm013m126a/manifest.json",
16+
],
17+
18+
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.
19+
20+
"config": {
21+
"screen": "lpm013m126a",
22+
"touch": "",
23+
},
24+
25+
### Pixel format
26+
The LPM013M126A driver requires 8-bit color pixels as input. When building with `mcconfig`, set the pixel format to `rgb332` on the command line:
27+
28+
mcconfig -m -p esp -f rgb332
29+
30+
### Defines
31+
There are no unique `defines` in the manifest apart from those described in the Dither and SPI sections below.
32+
33+
### Dither
34+
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.
35+
36+
"defines": {
37+
"lpm013m126a": {
38+
/* other properties here */
39+
"dither": true,
40+
}
41+
}
42+
43+
### Configuring SPI
44+
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.
45+
46+
"defines": {
47+
"lpm013m126a": {
48+
/* other properties here */
49+
"cs_pin": 4,
50+
"spi_port": "#HSPI",
51+
}
52+
}
53+
54+
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.
55+
56+
### Drawing
57+
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`.

documentation/drivers/ls013b4dn04/ls013b4dn04.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ If using Commodetto or Piu, set the `screen` property of the `config` object in
2222
"touch": "",
2323
},
2424

25+
### Pixel format
26+
The LS013B4DN04 driver requires 8-bit gray pixels as input. When building with `mcconfig`, set the pixel format to `gray256` on the command line:
27+
28+
mcconfig -m -p esp -f gray256
29+
2530
### Defines
2631
In the `defines` object, declare the pixel `width` and `height`.
2732

@@ -32,10 +37,6 @@ In the `defines` object, declare the pixel `width` and `height`.
3237
}
3338
}
3439

35-
The LS013B4DN04 driver requires 8-bit gray pixels as input. When building with `mcconfig`, set the pixel format to `gray256` on the command line:
36-
37-
mcconfig -m -p esp -f gray256
38-
3940
### Configuring SPI
4041
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.
4142

documentation/drivers/ssd1306/ssd1306.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ If using Commodetto or Piu, set the `screen` property of the `config` object in
2222
"touch": "",
2323
},
2424

25+
### Pixel format
26+
The SSD1306 driver requires 8-bit gray (`gray256`) pixels as input. When building with `mcconfig`, set the pixel format to `gray256` on the command line:
27+
28+
mcconfig -m -p esp -f gray256
29+
2530
### Defines
2631
In the `defines` object, declare the pixel `width` and `height`. The default connection is SPI, but it is recommended to explicitly set the connection type in the application manifest:
2732

@@ -33,10 +38,6 @@ In the `defines` object, declare the pixel `width` and `height`. The default con
3338
"i2c": false,
3439
}
3540
}
36-
37-
The SSD1306 driver requires 8-bit gray (`gray256`) pixels as input. When building with `mcconfig`, set the pixel format to `gray256` on the command line:
38-
39-
mcconfig -m -p esp -f gray256
4041

4142
### Dither
4243
The SSD1306 driver implements optional dithering. Dithering allows an approximation of gray pixels on black and white OLED displays. Enabling dithering uses about an additional 520 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.

documentation/drivers/ssd1351/ssd1351.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ If using Commodetto or Piu, set the `screen` property of the `config` object in
2222
"touch": "",
2323
},
2424

25+
### Pixel format
26+
The SSD1351 driver requires 16-bit color pixels as input. When building with `mcconfig`, set the pixel format to `rgb565le` on the command line:
27+
28+
mcconfig -m -p esp -f rgb565le
29+
2530
### Defines
2631
In the `defines` object, declare the pixel `width` and `height`.
2732

@@ -73,10 +78,6 @@ The optional `initialization` property is used to override the default initializ
7378
}
7479
}
7580

76-
The SSD1351 driver requires 16-bit color pixels as input. When building with `mcconfig`, set the pixel format to `rgb565le` on the command line:
77-
78-
mcconfig -m -p esp -f rgb565le
79-
8081
### Configuring SPI
8182
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.
8283

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"defines": {
3+
"lpm013m126a": {
4+
"width": 176,
5+
"height": 176,
6+
"dither": false
7+
}
8+
},
9+
"preload": [
10+
"lpm013m126a",
11+
"commodetto/Bitmap",
12+
],
13+
"platforms": {
14+
"esp": {
15+
"include": [
16+
"$(MODULES)/pins/digital/manifest.json",
17+
"$(MODULES)/pins/spi/manifest.json",
18+
],
19+
"modules": {
20+
"*": "$(MODULES)/drivers/lpm013m126a/*",
21+
"commodetto/Bitmap": "$(COMMODETTO)/commodettoBitmap",
22+
},
23+
"defines": {
24+
"lpm013m126a": {
25+
"cs_pin": 4,
26+
"dc_pin": 2,
27+
"spi_port": "#HSPI"
28+
}
29+
}
30+
},
31+
"esp32": {
32+
"include": [
33+
"$(MODULES)/pins/digital/manifest.json",
34+
"$(MODULES)/pins/spi/manifest.json",
35+
],
36+
"modules": {
37+
"*": "$(MODULES)/drivers/lpm013m126a/*",
38+
"commodetto/Bitmap": "$(COMMODETTO)/commodettoBitmap",
39+
},
40+
"defines": {
41+
"lpm013m126a": {
42+
"cs_pin": 4,
43+
"dc_pin": 2,
44+
"spi_port": "#HSPI"
45+
}
46+
}
47+
}
48+
}
49+
}

0 commit comments

Comments
 (0)