node-red-contrib-periph-motor 1.5.1 → 1.5.3
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 +17 -7
- package/examples/drv2605/demo.json +12 -6
- package/examples/drv8830/demo.json +11 -5
- package/examples/tmc2130/demo.json +44 -15
- package/examples/tmc2208/demo.json +13 -7
- package/examples/tmc2209/demo.json +13 -7
- package/examples/tmc5160/demo.json +146 -24
- package/nodes/drv2605/drv2605.html +44 -18
- package/nodes/drv2605/drv2605.js +30 -24
- package/nodes/drv8830/drv8830.html +42 -16
- package/nodes/drv8830/drv8830.js +26 -20
- package/nodes/tmc2130/tmc2130.html +58 -32
- package/nodes/tmc2130/tmc2130.js +30 -23
- package/nodes/tmc2208/tmc2208.html +50 -24
- package/nodes/tmc2208/tmc2208.js +33 -26
- package/nodes/tmc2209/tmc2209.html +54 -28
- package/nodes/tmc2209/tmc2209.js +35 -28
- package/nodes/tmc5160/tmc5160.html +47 -21
- package/nodes/tmc5160/tmc5160.js +35 -28
- package/package.json +11 -3
- package/index.js +0 -11
package/README.md
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
# node-red-contrib-periph-motor
|
|
2
2
|
|
|
3
|
-
Node-RED nodes for motor driver chips — part of the [Periph](https://github.com/tuhde/Periph) library.
|
|
3
|
+
Node-RED nodes for motor driver chips: DRV2605, DRV8830, TMC2130, TMC2208, TMC2209, TMC5160 — part of the [Periph](https://github.com/tuhde/Periph) library.
|
|
4
|
+
|
|
5
|
+
**Supported chips (6):** DRV2605, DRV8830, TMC2130, TMC2208, TMC2209, TMC5160.
|
|
6
|
+
|
|
7
|
+
Each chip has a sensor/actuator node plus a shared `-device` config node that holds the bus settings. Importable example flows are in [`examples/`](https://github.com/tuhde/Periph/tree/main/nodejs/packages/node-red-contrib-periph-motor/examples).
|
|
4
8
|
|
|
5
9
|
## Install
|
|
6
10
|
|
|
@@ -16,12 +20,18 @@ npm install node-red-contrib-periph-motor
|
|
|
16
20
|
|
|
17
21
|
| Node | Kind | Description |
|
|
18
22
|
|------|------|-------------|
|
|
19
|
-
| `
|
|
20
|
-
| `
|
|
21
|
-
| `
|
|
22
|
-
| `
|
|
23
|
-
| `
|
|
24
|
-
| `
|
|
23
|
+
| `drv2605-device` | config | Bus configuration for a DRV2605 |
|
|
24
|
+
| `drv2605` | input | Plays haptic effects on an ERM or LRA vibration motor through a DRV2605 haptic driver over I²C (fixed address 0x5A). The EN pin must be high. |
|
|
25
|
+
| `drv8830-device` | config | I²C bus and address for a DRV8830 |
|
|
26
|
+
| `drv8830` | input | Drives a brushed DC motor through a DRV8830 low-voltage H-bridge over I²C, and reports its fault status. The chip regulates the commanded voltage across the motor, so speed stays constant as the supply sags. |
|
|
27
|
+
| `tmc2130-device` | config | Bus configuration for a TMC2130 |
|
|
28
|
+
| `tmc2130` | input | Drives a two-phase bipolar stepper motor through a Trinamic TMC2130 over SPI (Mode 3). The chip has no internal step generator, so the node pulses the STEP and DIR GPIOs; moves are blocking. |
|
|
29
|
+
| `tmc2208-device` | config | Bus configuration for a TMC2208 |
|
|
30
|
+
| `tmc2208` | input | Drives a two-phase bipolar stepper motor through a Trinamic TMC2202 / TMC2208 / TMC2224 over its single-wire UART. The chip's internal step generator moves the motor, so no STEP pulses are needed. |
|
|
31
|
+
| `tmc2209-device` | config | I²C bus and address for a TMC2209 |
|
|
32
|
+
| `tmc2209` | input | Drives a two-phase bipolar stepper motor through a Trinamic TMC2209 over its single-wire UART. The chip's internal step generator moves the motor, so no STEP pulses are needed. |
|
|
33
|
+
| `tmc5160-device` | config | I²C bus and address for a TMC5160 |
|
|
34
|
+
| `tmc5160` | input | Drives a two-phase bipolar stepper motor through a Trinamic TMC5160 over SPI (Mode 3) or single-wire UART. The chip's internal SixPoint ramp generator moves the motor; positions are in full steps, speeds in full steps/s and accelerations in full steps/s². |
|
|
25
35
|
|
|
26
36
|
## Links
|
|
27
37
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"type": "tab",
|
|
5
5
|
"label": "DRV2605 Haptic Demo",
|
|
6
6
|
"disabled": false,
|
|
7
|
-
"info": "Haptic feedback on a vibration motor. The first Inject node sends a button-press effect ({effect: 7}, Soft Bump) on click; the second sends a notification sequence ({sequence: [47, [\"wait\", 200], 47]}, two buzzes 200 ms apart); the third sends {rtp: 0.6} for a constant 60 % buzz and, after 1 s, a Function node sends {stop: true}. Every reply from the
|
|
7
|
+
"info": "Haptic feedback on a vibration motor. The first Inject node sends a button-press effect ({effect: 7}, Soft Bump) on click; the second sends a notification sequence ({sequence: [47, [\"wait\", 200], 47]}, two buzzes 200 ms apart); the third sends {rtp: 0.6} for a constant 60 % buzz and, after 1 s, a Function node sends {stop: true}. Every reply from the drv2605 node is shown in a Debug node. Demonstrates click, notification and constant-buzz haptics."
|
|
8
8
|
},
|
|
9
9
|
{
|
|
10
10
|
"id": "inj-click",
|
|
@@ -127,12 +127,17 @@
|
|
|
127
127
|
]
|
|
128
128
|
},
|
|
129
129
|
{
|
|
130
|
-
"id": "
|
|
131
|
-
"type": "
|
|
132
|
-
"name": "",
|
|
130
|
+
"id": "drv2605-device-1",
|
|
131
|
+
"type": "drv2605-device",
|
|
132
|
+
"name": "DRV2605",
|
|
133
133
|
"bus": "1",
|
|
134
134
|
"actuator": "erm",
|
|
135
|
-
"library": "A"
|
|
135
|
+
"library": "A"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"id": "drv",
|
|
139
|
+
"type": "drv2605",
|
|
140
|
+
"name": "",
|
|
136
141
|
"z": "tab-drv2605-demo",
|
|
137
142
|
"x": 640,
|
|
138
143
|
"y": 140,
|
|
@@ -140,7 +145,8 @@
|
|
|
140
145
|
[
|
|
141
146
|
"dbg"
|
|
142
147
|
]
|
|
143
|
-
]
|
|
148
|
+
],
|
|
149
|
+
"device": "drv2605-device-1"
|
|
144
150
|
},
|
|
145
151
|
{
|
|
146
152
|
"id": "dbg",
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"type": "tab",
|
|
5
5
|
"label": "DRV8830 Motor Ramp Demo",
|
|
6
6
|
"disabled": false,
|
|
7
|
-
"info": "A battery-powered motor controller. An Inject node ticks once per second into a Function node that ramps msg.payload.voltage from 0 to 3.0 V in 0.5 V steps, holds 3.0 V for 5 s, then reverses to -3.0 V — the DRV8830 regulates that average voltage across the motor, so speed stays constant while the battery sags. A second, independent Inject node polls every 2 s (any message) so the
|
|
7
|
+
"info": "A battery-powered motor controller. An Inject node ticks once per second into a Function node that ramps msg.payload.voltage from 0 to 3.0 V in 0.5 V steps, holds 3.0 V for 5 s, then reverses to -3.0 V — the DRV8830 regulates that average voltage across the motor, so speed stays constant while the battery sags. A second, independent Inject node polls every 2 s (any message) so the drv8830 node emits its fault status; a Function node checks msg.payload.fault and, if set, sends {stop: true} followed by {clear_fault: true} back into the driver to recover, while a Debug node shows every status reading."
|
|
8
8
|
},
|
|
9
9
|
{
|
|
10
10
|
"id": "inj-ramp",
|
|
@@ -63,11 +63,16 @@
|
|
|
63
63
|
]
|
|
64
64
|
},
|
|
65
65
|
{
|
|
66
|
-
"id": "drv8830-
|
|
67
|
-
"type": "
|
|
66
|
+
"id": "drv8830-device-1",
|
|
67
|
+
"type": "drv8830-device",
|
|
68
68
|
"name": "DRV8830",
|
|
69
69
|
"bus": "1",
|
|
70
|
-
"address": "0x60"
|
|
70
|
+
"address": "0x60"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"id": "drv8830-node",
|
|
74
|
+
"type": "drv8830",
|
|
75
|
+
"name": "DRV8830",
|
|
71
76
|
"z": "tab-drv8830-demo",
|
|
72
77
|
"x": 540,
|
|
73
78
|
"y": 140,
|
|
@@ -75,7 +80,8 @@
|
|
|
75
80
|
[
|
|
76
81
|
"fn-guard"
|
|
77
82
|
]
|
|
78
|
-
]
|
|
83
|
+
],
|
|
84
|
+
"device": "drv8830-device-1"
|
|
79
85
|
},
|
|
80
86
|
{
|
|
81
87
|
"id": "fn-guard",
|
|
@@ -20,7 +20,11 @@
|
|
|
20
20
|
"z": "tab-tmc2130-demo",
|
|
21
21
|
"x": 190,
|
|
22
22
|
"y": 80,
|
|
23
|
-
"wires": [
|
|
23
|
+
"wires": [
|
|
24
|
+
[
|
|
25
|
+
"tmc2130-node"
|
|
26
|
+
]
|
|
27
|
+
]
|
|
24
28
|
},
|
|
25
29
|
{
|
|
26
30
|
"id": "inj-cycle",
|
|
@@ -36,7 +40,11 @@
|
|
|
36
40
|
"z": "tab-tmc2130-demo",
|
|
37
41
|
"x": 140,
|
|
38
42
|
"y": 160,
|
|
39
|
-
"wires": [
|
|
43
|
+
"wires": [
|
|
44
|
+
[
|
|
45
|
+
"fn-cycle"
|
|
46
|
+
]
|
|
47
|
+
]
|
|
40
48
|
},
|
|
41
49
|
{
|
|
42
50
|
"id": "fn-cycle",
|
|
@@ -48,7 +56,11 @@
|
|
|
48
56
|
"z": "tab-tmc2130-demo",
|
|
49
57
|
"x": 330,
|
|
50
58
|
"y": 160,
|
|
51
|
-
"wires": [
|
|
59
|
+
"wires": [
|
|
60
|
+
[
|
|
61
|
+
"tmc2130-node"
|
|
62
|
+
]
|
|
63
|
+
]
|
|
52
64
|
},
|
|
53
65
|
{
|
|
54
66
|
"id": "inj-poll",
|
|
@@ -64,26 +76,41 @@
|
|
|
64
76
|
"z": "tab-tmc2130-demo",
|
|
65
77
|
"x": 140,
|
|
66
78
|
"y": 240,
|
|
67
|
-
"wires": [
|
|
79
|
+
"wires": [
|
|
80
|
+
[
|
|
81
|
+
"tmc2130-node"
|
|
82
|
+
]
|
|
83
|
+
]
|
|
68
84
|
},
|
|
69
85
|
{
|
|
70
|
-
"id": "tmc2130-
|
|
71
|
-
"type": "
|
|
86
|
+
"id": "tmc2130-device-1",
|
|
87
|
+
"type": "tmc2130-device",
|
|
72
88
|
"name": "TMC2130",
|
|
73
|
-
"bus": "0",
|
|
74
89
|
"device": "0",
|
|
75
|
-
"
|
|
76
|
-
"stepGpio": "0:27",
|
|
77
|
-
"dirGpio": "0:22",
|
|
78
|
-
"enGpio": "0:17",
|
|
79
|
-
"rsense": "0.11",
|
|
90
|
+
"speed": "200",
|
|
80
91
|
"current": "0.5",
|
|
92
|
+
"rsense": "0.11",
|
|
93
|
+
"bus": "0",
|
|
94
|
+
"speedHz": "1000000",
|
|
81
95
|
"microsteps": "16",
|
|
82
|
-
"
|
|
96
|
+
"enGpio": "0:17",
|
|
97
|
+
"dirGpio": "0:22",
|
|
98
|
+
"stepGpio": "0:27"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"id": "tmc2130-node",
|
|
102
|
+
"type": "tmc2130",
|
|
103
|
+
"name": "TMC2130",
|
|
83
104
|
"z": "tab-tmc2130-demo",
|
|
84
105
|
"x": 560,
|
|
85
106
|
"y": 160,
|
|
86
|
-
"wires": [
|
|
107
|
+
"wires": [
|
|
108
|
+
[
|
|
109
|
+
"fn-fault",
|
|
110
|
+
"dbg-out"
|
|
111
|
+
]
|
|
112
|
+
],
|
|
113
|
+
"device": "tmc2130-device-1"
|
|
87
114
|
},
|
|
88
115
|
{
|
|
89
116
|
"id": "fn-fault",
|
|
@@ -95,7 +122,9 @@
|
|
|
95
122
|
"z": "tab-tmc2130-demo",
|
|
96
123
|
"x": 780,
|
|
97
124
|
"y": 120,
|
|
98
|
-
"wires": [
|
|
125
|
+
"wires": [
|
|
126
|
+
[]
|
|
127
|
+
]
|
|
99
128
|
},
|
|
100
129
|
{
|
|
101
130
|
"id": "dbg-out",
|
|
@@ -83,16 +83,21 @@
|
|
|
83
83
|
]
|
|
84
84
|
},
|
|
85
85
|
{
|
|
86
|
-
"id": "tmc2208-
|
|
87
|
-
"type": "
|
|
88
|
-
"z": "tab-tmc2208-demo",
|
|
86
|
+
"id": "tmc2208-device-1",
|
|
87
|
+
"type": "tmc2208-device",
|
|
89
88
|
"name": "TMC2208",
|
|
90
|
-
"port": "/dev/ttyS0",
|
|
91
89
|
"baudrate": "115200",
|
|
92
|
-
"rsense": "0.11",
|
|
93
90
|
"current": "0.5",
|
|
91
|
+
"rsense": "0.11",
|
|
94
92
|
"microsteps": "16",
|
|
95
|
-
"
|
|
93
|
+
"port": "/dev/ttyS0",
|
|
94
|
+
"enGpio": ""
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"id": "tmc2208-node",
|
|
98
|
+
"type": "tmc2208",
|
|
99
|
+
"z": "tab-tmc2208-demo",
|
|
100
|
+
"name": "TMC2208",
|
|
96
101
|
"x": 570,
|
|
97
102
|
"y": 160,
|
|
98
103
|
"wires": [
|
|
@@ -100,7 +105,8 @@
|
|
|
100
105
|
"fn-fault",
|
|
101
106
|
"dbg-status"
|
|
102
107
|
]
|
|
103
|
-
]
|
|
108
|
+
],
|
|
109
|
+
"device": "tmc2208-device-1"
|
|
104
110
|
},
|
|
105
111
|
{
|
|
106
112
|
"id": "fn-fault",
|
|
@@ -83,16 +83,21 @@
|
|
|
83
83
|
]
|
|
84
84
|
},
|
|
85
85
|
{
|
|
86
|
-
"id": "tmc2209-
|
|
87
|
-
"type": "
|
|
88
|
-
"z": "tab-tmc2209-demo",
|
|
86
|
+
"id": "tmc2209-device-1",
|
|
87
|
+
"type": "tmc2209-device",
|
|
89
88
|
"name": "TMC2209",
|
|
90
|
-
"port": "/dev/ttyS0",
|
|
91
89
|
"baudrate": "115200",
|
|
92
|
-
"rsense": "0.11",
|
|
93
90
|
"current": "0.5",
|
|
91
|
+
"rsense": "0.11",
|
|
94
92
|
"microsteps": "16",
|
|
95
|
-
"
|
|
93
|
+
"port": "/dev/ttyS0",
|
|
94
|
+
"enGpio": ""
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"id": "tmc2209-node",
|
|
98
|
+
"type": "tmc2209",
|
|
99
|
+
"z": "tab-tmc2209-demo",
|
|
100
|
+
"name": "TMC2209",
|
|
96
101
|
"x": 570,
|
|
97
102
|
"y": 160,
|
|
98
103
|
"wires": [
|
|
@@ -100,7 +105,8 @@
|
|
|
100
105
|
"fn-fault",
|
|
101
106
|
"dbg-status"
|
|
102
107
|
]
|
|
103
|
-
]
|
|
108
|
+
],
|
|
109
|
+
"device": "tmc2209-device-1"
|
|
104
110
|
},
|
|
105
111
|
{
|
|
106
112
|
"id": "fn-fault",
|
|
@@ -1,26 +1,148 @@
|
|
|
1
1
|
[
|
|
2
|
-
{
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
2
|
+
{
|
|
3
|
+
"id": "tab-tmc5160-demo",
|
|
4
|
+
"type": "tab",
|
|
5
|
+
"label": "TMC5160 Stepper Demo",
|
|
6
|
+
"disabled": false,
|
|
7
|
+
"info": "A positioning stage driven by the TMC5160 ramp generator. One Inject node sends {enable: true, current: 1.5, speed: 300, acceleration: 800} once at start. A second Inject node ticks every 5 s into a Function node that alternates {move_to: 400} and {move_to: 0}, so the chip moves forward and back by itself. A third Inject node polls the driver status every 2 s (any other message); a Function node checks msg.payload.fault and raises a Node-RED warning when it is non-zero and a notice when sg_result drops below 100, while a Debug node shows every reply."
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"id": "inj-setup",
|
|
11
|
+
"type": "inject",
|
|
12
|
+
"name": "Enable 1.5 A, 300 steps/s, 800 steps/s²",
|
|
13
|
+
"topic": "",
|
|
14
|
+
"payload": "{\"enable\":true,\"current\":1.5,\"speed\":300,\"acceleration\":800}",
|
|
15
|
+
"payloadType": "json",
|
|
16
|
+
"repeat": "",
|
|
17
|
+
"crontab": "",
|
|
18
|
+
"once": true,
|
|
19
|
+
"onceDelay": 1,
|
|
20
|
+
"z": "tab-tmc5160-demo",
|
|
21
|
+
"x": 220,
|
|
22
|
+
"y": 80,
|
|
23
|
+
"wires": [
|
|
24
|
+
[
|
|
25
|
+
"tmc5160-node"
|
|
26
|
+
]
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"id": "inj-cycle",
|
|
31
|
+
"type": "inject",
|
|
32
|
+
"name": "Cycle tick (5 s)",
|
|
33
|
+
"topic": "",
|
|
34
|
+
"payload": "",
|
|
35
|
+
"payloadType": "date",
|
|
36
|
+
"repeat": "5",
|
|
37
|
+
"crontab": "",
|
|
38
|
+
"once": true,
|
|
39
|
+
"onceDelay": 3,
|
|
40
|
+
"z": "tab-tmc5160-demo",
|
|
41
|
+
"x": 140,
|
|
42
|
+
"y": 160,
|
|
43
|
+
"wires": [
|
|
44
|
+
[
|
|
45
|
+
"fn-cycle"
|
|
46
|
+
]
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"id": "fn-cycle",
|
|
51
|
+
"type": "function",
|
|
52
|
+
"name": "move_to 400 / 0",
|
|
53
|
+
"func": "const seq = [{ move_to: 400 }, { move_to: 0 }];\nconst i = context.get('step') || 0;\ncontext.set('step', (i + 1) % seq.length);\nmsg.payload = seq[i];\nreturn msg;",
|
|
54
|
+
"outputs": 1,
|
|
55
|
+
"noerr": 0,
|
|
56
|
+
"z": "tab-tmc5160-demo",
|
|
57
|
+
"x": 330,
|
|
58
|
+
"y": 160,
|
|
59
|
+
"wires": [
|
|
60
|
+
[
|
|
61
|
+
"tmc5160-node"
|
|
62
|
+
]
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"id": "inj-poll",
|
|
67
|
+
"type": "inject",
|
|
68
|
+
"name": "Poll status (2 s)",
|
|
69
|
+
"topic": "",
|
|
70
|
+
"payload": "",
|
|
71
|
+
"payloadType": "date",
|
|
72
|
+
"repeat": "2",
|
|
73
|
+
"crontab": "",
|
|
74
|
+
"once": true,
|
|
75
|
+
"onceDelay": 2,
|
|
76
|
+
"z": "tab-tmc5160-demo",
|
|
77
|
+
"x": 140,
|
|
78
|
+
"y": 240,
|
|
79
|
+
"wires": [
|
|
80
|
+
[
|
|
81
|
+
"tmc5160-node"
|
|
82
|
+
]
|
|
83
|
+
]
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"id": "tmc5160-device-1",
|
|
87
|
+
"type": "tmc5160-device",
|
|
88
|
+
"name": "TMC5160",
|
|
89
|
+
"enGpio": "0:17",
|
|
90
|
+
"rsense": "0.075",
|
|
91
|
+
"speed": "200",
|
|
92
|
+
"fclk": "12000000",
|
|
93
|
+
"diag1Gpio": "",
|
|
94
|
+
"baudrate": "115200",
|
|
95
|
+
"current": "1.0",
|
|
96
|
+
"address": "0",
|
|
97
|
+
"acceleration": "400",
|
|
98
|
+
"echo": true,
|
|
99
|
+
"diag0Gpio": "",
|
|
100
|
+
"port": "/dev/ttyS0",
|
|
101
|
+
"bus": "spi",
|
|
102
|
+
"spiBus": "0",
|
|
103
|
+
"spiDevice": "0"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"id": "tmc5160-node",
|
|
107
|
+
"type": "tmc5160",
|
|
108
|
+
"name": "TMC5160",
|
|
109
|
+
"z": "tab-tmc5160-demo",
|
|
110
|
+
"x": 560,
|
|
111
|
+
"y": 160,
|
|
112
|
+
"wires": [
|
|
113
|
+
[
|
|
114
|
+
"fn-fault",
|
|
115
|
+
"dbg-out"
|
|
116
|
+
]
|
|
117
|
+
],
|
|
118
|
+
"device": "tmc5160-device-1"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"id": "fn-fault",
|
|
122
|
+
"type": "function",
|
|
123
|
+
"name": "fault / stall check",
|
|
124
|
+
"func": "if (msg.payload.fault) {\n node.warn('TMC5160 fault bitmask: ' + msg.payload.fault);\n return msg;\n}\nif (msg.payload.tstep !== undefined && msg.payload.sg_result < 100) {\n node.warn('TMC5160 SG_RESULT low: ' + msg.payload.sg_result);\n return msg;\n}\nreturn null;",
|
|
125
|
+
"outputs": 1,
|
|
126
|
+
"noerr": 0,
|
|
127
|
+
"z": "tab-tmc5160-demo",
|
|
128
|
+
"x": 780,
|
|
129
|
+
"y": 120,
|
|
130
|
+
"wires": [
|
|
131
|
+
[]
|
|
132
|
+
]
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"id": "dbg-out",
|
|
136
|
+
"type": "debug",
|
|
137
|
+
"name": "TMC5160 reply",
|
|
138
|
+
"active": true,
|
|
139
|
+
"tosidebar": true,
|
|
140
|
+
"console": false,
|
|
141
|
+
"tostatus": false,
|
|
142
|
+
"complete": "payload",
|
|
143
|
+
"z": "tab-tmc5160-demo",
|
|
144
|
+
"x": 780,
|
|
145
|
+
"y": 200,
|
|
146
|
+
"wires": []
|
|
147
|
+
}
|
|
26
148
|
]
|
|
@@ -1,40 +1,38 @@
|
|
|
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('drv2605-device', {
|
|
4
|
+
category: 'config',
|
|
5
5
|
defaults: {
|
|
6
6
|
name: { value: '' },
|
|
7
7
|
bus: { value: '1', required: true, validate: RED.validators.number() },
|
|
8
8
|
actuator: { value: 'erm', required: true },
|
|
9
9
|
library: { value: 'A', required: true }
|
|
10
10
|
},
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
label: function() { return this.name || 'DRV2605'; },
|
|
15
|
-
paletteLabel: 'DRV2605'
|
|
11
|
+
label: function() {
|
|
12
|
+
return this.name || 'DRV2605';
|
|
13
|
+
}
|
|
16
14
|
});
|
|
17
15
|
</script>
|
|
18
16
|
|
|
19
|
-
<script type="text/html" data-template-name="
|
|
17
|
+
<script type="text/html" data-template-name="drv2605-device">
|
|
20
18
|
<div class="form-row">
|
|
21
|
-
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
22
|
-
<input type="text" id="node-input-name" placeholder="DRV2605">
|
|
19
|
+
<label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
20
|
+
<input type="text" id="node-config-input-name" placeholder="DRV2605">
|
|
23
21
|
</div>
|
|
24
22
|
<div class="form-row">
|
|
25
|
-
<label for="node-input-bus"><i class="fa fa-microchip"></i> I²C bus</label>
|
|
26
|
-
<input type="number" id="node-input-bus" min="0" style="width:80px"> (Linux /dev/i2c-N)
|
|
23
|
+
<label for="node-config-input-bus"><i class="fa fa-microchip"></i> I²C bus</label>
|
|
24
|
+
<input type="number" id="node-config-input-bus" min="0" style="width:80px"> (Linux /dev/i2c-N)
|
|
27
25
|
</div>
|
|
28
26
|
<div class="form-row">
|
|
29
|
-
<label for="node-input-actuator"><i class="fa fa-bolt"></i> Actuator</label>
|
|
30
|
-
<select id="node-input-actuator" style="width:120px">
|
|
27
|
+
<label for="node-config-input-actuator"><i class="fa fa-bolt"></i> Actuator</label>
|
|
28
|
+
<select id="node-config-input-actuator" style="width:120px">
|
|
31
29
|
<option value="erm">ERM</option>
|
|
32
30
|
<option value="lra">LRA</option>
|
|
33
31
|
</select>
|
|
34
32
|
</div>
|
|
35
33
|
<div class="form-row">
|
|
36
|
-
<label for="node-input-library"><i class="fa fa-book"></i> Library</label>
|
|
37
|
-
<select id="node-input-library" style="width:120px">
|
|
34
|
+
<label for="node-config-input-library"><i class="fa fa-book"></i> Library</label>
|
|
35
|
+
<select id="node-config-input-library" style="width:120px">
|
|
38
36
|
<option value="A">A (ERM)</option>
|
|
39
37
|
<option value="B">B (ERM)</option>
|
|
40
38
|
<option value="C">C (ERM)</option>
|
|
@@ -45,7 +43,35 @@
|
|
|
45
43
|
</div>
|
|
46
44
|
</script>
|
|
47
45
|
|
|
48
|
-
|
|
46
|
+
<!-- Read node -->
|
|
47
|
+
<script type="text/javascript">
|
|
48
|
+
RED.nodes.registerType('drv2605', {
|
|
49
|
+
category: 'Peripheral',
|
|
50
|
+
color: '#C084FC',
|
|
51
|
+
defaults: {
|
|
52
|
+
name: { value: '' },
|
|
53
|
+
device: { value: '', type: 'drv2605-device', required: true }
|
|
54
|
+
},
|
|
55
|
+
inputs: 1,
|
|
56
|
+
outputs: 1,
|
|
57
|
+
icon: 'font-awesome/fa-cog',
|
|
58
|
+
label: function() { return this.name || 'DRV2605'; },
|
|
59
|
+
paletteLabel: 'DRV2605'
|
|
60
|
+
});
|
|
61
|
+
</script>
|
|
62
|
+
|
|
63
|
+
<script type="text/html" data-template-name="drv2605">
|
|
64
|
+
<div class="form-row">
|
|
65
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
66
|
+
<input type="text" id="node-input-name" placeholder="DRV2605">
|
|
67
|
+
</div>
|
|
68
|
+
<div class="form-row">
|
|
69
|
+
<label for="node-input-device"><i class="fa fa-microchip"></i> Device</label>
|
|
70
|
+
<input type="text" id="node-input-device">
|
|
71
|
+
</div>
|
|
72
|
+
</script>
|
|
73
|
+
|
|
74
|
+
<script type="text/html" data-help-name="drv2605">
|
|
49
75
|
<p>Plays haptic effects on an ERM or LRA vibration motor through a DRV2605 haptic driver over I²C (fixed address 0x5A). The EN pin must be high.</p>
|
|
50
76
|
|
|
51
77
|
<h3>Inputs</h3>
|