Ref. #41

Co-authored-by: akihiko kigure <akihiko.kigure@lifewood-m1.local>
Co-authored-by: bot <bot@example>
This commit is contained in:
Akihiko.KIgure 2022-01-18 22:24:49 +09:00 committed by GitHub
parent 86ef1c4221
commit 8fc977510d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 4218 additions and 929 deletions

1
docs/.nojekyll Normal file
View file

@ -0,0 +1 @@
TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.

99
docs/assets/highlight.css Normal file
View file

@ -0,0 +1,99 @@
:root {
--light-hl-0: #0000FF;
--dark-hl-0: #569CD6;
--light-hl-1: #000000;
--dark-hl-1: #D4D4D4;
--light-hl-2: #0070C1;
--dark-hl-2: #4FC1FF;
--light-hl-3: #795E26;
--dark-hl-3: #DCDCAA;
--light-hl-4: #A31515;
--dark-hl-4: #CE9178;
--light-hl-5: #001080;
--dark-hl-5: #9CDCFE;
--light-hl-6: #AF00DB;
--dark-hl-6: #C586C0;
--light-hl-7: #098658;
--dark-hl-7: #B5CEA8;
--light-hl-8: #008000;
--dark-hl-8: #6A9955;
--light-hl-9: #267F99;
--dark-hl-9: #4EC9B0;
--light-hl-10: #000000;
--dark-hl-10: #C8C8C8;
--light-code-background: #FFFFFF;
--dark-code-background: #1E1E1E;
}
@media (prefers-color-scheme: light) { :root {
--hl-0: var(--light-hl-0);
--hl-1: var(--light-hl-1);
--hl-2: var(--light-hl-2);
--hl-3: var(--light-hl-3);
--hl-4: var(--light-hl-4);
--hl-5: var(--light-hl-5);
--hl-6: var(--light-hl-6);
--hl-7: var(--light-hl-7);
--hl-8: var(--light-hl-8);
--hl-9: var(--light-hl-9);
--hl-10: var(--light-hl-10);
--code-background: var(--light-code-background);
} }
@media (prefers-color-scheme: dark) { :root {
--hl-0: var(--dark-hl-0);
--hl-1: var(--dark-hl-1);
--hl-2: var(--dark-hl-2);
--hl-3: var(--dark-hl-3);
--hl-4: var(--dark-hl-4);
--hl-5: var(--dark-hl-5);
--hl-6: var(--dark-hl-6);
--hl-7: var(--dark-hl-7);
--hl-8: var(--dark-hl-8);
--hl-9: var(--dark-hl-9);
--hl-10: var(--dark-hl-10);
--code-background: var(--dark-code-background);
} }
body.light {
--hl-0: var(--light-hl-0);
--hl-1: var(--light-hl-1);
--hl-2: var(--light-hl-2);
--hl-3: var(--light-hl-3);
--hl-4: var(--light-hl-4);
--hl-5: var(--light-hl-5);
--hl-6: var(--light-hl-6);
--hl-7: var(--light-hl-7);
--hl-8: var(--light-hl-8);
--hl-9: var(--light-hl-9);
--hl-10: var(--light-hl-10);
--code-background: var(--light-code-background);
}
body.dark {
--hl-0: var(--dark-hl-0);
--hl-1: var(--dark-hl-1);
--hl-2: var(--dark-hl-2);
--hl-3: var(--dark-hl-3);
--hl-4: var(--dark-hl-4);
--hl-5: var(--dark-hl-5);
--hl-6: var(--dark-hl-6);
--hl-7: var(--dark-hl-7);
--hl-8: var(--dark-hl-8);
--hl-9: var(--dark-hl-9);
--hl-10: var(--dark-hl-10);
--code-background: var(--dark-code-background);
}
.hl-0 { color: var(--hl-0); }
.hl-1 { color: var(--hl-1); }
.hl-2 { color: var(--hl-2); }
.hl-3 { color: var(--hl-3); }
.hl-4 { color: var(--hl-4); }
.hl-5 { color: var(--hl-5); }
.hl-6 { color: var(--hl-6); }
.hl-7 { color: var(--hl-7); }
.hl-8 { color: var(--hl-8); }
.hl-9 { color: var(--hl-9); }
.hl-10 { color: var(--hl-10); }
pre, code { background: var(--code-background); }

1043
docs/assets/icons.css Normal file

File diff suppressed because it is too large Load diff

BIN
docs/assets/icons.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

BIN
docs/assets/icons@2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

52
docs/assets/main.js Normal file

File diff suppressed because one or more lines are too long

