rpi-io 2.0.5 → 2.0.7
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 +7 -17
- package/history.md +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
**rpi-io** is a lite [ESM](https://nodejs.org/api/esm.html#modules-ecmascript-modules) module for **Node.js** to control **Raspberry Pi** GPIO: access (in, out), input event detection and [PWM](https://en.wikipedia.org/wiki/Pulse-width_modulation) peripheral control.
|
|
6
6
|
|
|
7
|
+
**rpi-io** is built on a high performance hybrid architecture based on Node.js + C addon.
|
|
8
|
+
|
|
7
9
|
**rpi-io** is designed for recent versions of Raspberry and related OS and middlewares. It has been tested in the following environments:
|
|
8
10
|
|
|
9
11
|
- Raspberry Pi models: *RPi 5,* *RPi 4B* and *RPi Zero 2.*
|
|
@@ -12,24 +14,12 @@
|
|
|
12
14
|
- Input/Output - [libgpiod](https://libgpiod.readthedocs.io/en/stable/) v1.6.3 (*Bookworm*) and v2.2.1 (*Trixie*)
|
|
13
15
|
- PWM - [sysfs](https://en.wikipedia.org/wiki/Sysfs) interface.
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
## What's new with version 2
|
|
18
|
-
|
|
19
|
-
| | version 1 | version 2 |
|
|
20
|
-
| ------------ | ------------ | ------------------------ |
|
|
21
|
-
| Architecture | Full Node.js | Hybrid Node.js + C addon |
|
|
22
|
-
| Performance | Low | High |
|
|
23
|
-
|
|
24
|
-
⚠️ Given the new architecture, the v2 API is not compatible with the v1 one.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
|
|
28
18
|
## Prerequisites
|
|
29
19
|
|
|
30
20
|
### libgpiod
|
|
31
21
|
|
|
32
|
-
By default *libgpiod* is available with the latest Raspberry Pi OS distributions. If you want to install **rpi-io** with older - not tested - distributions, be sure it is installed.
|
|
22
|
+
By default, *libgpiod* is available with the latest Raspberry Pi OS distributions. If you want to install **rpi-io** with older - not tested - distributions, be sure it is installed.
|
|
33
23
|
|
|
34
24
|
```bash
|
|
35
25
|
sudo apt-get update
|
|
@@ -250,7 +240,7 @@ const btn = new RIO(18, "input", {bias: "pull-up"})
|
|
|
250
240
|
|
|
251
241
|
#### Servo motor
|
|
252
242
|
|
|
253
|
-
REMINDER: PWM peripherals used in hardware mode need some specific [configuration](
|
|
243
|
+
REMINDER: PWM peripherals used in hardware mode need some specific [configuration](## Configuration for PWM-based peripherals).
|
|
254
244
|
|
|
255
245
|
##### Diagram for servo-motor *SG90*
|
|
256
246
|
```
|
|
@@ -488,7 +478,7 @@ myButton.monitoringStart(callback, "both", 30)
|
|
|
488
478
|
|
|
489
479
|
- **callback** *{Function}* Function triggered by input events where parameter is *edge* that can be either "rising" (input change from 0 to 1) or "falling" (input change from 1 to 0).
|
|
490
480
|
- **edge** *{String}* Filter of monitored events: "rising", "falling", "both" (default value).
|
|
491
|
-
- **bounce** *{Number}* Set
|
|
481
|
+
- **bounce** *{Number}* Set threshold in ms to filter consecutive events of same type. Default value is 0.
|
|
492
482
|
|
|
493
483
|
|
|
494
484
|
|
|
@@ -603,7 +593,7 @@ import {sleep, ctrlC} from "rpi-io"
|
|
|
603
593
|
|
|
604
594
|
## Benchmark
|
|
605
595
|
|
|
606
|
-
The following tables
|
|
596
|
+
The following tables summarize main operation times on various devices. Results are in micro-seconds (µs).
|
|
607
597
|
|
|
608
598
|
**PLEASE NOTE**: As PWM operations rely on files, performance of microSD cards installed on RPi may have a significant impact on results for `pwmDuty()`.
|
|
609
599
|
|
package/history.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rpi-io",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.7",
|
|
4
4
|
"description": "Nodejs module to control Raspberry Pi GPIO",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"raspberry",
|
|
@@ -43,10 +43,10 @@
|
|
|
43
43
|
"postinstall": "echo 'Installation complete!'",
|
|
44
44
|
"clean": "node-gyp clean",
|
|
45
45
|
"configure": "node-gyp configure",
|
|
46
|
-
"
|
|
46
|
+
"//----- Shell scripts -----": "To check environment and libgpiod version",
|
|
47
47
|
"check": "bash script/check-env.sh",
|
|
48
48
|
"detect-version": "bash script/detect-gpiod-version.sh",
|
|
49
|
-
"
|
|
49
|
+
"//----- Javascript scripts -----": "Misc examples and tests",
|
|
50
50
|
"line-write": "node ./test/write.js",
|
|
51
51
|
"line-read": "node ./test/read.js",
|
|
52
52
|
"line-pwm-led": "node ./test/pwm-led.js",
|