node-red-contrib-periph-display 1.5.1 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -12
- package/examples/il0373/demo.json +18 -12
- package/examples/pcf8576/demo.json +2 -2
- package/examples/pcf8578/demo.json +2 -2
- package/examples/pcf8579/demo.json +2 -2
- package/examples/sh1106/demo.json +15 -7
- package/examples/ssd1305/demo.json +15 -7
- package/examples/ssd1306/demo.json +14 -7
- package/examples/ssd1331/demo.json +14 -8
- package/examples/st7036/demo.json +15 -9
- package/examples/uc1611s/demo.json +77 -20
- package/examples/uc8159/demo.json +16 -10
- package/examples/uc8276c/demo.json +18 -12
- package/nodes/il0373/il0373.html +58 -32
- package/nodes/il0373/il0373.js +16 -9
- package/nodes/pcf8576/pcf8576.html +3 -3
- package/nodes/pcf8576/pcf8576.js +1 -1
- package/nodes/pcf8578/pcf8578.html +3 -3
- package/nodes/pcf8578/pcf8578.js +1 -1
- package/nodes/pcf8579/pcf8579.html +3 -3
- package/nodes/pcf8579/pcf8579.js +1 -1
- package/nodes/sh1106/sh1106.html +62 -36
- package/nodes/sh1106/sh1106.js +20 -11
- package/nodes/ssd1305/ssd1305.html +62 -36
- package/nodes/ssd1305/ssd1305.js +20 -11
- package/nodes/ssd1306/ssd1306.html +62 -36
- package/nodes/ssd1306/ssd1306.js +18 -11
- package/nodes/ssd1331/ssd1331.html +49 -23
- package/nodes/ssd1331/ssd1331.js +16 -9
- package/nodes/st7036/st7036.html +51 -25
- package/nodes/st7036/st7036.js +15 -9
- package/nodes/uc1611s/uc1611s.html +64 -38
- package/nodes/uc1611s/uc1611s.js +21 -12
- package/nodes/uc8159/uc8159.html +55 -29
- package/nodes/uc8159/uc8159.js +16 -9
- package/nodes/uc8276c/uc8276c.html +58 -32
- package/nodes/uc8276c/uc8276c.js +16 -9
- package/package.json +1 -1
- package/index.js +0 -11
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
<!-- Config node: one instance per physical device -->
|
|
1
2
|
<script type="text/javascript">
|
|
2
|
-
RED.nodes.registerType('
|
|
3
|
-
category: '
|
|
4
|
-
color: '#C084FC',
|
|
3
|
+
RED.nodes.registerType('uc8276c-device', {
|
|
4
|
+
category: 'config',
|
|
5
5
|
defaults: {
|
|
6
6
|
name: { value: '' },
|
|
7
7
|
spiBus: { value: '0', required: true, validate: RED.validators.number() },
|
|
@@ -16,63 +16,89 @@
|
|
|
16
16
|
busyTimeout: { value: '30000', required: true, validate: RED.validators.number() },
|
|
17
17
|
autoShow: { value: false }
|
|
18
18
|
},
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
label: function() { return this.name || 'UC8276C'; },
|
|
23
|
-
paletteLabel: 'UC8276C'
|
|
19
|
+
label: function() {
|
|
20
|
+
return this.name || 'UC8276C';
|
|
21
|
+
}
|
|
24
22
|
});
|
|
25
23
|
</script>
|
|
26
24
|
|
|
27
|
-
<script type="text/html" data-template-name="
|
|
25
|
+
<script type="text/html" data-template-name="uc8276c-device">
|
|
28
26
|
<div class="form-row">
|
|
29
|
-
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
30
|
-
<input type="text" id="node-input-name" placeholder="UC8276C">
|
|
27
|
+
<label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
28
|
+
<input type="text" id="node-config-input-name" placeholder="UC8276C">
|
|
31
29
|
</div>
|
|
32
30
|
<div class="form-row">
|
|
33
|
-
<label for="node-input-spiBus"><i class="fa fa-microchip"></i> SPI bus</label>
|
|
34
|
-
<input type="number" id="node-input-spiBus" min="0" style="width:70px">
|
|
35
|
-
chip select <input type="number" id="node-input-spiDevice" min="0" style="width:70px">
|
|
31
|
+
<label for="node-config-input-spiBus"><i class="fa fa-microchip"></i> SPI bus</label>
|
|
32
|
+
<input type="number" id="node-config-input-spiBus" min="0" style="width:70px">
|
|
33
|
+
chip select <input type="number" id="node-config-input-spiDevice" min="0" style="width:70px">
|
|
36
34
|
</div>
|
|
37
35
|
<div class="form-row">
|
|
38
|
-
<label for="node-input-gpioChip">GPIO chip</label>
|
|
39
|
-
<input type="number" id="node-input-gpioChip" min="0" style="width:70px">
|
|
36
|
+
<label for="node-config-input-gpioChip">GPIO chip</label>
|
|
37
|
+
<input type="number" id="node-config-input-gpioChip" min="0" style="width:70px">
|
|
40
38
|
</div>
|
|
41
39
|
<div class="form-row">
|
|
42
|
-
<label for="node-input-dcPin">D/C# line</label>
|
|
43
|
-
<input type="number" id="node-input-dcPin" min="0" style="width:70px">
|
|
40
|
+
<label for="node-config-input-dcPin">D/C# line</label>
|
|
41
|
+
<input type="number" id="node-config-input-dcPin" min="0" style="width:70px">
|
|
44
42
|
</div>
|
|
45
43
|
<div class="form-row">
|
|
46
|
-
<label for="node-input-resPin">RES# line</label>
|
|
47
|
-
<input type="number" id="node-input-resPin" min="0" style="width:70px">
|
|
44
|
+
<label for="node-config-input-resPin">RES# line</label>
|
|
45
|
+
<input type="number" id="node-config-input-resPin" min="0" style="width:70px">
|
|
48
46
|
</div>
|
|
49
47
|
<div class="form-row">
|
|
50
|
-
<label for="node-input-busyPin">BUSY_N line</label>
|
|
51
|
-
<input type="number" id="node-input-busyPin" min="0" style="width:70px">
|
|
48
|
+
<label for="node-config-input-busyPin">BUSY_N line</label>
|
|
49
|
+
<input type="number" id="node-config-input-busyPin" min="0" style="width:70px">
|
|
52
50
|
</div>
|
|
53
51
|
<div class="form-row">
|
|
54
|
-
<label for="node-input-wireMode">Wire mode</label>
|
|
55
|
-
<select id="node-input-wireMode" style="width:260px">
|
|
52
|
+
<label for="node-config-input-wireMode">Wire mode</label>
|
|
53
|
+
<select id="node-config-input-wireMode" style="width:260px">
|
|
56
54
|
<option value="simplex">Simplex (MOSI to DIN, write only)</option>
|
|
57
55
|
<option value="pin">Half-duplex pin (MOSI-resistor-MISO)</option>
|
|
58
56
|
</select>
|
|
59
57
|
</div>
|
|
60
58
|
<div class="form-row">
|
|
61
|
-
<label for="node-input-width">Size</label>
|
|
62
|
-
<input type="number" id="node-input-width" min="8" max="400" step="8" style="width:70px"> x
|
|
63
|
-
<input type="number" id="node-input-height" min="1" max="300" style="width:70px"> px
|
|
59
|
+
<label for="node-config-input-width">Size</label>
|
|
60
|
+
<input type="number" id="node-config-input-width" min="8" max="400" step="8" style="width:70px"> x
|
|
61
|
+
<input type="number" id="node-config-input-height" min="1" max="300" style="width:70px"> px
|
|
62
|
+
</div>
|
|
63
|
+
<div class="form-row">
|
|
64
|
+
<label for="node-config-input-busyTimeout">BUSY timeout (ms)</label>
|
|
65
|
+
<input type="number" id="node-config-input-busyTimeout" min="0" style="width:100px">
|
|
64
66
|
</div>
|
|
65
67
|
<div class="form-row">
|
|
66
|
-
<label for="node-input-
|
|
67
|
-
<input type="
|
|
68
|
+
<label for="node-config-input-autoShow">Auto-show</label>
|
|
69
|
+
<input type="checkbox" id="node-config-input-autoShow" style="width:auto"> refresh after every drawing message
|
|
70
|
+
</div>
|
|
71
|
+
</script>
|
|
72
|
+
|
|
73
|
+
<!-- Read node -->
|
|
74
|
+
<script type="text/javascript">
|
|
75
|
+
RED.nodes.registerType('uc8276c', {
|
|
76
|
+
category: 'Peripheral',
|
|
77
|
+
color: '#C084FC',
|
|
78
|
+
defaults: {
|
|
79
|
+
name: { value: '' },
|
|
80
|
+
device: { value: '', type: 'uc8276c-device', required: true }
|
|
81
|
+
},
|
|
82
|
+
inputs: 1,
|
|
83
|
+
outputs: 1,
|
|
84
|
+
icon: 'font-awesome/fa-television',
|
|
85
|
+
label: function() { return this.name || 'UC8276C'; },
|
|
86
|
+
paletteLabel: 'UC8276C'
|
|
87
|
+
});
|
|
88
|
+
</script>
|
|
89
|
+
|
|
90
|
+
<script type="text/html" data-template-name="uc8276c">
|
|
91
|
+
<div class="form-row">
|
|
92
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
93
|
+
<input type="text" id="node-input-name" placeholder="UC8276C">
|
|
68
94
|
</div>
|
|
69
95
|
<div class="form-row">
|
|
70
|
-
<label for="node-input-
|
|
71
|
-
<input type="
|
|
96
|
+
<label for="node-input-device"><i class="fa fa-microchip"></i> Device</label>
|
|
97
|
+
<input type="text" id="node-input-device">
|
|
72
98
|
</div>
|
|
73
99
|
</script>
|
|
74
100
|
|
|
75
|
-
<script type="text/html" data-help-name="
|
|
101
|
+
<script type="text/html" data-help-name="uc8276c">
|
|
76
102
|
<p>Draws on a UC8276C black/white/red e-paper panel (400 x 300, e.g. Waveshare 4.2inch e-Paper (B)) over SPI. Drawing messages change the framebuffer only; <code>show</code> sends it and refreshes the panel, which blocks the node for about 17 seconds.</p>
|
|
77
103
|
|
|
78
104
|
<h3>Inputs</h3>
|
package/nodes/uc8276c/uc8276c.js
CHANGED
|
@@ -18,7 +18,7 @@ module.exports = function(RED) {
|
|
|
18
18
|
return c;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
function
|
|
21
|
+
function UC8276CDeviceNode(config) {
|
|
22
22
|
RED.nodes.createNode(this, config);
|
|
23
23
|
const node = this;
|
|
24
24
|
node.autoShow = !!config.autoShow;
|
|
@@ -45,9 +45,20 @@ module.exports = function(RED) {
|
|
|
45
45
|
node.error('UC8276C init failed: ' + e.message);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
node.on('close', function() {
|
|
49
|
+
if (node.connection) node.connection.close();
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
RED.nodes.registerType('uc8276c-device', UC8276CDeviceNode);
|
|
53
|
+
|
|
54
|
+
function UC8276CReadNode(config) {
|
|
55
|
+
RED.nodes.createNode(this, config);
|
|
56
|
+
const node = this;
|
|
57
|
+
const deviceNode = RED.nodes.getNode(config.device) || {};
|
|
58
|
+
|
|
48
59
|
node.on('input', async function(msg, send, done) {
|
|
49
|
-
if (!
|
|
50
|
-
const d =
|
|
60
|
+
if (!deviceNode.driver) { done(); return; }
|
|
61
|
+
const d = deviceNode.driver;
|
|
51
62
|
const p = msg.payload || {};
|
|
52
63
|
try {
|
|
53
64
|
if (p.clear !== undefined) d.clear(color(p.clear, WHITE));
|
|
@@ -65,7 +76,7 @@ module.exports = function(RED) {
|
|
|
65
76
|
d.blit(b.x, b.y, Buffer.from(b.data), b.w, b.h, color(b.color));
|
|
66
77
|
}
|
|
67
78
|
if (p.wake) await d.wake();
|
|
68
|
-
if (p.show || (
|
|
79
|
+
if (p.show || (deviceNode.autoShow && (p.clear !== undefined || p.pixel || p.line || p.rect || p.bitmap))) {
|
|
69
80
|
node.status({ fill: 'yellow', shape: 'ring', text: 'refreshing' });
|
|
70
81
|
await d.show();
|
|
71
82
|
node.status({});
|
|
@@ -92,10 +103,6 @@ module.exports = function(RED) {
|
|
|
92
103
|
done(e);
|
|
93
104
|
}
|
|
94
105
|
});
|
|
95
|
-
|
|
96
|
-
node.on('close', function() {
|
|
97
|
-
if (node.connection) node.connection.close();
|
|
98
|
-
});
|
|
99
106
|
}
|
|
100
|
-
RED.nodes.registerType('
|
|
107
|
+
RED.nodes.registerType('uc8276c', UC8276CReadNode);
|
|
101
108
|
};
|
package/package.json
CHANGED
package/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
module.exports = function(RED) {
|
|
5
|
-
const nodesDir = path.join(__dirname, 'nodes');
|
|
6
|
-
if (!fs.existsSync(nodesDir)) return;
|
|
7
|
-
fs.readdirSync(nodesDir).forEach(function(chip) {
|
|
8
|
-
const nodeFile = path.join(nodesDir, chip, chip + '.js');
|
|
9
|
-
if (fs.existsSync(nodeFile)) require(nodeFile)(RED);
|
|
10
|
-
});
|
|
11
|
-
};
|