1
docs/assets/search.js Normal file

File diff suppressed because one or more lines are too long

1388
docs/assets/style.css Normal file

File diff suppressed because it is too large Load diff

BIN
docs/assets/widgets.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 480 B

BIN
docs/assets/widgets@2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 855 B

File diff suppressed because one or more lines are too long

257
docs/classes/GPIOPort.html Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,12 @@
<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>InvalidAccessError | node-web-gpio</title><meta name="description" content="Documentation for node-web-gpio"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script async src="../assets/search.js" id="search-script"></script></head><body><script>document.body.classList.add(localStorage.getItem("tsd-theme") || "os")</script><header><div class="tsd-page-toolbar"><div class="container"><div class="table-wrap"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption">Search</label><input type="text" id="tsd-search-field"/></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">node-web-gpio</a></div><div class="table-cell" id="tsd-widgets"><div id="tsd-filter"><a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a><div class="tsd-filter-group"><div class="tsd-select" id="tsd-filter-visibility"><span class="tsd-select-label">All</span><ul class="tsd-select-list"><li data-value="public">Public</li><li data-value="protected">Public/Protected</li><li data-value="private" class="selected">All</li></ul></div> <input type="checkbox" id="tsd-filter-inherited" checked/><label class="tsd-widget" for="tsd-filter-inherited">Inherited</label><input type="checkbox" id="tsd-filter-externals" checked/><label class="tsd-widget" for="tsd-filter-externals">Externals</label></div></div><a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a></div></div></div></div><div class="tsd-page-title"><div class="container"><ul class="tsd-breadcrumb"><li><a href="../modules.html">node-web-gpio</a></li><li><a href="InvalidAccessError.html">InvalidAccessError</a></li></ul><h1>Class InvalidAccessError</h1></div></div></header><div class="container container-main"><div class="row"><div class="col-8 col-content"><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><div class="lead">
<p>無効なアクセスエラー</p>
</div></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="tsd-signature-type">Error</span><ul class="tsd-hierarchy"><li><span class="target">InvalidAccessError</span></li></ul></li></ul></section><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Constructors</h3><ul class="tsd-index-list"><li class="tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite"><a href="InvalidAccessError.html#constructor" class="tsd-kind-icon">constructor</a></li></ul></section><section class="tsd-index-section tsd-is-inherited tsd-is-external"><h3>Properties</h3><ul class="tsd-index-list"><li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-external"><a href="InvalidAccessError.html#message" class="tsd-kind-icon">message</a></li><li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-external"><a href="InvalidAccessError.html#name" class="tsd-kind-icon">name</a></li><li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-external"><a href="InvalidAccessError.html#stack" class="tsd-kind-icon">stack</a></li><li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external"><a href="InvalidAccessError.html#prepareStackTrace" class="tsd-kind-icon">prepare<wbr/>Stack<wbr/>Trace</a></li><li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external"><a href="InvalidAccessError.html#stackTraceLimit" class="tsd-kind-icon">stack<wbr/>Trace<wbr/>Limit</a></li></ul></section><section class="tsd-index-section tsd-is-inherited tsd-is-external"><h3>Methods</h3><ul class="tsd-index-list"><li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external"><a href="InvalidAccessError.html#captureStackTrace" class="tsd-kind-icon">capture<wbr/>Stack<wbr/>Trace</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Constructors</h2><section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite"><a id="constructor" class="tsd-anchor"></a><h3>constructor</h3><ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite"><li class="tsd-signature tsd-kind-icon">new <wbr/>Invalid<wbr/>Access<wbr/>Error<span class="tsd-signature-symbol">(</span>message<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="InvalidAccessError.html" class="tsd-signature-type" data-tsd-kind="Class">InvalidAccessError</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Overrides Error.constructor</p><ul><li>Defined in <a href="https://github.com/gurezo/node-web-gpio/blob/53e1150/index.ts#L335">index.ts:335</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Creates an instance of InvalidAccessError.</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>message: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>エラーメッセージ</p>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <a href="InvalidAccessError.html" class="tsd-signature-type" data-tsd-kind="Class">InvalidAccessError</a></h4></li></ul></section></section><section class="tsd-panel-group tsd-member-group tsd-is-inherited tsd-is-external"><h2>Properties</h2><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-external"><a id="message" class="tsd-anchor"></a><h3>message</h3><div class="tsd-signature tsd-kind-icon">message<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><p>Inherited from Error.message</p><ul><li>Defined in node_modules/typescript/lib/lib.es5.d.ts:974</li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-external"><a id="name" class="tsd-anchor"></a><h3>name</h3><div class="tsd-signature tsd-kind-icon">name<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><p>Inherited from Error.name</p><ul><li>Defined in node_modules/typescript/lib/lib.es5.d.ts:973</li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-external"><a id="stack" class="tsd-anchor"></a><h3><span class="tsd-flag ts-flagOptional">Optional</span> stack</h3><div class="tsd-signature tsd-kind-icon">stack<span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><p>Inherited from Error.stack</p><ul><li>Defined in node_modules/typescript/lib/lib.es5.d.ts:975</li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external"><a id="prepareStackTrace" class="tsd-anchor"></a><h3><span class="tsd-flag ts-flagStatic">Static</span> <span class="tsd-flag ts-flagOptional">Optional</span> prepare<wbr/>Stack<wbr/>Trace</h3><div class="tsd-signature tsd-kind-icon">prepare<wbr/>Stack<wbr/>Trace<span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-symbol">(</span>err<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Error</span>, stackTraces<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">CallSite</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> =&gt; </span><span class="tsd-signature-type">any</span></div><aside class="tsd-sources"><p>Inherited from Error.prepareStackTrace</p><ul><li>Defined in node_modules/@types/node/globals.d.ts:11</li></ul></aside><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-kind-type-literal tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span>err<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Error</span>, stackTraces<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">CallSite</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead">
<p>Optional override for formatting stack traces</p>
</div><dl class="tsd-comment-tags"><dt>see</dt><dd><p><a href="https://v8.dev/docs/stack-trace-api#customizing-stack-traces">https://v8.dev/docs/stack-trace-api#customizing-stack-traces</a></p>
</dd></dl></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>err: <span class="tsd-signature-type">Error</span></h5></li><li><h5>stackTraces: <span class="tsd-signature-type">CallSite</span><span class="tsd-signature-symbol">[]</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">any</span></h4></li></ul></li></ul></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external"><a id="stackTraceLimit" class="tsd-anchor"></a><h3><span class="tsd-flag ts-flagStatic">Static</span> stack<wbr/>Trace<wbr/>Limit</h3><div class="tsd-signature tsd-kind-icon">stack<wbr/>Trace<wbr/>Limit<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><p>Inherited from Error.stackTraceLimit</p><ul><li>Defined in node_modules/@types/node/globals.d.ts:13</li></ul></aside></section></section><section class="tsd-panel-group tsd-member-group tsd-is-inherited tsd-is-external"><h2>Methods</h2><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external"><a id="captureStackTrace" class="tsd-anchor"></a><h3><span class="tsd-flag ts-flagStatic">Static</span> capture<wbr/>Stack<wbr/>Trace</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external"><li class="tsd-signature tsd-kind-icon">capture<wbr/>Stack<wbr/>Trace<span class="tsd-signature-symbol">(</span>targetObject<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">object</span>, constructorOpt<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Function</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from Error.captureStackTrace</p><ul><li>Defined in node_modules/@types/node/globals.d.ts:4</li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Create .stack property on a target object</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>targetObject: <span class="tsd-signature-type">object</span></h5></li><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> constructorOpt: <span class="tsd-signature-type">Function</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></section></section></div><div class="col-4 col-menu menu-sticky-wrap menu-highlight"><nav class="tsd-navigation primary"><ul><li class=""><a href="../modules.html">Exports</a></li></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="current tsd-kind-class"><a href="InvalidAccessError.html" class="tsd-kind-icon">Invalid<wbr/>Access<wbr/>Error</a><ul><li class="tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite"><a href="InvalidAccessError.html#constructor" class="tsd-kind-icon">constructor</a></li><li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-external"><a href="InvalidAccessError.html#message" class="tsd-kind-icon">message</a></li><li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-external"><a href="InvalidAccessError.html#name" class="tsd-kind-icon">name</a></li><li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-external"><a href="InvalidAccessError.html#stack" class="tsd-kind-icon">stack</a></li><li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external"><a href="InvalidAccessError.html#prepareStackTrace" class="tsd-kind-icon">prepare<wbr/>Stack<wbr/>Trace</a></li><li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external"><a href="InvalidAccessError.html#stackTraceLimit" class="tsd-kind-icon">stack<wbr/>Trace<wbr/>Limit</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external"><a href="InvalidAccessError.html#captureStackTrace" class="tsd-kind-icon">capture<wbr/>Stack<wbr/>Trace</a></li></ul></li></ul></nav></div></div></div><footer class="with-border-bottom"><div class="container"><h2>Legend</h2><div class="tsd-legend-group"><ul class="tsd-legend"><li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li><li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-constructor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited constructor</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private property</span></li></ul></div><h2>Settings</h2><p>Theme <select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></p></div></footer><div class="container tsd-generator"><p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></div><div class="overlay"></div><script src="../assets/main.js"></script></body></html>

View file

@ -0,0 +1,12 @@
<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>OperationError | node-web-gpio</title><meta name="description" content="Documentation for node-web-gpio"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script async src="../assets/search.js" id="search-script"></script></head><body><script>document.body.classList.add(localStorage.getItem("tsd-theme") || "os")</script><header><div class="tsd-page-toolbar"><div class="container"><div class="table-wrap"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption">Search</label><input type="text" id="tsd-search-field"/></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">node-web-gpio</a></div><div class="table-cell" id="tsd-widgets"><div id="tsd-filter"><a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a><div class="tsd-filter-group"><div class="tsd-select" id="tsd-filter-visibility"><span class="tsd-select-label">All</span><ul class="tsd-select-list"><li data-value="public">Public</li><li data-value="protected">Public/Protected</li><li data-value="private" class="selected">All</li></ul></div> <input type="checkbox" id="tsd-filter-inherited" checked/><label class="tsd-widget" for="tsd-filter-inherited">Inherited</label><input type="checkbox" id="tsd-filter-externals" checked/><label class="tsd-widget" for="tsd-filter-externals">Externals</label></div></div><a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a></div></div></div></div><div class="tsd-page-title"><div class="container"><ul class="tsd-breadcrumb"><li><a href="../modules.html">node-web-gpio</a></li><li><a href="OperationError.html">OperationError</a></li></ul><h1>Class OperationError</h1></div></div></header><div class="container container-main"><div class="row"><div class="col-8 col-content"><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><div class="lead">
<p>操作エラー</p>
</div></div></section><section class="tsd-panel tsd-hierarchy"><h3>Hierarchy</h3><ul class="tsd-hierarchy"><li><span class="tsd-signature-type">Error</span><ul class="tsd-hierarchy"><li><span class="target">OperationError</span></li></ul></li></ul></section><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Constructors</h3><ul class="tsd-index-list"><li class="tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite"><a href="OperationError.html#constructor" class="tsd-kind-icon">constructor</a></li></ul></section><section class="tsd-index-section tsd-is-inherited tsd-is-external"><h3>Properties</h3><ul class="tsd-index-list"><li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-external"><a href="OperationError.html#message" class="tsd-kind-icon">message</a></li><li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-external"><a href="OperationError.html#name" class="tsd-kind-icon">name</a></li><li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-external"><a href="OperationError.html#stack" class="tsd-kind-icon">stack</a></li><li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external"><a href="OperationError.html#prepareStackTrace" class="tsd-kind-icon">prepare<wbr/>Stack<wbr/>Trace</a></li><li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external"><a href="OperationError.html#stackTraceLimit" class="tsd-kind-icon">stack<wbr/>Trace<wbr/>Limit</a></li></ul></section><section class="tsd-index-section tsd-is-inherited tsd-is-external"><h3>Methods</h3><ul class="tsd-index-list"><li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external"><a href="OperationError.html#captureStackTrace" class="tsd-kind-icon">capture<wbr/>Stack<wbr/>Trace</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Constructors</h2><section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite"><a id="constructor" class="tsd-anchor"></a><h3>constructor</h3><ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite"><li class="tsd-signature tsd-kind-icon">new <wbr/>Operation<wbr/>Error<span class="tsd-signature-symbol">(</span>message<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="OperationError.html" class="tsd-signature-type" data-tsd-kind="Class">OperationError</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Overrides Error.constructor</p><ul><li>Defined in <a href="https://github.com/gurezo/node-web-gpio/blob/53e1150/index.ts#L349">index.ts:349</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Creates an instance of OperationError.</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>message: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead">
<p>エラーメッセージ</p>
</div></div></li></ul><h4 class="tsd-returns-title">Returns <a href="OperationError.html" class="tsd-signature-type" data-tsd-kind="Class">OperationError</a></h4></li></ul></section></section><section class="tsd-panel-group tsd-member-group tsd-is-inherited tsd-is-external"><h2>Properties</h2><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-external"><a id="message" class="tsd-anchor"></a><h3>message</h3><div class="tsd-signature tsd-kind-icon">message<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><p>Inherited from Error.message</p><ul><li>Defined in node_modules/typescript/lib/lib.es5.d.ts:974</li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-external"><a id="name" class="tsd-anchor"></a><h3>name</h3><div class="tsd-signature tsd-kind-icon">name<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><p>Inherited from Error.name</p><ul><li>Defined in node_modules/typescript/lib/lib.es5.d.ts:973</li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-external"><a id="stack" class="tsd-anchor"></a><h3><span class="tsd-flag ts-flagOptional">Optional</span> stack</h3><div class="tsd-signature tsd-kind-icon">stack<span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><p>Inherited from Error.stack</p><ul><li>Defined in node_modules/typescript/lib/lib.es5.d.ts:975</li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external"><a id="prepareStackTrace" class="tsd-anchor"></a><h3><span class="tsd-flag ts-flagStatic">Static</span> <span class="tsd-flag ts-flagOptional">Optional</span> prepare<wbr/>Stack<wbr/>Trace</h3><div class="tsd-signature tsd-kind-icon">prepare<wbr/>Stack<wbr/>Trace<span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-symbol">(</span>err<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Error</span>, stackTraces<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">CallSite</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> =&gt; </span><span class="tsd-signature-type">any</span></div><aside class="tsd-sources"><p>Inherited from Error.prepareStackTrace</p><ul><li>Defined in node_modules/@types/node/globals.d.ts:11</li></ul></aside><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-kind-type-literal tsd-parent-kind-class"><li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span>err<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Error</span>, stackTraces<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">CallSite</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead">
<p>Optional override for formatting stack traces</p>
</div><dl class="tsd-comment-tags"><dt>see</dt><dd><p><a href="https://v8.dev/docs/stack-trace-api#customizing-stack-traces">https://v8.dev/docs/stack-trace-api#customizing-stack-traces</a></p>
</dd></dl></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>err: <span class="tsd-signature-type">Error</span></h5></li><li><h5>stackTraces: <span class="tsd-signature-type">CallSite</span><span class="tsd-signature-symbol">[]</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">any</span></h4></li></ul></li></ul></div></section><section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external"><a id="stackTraceLimit" class="tsd-anchor"></a><h3><span class="tsd-flag ts-flagStatic">Static</span> stack<wbr/>Trace<wbr/>Limit</h3><div class="tsd-signature tsd-kind-icon">stack<wbr/>Trace<wbr/>Limit<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources"><p>Inherited from Error.stackTraceLimit</p><ul><li>Defined in node_modules/@types/node/globals.d.ts:13</li></ul></aside></section></section><section class="tsd-panel-group tsd-member-group tsd-is-inherited tsd-is-external"><h2>Methods</h2><section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external"><a id="captureStackTrace" class="tsd-anchor"></a><h3><span class="tsd-flag ts-flagStatic">Static</span> capture<wbr/>Stack<wbr/>Trace</h3><ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external"><li class="tsd-signature tsd-kind-icon">capture<wbr/>Stack<wbr/>Trace<span class="tsd-signature-symbol">(</span>targetObject<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">object</span>, constructorOpt<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Function</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from Error.captureStackTrace</p><ul><li>Defined in node_modules/@types/node/globals.d.ts:4</li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p>Create .stack property on a target object</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>targetObject: <span class="tsd-signature-type">object</span></h5></li><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> constructorOpt: <span class="tsd-signature-type">Function</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></section></section></div><div class="col-4 col-menu menu-sticky-wrap menu-highlight"><nav class="tsd-navigation primary"><ul><li class=""><a href="../modules.html">Exports</a></li></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="current tsd-kind-class"><a href="OperationError.html" class="tsd-kind-icon">Operation<wbr/>Error</a><ul><li class="tsd-kind-constructor tsd-parent-kind-class tsd-is-overwrite"><a href="OperationError.html#constructor" class="tsd-kind-icon">constructor</a></li><li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-external"><a href="OperationError.html#message" class="tsd-kind-icon">message</a></li><li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-external"><a href="OperationError.html#name" class="tsd-kind-icon">name</a></li><li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-external"><a href="OperationError.html#stack" class="tsd-kind-icon">stack</a></li><li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external"><a href="OperationError.html#prepareStackTrace" class="tsd-kind-icon">prepare<wbr/>Stack<wbr/>Trace</a></li><li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external"><a href="OperationError.html#stackTraceLimit" class="tsd-kind-icon">stack<wbr/>Trace<wbr/>Limit</a></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-static tsd-is-external"><a href="OperationError.html#captureStackTrace" class="tsd-kind-icon">capture<wbr/>Stack<wbr/>Trace</a></li></ul></li></ul></nav></div></div></div><footer class="with-border-bottom"><div class="container"><h2>Legend</h2><div class="tsd-legend-group"><ul class="tsd-legend"><li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li><li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-constructor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited constructor</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private property</span></li></ul></div><h2>Settings</h2><p>Theme <select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></p></div></footer><div class="container tsd-generator"><p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></div><div class="overlay"></div><script src="../assets/main.js"></script></body></html>

17
docs/index.html Normal file
View file

@ -0,0 +1,17 @@
<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>node-web-gpio</title><meta name="description" content="Documentation for node-web-gpio"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="assets/style.css"/><link rel="stylesheet" href="assets/highlight.css"/><script async src="assets/search.js" id="search-script"></script></head><body><script>document.body.classList.add(localStorage.getItem("tsd-theme") || "os")</script><header><div class="tsd-page-toolbar"><div class="container"><div class="table-wrap"><div class="table-cell" id="tsd-search" data-base="."><div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption">Search</label><input type="text" id="tsd-search-field"/></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="index.html" class="title">node-web-gpio</a></div><div class="table-cell" id="tsd-widgets"><div id="tsd-filter"><a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a><div class="tsd-filter-group"><div class="tsd-select" id="tsd-filter-visibility"><span class="tsd-select-label">All</span><ul class="tsd-select-list"><li data-value="public">Public</li><li data-value="protected">Public/Protected</li><li data-value="private" class="selected">All</li></ul></div> <input type="checkbox" id="tsd-filter-inherited" checked/><label class="tsd-widget" for="tsd-filter-inherited">Inherited</label><input type="checkbox" id="tsd-filter-externals" checked/><label class="tsd-widget" for="tsd-filter-externals">Externals</label></div></div><a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a></div></div></div></div><div class="tsd-page-title"><div class="container"><h1>node-web-gpio</h1></div></div></header><div class="container container-main"><div class="row"><div class="col-8 col-content"><div class="tsd-panel tsd-typography">
<a href="#node-web-gpio" id="node-web-gpio" style="color: inherit; text-decoration: none;">
<h1>node-web-gpio</h1>
</a>
<p>GPIO access with Node.js</p>
<a href="#usage" id="usage" style="color: inherit; text-decoration: none;">
<h2>Usage</h2>
</a>
<pre><code class="language-js"><span class="hl-0">const</span><span class="hl-1"> { </span><span class="hl-2">requestGPIOAccess</span><span class="hl-1"> } = </span><span class="hl-3">require</span><span class="hl-1">(</span><span class="hl-4">&quot;node-web-gpio&quot;</span><span class="hl-1">);</span><br/><span class="hl-0">const</span><span class="hl-1"> { </span><span class="hl-2">promisify</span><span class="hl-1"> } = </span><span class="hl-3">require</span><span class="hl-1">(</span><span class="hl-4">&quot;util&quot;</span><span class="hl-1">);</span><br/><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">sleep</span><span class="hl-1"> = </span><span class="hl-3">promisify</span><span class="hl-1">(</span><span class="hl-5">setTimeout</span><span class="hl-1">);</span><br/><br/><span class="hl-0">async</span><span class="hl-1"> </span><span class="hl-0">function</span><span class="hl-1"> </span><span class="hl-3">main</span><span class="hl-1">() {</span><br/><span class="hl-1"> </span><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">gpioAccess</span><span class="hl-1"> = </span><span class="hl-6">await</span><span class="hl-1"> </span><span class="hl-3">requestGPIOAccess</span><span class="hl-1">();</span><br/><span class="hl-1"> </span><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">port</span><span class="hl-1"> = </span><span class="hl-5">gpioAccess</span><span class="hl-1">.</span><span class="hl-5">ports</span><span class="hl-1">.</span><span class="hl-3">get</span><span class="hl-1">(</span><span class="hl-7">26</span><span class="hl-1">);</span><br/><br/><span class="hl-1"> </span><span class="hl-6">await</span><span class="hl-1"> </span><span class="hl-5">port</span><span class="hl-1">.</span><span class="hl-3">export</span><span class="hl-1">(</span><span class="hl-4">&quot;out&quot;</span><span class="hl-1">);</span><br/><br/><span class="hl-1"> </span><span class="hl-6">for</span><span class="hl-1"> (;;) {</span><br/><span class="hl-1"> </span><span class="hl-6">await</span><span class="hl-1"> </span><span class="hl-5">port</span><span class="hl-1">.</span><span class="hl-3">write</span><span class="hl-1">(</span><span class="hl-7">1</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-6">await</span><span class="hl-1"> </span><span class="hl-3">sleep</span><span class="hl-1">(</span><span class="hl-7">1000</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-6">await</span><span class="hl-1"> </span><span class="hl-5">port</span><span class="hl-1">.</span><span class="hl-3">write</span><span class="hl-1">(</span><span class="hl-7">0</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-6">await</span><span class="hl-1"> </span><span class="hl-3">sleep</span><span class="hl-1">(</span><span class="hl-7">1000</span><span class="hl-1">);</span><br/><span class="hl-1"> }</span><br/><span class="hl-1">}</span><br/><br/><span class="hl-3">main</span><span class="hl-1">();</span>
</code></pre>
<a href="#document" id="document" style="color: inherit; text-decoration: none;">
<h2>Document</h2>
</a>
<p><a href="http://browserobo.github.io/WebGPIO">Web GPIO API</a></p>
</div></div><div class="col-4 col-menu menu-sticky-wrap menu-highlight"><nav class="tsd-navigation primary"><ul><li class="current"><a href="modules.html">Exports</a></li></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="tsd-kind-class"><a href="classes/GPIOAccess.html" class="tsd-kind-icon">GPIOAccess</a></li><li class="tsd-kind-class"><a href="classes/GPIOPort.html" class="tsd-kind-icon">GPIOPort</a></li><li class="tsd-kind-class"><a href="classes/GPIOPortMap.html" class="tsd-kind-icon">GPIOPort<wbr/>Map</a></li><li class="tsd-kind-class"><a href="classes/InvalidAccessError.html" class="tsd-kind-icon">Invalid<wbr/>Access<wbr/>Error</a></li><li class="tsd-kind-class"><a href="classes/OperationError.html" class="tsd-kind-icon">Operation<wbr/>Error</a></li><li class="tsd-kind-function"><a href="modules.html#requestGPIOAccess" class="tsd-kind-icon">requestGPIOAccess</a></li></ul></nav></div></div></div><footer class="with-border-bottom"><div class="container"><h2>Legend</h2><div class="tsd-legend-group"><ul class="tsd-legend"><li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li><li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-constructor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited constructor</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private property</span></li></ul></div><h2>Settings</h2><p>Theme <select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></p></div></footer><div class="container tsd-generator"><p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></div><div class="overlay"></div><script src="assets/main.js"></script></body></html>

