This commit is contained in:
2018-05-16 10:10:23 +02:00
commit 79abc63edd
597 changed files with 93351 additions and 0 deletions

5
node_modules/onoff/examples/accessible.js generated vendored Normal file
View File

@ -0,0 +1,5 @@
"use strict";
const Gpio = require('../onoff').Gpio; // Gpio class
console.log('Gpio functionality accessible on this computer?', Gpio.accessible);

29
node_modules/onoff/examples/blink-led-async.js generated vendored Normal file
View File

@ -0,0 +1,29 @@
"use strict";
const Gpio = require('../onoff').Gpio; // Gpio class
const led = new Gpio(17, 'out'); // Export GPIO17 as an output
// Toggle the state of the LED connected to GPIO17 every 200ms 'count' times.
// Here asynchronous methods are used. Synchronous methods are also available.
(function blink(count) {
if (count <= 0) {
return led.unexport();
}
led.read(function (err, value) { // Asynchronous read
if (err) {
throw err;
}
led.write(value ^ 1, function (err) { // Asynchronous write
if (err) {
throw err;
}
});
});
setTimeout(function () {
blink(count - 1);
}, 200);
}(25));

18
node_modules/onoff/examples/blink-led.js generated vendored Normal file
View File

@ -0,0 +1,18 @@
"use strict";
const Gpio = require('../onoff').Gpio; // Gpio class
const led = new Gpio(17, 'out'); // Export GPIO17 as an output
// Toggle the state of the LED connected to GPIO17 every 200ms.
// Here synchronous methods are used. Asynchronous methods are also available.
const iv = setInterval(function () {
led.writeSync(led.readSync() ^ 1); // 1 = on, 0 = off :)
}, 200);
// Stop blinking the LED and turn it off after 5 seconds
setTimeout(function () {
clearInterval(iv); // Stop blinking
led.writeSync(0); // Turn LED off
led.unexport(); // Unexport GPIO and free resources
}, 5000);

19
node_modules/onoff/examples/debounce-button.js generated vendored Normal file
View File

@ -0,0 +1,19 @@
"use strict";
const Gpio = require('../onoff').Gpio;
const led = new Gpio(17, 'out');
const button = new Gpio(4, 'in', 'rising', {debounceTimeout: 10});
button.watch(function (err, value) {
if (err) {
throw err;
}
led.writeSync(led.readSync() ^ 1);
});
process.on('SIGINT', function () {
led.unexport();
button.unexport();
});

19
node_modules/onoff/examples/light-switch.js generated vendored Normal file
View File

@ -0,0 +1,19 @@
"use strict";
const Gpio = require('../onoff').Gpio;
const led = new Gpio(17, 'out');
const button = new Gpio(4, 'in', 'both');
button.watch(function (err, value) {
if (err) {
throw err;
}
led.writeSync(value);
});
process.on('SIGINT', function () {
led.unexport();
button.unexport();
});

BIN
node_modules/onoff/examples/light-switch.png generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 KiB

21
node_modules/onoff/examples/mygpio-overlay.dts generated vendored Normal file
View File

@ -0,0 +1,21 @@
/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2708";
fragment@0 {
target = <&gpio>;
__overlay__ {
pinctrl-names = "default";
pinctrl-0 = <&my_pins>;
my_pins: my_pins {
brcm,pins = <7 8 9>; /* gpio no. */
brcm,function = <0 0 0>; /* 0:in, 1:out */
brcm,pull = <1 1 2>; /* 2:up 1:down 0:none */
};
};
};
};

6
node_modules/onoff/examples/run-examples generated vendored Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
node blink-led
node blink-led-async
node wait-for-interrupt
node light-switch

22
node_modules/onoff/examples/wait-for-interrupt.js generated vendored Normal file
View File

@ -0,0 +1,22 @@
"use strict";
const Gpio = require('../onoff').Gpio; // Gpio class
// Export GPIO4 as an interrupt generating input with a debounceTimeout of 10
// milliseconds
const button = new Gpio(4, 'in', 'rising', {debounceTimeout: 10});
console.log('Please press the button on GPIO4...');
// The callback passed to watch will be invoked when the button connected to
// GPIO4 is pressed
button.watch(function (err, value) {
if (err) {
throw err;
}
console.log('Button pressed!, its value was ' + value);
button.unexport(); // Unexport GPIO and free resources
});