This commit is contained in:
Nebel 2019-10-18 01:29:58 +09:00
parent 3af2268119
commit 3b39377e22
2 changed files with 4 additions and 4 deletions

View file

@ -8,7 +8,7 @@ const path = require("path");
*/ */
const PollingInterval = 100; const PollingInterval = 100;
const SysfsGPIOPath = "/sys/class/gpio"; const SysfsGPIOPath = "/sys/class/gpio";
const GPIOPortMapSizeMax = 1023; const GPIOPortMapSizeMax = 1024;
const Uint16Max = 65535; const Uint16Max = 65535;
function parseUint16(string) { function parseUint16(string) {
const n = Number.parseInt(string, 10); const n = Number.parseInt(string, 10);
@ -154,7 +154,7 @@ class OperationError extends Error {
} }
exports.OperationError = OperationError; exports.OperationError = OperationError;
async function requestGPIOAccess() { async function requestGPIOAccess() {
const ports = new GPIOPortMap([...Array(GPIOPortMapSizeMax + 1).keys()].map(portNumber => [ const ports = new GPIOPortMap([...Array(GPIOPortMapSizeMax).keys()].map(portNumber => [
portNumber, portNumber,
new GPIOPort(portNumber) new GPIOPort(portNumber)
])); ]));

View file

@ -9,7 +9,7 @@ const PollingInterval = 100;
const SysfsGPIOPath = "/sys/class/gpio"; const SysfsGPIOPath = "/sys/class/gpio";
const GPIOPortMapSizeMax = 1023; const GPIOPortMapSizeMax = 1024;
const Uint16Max = 65535; const Uint16Max = 65535;
@ -232,7 +232,7 @@ export class OperationError extends Error {}
export async function requestGPIOAccess(): Promise<GPIOAccess> { export async function requestGPIOAccess(): Promise<GPIOAccess> {
const ports = new GPIOPortMap( const ports = new GPIOPortMap(
[...Array(GPIOPortMapSizeMax + 1).keys()].map(portNumber => [ [...Array(GPIOPortMapSizeMax).keys()].map(portNumber => [
portNumber, portNumber,
new GPIOPort(portNumber) new GPIOPort(portNumber)
]) ])