obniz
Version:
obniz sdk for javascript
113 lines (62 loc) • 2.39 kB
Markdown
# <a name="logicAnalyzer">logicAnalyzer</a>
Monitor io logic level changes by sampling io.
## request: <a name="-request-logicanalyzer-init">init</a>
| path | type | conditions | description |
|:---- |:---- |:---- |:---- |
| `logic_analyzer.io[]` | [pinSetting](#pinsetting) | <ul><li>required</li></ul> | |
| `logic_analyzer.interval` | number | <ul><li>required</li><li>0 < value</li></ul> | |
| `logic_analyzer.duration` | integer | <ul><li>required</li><li>0 < value</li></ul> | |
| `logic_analyzer.trigger.value` | boolean | <ul><li>required</li></ul> | start value |
| `logic_analyzer.trigger.samples` | integer | <ul><li>required</li><li>0 ≤ value</li></ul> | how that values consists |
With below sample code, you will receive only data which start with 'false, false, false' 3bit.
```
// Json Example
[
{
"logic_analyzer": {
"io": [ 0],
"interval": 500,
"duration": 500,
"trigger": {
"value": false,
"samples": 3
}
}
}
]
```
## request: <a name="-request-logicanalyzer-deinit">deinit</a>
| path | type | conditions | description |
|:---- |:---- |:---- |:---- |
| `logic_analyzer` | null | <ul><li>required</li></ul> | |
```
// Json Example
[
{
"logic_analyzer": null
}
]
```
## response: <a name="-response-logicanalyzer-data">data</a>
| path | type | conditions | description |
|:---- |:---- |:---- |:---- |
| `logic_analyzer.data` | [bitArray](#bitarray) | <ul><li>required</li></ul> | |
```
//Response Example
[
{
"logic_analyzer": {
"data": [0, 1, 1, 0, 0, 1, 1, 0]
}
}
]
```
# type defines
## <a name="bitarray">bitArray</a>
| type | conditions | examples | description |
|:----|:----|:----|:----|
| array | <ul><li>items<br/><ul><li>0 ≤ value ≤ 1</li></ul></li></ul> | <ul><li>`[0, 1, 1, 0, 0, 1, 1, 0]`</li><li>`[0, 0, 1, 0, 0, 0, 0, 0]`</li></ul> | Binary data array represented in 0 1. |
## <a name="pinsetting">pinSetting</a>
| type | conditions | examples | description |
|:----|:----|:----|:----|
| integer | <ul><li>0 ≤ value ≤ 11</li></ul> | <ul><li>`0`</li><li>`1`</li><li>`2`</li><li>`3`</li><li>`4`</li><li>`5`</li><li>`6`</li></ul> | |