Merge pull request #1256 from xodio/refactor-1241-extract-gpio-nodes
Extract gpio nodes
@@ -57,7 +57,7 @@ correctness. Here is our patch:
|
||||
|
||||

|
||||
|
||||
Bind the `PORT` value of `analog-input` to the board pin number you’ve
|
||||
Bind the `PORT` value of `analog-sensor` to the board pin number you’ve
|
||||
connected the sensor. Upload with debugger enabled, slowly move a book or sheet
|
||||
of paper ahead of the sensor and observe value change. Do measurements look
|
||||
realistic? Cool! We have a “body” for our new node.
|
||||
|
||||
@@ -3,178 +3,178 @@
|
||||
"patches": {
|
||||
"@/main": {
|
||||
"comments": {
|
||||
"BJt6agslz": {
|
||||
"id": "BJt6agslz",
|
||||
"position": {
|
||||
"x": 204,
|
||||
"y": 102
|
||||
},
|
||||
"size": {
|
||||
"width": 136,
|
||||
"height": 51
|
||||
},
|
||||
"content": "Multiply by 5 to get the voltage level"
|
||||
},
|
||||
"BJ8kCxoez": {
|
||||
"content": "Map the voltage to inverse distance (1/cm)",
|
||||
"id": "BJ8kCxoez",
|
||||
"position": {
|
||||
"x": 306,
|
||||
"y": 204
|
||||
},
|
||||
"size": {
|
||||
"width": 136,
|
||||
"height": 51
|
||||
"height": 51,
|
||||
"width": 136
|
||||
}
|
||||
},
|
||||
"BJt6agslz": {
|
||||
"content": "Multiply by 5 to get the voltage level",
|
||||
"id": "BJt6agslz",
|
||||
"position": {
|
||||
"x": 204,
|
||||
"y": 102
|
||||
},
|
||||
"content": "Map the voltage to inverse distance (1/cm)"
|
||||
"size": {
|
||||
"height": 51,
|
||||
"width": 136
|
||||
}
|
||||
},
|
||||
"BkgWAgjeM": {
|
||||
"content": "Invert the distance",
|
||||
"id": "BkgWAgjeM",
|
||||
"position": {
|
||||
"x": 170,
|
||||
"y": 306
|
||||
},
|
||||
"size": {
|
||||
"width": 136,
|
||||
"height": 51
|
||||
},
|
||||
"content": "Invert the distance"
|
||||
"height": 51,
|
||||
"width": 136
|
||||
}
|
||||
},
|
||||
"HksWAeoeG": {
|
||||
"content": "Divide by 100 to convert centimeters to meters",
|
||||
"id": "HksWAeoeG",
|
||||
"position": {
|
||||
"x": 170,
|
||||
"y": 408
|
||||
},
|
||||
"size": {
|
||||
"width": 170,
|
||||
"height": 51
|
||||
},
|
||||
"content": "Divide by 100 to convert centimeters to meters"
|
||||
"height": 51,
|
||||
"width": 170
|
||||
}
|
||||
}
|
||||
},
|
||||
"links": {
|
||||
"SJHwjejlM": {
|
||||
"id": "SJHwjejlM",
|
||||
"output": {
|
||||
"nodeId": "BkdmixilM",
|
||||
"pinKey": "BkQzLCurwJZ"
|
||||
},
|
||||
"input": {
|
||||
"nodeId": "HkbVixief",
|
||||
"pinKey": "BJlzICOSv1-"
|
||||
}
|
||||
},
|
||||
"Bywwsligz": {
|
||||
"id": "Bywwsligz",
|
||||
"output": {
|
||||
"nodeId": "BJbZigolM",
|
||||
"pinKey": "SyBtREhlW"
|
||||
},
|
||||
"input": {
|
||||
"nodeId": "BkdmixilM",
|
||||
"pinKey": "B1GfLR_SPk-"
|
||||
}
|
||||
},
|
||||
"HkWdsljlG": {
|
||||
"id": "HkWdsljlG",
|
||||
"output": {
|
||||
"nodeId": "HkbVixief",
|
||||
"pinKey": "H12bIR_SPyZ"
|
||||
},
|
||||
"input": {
|
||||
"nodeId": "BkADjeolG",
|
||||
"pinKey": "BytUCdHD1-"
|
||||
},
|
||||
"output": {
|
||||
"nodeId": "HkbVixief",
|
||||
"pinKey": "H12bIR_SPyZ"
|
||||
}
|
||||
},
|
||||
"Hkhi-o0JX": {
|
||||
"id": "Hkhi-o0JX",
|
||||
"input": {
|
||||
"nodeId": "BkdmixilM",
|
||||
"pinKey": "B1GfLR_SPk-"
|
||||
},
|
||||
"output": {
|
||||
"nodeId": "B1pqWsCkQ",
|
||||
"pinKey": "BkoeN9Ay7"
|
||||
}
|
||||
},
|
||||
"Hypdsxsez": {
|
||||
"id": "Hypdsxsez",
|
||||
"output": {
|
||||
"nodeId": "BkADjeolG",
|
||||
"pinKey": "BkqLCOSw1W"
|
||||
},
|
||||
"input": {
|
||||
"nodeId": "Byjusxilz",
|
||||
"pinKey": "SkdIRuBD1b"
|
||||
},
|
||||
"output": {
|
||||
"nodeId": "BkADjeolG",
|
||||
"pinKey": "BkqLCOSw1W"
|
||||
}
|
||||
},
|
||||
"SJHwjejlM": {
|
||||
"id": "SJHwjejlM",
|
||||
"input": {
|
||||
"nodeId": "HkbVixief",
|
||||
"pinKey": "BJlzICOSv1-"
|
||||
},
|
||||
"output": {
|
||||
"nodeId": "BkdmixilM",
|
||||
"pinKey": "BkQzLCurwJZ"
|
||||
}
|
||||
},
|
||||
"ry_FilolM": {
|
||||
"id": "ry_FilolM",
|
||||
"output": {
|
||||
"nodeId": "Byjusxilz",
|
||||
"pinKey": "BkqLCOSw1W"
|
||||
},
|
||||
"input": {
|
||||
"nodeId": "HyIFsxjgG",
|
||||
"pinKey": "HkXK-dGob"
|
||||
},
|
||||
"output": {
|
||||
"nodeId": "Byjusxilz",
|
||||
"pinKey": "BkqLCOSw1W"
|
||||
}
|
||||
}
|
||||
},
|
||||
"nodes": {
|
||||
"BJbZigolM": {
|
||||
"id": "BJbZigolM",
|
||||
"type": "xod/core/analog-input",
|
||||
"B1pqWsCkQ": {
|
||||
"id": "B1pqWsCkQ",
|
||||
"position": {
|
||||
"x": 102,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"BkdmixilM": {
|
||||
"id": "BkdmixilM",
|
||||
"type": "xod/core/multiply",
|
||||
"position": {
|
||||
"x": 102,
|
||||
"y": 102
|
||||
},
|
||||
"boundValues": {
|
||||
"SJ4zUC_BD1-": 5
|
||||
}
|
||||
},
|
||||
"HkbVixief": {
|
||||
"id": "HkbVixief",
|
||||
"type": "xod/math/map",
|
||||
"position": {
|
||||
"x": 102,
|
||||
"y": 204
|
||||
},
|
||||
"boundValues": {
|
||||
"ry1z8CuBDy-": 1.25,
|
||||
"HJCWLAdSwyW": 2,
|
||||
"rJbGU0_Hv1Z": 0.02,
|
||||
"rkpbU0OrwyZ": 0.033
|
||||
}
|
||||
"type": "xod/common-hardware/analog-sensor"
|
||||
},
|
||||
"BkADjeolG": {
|
||||
"boundLiterals": {
|
||||
"SkdIRuBD1b": "1"
|
||||
},
|
||||
"id": "BkADjeolG",
|
||||
"type": "xod/core/divide",
|
||||
"position": {
|
||||
"x": 68,
|
||||
"y": 306
|
||||
},
|
||||
"boundValues": {
|
||||
"SkdIRuBD1b": 1
|
||||
}
|
||||
"type": "xod/core/divide"
|
||||
},
|
||||
"BkdmixilM": {
|
||||
"boundLiterals": {
|
||||
"SJ4zUC_BD1-": "5"
|
||||
},
|
||||
"id": "BkdmixilM",
|
||||
"position": {
|
||||
"x": 102,
|
||||
"y": 102
|
||||
},
|
||||
"type": "xod/core/multiply"
|
||||
},
|
||||
"Byjusxilz": {
|
||||
"boundLiterals": {
|
||||
"BytUCdHD1-": "100"
|
||||
},
|
||||
"id": "Byjusxilz",
|
||||
"type": "xod/core/divide",
|
||||
"position": {
|
||||
"x": 68,
|
||||
"y": 408
|
||||
},
|
||||
"boundValues": {
|
||||
"BytUCdHD1-": 100
|
||||
}
|
||||
"type": "xod/core/divide"
|
||||
},
|
||||
"HkbVixief": {
|
||||
"boundLiterals": {
|
||||
"HJCWLAdSwyW": "2",
|
||||
"rJbGU0_Hv1Z": "0.02",
|
||||
"rkpbU0OrwyZ": "0.033",
|
||||
"ry1z8CuBDy-": "1.25"
|
||||
},
|
||||
"id": "HkbVixief",
|
||||
"position": {
|
||||
"x": 102,
|
||||
"y": 204
|
||||
},
|
||||
"type": "xod/math/map"
|
||||
},
|
||||
"HyIFsxjgG": {
|
||||
"id": "HyIFsxjgG",
|
||||
"type": "xod/core/watch",
|
||||
"position": {
|
||||
"x": 68,
|
||||
"y": 510
|
||||
}
|
||||
},
|
||||
"type": "xod/core/watch"
|
||||
}
|
||||
},
|
||||
"path": "@/main"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,235 +1,235 @@
|
||||
{
|
||||
"name": "sharp-irm",
|
||||
"patches": {
|
||||
"@/main": {
|
||||
"links": {
|
||||
"BJlK0ljez": {
|
||||
"id": "BJlK0ljez",
|
||||
"output": {
|
||||
"nodeId": "BytOAxolG",
|
||||
"pinKey": "SkTw0gjgf"
|
||||
},
|
||||
"input": {
|
||||
"nodeId": "HyIFsxjgG",
|
||||
"pinKey": "HkXK-dGob"
|
||||
}
|
||||
}
|
||||
},
|
||||
"nodes": {
|
||||
"HyIFsxjgG": {
|
||||
"id": "HyIFsxjgG",
|
||||
"type": "xod/core/watch",
|
||||
"position": {
|
||||
"x": 68,
|
||||
"y": 204
|
||||
}
|
||||
},
|
||||
"BytOAxolG": {
|
||||
"id": "BytOAxolG",
|
||||
"type": "@/gp2y0a02-range-meter",
|
||||
"position": {
|
||||
"x": 68,
|
||||
"y": 102
|
||||
}
|
||||
}
|
||||
},
|
||||
"path": "@/main"
|
||||
},
|
||||
"@/gp2y0a02-range-meter": {
|
||||
"nodes": {
|
||||
"HkRSAlixf": {
|
||||
"id": "HkRSAlixf",
|
||||
"type": "xod/core/analog-input",
|
||||
"position": {
|
||||
"x": 68,
|
||||
"y": 102
|
||||
}
|
||||
},
|
||||
"Skg0rRxjeM": {
|
||||
"id": "Skg0rRxjeM",
|
||||
"type": "xod/core/multiply",
|
||||
"position": {
|
||||
"x": 68,
|
||||
"y": 204
|
||||
},
|
||||
"boundValues": {
|
||||
"SJ4zUC_BD1-": 5
|
||||
}
|
||||
},
|
||||
"HkWRBRxigf": {
|
||||
"id": "HkWRBRxigf",
|
||||
"type": "xod/math/map",
|
||||
"position": {
|
||||
"x": 68,
|
||||
"y": 306
|
||||
},
|
||||
"boundValues": {
|
||||
"ry1z8CuBDy-": 1.25,
|
||||
"HJCWLAdSwyW": 2,
|
||||
"rJbGU0_Hv1Z": 0.02,
|
||||
"rkpbU0OrwyZ": 0.033
|
||||
}
|
||||
},
|
||||
"SyfABRgjgG": {
|
||||
"id": "SyfABRgjgG",
|
||||
"type": "xod/core/divide",
|
||||
"position": {
|
||||
"x": 34,
|
||||
"y": 408
|
||||
},
|
||||
"boundValues": {
|
||||
"SkdIRuBD1b": 1
|
||||
}
|
||||
},
|
||||
"rJQABAgilM": {
|
||||
"id": "rJQABAgilM",
|
||||
"type": "xod/core/divide",
|
||||
"position": {
|
||||
"x": 34,
|
||||
"y": 510
|
||||
},
|
||||
"boundValues": {
|
||||
"BytUCdHD1-": 100
|
||||
}
|
||||
},
|
||||
"HJ7vCgjef": {
|
||||
"id": "HJ7vCgjef",
|
||||
"type": "xod/patch-nodes/input-number",
|
||||
"position": {
|
||||
"x": 68,
|
||||
"y": 0
|
||||
},
|
||||
"label": "PORT"
|
||||
},
|
||||
"SkTw0gjgf": {
|
||||
"id": "SkTw0gjgf",
|
||||
"type": "xod/patch-nodes/output-number",
|
||||
"position": {
|
||||
"x": 34,
|
||||
"y": 612
|
||||
},
|
||||
"label": "Dm"
|
||||
}
|
||||
},
|
||||
"links": {
|
||||
"Hy4CHCeigf": {
|
||||
"id": "Hy4CHCeigf",
|
||||
"output": {
|
||||
"nodeId": "Skg0rRxjeM",
|
||||
"pinKey": "BkQzLCurwJZ"
|
||||
},
|
||||
"input": {
|
||||
"nodeId": "HkWRBRxigf",
|
||||
"pinKey": "BJlzICOSv1-"
|
||||
}
|
||||
},
|
||||
"rkHCSAxslf": {
|
||||
"id": "rkHCSAxslf",
|
||||
"output": {
|
||||
"nodeId": "HkRSAlixf",
|
||||
"pinKey": "SyBtREhlW"
|
||||
},
|
||||
"input": {
|
||||
"nodeId": "Skg0rRxjeM",
|
||||
"pinKey": "B1GfLR_SPk-"
|
||||
}
|
||||
},
|
||||
"BJ80H0xixG": {
|
||||
"id": "BJ80H0xixG",
|
||||
"output": {
|
||||
"nodeId": "HkWRBRxigf",
|
||||
"pinKey": "H12bIR_SPyZ"
|
||||
},
|
||||
"input": {
|
||||
"nodeId": "SyfABRgjgG",
|
||||
"pinKey": "BytUCdHD1-"
|
||||
}
|
||||
},
|
||||
"BJw0SRgoeG": {
|
||||
"id": "BJw0SRgoeG",
|
||||
"output": {
|
||||
"nodeId": "SyfABRgjgG",
|
||||
"pinKey": "BkqLCOSw1W"
|
||||
},
|
||||
"input": {
|
||||
"nodeId": "rJQABAgilM",
|
||||
"pinKey": "SkdIRuBD1b"
|
||||
}
|
||||
},
|
||||
"ByHvAgilf": {
|
||||
"id": "ByHvAgilf",
|
||||
"output": {
|
||||
"nodeId": "HJ7vCgjef",
|
||||
"pinKey": "__out__"
|
||||
},
|
||||
"input": {
|
||||
"nodeId": "HkRSAlixf",
|
||||
"pinKey": "BJuORNheZ"
|
||||
}
|
||||
},
|
||||
"rkxd0lixz": {
|
||||
"id": "rkxd0lixz",
|
||||
"output": {
|
||||
"nodeId": "rJQABAgilM",
|
||||
"pinKey": "BkqLCOSw1W"
|
||||
},
|
||||
"input": {
|
||||
"nodeId": "SkTw0gjgf",
|
||||
"pinKey": "__in__"
|
||||
}
|
||||
}
|
||||
},
|
||||
"comments": {
|
||||
"SJu0H0xsxz": {
|
||||
"id": "SJu0H0xsxz",
|
||||
"position": {
|
||||
"x": 170,
|
||||
"y": 204
|
||||
},
|
||||
"size": {
|
||||
"width": 136,
|
||||
"height": 51
|
||||
},
|
||||
"content": "Multiply by 5 to get the voltage level"
|
||||
},
|
||||
"H1FCSCxsxf": {
|
||||
"id": "H1FCSCxsxf",
|
||||
"position": {
|
||||
"x": 272,
|
||||
"y": 306
|
||||
},
|
||||
"size": {
|
||||
"width": 136,
|
||||
"height": 51
|
||||
},
|
||||
"content": "Map the voltage to inverse distance (1/cm)"
|
||||
},
|
||||
"rJqArResef": {
|
||||
"id": "rJqArResef",
|
||||
"position": {
|
||||
"x": 136,
|
||||
"y": 408
|
||||
},
|
||||
"size": {
|
||||
"width": 136,
|
||||
"height": 51
|
||||
},
|
||||
"content": "Invert the distance"
|
||||
},
|
||||
"Bko0B0xsgz": {
|
||||
"content": "Divide by 100 to convert centimeters to meters",
|
||||
"id": "Bko0B0xsgz",
|
||||
"position": {
|
||||
"x": 136,
|
||||
"y": 510
|
||||
},
|
||||
"size": {
|
||||
"width": 170,
|
||||
"height": 51
|
||||
"height": 51,
|
||||
"width": 170
|
||||
}
|
||||
},
|
||||
"H1FCSCxsxf": {
|
||||
"content": "Map the voltage to inverse distance (1/cm)",
|
||||
"id": "H1FCSCxsxf",
|
||||
"position": {
|
||||
"x": 272,
|
||||
"y": 306
|
||||
},
|
||||
"content": "Divide by 100 to convert centimeters to meters"
|
||||
"size": {
|
||||
"height": 51,
|
||||
"width": 136
|
||||
}
|
||||
},
|
||||
"SJu0H0xsxz": {
|
||||
"content": "Multiply by 5 to get the voltage level",
|
||||
"id": "SJu0H0xsxz",
|
||||
"position": {
|
||||
"x": 170,
|
||||
"y": 204
|
||||
},
|
||||
"size": {
|
||||
"height": 51,
|
||||
"width": 136
|
||||
}
|
||||
},
|
||||
"rJqArResef": {
|
||||
"content": "Invert the distance",
|
||||
"id": "rJqArResef",
|
||||
"position": {
|
||||
"x": 136,
|
||||
"y": 408
|
||||
},
|
||||
"size": {
|
||||
"height": 51,
|
||||
"width": 136
|
||||
}
|
||||
}
|
||||
},
|
||||
"links": {
|
||||
"B1PAWsRJX": {
|
||||
"id": "B1PAWsRJX",
|
||||
"input": {
|
||||
"nodeId": "Skg0rRxjeM",
|
||||
"pinKey": "B1GfLR_SPk-"
|
||||
},
|
||||
"output": {
|
||||
"nodeId": "Hksa-sCJX",
|
||||
"pinKey": "BkoeN9Ay7"
|
||||
}
|
||||
},
|
||||
"BJ80H0xixG": {
|
||||
"id": "BJ80H0xixG",
|
||||
"input": {
|
||||
"nodeId": "SyfABRgjgG",
|
||||
"pinKey": "BytUCdHD1-"
|
||||
},
|
||||
"output": {
|
||||
"nodeId": "HkWRBRxigf",
|
||||
"pinKey": "H12bIR_SPyZ"
|
||||
}
|
||||
},
|
||||
"BJw0SRgoeG": {
|
||||
"id": "BJw0SRgoeG",
|
||||
"input": {
|
||||
"nodeId": "rJQABAgilM",
|
||||
"pinKey": "SkdIRuBD1b"
|
||||
},
|
||||
"output": {
|
||||
"nodeId": "SyfABRgjgG",
|
||||
"pinKey": "BkqLCOSw1W"
|
||||
}
|
||||
},
|
||||
"Hy4CHCeigf": {
|
||||
"id": "Hy4CHCeigf",
|
||||
"input": {
|
||||
"nodeId": "HkWRBRxigf",
|
||||
"pinKey": "BJlzICOSv1-"
|
||||
},
|
||||
"output": {
|
||||
"nodeId": "Skg0rRxjeM",
|
||||
"pinKey": "BkQzLCurwJZ"
|
||||
}
|
||||
},
|
||||
"rk8AWoCJQ": {
|
||||
"id": "rk8AWoCJQ",
|
||||
"input": {
|
||||
"nodeId": "Hksa-sCJX",
|
||||
"pinKey": "r1l3XcR17"
|
||||
},
|
||||
"output": {
|
||||
"nodeId": "ry-CZiAk7",
|
||||
"pinKey": "__out__"
|
||||
}
|
||||
},
|
||||
"rkxd0lixz": {
|
||||
"id": "rkxd0lixz",
|
||||
"input": {
|
||||
"nodeId": "SkTw0gjgf",
|
||||
"pinKey": "__in__"
|
||||
},
|
||||
"output": {
|
||||
"nodeId": "rJQABAgilM",
|
||||
"pinKey": "BkqLCOSw1W"
|
||||
}
|
||||
}
|
||||
},
|
||||
"nodes": {
|
||||
"HkWRBRxigf": {
|
||||
"boundLiterals": {
|
||||
"HJCWLAdSwyW": "2",
|
||||
"rJbGU0_Hv1Z": "0.02",
|
||||
"rkpbU0OrwyZ": "0.033",
|
||||
"ry1z8CuBDy-": "1.25"
|
||||
},
|
||||
"id": "HkWRBRxigf",
|
||||
"position": {
|
||||
"x": 68,
|
||||
"y": 306
|
||||
},
|
||||
"type": "xod/math/map"
|
||||
},
|
||||
"Hksa-sCJX": {
|
||||
"id": "Hksa-sCJX",
|
||||
"position": {
|
||||
"x": 68,
|
||||
"y": 102
|
||||
},
|
||||
"type": "xod/common-hardware/analog-sensor"
|
||||
},
|
||||
"SkTw0gjgf": {
|
||||
"id": "SkTw0gjgf",
|
||||
"label": "Dm",
|
||||
"position": {
|
||||
"x": 34,
|
||||
"y": 612
|
||||
},
|
||||
"type": "xod/patch-nodes/output-number"
|
||||
},
|
||||
"Skg0rRxjeM": {
|
||||
"boundLiterals": {
|
||||
"SJ4zUC_BD1-": "5"
|
||||
},
|
||||
"id": "Skg0rRxjeM",
|
||||
"position": {
|
||||
"x": 68,
|
||||
"y": 204
|
||||
},
|
||||
"type": "xod/core/multiply"
|
||||
},
|
||||
"SyfABRgjgG": {
|
||||
"boundLiterals": {
|
||||
"SkdIRuBD1b": "1"
|
||||
},
|
||||
"id": "SyfABRgjgG",
|
||||
"position": {
|
||||
"x": 34,
|
||||
"y": 408
|
||||
},
|
||||
"type": "xod/core/divide"
|
||||
},
|
||||
"rJQABAgilM": {
|
||||
"boundLiterals": {
|
||||
"BytUCdHD1-": "100"
|
||||
},
|
||||
"id": "rJQABAgilM",
|
||||
"position": {
|
||||
"x": 34,
|
||||
"y": 510
|
||||
},
|
||||
"type": "xod/core/divide"
|
||||
},
|
||||
"ry-CZiAk7": {
|
||||
"id": "ry-CZiAk7",
|
||||
"label": "PORT",
|
||||
"position": {
|
||||
"x": 68,
|
||||
"y": 0
|
||||
},
|
||||
"type": "xod/patch-nodes/input-port"
|
||||
}
|
||||
},
|
||||
"path": "@/gp2y0a02-range-meter"
|
||||
},
|
||||
"@/main": {
|
||||
"links": {
|
||||
"BJlK0ljez": {
|
||||
"id": "BJlK0ljez",
|
||||
"input": {
|
||||
"nodeId": "HyIFsxjgG",
|
||||
"pinKey": "HkXK-dGob"
|
||||
},
|
||||
"output": {
|
||||
"nodeId": "BytOAxolG",
|
||||
"pinKey": "SkTw0gjgf"
|
||||
}
|
||||
}
|
||||
},
|
||||
"nodes": {
|
||||
"BytOAxolG": {
|
||||
"id": "BytOAxolG",
|
||||
"position": {
|
||||
"x": 68,
|
||||
"y": 102
|
||||
},
|
||||
"type": "@/gp2y0a02-range-meter"
|
||||
},
|
||||
"HyIFsxjgG": {
|
||||
"id": "HyIFsxjgG",
|
||||
"position": {
|
||||
"x": 68,
|
||||
"y": 204
|
||||
},
|
||||
"type": "xod/core/watch"
|
||||
}
|
||||
},
|
||||
"path": "@/main"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,355 +1,355 @@
|
||||
{
|
||||
"name": "sharp-irm",
|
||||
"patches": {
|
||||
"@/main": {
|
||||
"comments": {
|
||||
"HJcjI-olf": {
|
||||
"id": "HJcjI-olf",
|
||||
"position": {
|
||||
"x": 204,
|
||||
"y": 102
|
||||
},
|
||||
"size": {
|
||||
"width": 136,
|
||||
"height": 51
|
||||
},
|
||||
"content": "Look! We can read three sensors at once"
|
||||
}
|
||||
},
|
||||
"links": {
|
||||
"BJlK0ljez": {
|
||||
"id": "BJlK0ljez",
|
||||
"output": {
|
||||
"nodeId": "BytOAxolG",
|
||||
"pinKey": "SkTw0gjgf"
|
||||
},
|
||||
"input": {
|
||||
"nodeId": "HyIFsxjgG",
|
||||
"pinKey": "HkXK-dGob"
|
||||
}
|
||||
},
|
||||
"Hy-YhGZjez": {
|
||||
"id": "Hy-YhGZjez",
|
||||
"output": {
|
||||
"nodeId": "H1xY2GWjez",
|
||||
"pinKey": "SkTw0gjgf"
|
||||
},
|
||||
"input": {
|
||||
"nodeId": "HJF3MWjgG",
|
||||
"pinKey": "HkXK-dGob"
|
||||
}
|
||||
},
|
||||
"HJWihGWsxG": {
|
||||
"id": "HJWihGWsxG",
|
||||
"output": {
|
||||
"nodeId": "Hyxo2G-jxf",
|
||||
"pinKey": "SkTw0gjgf"
|
||||
},
|
||||
"input": {
|
||||
"nodeId": "B1s3zWoeM",
|
||||
"pinKey": "HkXK-dGob"
|
||||
}
|
||||
}
|
||||
},
|
||||
"nodes": {
|
||||
"HyIFsxjgG": {
|
||||
"id": "HyIFsxjgG",
|
||||
"type": "xod/core/watch",
|
||||
"position": {
|
||||
"x": -68,
|
||||
"y": 204
|
||||
}
|
||||
},
|
||||
"BytOAxolG": {
|
||||
"id": "BytOAxolG",
|
||||
"type": "@/gp2y0a02-range-meter",
|
||||
"position": {
|
||||
"x": -68,
|
||||
"y": 102
|
||||
},
|
||||
"boundValues": {
|
||||
"HJ7vCgjef": 1
|
||||
}
|
||||
},
|
||||
"HJF3MWjgG": {
|
||||
"id": "HJF3MWjgG",
|
||||
"type": "xod/core/watch",
|
||||
"position": {
|
||||
"x": -204,
|
||||
"y": 204
|
||||
}
|
||||
},
|
||||
"H1xY2GWjez": {
|
||||
"id": "H1xY2GWjez",
|
||||
"type": "@/gp2y0a02-range-meter",
|
||||
"position": {
|
||||
"x": -204,
|
||||
"y": 102
|
||||
}
|
||||
},
|
||||
"B1s3zWoeM": {
|
||||
"id": "B1s3zWoeM",
|
||||
"type": "xod/core/watch",
|
||||
"position": {
|
||||
"x": 68,
|
||||
"y": 204
|
||||
}
|
||||
},
|
||||
"Hyxo2G-jxf": {
|
||||
"id": "Hyxo2G-jxf",
|
||||
"type": "@/gp2y0a02-range-meter",
|
||||
"position": {
|
||||
"x": 68,
|
||||
"y": 102
|
||||
},
|
||||
"boundValues": {
|
||||
"HJ7vCgjef": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
"path": "@/main"
|
||||
},
|
||||
"@/gp2y0a02-range-meter": {
|
||||
"nodes": {
|
||||
"HkRSAlixf": {
|
||||
"id": "HkRSAlixf",
|
||||
"type": "xod/core/analog-input",
|
||||
"position": {
|
||||
"x": 68,
|
||||
"y": 102
|
||||
}
|
||||
},
|
||||
"Skg0rRxjeM": {
|
||||
"id": "Skg0rRxjeM",
|
||||
"type": "xod/core/multiply",
|
||||
"position": {
|
||||
"x": 68,
|
||||
"y": 306
|
||||
},
|
||||
"boundValues": {
|
||||
"SJ4zUC_BD1-": 5
|
||||
}
|
||||
},
|
||||
"HkWRBRxigf": {
|
||||
"id": "HkWRBRxigf",
|
||||
"type": "xod/math/map",
|
||||
"position": {
|
||||
"x": 68,
|
||||
"y": 408
|
||||
},
|
||||
"boundValues": {
|
||||
"ry1z8CuBDy-": 1.25,
|
||||
"HJCWLAdSwyW": 2,
|
||||
"rJbGU0_Hv1Z": 0.02,
|
||||
"rkpbU0OrwyZ": 0.033
|
||||
}
|
||||
},
|
||||
"SyfABRgjgG": {
|
||||
"id": "SyfABRgjgG",
|
||||
"type": "xod/core/divide",
|
||||
"position": {
|
||||
"x": 34,
|
||||
"y": 510
|
||||
},
|
||||
"boundValues": {
|
||||
"SkdIRuBD1b": 1
|
||||
}
|
||||
},
|
||||
"rJQABAgilM": {
|
||||
"id": "rJQABAgilM",
|
||||
"type": "xod/core/divide",
|
||||
"position": {
|
||||
"x": 34,
|
||||
"y": 612
|
||||
},
|
||||
"boundValues": {
|
||||
"BytUCdHD1-": 100
|
||||
}
|
||||
},
|
||||
"HJ7vCgjef": {
|
||||
"id": "HJ7vCgjef",
|
||||
"type": "xod/patch-nodes/input-number",
|
||||
"position": {
|
||||
"x": 34,
|
||||
"y": 0
|
||||
},
|
||||
"label": "PORT"
|
||||
},
|
||||
"SkTw0gjgf": {
|
||||
"id": "SkTw0gjgf",
|
||||
"type": "xod/patch-nodes/output-number",
|
||||
"position": {
|
||||
"x": 34,
|
||||
"y": 714
|
||||
},
|
||||
"label": "Dm"
|
||||
},
|
||||
"SyeOgZsgG": {
|
||||
"id": "SyeOgZsgG",
|
||||
"type": "xod/patch-nodes/input-pulse",
|
||||
"position": {
|
||||
"x": 170,
|
||||
"y": 0
|
||||
},
|
||||
"label": "UPD",
|
||||
"boundValues": {
|
||||
"__out__": "CONTINUOUSLY"
|
||||
}
|
||||
},
|
||||
"BJqdlWogG": {
|
||||
"id": "BJqdlWogG",
|
||||
"type": "xod/patch-nodes/input-number",
|
||||
"position": {
|
||||
"x": 102,
|
||||
"y": 204
|
||||
},
|
||||
"label": "AVcc",
|
||||
"boundValues": {
|
||||
"__out__": 5
|
||||
}
|
||||
}
|
||||
},
|
||||
"links": {
|
||||
"Hy4CHCeigf": {
|
||||
"id": "Hy4CHCeigf",
|
||||
"output": {
|
||||
"nodeId": "Skg0rRxjeM",
|
||||
"pinKey": "BkQzLCurwJZ"
|
||||
},
|
||||
"input": {
|
||||
"nodeId": "HkWRBRxigf",
|
||||
"pinKey": "BJlzICOSv1-"
|
||||
}
|
||||
},
|
||||
"rkHCSAxslf": {
|
||||
"id": "rkHCSAxslf",
|
||||
"output": {
|
||||
"nodeId": "HkRSAlixf",
|
||||
"pinKey": "SyBtREhlW"
|
||||
},
|
||||
"input": {
|
||||
"nodeId": "Skg0rRxjeM",
|
||||
"pinKey": "B1GfLR_SPk-"
|
||||
}
|
||||
},
|
||||
"BJ80H0xixG": {
|
||||
"id": "BJ80H0xixG",
|
||||
"output": {
|
||||
"nodeId": "HkWRBRxigf",
|
||||
"pinKey": "H12bIR_SPyZ"
|
||||
},
|
||||
"input": {
|
||||
"nodeId": "SyfABRgjgG",
|
||||
"pinKey": "BytUCdHD1-"
|
||||
}
|
||||
},
|
||||
"BJw0SRgoeG": {
|
||||
"id": "BJw0SRgoeG",
|
||||
"output": {
|
||||
"nodeId": "SyfABRgjgG",
|
||||
"pinKey": "BkqLCOSw1W"
|
||||
},
|
||||
"input": {
|
||||
"nodeId": "rJQABAgilM",
|
||||
"pinKey": "SkdIRuBD1b"
|
||||
}
|
||||
},
|
||||
"ByHvAgilf": {
|
||||
"id": "ByHvAgilf",
|
||||
"output": {
|
||||
"nodeId": "HJ7vCgjef",
|
||||
"pinKey": "__out__"
|
||||
},
|
||||
"input": {
|
||||
"nodeId": "HkRSAlixf",
|
||||
"pinKey": "BJuORNheZ"
|
||||
}
|
||||
},
|
||||
"rkxd0lixz": {
|
||||
"id": "rkxd0lixz",
|
||||
"output": {
|
||||
"nodeId": "rJQABAgilM",
|
||||
"pinKey": "BkqLCOSw1W"
|
||||
},
|
||||
"input": {
|
||||
"nodeId": "SkTw0gjgf",
|
||||
"pinKey": "__in__"
|
||||
}
|
||||
},
|
||||
"SJbdeZoeM": {
|
||||
"id": "SJbdeZoeM",
|
||||
"output": {
|
||||
"nodeId": "SyeOgZsgG",
|
||||
"pinKey": "__out__"
|
||||
},
|
||||
"input": {
|
||||
"nodeId": "HkRSAlixf",
|
||||
"pinKey": "SyKd0E2x-"
|
||||
}
|
||||
},
|
||||
"SkxtlZjxG": {
|
||||
"id": "SkxtlZjxG",
|
||||
"output": {
|
||||
"nodeId": "BJqdlWogG",
|
||||
"pinKey": "__out__"
|
||||
},
|
||||
"input": {
|
||||
"nodeId": "Skg0rRxjeM",
|
||||
"pinKey": "SJ4zUC_BD1-"
|
||||
}
|
||||
}
|
||||
},
|
||||
"comments": {
|
||||
"SJu0H0xsxz": {
|
||||
"id": "SJu0H0xsxz",
|
||||
"position": {
|
||||
"x": 170,
|
||||
"y": 306
|
||||
},
|
||||
"size": {
|
||||
"width": 170,
|
||||
"height": 51
|
||||
},
|
||||
"content": "Multiply by AVcc to get the voltage level"
|
||||
},
|
||||
"H1FCSCxsxf": {
|
||||
"id": "H1FCSCxsxf",
|
||||
"position": {
|
||||
"x": 272,
|
||||
"y": 408
|
||||
},
|
||||
"size": {
|
||||
"width": 136,
|
||||
"height": 51
|
||||
},
|
||||
"content": "Map the voltage to inverse distance (1/cm)"
|
||||
},
|
||||
"rJqArResef": {
|
||||
"id": "rJqArResef",
|
||||
"position": {
|
||||
"x": 136,
|
||||
"y": 510
|
||||
},
|
||||
"size": {
|
||||
"width": 136,
|
||||
"height": 51
|
||||
},
|
||||
"content": "Invert the distance"
|
||||
},
|
||||
"Bko0B0xsgz": {
|
||||
"content": "Divide by 100 to convert centimeters to meters",
|
||||
"id": "Bko0B0xsgz",
|
||||
"position": {
|
||||
"x": 136,
|
||||
"y": 612
|
||||
},
|
||||
"size": {
|
||||
"width": 170,
|
||||
"height": 51
|
||||
"height": 51,
|
||||
"width": 170
|
||||
}
|
||||
},
|
||||
"H1FCSCxsxf": {
|
||||
"content": "Map the voltage to inverse distance (1/cm)",
|
||||
"id": "H1FCSCxsxf",
|
||||
"position": {
|
||||
"x": 272,
|
||||
"y": 408
|
||||
},
|
||||
"content": "Divide by 100 to convert centimeters to meters"
|
||||
"size": {
|
||||
"height": 51,
|
||||
"width": 136
|
||||
}
|
||||
},
|
||||
"SJu0H0xsxz": {
|
||||
"content": "Multiply by AVcc to get the voltage level",
|
||||
"id": "SJu0H0xsxz",
|
||||
"position": {
|
||||
"x": 170,
|
||||
"y": 306
|
||||
},
|
||||
"size": {
|
||||
"height": 51,
|
||||
"width": 170
|
||||
}
|
||||
},
|
||||
"rJqArResef": {
|
||||
"content": "Invert the distance",
|
||||
"id": "rJqArResef",
|
||||
"position": {
|
||||
"x": 136,
|
||||
"y": 510
|
||||
},
|
||||
"size": {
|
||||
"height": 51,
|
||||
"width": 136
|
||||
}
|
||||
}
|
||||
},
|
||||
"links": {
|
||||
"BJ80H0xixG": {
|
||||
"id": "BJ80H0xixG",
|
||||
"input": {
|
||||
"nodeId": "SyfABRgjgG",
|
||||
"pinKey": "BytUCdHD1-"
|
||||
},
|
||||
"output": {
|
||||
"nodeId": "HkWRBRxigf",
|
||||
"pinKey": "H12bIR_SPyZ"
|
||||
}
|
||||
},
|
||||
"BJw0SRgoeG": {
|
||||
"id": "BJw0SRgoeG",
|
||||
"input": {
|
||||
"nodeId": "rJQABAgilM",
|
||||
"pinKey": "SkdIRuBD1b"
|
||||
},
|
||||
"output": {
|
||||
"nodeId": "SyfABRgjgG",
|
||||
"pinKey": "BkqLCOSw1W"
|
||||
}
|
||||
},
|
||||
"ByLeGi0ym": {
|
||||
"id": "ByLeGi0ym",
|
||||
"input": {
|
||||
"nodeId": "SJAyGsRJQ",
|
||||
"pinKey": "SkUhQ5RkQ"
|
||||
},
|
||||
"output": {
|
||||
"nodeId": "SyeOgZsgG",
|
||||
"pinKey": "__out__"
|
||||
}
|
||||
},
|
||||
"HJfxGiRJX": {
|
||||
"id": "HJfxGiRJX",
|
||||
"input": {
|
||||
"nodeId": "Skg0rRxjeM",
|
||||
"pinKey": "B1GfLR_SPk-"
|
||||
},
|
||||
"output": {
|
||||
"nodeId": "SJAyGsRJQ",
|
||||
"pinKey": "BkoeN9Ay7"
|
||||
}
|
||||
},
|
||||
"Hk0xGjCJm": {
|
||||
"id": "Hk0xGjCJm",
|
||||
"input": {
|
||||
"nodeId": "SJAyGsRJQ",
|
||||
"pinKey": "r1l3XcR17"
|
||||
},
|
||||
"output": {
|
||||
"nodeId": "HkhxMoR1X",
|
||||
"pinKey": "__out__"
|
||||
}
|
||||
},
|
||||
"Hy4CHCeigf": {
|
||||
"id": "Hy4CHCeigf",
|
||||
"input": {
|
||||
"nodeId": "HkWRBRxigf",
|
||||
"pinKey": "BJlzICOSv1-"
|
||||
},
|
||||
"output": {
|
||||
"nodeId": "Skg0rRxjeM",
|
||||
"pinKey": "BkQzLCurwJZ"
|
||||
}
|
||||
},
|
||||
"SkxtlZjxG": {
|
||||
"id": "SkxtlZjxG",
|
||||
"input": {
|
||||
"nodeId": "Skg0rRxjeM",
|
||||
"pinKey": "SJ4zUC_BD1-"
|
||||
},
|
||||
"output": {
|
||||
"nodeId": "BJqdlWogG",
|
||||
"pinKey": "__out__"
|
||||
}
|
||||
},
|
||||
"rkxd0lixz": {
|
||||
"id": "rkxd0lixz",
|
||||
"input": {
|
||||
"nodeId": "SkTw0gjgf",
|
||||
"pinKey": "__in__"
|
||||
},
|
||||
"output": {
|
||||
"nodeId": "rJQABAgilM",
|
||||
"pinKey": "BkqLCOSw1W"
|
||||
}
|
||||
}
|
||||
},
|
||||
"nodes": {
|
||||
"BJqdlWogG": {
|
||||
"boundLiterals": {
|
||||
"__out__": "5"
|
||||
},
|
||||
"id": "BJqdlWogG",
|
||||
"label": "AVcc",
|
||||
"position": {
|
||||
"x": 102,
|
||||
"y": 204
|
||||
},
|
||||
"type": "xod/patch-nodes/input-number"
|
||||
},
|
||||
"HkWRBRxigf": {
|
||||
"boundLiterals": {
|
||||
"HJCWLAdSwyW": "2",
|
||||
"rJbGU0_Hv1Z": "0.02",
|
||||
"rkpbU0OrwyZ": "0.033",
|
||||
"ry1z8CuBDy-": "1.25"
|
||||
},
|
||||
"id": "HkWRBRxigf",
|
||||
"position": {
|
||||
"x": 68,
|
||||
"y": 408
|
||||
},
|
||||
"type": "xod/math/map"
|
||||
},
|
||||
"HkhxMoR1X": {
|
||||
"id": "HkhxMoR1X",
|
||||
"label": "PORT",
|
||||
"position": {
|
||||
"x": 34,
|
||||
"y": 0
|
||||
},
|
||||
"type": "xod/patch-nodes/input-port"
|
||||
},
|
||||
"SJAyGsRJQ": {
|
||||
"id": "SJAyGsRJQ",
|
||||
"position": {
|
||||
"x": 34,
|
||||
"y": 102
|
||||
},
|
||||
"type": "xod/common-hardware/analog-sensor"
|
||||
},
|
||||
"SkTw0gjgf": {
|
||||
"id": "SkTw0gjgf",
|
||||
"label": "Dm",
|
||||
"position": {
|
||||
"x": 34,
|
||||
"y": 714
|
||||
},
|
||||
"type": "xod/patch-nodes/output-number"
|
||||
},
|
||||
"Skg0rRxjeM": {
|
||||
"boundLiterals": {
|
||||
"SJ4zUC_BD1-": "5"
|
||||
},
|
||||
"id": "Skg0rRxjeM",
|
||||
"position": {
|
||||
"x": 68,
|
||||
"y": 306
|
||||
},
|
||||
"type": "xod/core/multiply"
|
||||
},
|
||||
"SyeOgZsgG": {
|
||||
"boundLiterals": {
|
||||
"__out__": "Continuously"
|
||||
},
|
||||
"id": "SyeOgZsgG",
|
||||
"label": "UPD",
|
||||
"position": {
|
||||
"x": 136,
|
||||
"y": 0
|
||||
},
|
||||
"type": "xod/patch-nodes/input-pulse"
|
||||
},
|
||||
"SyfABRgjgG": {
|
||||
"boundLiterals": {
|
||||
"SkdIRuBD1b": "1"
|
||||
},
|
||||
"id": "SyfABRgjgG",
|
||||
"position": {
|
||||
"x": 34,
|
||||
"y": 510
|
||||
},
|
||||
"type": "xod/core/divide"
|
||||
},
|
||||
"rJQABAgilM": {
|
||||
"boundLiterals": {
|
||||
"BytUCdHD1-": "100"
|
||||
},
|
||||
"id": "rJQABAgilM",
|
||||
"position": {
|
||||
"x": 34,
|
||||
"y": 612
|
||||
},
|
||||
"type": "xod/core/divide"
|
||||
}
|
||||
},
|
||||
"path": "@/gp2y0a02-range-meter"
|
||||
},
|
||||
"@/main": {
|
||||
"comments": {
|
||||
"HJcjI-olf": {
|
||||
"content": "Look! We can read three sensors at once",
|
||||
"id": "HJcjI-olf",
|
||||
"position": {
|
||||
"x": 204,
|
||||
"y": 102
|
||||
},
|
||||
"size": {
|
||||
"height": 51,
|
||||
"width": 136
|
||||
}
|
||||
}
|
||||
},
|
||||
"links": {
|
||||
"BJlK0ljez": {
|
||||
"id": "BJlK0ljez",
|
||||
"input": {
|
||||
"nodeId": "HyIFsxjgG",
|
||||
"pinKey": "HkXK-dGob"
|
||||
},
|
||||
"output": {
|
||||
"nodeId": "BytOAxolG",
|
||||
"pinKey": "SkTw0gjgf"
|
||||
}
|
||||
},
|
||||
"HJWihGWsxG": {
|
||||
"id": "HJWihGWsxG",
|
||||
"input": {
|
||||
"nodeId": "B1s3zWoeM",
|
||||
"pinKey": "HkXK-dGob"
|
||||
},
|
||||
"output": {
|
||||
"nodeId": "Hyxo2G-jxf",
|
||||
"pinKey": "SkTw0gjgf"
|
||||
}
|
||||
},
|
||||
"Hy-YhGZjez": {
|
||||
"id": "Hy-YhGZjez",
|
||||
"input": {
|
||||
"nodeId": "HJF3MWjgG",
|
||||
"pinKey": "HkXK-dGob"
|
||||
},
|
||||
"output": {
|
||||
"nodeId": "H1xY2GWjez",
|
||||
"pinKey": "SkTw0gjgf"
|
||||
}
|
||||
}
|
||||
},
|
||||
"nodes": {
|
||||
"B1s3zWoeM": {
|
||||
"id": "B1s3zWoeM",
|
||||
"position": {
|
||||
"x": 68,
|
||||
"y": 204
|
||||
},
|
||||
"type": "xod/core/watch"
|
||||
},
|
||||
"BytOAxolG": {
|
||||
"boundLiterals": {
|
||||
"HJ7vCgjef": "1"
|
||||
},
|
||||
"id": "BytOAxolG",
|
||||
"position": {
|
||||
"x": -68,
|
||||
"y": 102
|
||||
},
|
||||
"type": "@/gp2y0a02-range-meter"
|
||||
},
|
||||
"H1xY2GWjez": {
|
||||
"id": "H1xY2GWjez",
|
||||
"position": {
|
||||
"x": -204,
|
||||
"y": 102
|
||||
},
|
||||
"type": "@/gp2y0a02-range-meter"
|
||||
},
|
||||
"HJF3MWjgG": {
|
||||
"id": "HJF3MWjgG",
|
||||
"position": {
|
||||
"x": -204,
|
||||
"y": 204
|
||||
},
|
||||
"type": "xod/core/watch"
|
||||
},
|
||||
"HyIFsxjgG": {
|
||||
"id": "HyIFsxjgG",
|
||||
"position": {
|
||||
"x": -68,
|
||||
"y": 204
|
||||
},
|
||||
"type": "xod/core/watch"
|
||||
},
|
||||
"Hyxo2G-jxf": {
|
||||
"boundLiterals": {
|
||||
"HJ7vCgjef": "2"
|
||||
},
|
||||
"id": "Hyxo2G-jxf",
|
||||
"position": {
|
||||
"x": 68,
|
||||
"y": 102
|
||||
},
|
||||
"type": "@/gp2y0a02-range-meter"
|
||||
}
|
||||
},
|
||||
"path": "@/main"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BIN
docs/guide/analog-sensor-node/step1.patch.png
Normal file → Executable file
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 25 KiB |
BIN
docs/guide/analog-sensor-node/step2a.patch.png
Normal file → Executable file
|
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 19 KiB |
BIN
docs/guide/analog-sensor-node/step3a.patch.png
Normal file → Executable file
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
@@ -14,6 +14,7 @@ Reference
|
||||
|
||||
* [`xod/core`](/libs/xod/core/)
|
||||
* [`xod/math`](/libs/xod/math/)
|
||||
* [`xod/gpio`](/libs/xod/gpio/)
|
||||
* [`xod/common-hardware`](/libs/xod/common-hardware/)
|
||||
* [`xod/units`](/libs/xod/units/)
|
||||
* [`xod/bits`](/libs/xod/bits/)
|
||||
|
||||
@@ -146,7 +146,7 @@
|
||||
url: https://www.seeedstudio.com/Mod-Red-LED-p-1142.html
|
||||
- part: Relay
|
||||
nodes:
|
||||
- xod/core/digital-output
|
||||
- xod/gpio/digital-write
|
||||
shopping:
|
||||
- shop: Adafruit
|
||||
sku: "#2935"
|
||||
|
||||
@@ -20,7 +20,7 @@ photoresistor node in XOD.
|
||||
Yet, we have basic nodes for working with the digital and analog ports of the
|
||||
Arduino. A photoresistor is a pretty primitive device, and all we need to do is
|
||||
read its value from the analog port on the Arduino. To do so, we will use an
|
||||
`analog-input` node.
|
||||
`analog-sensor` node.
|
||||
|
||||

|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ The circuit is the same as for the previous lesson.
|
||||
|
||||

|
||||
|
||||
In the example shown, if the `analog-input` node (our photoresistor) returns a
|
||||
In the example shown, if the `analog-sensor` node (our photoresistor) returns a
|
||||
value greater than the threshold, the `greater` node will set the `OUT` pin to
|
||||
`true`, and the LED will turn on.
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ message to trigger something else. It does not transmit any data. However, it
|
||||
is useful when you need to convey that an event has occurred or tell something
|
||||
else to work.
|
||||
|
||||
For example, say you only want an `analog-input` node to receive information
|
||||
For example, say you only want an `analog-sensor` node to receive information
|
||||
from a board port at certain intervals, and not all the time. This frequency
|
||||
can be set with the help of pulses.
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ Interfacing with hardware
|
||||
|
||||
If you want to use a sensor or an electronic module that you haven’t found
|
||||
support for, it’s quite possible that all you need is a few standard nodes
|
||||
like `analog-input` or `digital-output`.
|
||||
like `analog-read` or `digital-write`.
|
||||
|
||||
Refer to the item's documentation to understand how you can talk with the
|
||||
hardware.
|
||||
@@ -34,7 +34,7 @@ Write a native wrapper
|
||||
You can implement new nodes not only in XOD, but also with C++.
|
||||
You can even wrap an existing native library to make it available in XOD.
|
||||
|
||||
See the implementation of `analog-input`, `digital-output`, and `text-lcd-16x2`
|
||||
See the implementation of `analog-read`, `digital-write`, and `text-lcd-16x2`
|
||||
for examples of how to do this.
|
||||
|
||||
Tell us what you need
|
||||
|
||||
@@ -41,20 +41,20 @@ program that looks like the one below:
|
||||
|
||||

|
||||
|
||||
We use `pwm-output` from `xod/core` to provide a PWM signal to our LED. The
|
||||
We use `pwm-write` from `xod/gpio` to provide a PWM signal to our LED. The
|
||||
`DUTY` input defines the duty cycle. The value 0.0 denotes the always-low
|
||||
signal (LED is off), 0.33 is for a 33% cycle (one-third of full brightness),
|
||||
0.5 is for 50% brightness, etc. up to 1.0 for the always-high signal when the
|
||||
LED is 100% on.
|
||||
|
||||
Be sure to set the `PORT` input value to 3 with Inspector.
|
||||
Be sure to set the `PORT` input value to D3 with Inspector.
|
||||
|
||||
Next we use `analog-input` from `xod/core` to read values from the
|
||||
Next we use `analog-read` from `xod/gpio` to read values from the
|
||||
potentiometer. Read values are available on its output `VAL` and take the value
|
||||
0.0 for one of the potentiometer's limits, 1.0 for the other, and fractional
|
||||
values for anything between them.
|
||||
|
||||
For the `PORT` value on the `analog-input`, use value 14 which corresponds to
|
||||
For the `PORT` value on the `analog-read`, use value 14 which corresponds to
|
||||
pin A0 on the board.
|
||||
|
||||
<div class="ui segment">
|
||||
@@ -147,7 +147,7 @@ any popular text LCD to build a circuit like one below:
|
||||

|
||||
|
||||
Add the `text-lcd-16x2` node from `xod/common-hardware` and give it the value
|
||||
of `analog-input` as an input for the first line (`L1`). Link the output of the
|
||||
of `analog-read` as an input for the first line (`L1`). Link the output of the
|
||||
`less` node to the `L2` input.
|
||||
|
||||

|
||||
|
||||
@@ -28,7 +28,7 @@ work and communicates with other nodes.
|
||||
|
||||
Let’s talk about each node one by one from bottom to top.
|
||||
|
||||
### digital-output
|
||||
### digital-write
|
||||
|
||||
This node represents a single physical output pin on the board. It can be
|
||||
either in a high (enabled) or low (disabled) state. We use it to switch our LED
|
||||
@@ -38,7 +38,7 @@ The node has two *inputs*. They are `PORT` and `SIG`.
|
||||
|
||||
The `PORT` defines what physical pin corresponds to the node. Select the node
|
||||
by clicking on it. You’ll see the *Inspector* sidebar with the properties of
|
||||
the selected node, i.e. our `digital-output`.
|
||||
the selected node, i.e. our `digital-write`.
|
||||
|
||||

|
||||
|
||||
@@ -83,7 +83,7 @@ What happens in our blink program? Take a look:
|
||||
|
||||
1. The `clock` node ticks at regular intervals
|
||||
3. Each tick pulse goes to the `flip-flop` and toggles its state
|
||||
4. The `flip-flop` provides its state value to the `digital-output`
|
||||
4. The `flip-flop` provides its state value to the `digital-write`
|
||||
|
||||
As a result, we see the LED blinking.
|
||||
|
||||
@@ -99,8 +99,8 @@ That’s not too interesting. Let’s add another LED. Improve your circuit:
|
||||
|
||||

|
||||
|
||||
Place a new `digital-output` node. To do this, use the Project Browser sidebar.
|
||||
The `digital-output` node is available in the `xod/core` library. Hover the
|
||||
Place a new `digital-write` node. To do this, use the Project Browser sidebar.
|
||||
The `digital-write` node is available in the `xod/core` library. Hover the
|
||||
cursor over the item and click the (+).
|
||||
|
||||

|
||||
@@ -111,7 +111,7 @@ as the search query and you will quickly find the node you’re looking for.
|
||||
Press Enter or double click on an item found to place it.
|
||||
|
||||
You’ll see a new node appear in the main workspace. Drag it to the slot you
|
||||
want. The one next to the existing `digital-output` would be fine. In
|
||||
want. The one next to the existing `digital-write` would be fine. In
|
||||
Inspector, set the `PORT` for the new node to 12, since it will control our new
|
||||
LED.
|
||||
|
||||
@@ -124,11 +124,11 @@ Upload the updated program to the board. Whoa! Both LED’s are blinking.
|
||||
|
||||
Now let’s improve our program some more and make the lights blink
|
||||
alternately. To do this, we need to add a signal inversion into either of
|
||||
links connecting the `flip-flop` and `digital-output`s.
|
||||
links connecting the `flip-flop` and `digital-write`s.
|
||||
|
||||
The `not` node under `xod/core` does exactly that. Delete the existing link,
|
||||
place a `not` node, and add new links so that the signal from our `flip-flop`
|
||||
to the `digital-output` goes through it:
|
||||
to the `digital-write` goes through it:
|
||||
|
||||

|
||||
|
||||
@@ -145,7 +145,7 @@ state:
|
||||
|
||||

|
||||
|
||||
Now we have three `digital-output` nodes. It can be hard to understand which
|
||||
Now we have three `digital-write` nodes. It can be hard to understand which
|
||||
node corresponds to each LED, so it would be better to give them clear labels.
|
||||
To set a custom label for a node, select it and provide the label via
|
||||
Inspector:
|
||||
|
||||
@@ -72,16 +72,17 @@ describe('xod-arduino transpiler', () => {
|
||||
assert.deepEqual(patchPaths, [
|
||||
'xod/core/constant-number', // IVAL
|
||||
'xod/core/constant-boolean', // EN
|
||||
'xod/core/constant-number', // PORT
|
||||
'xod/core/constant-port', // PORT
|
||||
'xod/core/continuously', // UPD
|
||||
'xod/core/clock',
|
||||
'xod/core/flip-flop',
|
||||
'xod/core/digital-output',
|
||||
'xod/gpio/digital-write',
|
||||
]);
|
||||
|
||||
const ids = R.pluck('id', nodes);
|
||||
assert.deepEqual(
|
||||
ids,
|
||||
[0, 1, 2, 3, 4, 5],
|
||||
[0, 1, 2, 3, 4, 5, 6],
|
||||
'Node IDs were not arranged in topological order'
|
||||
);
|
||||
}));
|
||||
@@ -90,9 +91,9 @@ describe('xod-arduino transpiler', () => {
|
||||
describe('getNodeIdsMap', () => {
|
||||
it('should return correct NodeIdsMap', () => {
|
||||
const expected = {
|
||||
By6HVYHZb: '3',
|
||||
rkwIEFrWb: '4',
|
||||
SyeDNFBWZ: '5',
|
||||
By6HVYHZb: '4',
|
||||
rkwIEFrWb: '5',
|
||||
SyeDNFBWZ: '6',
|
||||
};
|
||||
|
||||
return loadProject([wsPath()], wsPath('blink'))
|
||||
|
||||
@@ -25,10 +25,10 @@ AVR Memory Usage
|
||||
----------------
|
||||
Device: atmega328p
|
||||
|
||||
Program: 1446 bytes (4.4% Full)
|
||||
Program: 1664 bytes (5.1% Full)
|
||||
(.text + .data + .bootloader)
|
||||
|
||||
Data: 30 bytes (1.5% Full)
|
||||
Data: 38 bytes (1.9% Full)
|
||||
(.data + .bss + .noinit)"
|
||||
|
||||
if [[ $AVR_SIZE_OUTPUT =~ "$EXPECTED_OUTPUT" ]]; then
|
||||
|
||||
@@ -97,7 +97,7 @@ describe('creating blink patch', () => {
|
||||
it('adds rest of the nodes needed for blink patch', async () => {
|
||||
// please note that nodes must be added in this specific order,
|
||||
// or else the order of implementations in transpiled code is different from fixture
|
||||
await projectBrowser.addNodeViaContextMenu('xod/core', 'digital-output');
|
||||
await projectBrowser.addNodeViaContextMenu('xod/gpio', 'digital-write');
|
||||
const [digitalOutputNode] = await getSelectedNodes(page);
|
||||
await digitalOutputNode.drag(150, 250);
|
||||
|
||||
@@ -109,7 +109,7 @@ describe('creating blink patch', () => {
|
||||
it('creates links between nodes', async () => {
|
||||
const clockNode = await Node.findByName(page, 'clock');
|
||||
const flipFlopNode = await Node.findByName(page, 'flip-flop');
|
||||
const digitalOutputNode = await Node.findByName(page, 'digital-output');
|
||||
const digitalOutputNode = await Node.findByName(page, 'digital-write');
|
||||
|
||||
const clockTickPin = await clockNode.findPinByName('TICK');
|
||||
|
||||
@@ -148,13 +148,13 @@ describe('creating blink patch', () => {
|
||||
it('binds values to outputs in Inspector', async () => {
|
||||
const inspector = await Inspector.findOnPage(page);
|
||||
const clockNode = await Node.findByName(page, 'clock');
|
||||
const digitalOutputNode = await Node.findByName(page, 'digital-output');
|
||||
const digitalOutputNode = await Node.findByName(page, 'digital-write');
|
||||
|
||||
await clockNode.click();
|
||||
await inspector.setPinValue('IVAL', '0.25');
|
||||
|
||||
await digitalOutputNode.click();
|
||||
await inspector.setPinValue('PORT', '13');
|
||||
await inspector.setPinValue('PORT', 'D13');
|
||||
});
|
||||
|
||||
it('shows transpiled code for arduino', async () => {
|
||||
|
||||
@@ -1050,14 +1050,14 @@
|
||||
},
|
||||
"H1UNiwVt-": {
|
||||
"boundLiterals": {
|
||||
"BJuORNheZ": "2"
|
||||
"SkuhqCqym": "A2"
|
||||
},
|
||||
"id": "H1UNiwVt-",
|
||||
"position": {
|
||||
"x": 272,
|
||||
"y": 0
|
||||
},
|
||||
"type": "xod/core/analog-input"
|
||||
"type": "xod/gpio/analog-read"
|
||||
},
|
||||
"S1THoPVFZ": {
|
||||
"boundLiterals": {
|
||||
@@ -1172,14 +1172,14 @@
|
||||
},
|
||||
"H1pMkkVqZ": {
|
||||
"boundLiterals": {
|
||||
"BJuORNheZ": "2"
|
||||
"SkuhqCqym": "A2"
|
||||
},
|
||||
"id": "H1pMkkVqZ",
|
||||
"position": {
|
||||
"x": 238,
|
||||
"y": -102
|
||||
},
|
||||
"type": "xod/core/analog-input"
|
||||
"type": "xod/gpio/analog-read"
|
||||
}
|
||||
},
|
||||
"path": "@/19-if-else"
|
||||
@@ -1289,14 +1289,14 @@
|
||||
},
|
||||
"rJyzdUqjZ": {
|
||||
"boundLiterals": {
|
||||
"BJuORNheZ": "2"
|
||||
"SkuhqCqym": "A2"
|
||||
},
|
||||
"id": "rJyzdUqjZ",
|
||||
"position": {
|
||||
"x": 306,
|
||||
"y": 0
|
||||
},
|
||||
"type": "xod/core/analog-input"
|
||||
"type": "xod/gpio/analog-read"
|
||||
}
|
||||
},
|
||||
"path": "@/20-fade"
|
||||
@@ -1349,7 +1349,7 @@
|
||||
"x": 306,
|
||||
"y": 204
|
||||
},
|
||||
"type": "xod/core/analog-input"
|
||||
"type": "xod/gpio/analog-read"
|
||||
},
|
||||
"Skw0PzVcZ": {
|
||||
"boundLiterals": {
|
||||
@@ -1412,7 +1412,7 @@
|
||||
"x": 306,
|
||||
"y": 408
|
||||
},
|
||||
"type": "xod/core/analog-input"
|
||||
"type": "xod/gpio/analog-read"
|
||||
},
|
||||
"rk_NQmEqb": {
|
||||
"boundLiterals": {
|
||||
@@ -2019,7 +2019,7 @@
|
||||
},
|
||||
"By5oDu8qW": {
|
||||
"boundLiterals": {
|
||||
"BJuORNheZ": "0"
|
||||
"SkuhqCqym": "A0"
|
||||
},
|
||||
"id": "By5oDu8qW",
|
||||
"label": "Photoresistor",
|
||||
@@ -2027,7 +2027,7 @@
|
||||
"x": 578,
|
||||
"y": 612
|
||||
},
|
||||
"type": "xod/core/analog-input"
|
||||
"type": "xod/gpio/analog-read"
|
||||
},
|
||||
"S1ykdOLqb": {
|
||||
"id": "S1ykdOLqb",
|
||||
|
||||
120
workspace/__lib__/xod/common-hardware/analog-sensor/patch.xodp
Normal file
@@ -0,0 +1,120 @@
|
||||
{
|
||||
"description": "Reads analog signal value from analog sensor",
|
||||
"links": [
|
||||
{
|
||||
"id": "HkDlNcCJQ",
|
||||
"input": {
|
||||
"nodeId": "BJdJV9RkX",
|
||||
"pinKey": "__in__"
|
||||
},
|
||||
"output": {
|
||||
"nodeId": "r1niX9AJQ",
|
||||
"pinKey": "BkGpcpcJQ"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "Syag4cRJQ",
|
||||
"input": {
|
||||
"nodeId": "BkoeN9Ay7",
|
||||
"pinKey": "__in__"
|
||||
},
|
||||
"output": {
|
||||
"nodeId": "r1niX9AJQ",
|
||||
"pinKey": "SyBtREhlW"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "r1A0QqRJ7",
|
||||
"input": {
|
||||
"nodeId": "r1niX9AJQ",
|
||||
"pinKey": "SkuhqCqym"
|
||||
},
|
||||
"output": {
|
||||
"nodeId": "r1l3XcR17",
|
||||
"pinKey": "__out__"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "rJlkN5R1Q",
|
||||
"input": {
|
||||
"nodeId": "r1niX9AJQ",
|
||||
"pinKey": "SyKd0E2x-"
|
||||
},
|
||||
"output": {
|
||||
"nodeId": "SkUhQ5RkQ",
|
||||
"pinKey": "__out__"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "ryFyXyJeX",
|
||||
"input": {
|
||||
"nodeId": "H1P1711gm",
|
||||
"pinKey": "__in__"
|
||||
},
|
||||
"output": {
|
||||
"nodeId": "r1niX9AJQ",
|
||||
"pinKey": "HJgzpqacyX"
|
||||
}
|
||||
}
|
||||
],
|
||||
"nodes": [
|
||||
{
|
||||
"description": "Fires on reading complete\n",
|
||||
"id": "BJdJV9RkX",
|
||||
"label": "DONE",
|
||||
"position": {
|
||||
"x": 68,
|
||||
"y": 204
|
||||
},
|
||||
"type": "xod/patch-nodes/output-pulse"
|
||||
},
|
||||
{
|
||||
"description": "The latest read value in range 0.0 … 1.0",
|
||||
"id": "BkoeN9Ay7",
|
||||
"label": "VAL",
|
||||
"position": {
|
||||
"x": 34,
|
||||
"y": 204
|
||||
},
|
||||
"type": "xod/patch-nodes/output-number"
|
||||
},
|
||||
{
|
||||
"description": "Fires if update failed. E.g. `PORT` is not an ADC port.\n",
|
||||
"id": "H1P1711gm",
|
||||
"label": "ERR",
|
||||
"position": {
|
||||
"x": 102,
|
||||
"y": 204
|
||||
},
|
||||
"type": "xod/patch-nodes/output-pulse"
|
||||
},
|
||||
{
|
||||
"description": "Triggers new read",
|
||||
"id": "SkUhQ5RkQ",
|
||||
"label": "UPD",
|
||||
"position": {
|
||||
"x": 68,
|
||||
"y": 0
|
||||
},
|
||||
"type": "xod/patch-nodes/input-pulse"
|
||||
},
|
||||
{
|
||||
"description": "Analog port to read from. Should start with `A` to succeed.\n",
|
||||
"id": "r1l3XcR17",
|
||||
"label": "PORT",
|
||||
"position": {
|
||||
"x": 34,
|
||||
"y": 0
|
||||
},
|
||||
"type": "xod/patch-nodes/input-port"
|
||||
},
|
||||
{
|
||||
"id": "r1niX9AJQ",
|
||||
"position": {
|
||||
"x": 34,
|
||||
"y": 102
|
||||
},
|
||||
"type": "xod/gpio/analog-read"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -19,6 +19,15 @@
|
||||
},
|
||||
"type": "xod/patch-nodes/not-implemented-in-xod"
|
||||
},
|
||||
{
|
||||
"description": "Use `xod/gpio/analog-read` instead",
|
||||
"id": "SJtJAJsJm",
|
||||
"position": {
|
||||
"x": 204,
|
||||
"y": 102
|
||||
},
|
||||
"type": "xod/patch-nodes/deprecated"
|
||||
},
|
||||
{
|
||||
"description": "The latest read value in range 0.0 … 1.0",
|
||||
"id": "SyBtREhlW",
|
||||
|
||||
@@ -24,6 +24,15 @@
|
||||
},
|
||||
"type": "xod/patch-nodes/output-boolean"
|
||||
},
|
||||
{
|
||||
"description": "Use `xod/gpio/digital-read` instead",
|
||||
"id": "H1oxA1o17",
|
||||
"position": {
|
||||
"x": 170,
|
||||
"y": 102
|
||||
},
|
||||
"type": "xod/patch-nodes/deprecated"
|
||||
},
|
||||
{
|
||||
"boundLiterals": {
|
||||
"__out__": "Continuously"
|
||||
|
||||
@@ -21,6 +21,15 @@
|
||||
},
|
||||
"type": "xod/patch-nodes/input-boolean"
|
||||
},
|
||||
{
|
||||
"description": "Use `xod/gpio/digital-write` instead",
|
||||
"id": "r1fbAJskX",
|
||||
"position": {
|
||||
"x": 204,
|
||||
"y": 102
|
||||
},
|
||||
"type": "xod/patch-nodes/deprecated"
|
||||
},
|
||||
{
|
||||
"id": "rkwUj42xb",
|
||||
"position": {
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
{
|
||||
"description": "Outputs hardware-supported PWM signal on a board port",
|
||||
"nodes": [
|
||||
{
|
||||
"description": "Use `xod/gpio/pwm-write` instead",
|
||||
"id": "BJ-fAJsyQ",
|
||||
"position": {
|
||||
"x": 170,
|
||||
"y": 102
|
||||
},
|
||||
"type": "xod/patch-nodes/deprecated"
|
||||
},
|
||||
{
|
||||
"description": "Duty cycle value in range 0.0 … 1.0",
|
||||
"id": "ByXnYHPyb",
|
||||
|
||||
1
workspace/__lib__/xod/gpio/analog-read/README.md
Normal file
@@ -0,0 +1 @@
|
||||
Previously known as `xod/core/analog-input`.
|
||||
20
workspace/__lib__/xod/gpio/analog-read/patch.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
struct State {
|
||||
};
|
||||
|
||||
{{ GENERATED_CODE }}
|
||||
|
||||
void evaluate(Context ctx) {
|
||||
if (!isInputDirty<input_UPD>(ctx))
|
||||
return;
|
||||
|
||||
const uint8_t port = getValue<input_PORT>(ctx);
|
||||
bool err = (port < A0 || port > A0 + NUM_ANALOG_INPUTS - 1);
|
||||
if (err) {
|
||||
emitValue<output_ERR>(ctx, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
::pinMode(port, INPUT);
|
||||
emitValue<output_VAL>(ctx, ::analogRead(port) / 1023.);
|
||||
emitValue<output_DONE>(ctx, 1);
|
||||
}
|
||||
69
workspace/__lib__/xod/gpio/analog-read/patch.xodp
Normal file
@@ -0,0 +1,69 @@
|
||||
{
|
||||
"description": "Reads analog signal value from board ADC port",
|
||||
"nodes": [
|
||||
{
|
||||
"description": "Fires on reading complete",
|
||||
"id": "BkGpcpcJQ",
|
||||
"label": "DONE",
|
||||
"position": {
|
||||
"x": 102,
|
||||
"y": 204
|
||||
},
|
||||
"type": "xod/patch-nodes/output-pulse"
|
||||
},
|
||||
{
|
||||
"id": "H1vY0E2xb",
|
||||
"position": {
|
||||
"x": 68,
|
||||
"y": 102
|
||||
},
|
||||
"type": "xod/patch-nodes/not-implemented-in-xod"
|
||||
},
|
||||
{
|
||||
"description": "Fires if update failed. E.g. `PORT` is not an ADC port.",
|
||||
"id": "HJgzpqacyX",
|
||||
"label": "ERR",
|
||||
"position": {
|
||||
"x": 170,
|
||||
"y": 204
|
||||
},
|
||||
"type": "xod/patch-nodes/output-pulse"
|
||||
},
|
||||
{
|
||||
"boundLiterals": {
|
||||
"__out__": "A0"
|
||||
},
|
||||
"description": "Analog port to read from. Should start with `A` to succeed.\n",
|
||||
"id": "SkuhqCqym",
|
||||
"label": "PORT",
|
||||
"position": {
|
||||
"x": 33,
|
||||
"y": -1
|
||||
},
|
||||
"type": "xod/patch-nodes/input-port"
|
||||
},
|
||||
{
|
||||
"description": "The latest read value in range 0.0 … 1.0",
|
||||
"id": "SyBtREhlW",
|
||||
"label": "VAL",
|
||||
"position": {
|
||||
"x": 34,
|
||||
"y": 204
|
||||
},
|
||||
"type": "xod/patch-nodes/output-number"
|
||||
},
|
||||
{
|
||||
"boundLiterals": {
|
||||
"__out__": "Continuously"
|
||||
},
|
||||
"description": "Triggers new read",
|
||||
"id": "SyKd0E2x-",
|
||||
"label": "UPD",
|
||||
"position": {
|
||||
"x": 102,
|
||||
"y": 0
|
||||
},
|
||||
"type": "xod/patch-nodes/input-pulse"
|
||||
}
|
||||
]
|
||||
}
|
||||
1
workspace/__lib__/xod/gpio/digital-read/README.md
Normal file
@@ -0,0 +1 @@
|
||||
Previously known as `xod/core/digital-input`.
|
||||
20
workspace/__lib__/xod/gpio/digital-read/patch.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
struct State {
|
||||
};
|
||||
|
||||
{{ GENERATED_CODE }}
|
||||
|
||||
void evaluate(Context ctx) {
|
||||
if (!isInputDirty<input_UPD>(ctx))
|
||||
return;
|
||||
|
||||
const uint8_t port = getValue<input_PORT>(ctx);
|
||||
bool err = (port < 0 || port > NUM_DIGITAL_PINS - 1);
|
||||
if (err) {
|
||||
emitValue<output_ERR>(ctx, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
::pinMode(port, INPUT);
|
||||
emitValue<output_SIG>(ctx, ::digitalRead(port));
|
||||
emitValue<output_DONE>(ctx, 1);
|
||||
}
|
||||
69
workspace/__lib__/xod/gpio/digital-read/patch.xodp
Normal file
@@ -0,0 +1,69 @@
|
||||
{
|
||||
"description": "Reads digital signal value from board GPIO port",
|
||||
"nodes": [
|
||||
{
|
||||
"description": "Board port to read from",
|
||||
"id": "B143qAq1Q",
|
||||
"label": "PORT",
|
||||
"position": {
|
||||
"x": 33,
|
||||
"y": -1
|
||||
},
|
||||
"type": "xod/patch-nodes/input-port"
|
||||
},
|
||||
{
|
||||
"boundLiterals": {
|
||||
"__in__": "False"
|
||||
},
|
||||
"description": "The last read signal value",
|
||||
"id": "B1gI0urv1W",
|
||||
"label": "SIG",
|
||||
"position": {
|
||||
"x": 34,
|
||||
"y": 204
|
||||
},
|
||||
"type": "xod/patch-nodes/output-boolean"
|
||||
},
|
||||
{
|
||||
"description": "Fires if update failed. E.g. `PORT` does not exist.",
|
||||
"id": "S1fi5aqyQ",
|
||||
"label": "ERR",
|
||||
"position": {
|
||||
"x": 170,
|
||||
"y": 204
|
||||
},
|
||||
"type": "xod/patch-nodes/output-pulse"
|
||||
},
|
||||
{
|
||||
"boundLiterals": {
|
||||
"__out__": "Continuously"
|
||||
},
|
||||
"description": "Triggers new read",
|
||||
"id": "SyLCdSwJZ",
|
||||
"label": "UPD",
|
||||
"position": {
|
||||
"x": 102,
|
||||
"y": 0
|
||||
},
|
||||
"type": "xod/patch-nodes/input-pulse"
|
||||
},
|
||||
{
|
||||
"id": "noNativeImpl",
|
||||
"position": {
|
||||
"x": 68,
|
||||
"y": 102
|
||||
},
|
||||
"type": "xod/patch-nodes/not-implemented-in-xod"
|
||||
},
|
||||
{
|
||||
"description": "Fires on reading complete",
|
||||
"id": "rkw3cp9k7",
|
||||
"label": "DONE",
|
||||
"position": {
|
||||
"x": 102,
|
||||
"y": 204
|
||||
},
|
||||
"type": "xod/patch-nodes/output-pulse"
|
||||
}
|
||||
]
|
||||
}
|
||||
1
workspace/__lib__/xod/gpio/digital-write/README.md
Normal file
@@ -0,0 +1 @@
|
||||
Previously known as `xod/core/digital-output`.
|
||||
21
workspace/__lib__/xod/gpio/digital-write/patch.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
struct State {
|
||||
};
|
||||
|
||||
{{ GENERATED_CODE }}
|
||||
|
||||
void evaluate(Context ctx) {
|
||||
if (!isInputDirty<input_UPD>(ctx))
|
||||
return;
|
||||
|
||||
const uint8_t port = getValue<input_PORT>(ctx);
|
||||
bool err = (port < 0 || port > NUM_DIGITAL_PINS - 1);
|
||||
if (err) {
|
||||
emitValue<output_ERR>(ctx, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
::pinMode(port, OUTPUT);
|
||||
const bool val = getValue<input_SIG>(ctx);
|
||||
::digitalWrite(port, val);
|
||||
emitValue<output_DONE>(ctx, 1);
|
||||
}
|
||||
66
workspace/__lib__/xod/gpio/digital-write/patch.xodp
Normal file
@@ -0,0 +1,66 @@
|
||||
{
|
||||
"description": "Outputs high or low signal on a board port",
|
||||
"nodes": [
|
||||
{
|
||||
"boundLiterals": {
|
||||
"__out__": "Continuously"
|
||||
},
|
||||
"description": "Triggers new write",
|
||||
"id": "BygApTqym",
|
||||
"label": "UPD",
|
||||
"position": {
|
||||
"x": 170,
|
||||
"y": 0
|
||||
},
|
||||
"type": "xod/patch-nodes/input-pulse"
|
||||
},
|
||||
{
|
||||
"description": "State to write",
|
||||
"id": "HJ6HsEngZ",
|
||||
"label": "SIG",
|
||||
"position": {
|
||||
"x": 102,
|
||||
"y": 0
|
||||
},
|
||||
"type": "xod/patch-nodes/input-boolean"
|
||||
},
|
||||
{
|
||||
"description": "Board port to write to",
|
||||
"id": "rJjXFA9JQ",
|
||||
"label": "PORT",
|
||||
"position": {
|
||||
"x": 34,
|
||||
"y": 0
|
||||
},
|
||||
"type": "xod/patch-nodes/input-port"
|
||||
},
|
||||
{
|
||||
"description": "Fires if write failed. E.g. `PORT` does not exist.",
|
||||
"id": "rJl2TqpqyX",
|
||||
"label": "ERR",
|
||||
"position": {
|
||||
"x": 102,
|
||||
"y": 204
|
||||
},
|
||||
"type": "xod/patch-nodes/output-pulse"
|
||||
},
|
||||
{
|
||||
"id": "rkwUj42xb",
|
||||
"position": {
|
||||
"x": 102,
|
||||
"y": 102
|
||||
},
|
||||
"type": "xod/patch-nodes/not-implemented-in-xod"
|
||||
},
|
||||
{
|
||||
"description": "Fires on writing complete",
|
||||
"id": "ry3pcpqyX",
|
||||
"label": "DONE",
|
||||
"position": {
|
||||
"x": 34,
|
||||
"y": 204
|
||||
},
|
||||
"type": "xod/patch-nodes/output-pulse"
|
||||
}
|
||||
]
|
||||
}
|
||||
9
workspace/__lib__/xod/gpio/project.xod
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"authors": [
|
||||
"XOD"
|
||||
],
|
||||
"description": "Nodes of XOD to deal with GPIO (hardware pins)",
|
||||
"license": "AGPL-3.0",
|
||||
"name": "gpio",
|
||||
"version": "0.21.0"
|
||||
}
|
||||
1
workspace/__lib__/xod/gpio/pwm-write/README.md
Normal file
@@ -0,0 +1 @@
|
||||
Previously known as `xod/core/pwm-output`.
|
||||
25
workspace/__lib__/xod/gpio/pwm-write/patch.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
struct State {
|
||||
};
|
||||
|
||||
{{ GENERATED_CODE }}
|
||||
|
||||
void evaluate(Context ctx) {
|
||||
if (!isInputDirty<input_UPD>(ctx))
|
||||
return;
|
||||
|
||||
const uint8_t port = getValue<input_PORT>(ctx);
|
||||
bool err = (port < 0 || port > NUM_DIGITAL_PINS - 1);
|
||||
|
||||
if (err) {
|
||||
emitValue<output_ERR>(ctx, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
auto duty = getValue<input_DUTY>(ctx);
|
||||
duty = duty > 1 ? 1 : (duty < 0 ? 0 : duty);
|
||||
uint8_t val = (uint8_t)(duty * 255.0);
|
||||
|
||||
::pinMode(port, OUTPUT);
|
||||
::analogWrite(port, val);
|
||||
emitValue<output_DONE>(ctx, 1);
|
||||
}
|
||||
66
workspace/__lib__/xod/gpio/pwm-write/patch.xodp
Normal file
@@ -0,0 +1,66 @@
|
||||
{
|
||||
"description": "Outputs hardware-supported PWM signal on a board port",
|
||||
"nodes": [
|
||||
{
|
||||
"boundLiterals": {
|
||||
"__out__": "Continuously"
|
||||
},
|
||||
"description": "Triggers new write",
|
||||
"id": "B14R6TcyQ",
|
||||
"label": "UPD",
|
||||
"position": {
|
||||
"x": 170,
|
||||
"y": 0
|
||||
},
|
||||
"type": "xod/patch-nodes/input-pulse"
|
||||
},
|
||||
{
|
||||
"description": "Duty cycle value in range 0.0 … 1.0",
|
||||
"id": "ByXnYHPyb",
|
||||
"label": "DUTY",
|
||||
"position": {
|
||||
"x": 102,
|
||||
"y": 0
|
||||
},
|
||||
"type": "xod/patch-nodes/input-number"
|
||||
},
|
||||
{
|
||||
"description": "Fires if write failed. E.g. `PORT` does not exist.",
|
||||
"id": "S1eDAq69yX",
|
||||
"label": "ERR",
|
||||
"position": {
|
||||
"x": 102,
|
||||
"y": 204
|
||||
},
|
||||
"type": "xod/patch-nodes/output-pulse"
|
||||
},
|
||||
{
|
||||
"description": "Fires on writing complete",
|
||||
"id": "SkwRqaq17",
|
||||
"label": "DONE",
|
||||
"position": {
|
||||
"x": 34,
|
||||
"y": 204
|
||||
},
|
||||
"type": "xod/patch-nodes/output-pulse"
|
||||
},
|
||||
{
|
||||
"description": "Board port to write to. If the port supports hardware PWM it will be used. If not, it will be set high for values greater than 0.5 and set low otherwise.",
|
||||
"id": "Syro9C9yQ",
|
||||
"label": "PORT",
|
||||
"position": {
|
||||
"x": 34,
|
||||
"y": 0
|
||||
},
|
||||
"type": "xod/patch-nodes/input-port"
|
||||
},
|
||||
{
|
||||
"id": "noNativeImpl",
|
||||
"position": {
|
||||
"x": 68,
|
||||
"y": 102
|
||||
},
|
||||
"type": "xod/patch-nodes/not-implemented-in-xod"
|
||||
}
|
||||
]
|
||||
}
|
||||
258
workspace/blink/__fixtures__/arduino.cpp
generated
@@ -684,6 +684,81 @@ void loop() {
|
||||
|
||||
namespace xod {
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// xod/core/continuously implementation
|
||||
//-----------------------------------------------------------------------------
|
||||
namespace xod__core__continuously {
|
||||
|
||||
struct State {
|
||||
};
|
||||
|
||||
struct Node {
|
||||
State state;
|
||||
TimeMs timeoutAt;
|
||||
Logic output_TICK;
|
||||
|
||||
union {
|
||||
struct {
|
||||
bool isOutputDirty_TICK : 1;
|
||||
bool isNodeDirty : 1;
|
||||
};
|
||||
|
||||
DirtyFlags dirtyFlags;
|
||||
};
|
||||
};
|
||||
|
||||
struct output_TICK { };
|
||||
|
||||
template<typename PinT> struct ValueType { using T = void; };
|
||||
template<> struct ValueType<output_TICK> { using T = Logic; };
|
||||
|
||||
struct ContextObject {
|
||||
Node* _node;
|
||||
|
||||
};
|
||||
|
||||
using Context = ContextObject*;
|
||||
|
||||
template<typename PinT> typename ValueType<PinT>::T getValue(Context ctx) {
|
||||
static_assert(always_false<PinT>::value,
|
||||
"Invalid pin descriptor. Expected one of:" \
|
||||
"" \
|
||||
" output_TICK");
|
||||
}
|
||||
|
||||
template<> Logic getValue<output_TICK>(Context ctx) {
|
||||
return ctx->_node->output_TICK;
|
||||
}
|
||||
|
||||
template<typename InputT> bool isInputDirty(Context ctx) {
|
||||
static_assert(always_false<InputT>::value,
|
||||
"Invalid input descriptor. Expected one of:" \
|
||||
"");
|
||||
return false;
|
||||
}
|
||||
|
||||
template<typename OutputT> void emitValue(Context ctx, typename ValueType<OutputT>::T val) {
|
||||
static_assert(always_false<OutputT>::value,
|
||||
"Invalid output descriptor. Expected one of:" \
|
||||
" output_TICK");
|
||||
}
|
||||
|
||||
template<> void emitValue<output_TICK>(Context ctx, Logic val) {
|
||||
ctx->_node->output_TICK = val;
|
||||
ctx->_node->isOutputDirty_TICK = true;
|
||||
}
|
||||
|
||||
State* getState(Context ctx) {
|
||||
return &ctx->_node->state;
|
||||
}
|
||||
|
||||
void evaluate(Context ctx) {
|
||||
emitValue<output_TICK>(ctx, 1);
|
||||
setTimeout(ctx, 0);
|
||||
}
|
||||
|
||||
} // namespace xod__core__continuously
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// xod/core/clock implementation
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -929,19 +1004,22 @@ void evaluate(Context ctx) {
|
||||
} // namespace xod__core__flip_flop
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// xod/core/digital-output implementation
|
||||
// xod/gpio/digital-write implementation
|
||||
//-----------------------------------------------------------------------------
|
||||
namespace xod__core__digital_output {
|
||||
namespace xod__gpio__digital_write {
|
||||
|
||||
struct State {
|
||||
int configuredPort = -1;
|
||||
};
|
||||
|
||||
struct Node {
|
||||
State state;
|
||||
Logic output_DONE;
|
||||
Logic output_ERR;
|
||||
|
||||
union {
|
||||
struct {
|
||||
bool isOutputDirty_DONE : 1;
|
||||
bool isOutputDirty_ERR : 1;
|
||||
bool isNodeDirty : 1;
|
||||
};
|
||||
|
||||
@@ -951,17 +1029,25 @@ struct Node {
|
||||
|
||||
struct input_PORT { };
|
||||
struct input_SIG { };
|
||||
struct input_UPD { };
|
||||
struct output_DONE { };
|
||||
struct output_ERR { };
|
||||
|
||||
template<typename PinT> struct ValueType { using T = void; };
|
||||
template<> struct ValueType<input_PORT> { using T = Number; };
|
||||
template<> struct ValueType<input_PORT> { using T = uint8_t; };
|
||||
template<> struct ValueType<input_SIG> { using T = Logic; };
|
||||
template<> struct ValueType<input_UPD> { using T = Logic; };
|
||||
template<> struct ValueType<output_DONE> { using T = Logic; };
|
||||
template<> struct ValueType<output_ERR> { using T = Logic; };
|
||||
|
||||
struct ContextObject {
|
||||
Node* _node;
|
||||
|
||||
Number _input_PORT;
|
||||
uint8_t _input_PORT;
|
||||
Logic _input_SIG;
|
||||
Logic _input_UPD;
|
||||
|
||||
bool _isInputDirty_UPD;
|
||||
};
|
||||
|
||||
using Context = ContextObject*;
|
||||
@@ -969,28 +1055,50 @@ using Context = ContextObject*;
|
||||
template<typename PinT> typename ValueType<PinT>::T getValue(Context ctx) {
|
||||
static_assert(always_false<PinT>::value,
|
||||
"Invalid pin descriptor. Expected one of:" \
|
||||
" input_PORT input_SIG" \
|
||||
"");
|
||||
" input_PORT input_SIG input_UPD" \
|
||||
" output_DONE output_ERR");
|
||||
}
|
||||
|
||||
template<> Number getValue<input_PORT>(Context ctx) {
|
||||
template<> uint8_t getValue<input_PORT>(Context ctx) {
|
||||
return ctx->_input_PORT;
|
||||
}
|
||||
template<> Logic getValue<input_SIG>(Context ctx) {
|
||||
return ctx->_input_SIG;
|
||||
}
|
||||
template<> Logic getValue<input_UPD>(Context ctx) {
|
||||
return ctx->_input_UPD;
|
||||
}
|
||||
template<> Logic getValue<output_DONE>(Context ctx) {
|
||||
return ctx->_node->output_DONE;
|
||||
}
|
||||
template<> Logic getValue<output_ERR>(Context ctx) {
|
||||
return ctx->_node->output_ERR;
|
||||
}
|
||||
|
||||
template<typename InputT> bool isInputDirty(Context ctx) {
|
||||
static_assert(always_false<InputT>::value,
|
||||
"Invalid input descriptor. Expected one of:" \
|
||||
"");
|
||||
" input_UPD");
|
||||
return false;
|
||||
}
|
||||
|
||||
template<> bool isInputDirty<input_UPD>(Context ctx) {
|
||||
return ctx->_isInputDirty_UPD;
|
||||
}
|
||||
|
||||
template<typename OutputT> void emitValue(Context ctx, typename ValueType<OutputT>::T val) {
|
||||
static_assert(always_false<OutputT>::value,
|
||||
"Invalid output descriptor. Expected one of:" \
|
||||
"");
|
||||
" output_DONE output_ERR");
|
||||
}
|
||||
|
||||
template<> void emitValue<output_DONE>(Context ctx, Logic val) {
|
||||
ctx->_node->output_DONE = val;
|
||||
ctx->_node->isOutputDirty_DONE = true;
|
||||
}
|
||||
template<> void emitValue<output_ERR>(Context ctx, Logic val) {
|
||||
ctx->_node->output_ERR = val;
|
||||
ctx->_node->isOutputDirty_ERR = true;
|
||||
}
|
||||
|
||||
State* getState(Context ctx) {
|
||||
@@ -998,20 +1106,23 @@ State* getState(Context ctx) {
|
||||
}
|
||||
|
||||
void evaluate(Context ctx) {
|
||||
State* state = getState(ctx);
|
||||
const int port = (int)getValue<input_PORT>(ctx);
|
||||
if (port != state->configuredPort) {
|
||||
::pinMode(port, OUTPUT);
|
||||
// Store configured port so to avoid repeating `pinMode` call if just
|
||||
// SIG is updated
|
||||
state->configuredPort = port;
|
||||
if (!isInputDirty<input_UPD>(ctx))
|
||||
return;
|
||||
|
||||
const uint8_t port = getValue<input_PORT>(ctx);
|
||||
bool err = (port < 0 || port > NUM_DIGITAL_PINS - 1);
|
||||
if (err) {
|
||||
emitValue<output_ERR>(ctx, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
::pinMode(port, OUTPUT);
|
||||
const bool val = getValue<input_SIG>(ctx);
|
||||
::digitalWrite(port, val);
|
||||
emitValue<output_DONE>(ctx, 1);
|
||||
}
|
||||
|
||||
} // namespace xod__core__digital_output
|
||||
} // namespace xod__gpio__digital_write
|
||||
|
||||
} // namespace xod
|
||||
|
||||
@@ -1032,27 +1143,42 @@ constexpr Number node_0_output_VAL = 0.25;
|
||||
|
||||
constexpr Logic node_1_output_VAL = true;
|
||||
|
||||
constexpr Number node_2_output_VAL = 13;
|
||||
constexpr uint8_t node_2_output_VAL = 13;
|
||||
|
||||
constexpr Logic node_3_output_TICK = false;
|
||||
xod__core__clock::Node node_3 = {
|
||||
xod__core__clock::State(), // state default
|
||||
xod__core__continuously::Node node_3 = {
|
||||
xod__core__continuously::State(), // state default
|
||||
0, // timeoutAt
|
||||
node_3_output_TICK, // output TICK default
|
||||
false, // TICK dirty
|
||||
true // node itself dirty
|
||||
};
|
||||
|
||||
constexpr Logic node_4_output_MEM = false;
|
||||
xod__core__flip_flop::Node node_4 = {
|
||||
constexpr Logic node_4_output_TICK = false;
|
||||
xod__core__clock::Node node_4 = {
|
||||
xod__core__clock::State(), // state default
|
||||
0, // timeoutAt
|
||||
node_4_output_TICK, // output TICK default
|
||||
false, // TICK dirty
|
||||
true // node itself dirty
|
||||
};
|
||||
|
||||
constexpr Logic node_5_output_MEM = false;
|
||||
xod__core__flip_flop::Node node_5 = {
|
||||
xod__core__flip_flop::State(), // state default
|
||||
node_4_output_MEM, // output MEM default
|
||||
node_5_output_MEM, // output MEM default
|
||||
true, // MEM dirty
|
||||
true // node itself dirty
|
||||
};
|
||||
|
||||
xod__core__digital_output::Node node_5 = {
|
||||
xod__core__digital_output::State(), // state default
|
||||
constexpr Logic node_6_output_DONE = false;
|
||||
constexpr Logic node_6_output_ERR = false;
|
||||
xod__gpio__digital_write::Node node_6 = {
|
||||
xod__gpio__digital_write::State(), // state default
|
||||
node_6_output_DONE, // output DONE default
|
||||
node_6_output_ERR, // output ERR default
|
||||
false, // DONE dirty
|
||||
false, // ERR dirty
|
||||
true // node itself dirty
|
||||
};
|
||||
|
||||
@@ -1064,6 +1190,7 @@ void runTransaction() {
|
||||
|
||||
// Check for timeouts
|
||||
detail::checkTriggerTimeout(&node_3);
|
||||
detail::checkTriggerTimeout(&node_4);
|
||||
|
||||
// defer-* nodes are always at the very bottom of the graph, so no one will
|
||||
// recieve values emitted by them. We must evaluate them before everybody
|
||||
@@ -1073,14 +1200,30 @@ void runTransaction() {
|
||||
// evaluate on the regular pass only if it pushed a new value again.
|
||||
|
||||
// Evaluate all dirty nodes
|
||||
{ // xod__core__clock #3
|
||||
{ // xod__core__continuously #3
|
||||
if (node_3.isNodeDirty) {
|
||||
XOD_TRACE_F("Eval node #");
|
||||
XOD_TRACE_LN(3);
|
||||
|
||||
xod__core__clock::ContextObject ctxObj;
|
||||
xod__core__continuously::ContextObject ctxObj;
|
||||
ctxObj._node = &node_3;
|
||||
|
||||
// copy data from upstream nodes into context
|
||||
|
||||
xod__core__continuously::evaluate(&ctxObj);
|
||||
|
||||
// mark downstream nodes dirty
|
||||
node_6.isNodeDirty |= node_3.isOutputDirty_TICK;
|
||||
}
|
||||
}
|
||||
{ // xod__core__clock #4
|
||||
if (node_4.isNodeDirty) {
|
||||
XOD_TRACE_F("Eval node #");
|
||||
XOD_TRACE_LN(4);
|
||||
|
||||
xod__core__clock::ContextObject ctxObj;
|
||||
ctxObj._node = &node_4;
|
||||
|
||||
// copy data from upstream nodes into context
|
||||
ctxObj._input_EN = node_1_output_VAL;
|
||||
ctxObj._input_IVAL = node_0_output_VAL;
|
||||
@@ -1091,43 +1234,46 @@ void runTransaction() {
|
||||
xod__core__clock::evaluate(&ctxObj);
|
||||
|
||||
// mark downstream nodes dirty
|
||||
node_4.isNodeDirty |= node_3.isOutputDirty_TICK;
|
||||
node_5.isNodeDirty |= node_4.isOutputDirty_TICK;
|
||||
}
|
||||
}
|
||||
{ // xod__core__flip_flop #4
|
||||
if (node_4.isNodeDirty) {
|
||||
XOD_TRACE_F("Eval node #");
|
||||
XOD_TRACE_LN(4);
|
||||
|
||||
xod__core__flip_flop::ContextObject ctxObj;
|
||||
ctxObj._node = &node_4;
|
||||
|
||||
// copy data from upstream nodes into context
|
||||
ctxObj._input_TGL = node_3.output_TICK;
|
||||
|
||||
ctxObj._isInputDirty_SET = false;
|
||||
ctxObj._isInputDirty_RST = false;
|
||||
ctxObj._isInputDirty_TGL = node_3.isOutputDirty_TICK;
|
||||
|
||||
xod__core__flip_flop::evaluate(&ctxObj);
|
||||
|
||||
// mark downstream nodes dirty
|
||||
node_5.isNodeDirty |= node_4.isOutputDirty_MEM;
|
||||
}
|
||||
}
|
||||
{ // xod__core__digital_output #5
|
||||
{ // xod__core__flip_flop #5
|
||||
if (node_5.isNodeDirty) {
|
||||
XOD_TRACE_F("Eval node #");
|
||||
XOD_TRACE_LN(5);
|
||||
|
||||
xod__core__digital_output::ContextObject ctxObj;
|
||||
xod__core__flip_flop::ContextObject ctxObj;
|
||||
ctxObj._node = &node_5;
|
||||
|
||||
// copy data from upstream nodes into context
|
||||
ctxObj._input_PORT = node_2_output_VAL;
|
||||
ctxObj._input_SIG = node_4.output_MEM;
|
||||
ctxObj._input_TGL = node_4.output_TICK;
|
||||
|
||||
xod__core__digital_output::evaluate(&ctxObj);
|
||||
ctxObj._isInputDirty_SET = false;
|
||||
ctxObj._isInputDirty_RST = false;
|
||||
ctxObj._isInputDirty_TGL = node_4.isOutputDirty_TICK;
|
||||
|
||||
xod__core__flip_flop::evaluate(&ctxObj);
|
||||
|
||||
// mark downstream nodes dirty
|
||||
node_6.isNodeDirty |= node_5.isOutputDirty_MEM;
|
||||
}
|
||||
}
|
||||
{ // xod__gpio__digital_write #6
|
||||
if (node_6.isNodeDirty) {
|
||||
XOD_TRACE_F("Eval node #");
|
||||
XOD_TRACE_LN(6);
|
||||
|
||||
xod__gpio__digital_write::ContextObject ctxObj;
|
||||
ctxObj._node = &node_6;
|
||||
|
||||
// copy data from upstream nodes into context
|
||||
ctxObj._input_PORT = node_2_output_VAL;
|
||||
ctxObj._input_SIG = node_5.output_MEM;
|
||||
ctxObj._input_UPD = node_3.output_TICK;
|
||||
|
||||
ctxObj._isInputDirty_UPD = node_3.isOutputDirty_TICK;
|
||||
|
||||
xod__gpio__digital_write::evaluate(&ctxObj);
|
||||
|
||||
// mark downstream nodes dirty
|
||||
}
|
||||
@@ -1137,7 +1283,9 @@ void runTransaction() {
|
||||
node_3.dirtyFlags = 0;
|
||||
node_4.dirtyFlags = 0;
|
||||
node_5.dirtyFlags = 0;
|
||||
node_6.dirtyFlags = 0;
|
||||
detail::clearStaleTimeout(&node_3);
|
||||
detail::clearStaleTimeout(&node_4);
|
||||
|
||||
XOD_TRACE_F("Transaction completed, t=");
|
||||
XOD_TRACE_LN(millis());
|
||||
|
||||
@@ -2,91 +2,105 @@
|
||||
:100010000C9479000C9479000C9479000C9479007C
|
||||
:100020000C9479000C9479000C9479000C9479006C
|
||||
:100030000C9479000C9479000C9479000C9479005C
|
||||
:100040000C9406020C9479000C9479000C947900BD
|
||||
:100040000C946F020C9479000C9479000C94790054
|
||||
:100050000C9479000C9479000C9479000C9479003C
|
||||
:100060000C9479000C947900000000080002010053
|
||||
:100070000003040700000000000000000000000072
|
||||
:10008000250028002B0000000000240027002A0083
|
||||
:10009000040404040404040402020202020203032E
|
||||
:1000A0000303030301020408102040800102040836
|
||||
:1000B000102001020408102011241FBECFEFD8E049
|
||||
:1000C000DEBFCDBF11E0A0E0B1E0E6E9F5E002C09F
|
||||
:1000D00005900D92A031B107D9F721E0A0E1B1E080
|
||||
:1000E00001C01D92AE31B207E1F70E9450020C949C
|
||||
:1000F000C9020C9400003FB7F89480911A019091C6
|
||||
:100100001B01A0911C01B0911D0126B5A89B05C043
|
||||
:100060000C9479000C947900000000002400270013
|
||||
:100070002A0000000000250028002B0004040404CE
|
||||
:100080000404040402020202020203030303030342
|
||||
:10009000010204081020408001020408102001021F
|
||||
:1000A00004081020000000080002010000030407FB
|
||||
:1000B000000000000000000011241FBECFEFD8E0B8
|
||||
:1000C000DEBFCDBF11E0A0E0B1E0E8E6F6E002C09F
|
||||
:1000D00005900D92A831B107D9F721E0A8E1B1E070
|
||||
:1000E00001C01D92A632B207E1F70E94B9020C943A
|
||||
:1000F00032030C9400003FB7F89480912201909154
|
||||
:100100002301A0912401B091250126B5A89B05C02B
|
||||
:100110002F3F19F00196A11DB11D3FBFBA2FA92F86
|
||||
:10012000982F8827820F911DA11DB11DBC01CD0103
|
||||
:1001300042E0660F771F881F991F4A95D1F70895EF
|
||||
:100140000F931F932FB7F894809116019091170188
|
||||
:10015000A0911801B09119012FBF809310019093C5
|
||||
:100160001101A0931201B093130140910A01509123
|
||||
:100170000B0160910C0170910D0141155105610554
|
||||
:100140000F931F932FB7F89480911E0190911F0178
|
||||
:10015000A0912001B09121012FBF809318019093AD
|
||||
:100160001901A0931A01B0931B0140911201509103
|
||||
:10017000130160911401709115014115510561053C
|
||||
:10018000710531F021E0481759076A077B0708F02D
|
||||
:1001900020E080910F0181FB992790F9922B90FB31
|
||||
:1001A00081F980930F01992309F446C04091100111
|
||||
:1001B000509111016091120170911301DB01CA018C
|
||||
:1001C00086509F4FAF4FBF4F209114012223A1F0C3
|
||||
:1001D0000091060110910701209108013091090159
|
||||
:1001E000041715072607370708F4E3C0801791079F
|
||||
:1001F000A207B30708F4DDC000910A0110910B01BA
|
||||
:1002000020910C0130910D010115110521053105D9
|
||||
:1002100031F0041715072607370708F4DBC0909163
|
||||
:100220000F0191708091050181FB222720F9922B0B
|
||||
:1002300090FB81F9809305018091050181FF1CC02D
|
||||
:100240009091040180910F0180FF03C081E0892714
|
||||
:1002500001C080E0891739F0809304018091050185
|
||||
:100260008160809305019091050180910201982B96
|
||||
:1002700090FB80F9809302018091020180FF70C0A1
|
||||
:100280002091040180910001909101010D9709F1E5
|
||||
:10029000E1EBF0E03491EDE9F0E08491882399F00E
|
||||
:1002A00090E0880F991FFC01EA57FF4FA591B49188
|
||||
:1002B000FC01E458FF4F859194918FB7F894EC912D
|
||||
:1002C000E32BEC938FBF8DE090E09093010180933E
|
||||
:1002D0000001E5E7F0E09491E1EBF0E08491EDE9D5
|
||||
:1002E000F0E0E491EE2309F43BC0992339F1933017
|
||||
:1002F00091F038F49130A9F0923001F594B59F7DDA
|
||||
:1003000012C0973091F09830A1F09430B9F49091E8
|
||||
:1003100080009F7D03C0909180009F779093800024
|
||||
:100320000DC094B59F7794BD09C09091B0009F77A0
|
||||
:1003300003C09091B0009F7D9093B000F0E0EE0F6D
|
||||
:10034000FF1FE458FF4FA591B4919FB7F894EC912B
|
||||
:10035000211103C080958E2301C08E2B8C939FBFEB
|
||||
:1003600010920F01109205011092020180910A0172
|
||||
:1003700090910B01A0910C01B0910D010097A10586
|
||||
:10038000B10509F440C040911001509111016091F4
|
||||
:1003900012017091130184179507A607B70798F506
|
||||
:1003A00010920A0110920B0110920C0110920D0193
|
||||
:1003B0002AC08093060190930701A0930801B0938F
|
||||
:1003C000090180930A0190930B01A0930C01B09353
|
||||
:1003D0000D0112CF21E020930E0120910F01216029
|
||||
:1003E00020930F018093060190930701A0930801C9
|
||||
:1003F000B093090180930A0190930B01A0930C0123
|
||||
:10040000B0930D010CCF1F910F9108951F920F9281
|
||||
:100410000FB60F9211242F933F938F939F93AF9317
|
||||
:10042000BF938091160190911701A0911801B0918E
|
||||
:1004300019013091150123E0230F2D3720F4019687
|
||||
:10044000A11DB11D05C026E8230F0296A11DB11DF7
|
||||
:10045000209315018093160190931701A093180122
|
||||
:10046000B093190180911A0190911B01A0911C0178
|
||||
:10047000B0911D010196A11DB11D80931A019093A9
|
||||
:100480001B01A0931C01B0931D01BF91AF919F91DF
|
||||
:100490008F913F912F910F900FBE0F901F90189545
|
||||
:1004A000789484B5826084BD84B5816084BD85B54F
|
||||
:1004B000826085BD85B5816085BD80916E0081605B
|
||||
:1004C00080936E0010928100809181008260809301
|
||||
:1004D0008100809181008160809381008091800003
|
||||
:1004E0008160809380008091B10084608093B1002E
|
||||
:1004F0008091B00081608093B00080917A00846028
|
||||
:1005000080937A0080917A00826080937A00809153
|
||||
:100510007A00816080937A0080917A00806880936D
|
||||
:100520007A001092C1000E947B004B015C0184E6BE
|
||||
:10053000C82ED12CE12CF12C0E947B00DC01CB01D8
|
||||
:1005400088199909AA09BB09883E9340A105B105FC
|
||||
:1005500058F021E0C21AD108E108F10888EE880EAF
|
||||
:1005600083E0981EA11CB11CC114D104E104F10464
|
||||
:1005700019F781E0809314010E94A00010921401E9
|
||||
:10058000C0E0D0E00E94A0002097E1F30E940000AC
|
||||
:06059000F9CFF894FFCF43
|
||||
:10059600FFFF010000030000000000000000000251
|
||||
:1001900020E08091170181FB992790F9292B20FB02
|
||||
:1001A00081F98093170180910B0190910C01A0912E
|
||||
:1001B0000D01B0910E010097A105B10571F031E07C
|
||||
:1001C000409118015091190160911A0170911B0121
|
||||
:1001D00084179507A607B70708F030E08091100153
|
||||
:1001E00081FB992790F9932B90FB81F98093100163
|
||||
:1001F0002223E9F081E0809316018091170181604C
|
||||
:1002000080931701409118015091190160911A01D2
|
||||
:1002100070911B01409312015093130160931401DC
|
||||
:1002200070931501809106018460809306019923E3
|
||||
:1002300009F446C0409118015091190160911A01CA
|
||||
:1002400070911B01DB01CA0186509F4FAF4FBF4F1A
|
||||
:1002500020911C012223A1F00091070110910801B7
|
||||
:100260002091090130910A01041715072607370765
|
||||
:1002700008F4FFC080179107A207B30708F4F9C07C
|
||||
:1002800000910B0110910C0120910D0130910E0194
|
||||
:10029000011511052105310531F004171507260751
|
||||
:1002A000370708F4F7C09091100191708091020116
|
||||
:1002B00081FB222720F9922B90FB81F98093020188
|
||||
:1002C0008091020181FF20C0909101018091100175
|
||||
:1002D00080FF03C081E0892701C080E0891739F0E1
|
||||
:1002E00080930101809102018160809302019091CD
|
||||
:1002F000020191708091060182FB222720F9922B46
|
||||
:1003000090FB82F9809306018091060182FF6CC008
|
||||
:10031000609101018091170180FF66C04DE950E0B6
|
||||
:10032000FA01749189E890E0FC012491222399F06C
|
||||
:1003300030E0220F331FF901E859FF4FA591B49126
|
||||
:100340002E583F4FF901059114912FB7F8943C9125
|
||||
:10035000732B7C932FBFE1EBF0E02491FA014491E1
|
||||
:10036000FC019491992309F43CC0222339F12330F4
|
||||
:1003700091F038F42130A9F0223001F584B58F7D59
|
||||
:1003800012C0273091F02830A1F02430B9F48091C8
|
||||
:1003900080008F7D03C0809180008F7780938000E4
|
||||
:1003A0000DC084B58F7784BD09C08091B0008F7770
|
||||
:1003B00003C08091B0008F7D8093B000E92FF0E002
|
||||
:1003C000EE0FFF1FEE58FF4FA591B4918FB7F89431
|
||||
:1003D0009C91611103C04095492301C0492B4C9366
|
||||
:1003E0008FBF81E0809304011092170110921001D9
|
||||
:1003F0001092020110920601809112019091130156
|
||||
:10040000A0911401B09115010097A105B10571F0FB
|
||||
:10041000409118015091190160911A0170911B01CE
|
||||
:1004200084179507A607B70708F44DC080910B0104
|
||||
:1004300090910C01A0910D01B0910E010097A105C2
|
||||
:10044000B10509F449C0409118015091190160911A
|
||||
:100450001A0170911B0184179507A607B707E0F5ED
|
||||
:1004600010920B0110920C0110920D0110920E01CE
|
||||
:1004700033C08093070190930801A0930901B093C2
|
||||
:100480000A0180930B0190930C01A0930D01B0938E
|
||||
:100490000E01F6CE21E020930F0120911001216082
|
||||
:1004A000209310018093070190930801A093090104
|
||||
:1004B000B0930A0180930B0190930C01A0930D015E
|
||||
:1004C000B0930E01F0CE109212011092130110920F
|
||||
:1004D000140110921501AACF1F910F9108951F9238
|
||||
:1004E0000F920FB60F9211242F933F938F939F93E8
|
||||
:1004F000AF93BF9380911E0190911F01A0912001A5
|
||||
:10050000B091210130911D0123E0230F2D3720F4FC
|
||||
:100510000196A11DB11D05C026E8230F0296A11D5D
|
||||
:10052000B11D20931D0180931E0190931F01A09384
|
||||
:100530002001B09321018091220190912301A0918B
|
||||
:100540002401B09125010196A11DB11D80932201C6
|
||||
:1005500090932301A0932401B0932501BF91AF9103
|
||||
:100560009F918F913F912F910F900FBE0F901F90F1
|
||||
:100570001895789484B5826084BD84B5816084BD0B
|
||||
:1005800085B5826085BD85B5816085BD80916E0031
|
||||
:10059000816080936E001092810080918100826062
|
||||
:1005A000809381008091810081608093810080919F
|
||||
:1005B00080008160809380008091B100846080938E
|
||||
:1005C000B1008091B00081608093B00080917A008A
|
||||
:1005D000846080937A0080917A00826080937A00B0
|
||||
:1005E00080917A00816080937A0080917A0080689F
|
||||
:1005F00080937A001092C1000E947B004B015C0145
|
||||
:1006000084E6C82ED12CE12CF12C0E947B00DC0169
|
||||
:10061000CB0188199909AA09BB09883E9340A10515
|
||||
:10062000B10558F021E0C21AD108E108F10888EEBE
|
||||
:10063000880E83E0981EA11CB11CC114D104E104F2
|
||||
:10064000F10419F781E080931C010E94A000109230
|
||||
:100650001C01C0E0D0E00E94A0002097E1F30E94BE
|
||||
:080660000000F9CFF894FFCF70
|
||||
:10066800000003000000040000000000000000007B
|
||||
:08067800020000000000000276
|
||||
:00000001FF
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
},
|
||||
{
|
||||
"boundLiterals": {
|
||||
"B134j4neZ": "13",
|
||||
"rJjXFA9JQ": "D13",
|
||||
"HJ6HsEngZ": "False"
|
||||
},
|
||||
"id": "SyeDNFBWZ",
|
||||
@@ -46,7 +46,7 @@
|
||||
"x": 0,
|
||||
"y": 204
|
||||
},
|
||||
"type": "xod/core/digital-output"
|
||||
"type": "xod/gpio/digital-write"
|
||||
},
|
||||
{
|
||||
"boundLiterals": {
|
||||
|
||||
@@ -59,14 +59,14 @@
|
||||
},
|
||||
{
|
||||
"boundLiterals": {
|
||||
"BJuORNheZ": "2"
|
||||
"SkuhqCqym": "A2"
|
||||
},
|
||||
"id": "H1UNiwVt-",
|
||||
"position": {
|
||||
"x": 272,
|
||||
"y": 0
|
||||
},
|
||||
"type": "xod/core/analog-input"
|
||||
"type": "xod/gpio/analog-read"
|
||||
},
|
||||
{
|
||||
"boundLiterals": {
|
||||
|
||||
@@ -97,14 +97,14 @@
|
||||
},
|
||||
{
|
||||
"boundLiterals": {
|
||||
"BJuORNheZ": "2"
|
||||
"SkuhqCqym": "A2"
|
||||
},
|
||||
"id": "H1pMkkVqZ",
|
||||
"position": {
|
||||
"x": 238,
|
||||
"y": -102
|
||||
},
|
||||
"type": "xod/core/analog-input"
|
||||
"type": "xod/gpio/analog-read"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -103,14 +103,14 @@
|
||||
},
|
||||
{
|
||||
"boundLiterals": {
|
||||
"BJuORNheZ": "2"
|
||||
"SkuhqCqym": "A2"
|
||||
},
|
||||
"id": "rJyzdUqjZ",
|
||||
"position": {
|
||||
"x": 306,
|
||||
"y": 0
|
||||
},
|
||||
"type": "xod/core/analog-input"
|
||||
"type": "xod/gpio/analog-read"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
"x": 306,
|
||||
"y": 204
|
||||
},
|
||||
"type": "xod/core/analog-input"
|
||||
"type": "xod/gpio/analog-read"
|
||||
},
|
||||
{
|
||||
"boundLiterals": {
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
"x": 306,
|
||||
"y": 408
|
||||
},
|
||||
"type": "xod/core/analog-input"
|
||||
"type": "xod/gpio/analog-read"
|
||||
},
|
||||
{
|
||||
"boundLiterals": {
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
},
|
||||
{
|
||||
"boundLiterals": {
|
||||
"BJuORNheZ": "0"
|
||||
"SkuhqCqym": "A0"
|
||||
},
|
||||
"id": "By5oDu8qW",
|
||||
"label": "Photoresistor",
|
||||
@@ -68,7 +68,7 @@
|
||||
"x": 578,
|
||||
"y": 612
|
||||
},
|
||||
"type": "xod/core/analog-input"
|
||||
"type": "xod/gpio/analog-read"
|
||||
},
|
||||
{
|
||||
"id": "S1ykdOLqb",
|
||||
|
||||