diff --git a/index.js b/index.js index 88da958..b24c991 100644 --- a/index.js +++ b/index.js @@ -8,7 +8,7 @@ const path = require("path"); */ const PollingInterval = 100; const SysfsGPIOPath = "/sys/class/gpio"; -const GPIOPortMapSizeMax = 1023; +const GPIOPortMapSizeMax = 1024; const Uint16Max = 65535; function parseUint16(string) { const n = Number.parseInt(string, 10); @@ -154,7 +154,7 @@ class OperationError extends Error { } exports.OperationError = OperationError; async function requestGPIOAccess() { - const ports = new GPIOPortMap([...Array(GPIOPortMapSizeMax + 1).keys()].map(portNumber => [ + const ports = new GPIOPortMap([...Array(GPIOPortMapSizeMax).keys()].map(portNumber => [ portNumber, new GPIOPort(portNumber) ])); diff --git a/index.ts b/index.ts index 2e9c8eb..1740487 100644 --- a/index.ts +++ b/index.ts @@ -9,7 +9,7 @@ const PollingInterval = 100; const SysfsGPIOPath = "/sys/class/gpio"; -const GPIOPortMapSizeMax = 1023; +const GPIOPortMapSizeMax = 1024; const Uint16Max = 65535; @@ -232,7 +232,7 @@ export class OperationError extends Error {} export async function requestGPIOAccess(): Promise { const ports = new GPIOPortMap( - [...Array(GPIOPortMapSizeMax + 1).keys()].map(portNumber => [ + [...Array(GPIOPortMapSizeMax).keys()].map(portNumber => [ portNumber, new GPIOPort(portNumber) ])