node-red-contrib-periph-magnetometer 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 CHANGED
@@ -1,6 +1,10 @@
1
1
  # node-red-contrib-periph-magnetometer
2
2
 
3
- Node-RED nodes for magnetometer chips — part of the [Periph](https://github.com/tuhde/Periph) library.
3
+ Node-RED nodes for magnetometer chips: AS5600, HMC5883L — part of the [Periph](https://github.com/tuhde/Periph) library.
4
+
5
+ **Supported chips (2):** AS5600, HMC5883L.
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-magnetometer/examples).
4
8
 
5
9
  ## Install
6
10
 
@@ -17,9 +21,9 @@ npm install node-red-contrib-periph-magnetometer
17
21
  | Node | Kind | Description |
18
22
  |------|------|-------------|
19
23
  | `as5600-device` | config | I²C bus and address for an AS5600 |
20
- | `periph-as5600` | input | Reads the absolute angle, raw count, and magnet detection status from an AS5600 contactless rotary position sensor over I²C. |
24
+ | `as5600` | input | Reads the absolute angle, raw count, and magnet detection status from an AS5600 contactless rotary position sensor over I²C. |
21
25
  | `hmc5883l-device` | config | I²C bus and address for a HMC5883L |
22
- | `periph-hmc5883l` | input | Reads the magnetic field on three axes from an HMC5883L 3-axis magnetometer over I²C. |
26
+ | `hmc5883l` | input | Reads the magnetic field on three axes from an HMC5883L 3-axis magnetometer over I²C. |
23
27
 
24
28
  ## Links
25
29
 
@@ -32,7 +32,7 @@
32
32
  },
33
33
  {
34
34
  "id": "read-as5600",
35
- "type": "periph-as5600",
35
+ "type": "as5600",
36
36
  "name": "AS5600",
37
37
  "device": "cfg-as5600",
38
38
  "z": "tab-as5600-demo",
@@ -31,7 +31,7 @@
31
31
  },
32
32
  {
33
33
  "id": "read-hmc5883l",
34
- "type": "periph-hmc5883l",
34
+ "type": "hmc5883l",
35
35
  "name": "HMC5883L",
36
36
  "device": "cfg-hmc5883l",
37
37
  "z": "tab-hmc5883l-demo",
@@ -35,7 +35,7 @@
35
35
 
36
36
  <!-- Read node: trigger → measurements -->
37
37
  <script type="text/javascript">
38
- RED.nodes.registerType('periph-as5600', {
38
+ RED.nodes.registerType('as5600', {
39
39
  category: 'Peripheral',
40
40
  color: '#C084FC',
41
41
  defaults: {
@@ -50,7 +50,7 @@
50
50
  });
51
51
  </script>
52
52
 
53
- <script type="text/html" data-template-name="periph-as5600">
53
+ <script type="text/html" data-template-name="as5600">
54
54
  <div class="form-row">
55
55
  <label for="node-input-device"><i class="fa fa-microchip"></i> Device</label>
56
56
  <input type="text" id="node-input-device">
@@ -61,7 +61,7 @@
61
61
  </div>
62
62
  </script>
63
63
 
64
- <script type="text/html" data-help-name="periph-as5600">
64
+ <script type="text/html" data-help-name="as5600">
65
65
  <p>Reads the absolute angle, raw count, and magnet detection status from an AS5600
66
66
  contactless rotary position sensor over I²C.</p>
67
67
  <p>Any input message triggers a measurement. The device is configured via an
@@ -45,5 +45,5 @@ module.exports = function(RED) {
45
45
  }
46
46
  });
47
47
  }
48
- RED.nodes.registerType('periph-as5600', AS5600ReadNode);
48
+ RED.nodes.registerType('as5600', AS5600ReadNode);
49
49
  };
@@ -30,7 +30,7 @@
30
30
 
31
31
  <!-- Read node: trigger → measurements -->
32
32
  <script type="text/javascript">
33
- RED.nodes.registerType('periph-hmc5883l', {
33
+ RED.nodes.registerType('hmc5883l', {
34
34
  category: 'Peripheral',
35
35
  color: '#C084FC',
36
36
  defaults: {
@@ -45,7 +45,7 @@
45
45
  });
46
46
  </script>
47
47
 
48
- <script type="text/html" data-template-name="periph-hmc5883l">
48
+ <script type="text/html" data-template-name="hmc5883l">
49
49
  <div class="form-row">
50
50
  <label for="node-input-device"><i class="fa fa-microchip"></i> Device</label>
51
51
  <input type="text" id="node-input-device">
@@ -56,7 +56,7 @@
56
56
  </div>
57
57
  </script>
58
58
 
59
- <script type="text/html" data-help-name="periph-hmc5883l">
59
+ <script type="text/html" data-help-name="hmc5883l">
60
60
  <p>Reads the magnetic field on three axes from an HMC5883L 3-axis magnetometer over I²C.</p>
61
61
  <p>Any input message triggers a measurement. The device is configured via an
62
62
  <b>hmc5883l-device</b> config node.</p>
@@ -42,5 +42,5 @@ module.exports = function(RED) {
42
42
  }
43
43
  });
44
44
  }
45
- RED.nodes.registerType('periph-hmc5883l', HMC5883LReadNode);
45
+ RED.nodes.registerType('hmc5883l', HMC5883LReadNode);
46
46
  };
package/package.json CHANGED
@@ -1,18 +1,23 @@
1
1
  {
2
2
  "name": "node-red-contrib-periph-magnetometer",
3
- "version": "1.5.1",
4
- "description": "Node-RED nodes for magnetometer chips",
3
+ "version": "1.5.3",
4
+ "description": "Node-RED nodes for magnetometer chips: AS5600, HMC5883L",
5
5
  "keywords": [
6
6
  "node-red",
7
7
  "magnetometer",
8
8
  "i2c",
9
9
  "spi",
10
10
  "sensor",
11
- "peripheral"
11
+ "peripheral",
12
+ "node-red-contrib",
13
+ "as5600",
14
+ "hmc5883l"
12
15
  ],
13
16
  "node-red": {
17
+ "version": ">=3.0.0",
14
18
  "nodes": {
15
- "as5600": "nodes/as5600/as5600.js"
19
+ "as5600": "nodes/as5600/as5600.js",
20
+ "hmc5883l": "nodes/hmc5883l/hmc5883l.js"
16
21
  }
17
22
  },
18
23
  "dependencies": {
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
- };