1
docs/modules.html Normal file

File diff suppressed because one or more lines are too long

116
index.ts
View file

@ -7,39 +7,77 @@ import * as path from 'path';
*/
const PollingInterval = 100;
/**
* GPIO
*/
const SysfsGPIOPath = '/sys/class/gpio';
/**
* GPIO
*/
const GPIOPortMapSizeMax = 1024;
/**
* Uint16 Max
*/
const Uint16Max = 65535;
/**
*
* Uint16型変換処理
* @param parseString
* @return Uint16型変換値
*/
function parseUint16(parseString: string) {
const n = Number.parseInt(parseString, 10);
if (0 <= n && n <= Uint16Max) return n;
else throw new RangeError(`Must be between 0 and ${Uint16Max}.`);
}
/** ポート番号 */
type PortNumber = number;
/** ポート名 */
type PortName = string;
/** ピン名 */
type PinName = string;
/** 入出力方向 */
type DirectionMode = 'in' | 'out';
/** GPIO 値 0: LOW / 1: HIGH */
type GPIOValue = 0 | 1;
/**
* GPIO
*/
interface GPIOChangeEvent {
/** 入出力値 */
readonly value: GPIOValue;
/** ポート */
readonly port: GPIOPort;
}
/**
* GPIO
*/
interface GPIOChangeEventHandler {
/** イベント */
(event: GPIOChangeEvent): void;
}
/**
* GPIO
*/
export class GPIOAccess extends EventEmitter {
/** ポート */
private readonly _ports: GPIOPortMap;
/** GPIO チェンジイベントハンドラ */
onchange: GPIOChangeEventHandler | undefined;
/**
* Creates an instance of GPIOAccess.
* @param ports
*/
constructor(ports?: GPIOPortMap) {
super();
@ -55,12 +93,18 @@ export class GPIOAccess extends EventEmitter {
});
}
/**
*
* @return
*/
get ports(): GPIOPortMap {
return this._ports;
}
/**
* Unexport all exported GPIO ports.
*
* @return
*/
async unexportAll(): Promise<void> {
await Promise.all(
@ -76,16 +120,31 @@ export class GPIOAccess extends EventEmitter {
*/
export class GPIOPortMap extends Map<PortNumber, GPIOPort> {}
/**
* GPIO
*/
export class GPIOPort extends EventEmitter {
/** ポート番号 */
private readonly _portNumber: PortNumber;
/** ポーリング間隔 */
private readonly _pollingInterval: number;
/** 入出力方向 */
private _direction: DirectionMode | OperationError;
/** エクスポート */
private _exported: boolean | OperationError;
/** エクスポートリトライ回数 */
private _exportRetry: number;
/** 入出力値 */
private _value: GPIOValue | undefined;
/** タイムアウト値 */
private _timeout: ReturnType<typeof setInterval> | undefined;
/** GPIO チェンジイベントハンドラ */
onchange: GPIOChangeEventHandler | undefined;
/**
* Creates an instance of GPIOPort.
* @param portNumber
*/
constructor(portNumber: PortNumber) {
super();
@ -100,29 +159,54 @@ export class GPIOPort extends EventEmitter {
});
}
/**
*
* @return
*/
get portNumber(): PortNumber {
return this._portNumber;
}
/**
*
* @return
*/
get portName(): PortName {
return `gpio${this.portNumber}`;
}
/**
*
* @return
*/
get pinName(): PinName {
// NOTE: Unknown pinName.
return '';
}
/**
* GPIO getter
* @return GPIO
*/
get direction(): DirectionMode {
if (this._direction instanceof OperationError) throw this._direction;
return this._direction;
}
/**
* GPIO export getter
* @return GPIO
*/
get exported(): boolean {
if (this._exported instanceof OperationError) throw this._exported;
return this._exported;
}
/**
* GPIO
* @param direction GPIO
* @return export
*/
async export(direction: DirectionMode): Promise<void> {
if (!/^(in|out)$/.test(direction)) {
throw new InvalidAccessError(`Must be "in" or "out".`);
@ -169,6 +253,11 @@ export class GPIOPort extends EventEmitter {
this._exported = true;
}
/**
* Unexport exported GPIO ports.
*
* @return
*/
async unexport(): Promise<void> {
clearInterval(this._timeout as ReturnType<typeof setInterval>);
@ -184,6 +273,10 @@ export class GPIOPort extends EventEmitter {
this._exported = false;
}
/**
*
* @return
*/
async read(): Promise<GPIOValue> {
if (!(this.exported && this.direction === 'in')) {
throw new InvalidAccessError(
@ -209,6 +302,10 @@ export class GPIOPort extends EventEmitter {
}
}
/**
*
* @return
*/
async write(value: GPIOValue): Promise<void> {
if (!(this.exported && this.direction === 'out')) {
throw new InvalidAccessError(
@ -227,14 +324,28 @@ export class GPIOPort extends EventEmitter {
}
}
/**
*
*/
export class InvalidAccessError extends Error {
/**
* Creates an instance of InvalidAccessError.
* @param message
*/
constructor(message: string) {
super(message);
this.name = this.constructor.name;
}
}
/**
*
*/
export class OperationError extends Error {
/**
* Creates an instance of OperationError.
* @param message
*/
constructor(message: string) {
super(message);
this.name = this.constructor.name;
@ -254,6 +365,11 @@ export async function requestGPIOAccess(): Promise<GPIOAccess> {
return new GPIOAccess(ports);
}
/**
*
* @param ms
* @return
*/
function sleep(ms: number) {
return new Promise((resolve) => {
return setTimeout(resolve, ms);

View file

@ -1,6 +1,6 @@
{
"name": "node-web-gpio",
"version": "1.0.12",
"version": "1.0.13",
"description": "GPIO access with Node.js",
"main": "dist/index.js",
"types": "dist/index.d.ts",
@ -21,13 +21,17 @@
"husky": "^7.0.4",
"lint-staged": "^12.1.2",
"prettier": "^2.5.1",
"typedoc": "^0.22.10",
"typescript": "^4.2.3"
},
"scripts": {
"build": "tsc",
"lint": "eslint index.ts",
"prepare": "husky install && rm -rf dist && npm run build",
"precommit": "lint-staged"
"precommit": "lint-staged",
"docs": "npm run remove:docs && npm run typedoc -- --options typedoc.json --exclude '**/*.spec.ts' ./ README.md",
"typedoc": "typedoc",
"remove:docs": "rm -rf docs"
},
"keywords": [
"gpio",

4
typedoc.json Normal file
View file

@ -0,0 +1,4 @@
{
"entryPoints": ["index.ts"],
"out": "docs"
}

1903
yarn.lock

File diff suppressed because it is too large Load diff