periph 1.0.0 → 1.0.1
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 +49 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# periph
|
|
2
|
+
|
|
3
|
+
JavaScript drivers for peripheral chips (sensors, actuators, and other ICs) connected via I²C, SPI, or UART. Runs on Linux and any Node.js host.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install periph
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
Drivers are accessed by path — require the chip module directly:
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
const { INA226Minimal } = require('periph/src/chips/power/ina226');
|
|
17
|
+
const { I2CTransport } = require('periph/src/transport/i2c');
|
|
18
|
+
|
|
19
|
+
const bus = await I2CTransport.open(1, 0x40); // I2C bus 1, address 0x40
|
|
20
|
+
const sensor = new INA226Minimal(bus);
|
|
21
|
+
console.log(await sensor.power()); // watts
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Each chip exposes two classes:
|
|
25
|
+
|
|
26
|
+
- `*Minimal` — primary use case, works out of the box with sensible defaults
|
|
27
|
+
- `*Full` — complete chip functionality, extends Minimal
|
|
28
|
+
|
|
29
|
+
## Supported chips
|
|
30
|
+
|
|
31
|
+
| Chip | Category | Require path |
|
|
32
|
+
|------|----------|-------------|
|
|
33
|
+
| AS5600 | Magnetometer | `periph/src/chips/magnetometer/as5600` |
|
|
34
|
+
| BMP180 | Pressure | `periph/src/chips/pressure/bmp180` |
|
|
35
|
+
| BMP280 | Pressure | `periph/src/chips/pressure/bmp280` |
|
|
36
|
+
| INA219 | Power monitor | `periph/src/chips/power/ina219` |
|
|
37
|
+
| INA226 | Power monitor | `periph/src/chips/power/ina226` |
|
|
38
|
+
| INA3221 | Power monitor (3-ch) | `periph/src/chips/power/ina3221` |
|
|
39
|
+
| MCP23017 | IO expander (16-bit) | `periph/src/chips/io_expander/mcp23017` |
|
|
40
|
+
| MCP4725 | 12-bit DAC | `periph/src/chips/adc_dac/mcp4725` |
|
|
41
|
+
| PCF8574 | IO expander (8-bit) | `periph/src/chips/io_expander/pcf8574` |
|
|
42
|
+
| PCF8575 | IO expander (16-bit) | `periph/src/chips/io_expander/pcf8575` |
|
|
43
|
+
| SK6812RGBW | LED (addressable RGBW) | `periph/src/chips/led/sk6812rgbw` |
|
|
44
|
+
| WS2812B | LED (addressable RGB) | `periph/src/chips/led/ws2812b` |
|
|
45
|
+
|
|
46
|
+
## Links
|
|
47
|
+
|
|
48
|
+
- [GitHub](https://github.com/tuhde/Periph)
|
|
49
|
+
- [Node-RED nodes](https://www.npmjs.com/search?q=node-red-contrib-periph)
|