dpad_board
Last Modified: 2024-03-17 07:09:19
Created On: 2023-12-10 15:58:46
Owned By: evezor
Created By: anfro
Contributors: anfro, evezor
Public: True
Executable
# --------------------------------------
# dpad_board
# 65f6971fa8283106canv
__canvas_id__ = '65f6971fa8283106'
# __version__ = TODO: add this
# --------------------------------------
from floe import FP
from NeoPixel import NeoPixel
from DigitalOutput import DigitalOutput
from DigitalInput import DigitalInput
from HbtLed import HbtLed
from ESP32Core import ESP32Core
from AnalogInput import AnalogInput
from CANBus import CANBus
def setup(iris):
AnalogInput(name="pot_a", pid=54271, pin=34, ring_size=10, noise_reduction=0.05, delay=50, datatype="float", debug=False, active=True, bcast=True, iris=iris)
AnalogInput(name="pot_b", pid=44395, pin=35, ring_size=10, noise_reduction=0.05, delay=50, datatype="float", debug=False, active=True, bcast=True, iris=iris)
CANBus(name="CANBus", pid=6545, rx=16, tx=4, adr=17, bus=0, baud=250000, rx_queue=25, terminal_debug=False, debug=False, active=True, bcast=False, iris=iris)
DigitalInput(name="a", pid=11454, pin=23, pullup='pullup', debounce=200, invert=True, initial_value=False, datatype="bool", debug=False, active=True, bcast=True, iris=iris)
DigitalInput(name="b", pid=31414, pin=22, pullup='pullup', debounce=200, invert=True, initial_value=False, datatype="bool", debug=False, active=True, bcast=True, iris=iris)
DigitalInput(name="down", pid=34263, pin=27, pullup='pullup', debounce=200, invert=True, initial_value=False, datatype="bool", debug=False, active=True, bcast=True, iris=iris)
DigitalInput(name="function_button", pid=2276, pin=36, pullup='None', debounce=200, invert=True, initial_value=False, datatype="bool", debug=False, active=True, bcast=True, iris=iris)
DigitalInput(name="left", pid=21221, pin=33, pullup='pullup', debounce=200, invert=True, initial_value=False, datatype="bool", debug=False, active=True, bcast=True, iris=iris)
DigitalInput(name="push", pid=21405, pin=32, pullup='pullup', debounce=200, invert=True, initial_value=False, datatype="bool", debug=False, active=True, bcast=True, iris=iris)
DigitalInput(name="right", pid=53170, pin=26, pullup='pullup', debounce=200, invert=True, initial_value=False, datatype="bool", debug=False, active=True, bcast=True, iris=iris)
DigitalInput(name="up", pid=15531, pin=25, pullup='pullup', debounce=200, invert=True, initial_value=False, datatype="bool", debug=False, active=True, bcast=True, iris=iris)
DigitalOutput(name="can_slp", pid=11397, pin=2, invert=False, initial_value=False, datatype="bool", debug=False, active=True, bcast=False, iris=iris)
DigitalOutput(name="led0", pid=34645, pin=15, invert=False, initial_value=False, datatype="bool", debug=False, active=True, bcast=False, iris=iris)
DigitalOutput(name="led1", pid=41646, pin=18, invert=False, initial_value=False, datatype="bool", debug=False, active=True, bcast=False, iris=iris)
DigitalOutput(name="led2", pid=56094, pin=19, invert=False, initial_value=False, datatype="bool", debug=False, active=True, bcast=False, iris=iris)
DigitalOutput(name="led3", pid=43505, pin=21, invert=False, initial_value=False, datatype="bool", debug=False, active=True, bcast=False, iris=iris)
ESP32Core(name="ESP32Core", pid=6074, wifi=False, hbt_led=FP(50487), neo_status=FP(47403), function_button=FP(2276), bus=FP(6545), zorg=None, webserver=None, debug=False, active=True, bcast=False, iris=iris)
HbtLed(name="HbtLed", pid=50487, pin=5, delay=1000, datatype="int", debug=False, active=True, bcast=False, iris=iris)
NeoPixel(name="neo_status", pid=47403, pin=17, number_of_pixels=1, animation=0, delay=200, animations=None, datatype="rgb", debug=False, active=True, bcast=False, iris=iris)
iris.add_hots({})
Canvas View:
Dependencies:
["NeoPixel", "DigitalOutput", "DigitalInput", "HbtLed", "Parameter", "FileReceiver", "ESP32Core", "AnalogInput", "CANBus"]
Uppie code:
this code is used as the constructor in this canvas is dropped on a canvas above
{
"canvas_id": "65d354fc6484b5b4canv",
"zorg": false,
"busses": {
"CANBus": "17"
},
"ports": [
{
"name": "led0",
"reference_id": "96906580-3660-5cf8-b9b3-166f6e6ea5ca",
"pid": 34645,
"type": "input",
"datatype": "bool",
"parameter_type": "DigitalOutput"
},
{
"name": "led1",
"reference_id": "6fbbd229-fc4a-97f9-9c6f-97000dd02f35",
"pid": 41646,
"type": "input",
"datatype": "bool",
"parameter_type": "DigitalOutput"
},
{
"name": "led2",
"reference_id": "43362a2a-22f5-3d89-faf0-017c9d8a2d3a",
"pid": 56094,
"type": "input",
"datatype": "bool",
"parameter_type": "DigitalOutput"
},
{
"name": "led3",
"reference_id": "9168f000-faea-9edf-99db-601cf242d227",
"pid": 43505,
"type": "input",
"datatype": "bool",
"parameter_type": "DigitalOutput"
},
{
"name": "pot_a",
"reference_id": "bc6689bc-6faa-2016-000d-c6e1322e3886",
"pid": 54271,
"type": "output",
"datatype": "float",
"parameter_type": "AnalogInput"
},
{
"name": "pot_b",
"reference_id": "ec2c4040-83a2-70f8-8adf-0ec319d9103e",
"pid": 44395,
"type": "output",
"datatype": "float",
"parameter_type": "AnalogInput"
},
{
"name": "up",
"reference_id": "f0ad4894-4b89-d253-ac1a-2d750ac12843",
"pid": 15531,
"type": "output",
"datatype": "bool",
"parameter_type": "DigitalInput"
},
{
"name": "push",
"reference_id": "35b74a58-0f1c-2f86-30b8-b791f7cd6d8d",
"pid": 21405,
"type": "output",
"datatype": "bool",
"parameter_type": "DigitalInput"
},
{
"name": "down",
"reference_id": "dde37652-3a7a-0bde-3f0d-291bef321dea",
"pid": 34263,
"type": "output",
"datatype": "bool",
"parameter_type": "DigitalInput"
},
{
"name": "left",
"reference_id": "d75f60a7-1e14-09b0-d4d7-22750ceee599",
"pid": 21221,
"type": "output",
"datatype": "bool",
"parameter_type": "DigitalInput"
},
{
"name": "right",
"reference_id": "27cbbfaf-6910-d42d-906e-d95b9204eacf",
"pid": 53170,
"type": "output",
"datatype": "bool",
"parameter_type": "DigitalInput"
},
{
"name": "a",
"reference_id": "59ce5ed0-b84c-a61f-9573-12de126698df",
"pid": 11454,
"type": "output",
"datatype": "bool",
"parameter_type": "DigitalInput"
},
{
"name": "b",
"reference_id": "c7733af9-7b75-e2d5-1964-948352f5709f",
"pid": 31414,
"type": "output",
"datatype": "bool",
"parameter_type": "DigitalInput"
}
]
}
Uppie subs:
{}
Canvas code:
[
{
"type": "CanvasID",
"id": "65f6971fa8283106canv",
"x": 26.786299999999983,
"y": 24.64382824707031,
"selectable": false,
"draggable": true,
"text": "CanvasID: 65f6971fa8283106canv",
"canvas_type": "core"
},
{
"type": "Parameter",
"name": "ESP32Core",
"id": "9e65d461-88ea-d923-2508-c70738045031",
"ParameterType": "ESP32Core",
"datatype": null,
"pid": "6074",
"x": 2402.7108518622163,
"y": 338.7312804460477,
"width": 95,
"height": 164,
"constants": {
"wifi": false
},
"up_data": {
"can_go_up": false,
"up": false
},
"debug": false,
"active": true,
"broadcast": false
},
{
"type": "Parameter",
"name": "function_button",
"id": "755f08c5-a527-574e-94c4-ec22787d7c83",
"ParameterType": "DigitalInput",
"datatype": "bool",
"pid": 2276,
"x": 2115.7108518622163,
"y": 324.0728804460477,
"width": 95,
"height": 51,
"constants": {
"pin": "36",
"pullup": "None",
"debounce": 200
},
"up_data": {
"can_go_up": true,
"type": "output",
"order": 999,
"up": false
},
"debug": false,
"active": true,
"broadcast": true
},
{
"type": "Parameter",
"name": "neo_status",
"id": "c02b1b9a-83a0-4dc8-6c78-b233f6794e97",
"ParameterType": "NeoPixel",
"datatype": "rgb",
"pid": 47403,
"x": 2092.7108518622163,
"y": 257.0728804460477,
"width": 73,
"height": 40,
"constants": {
"pin": "17",
"number_of_pixels": 1
},
"up_data": {
"can_go_up": true,
"type": "input",
"order": 999,
"up": false
},
"debug": false,
"active": true,
"broadcast": false
},
{
"type": "Parameter",
"name": "CANBus",
"id": "094dfcb9-7772-56e1-d37f-10f852b3fd3e",
"ParameterType": "CANBus",
"datatype": null,
"pid": 6545,
"x": 2144.7108518622163,
"y": 426.97208044604776,
"width": 79,
"height": 43,
"constants": {
"rx": "16",
"tx": "4",
"adr": "17",
"bus": "0",
"baud": 250000,
"rx_queue": 25
},
"up_data": {
"can_go_up": false,
"up": false
},
"debug": false,
"active": true,
"broadcast": false
},
{
"type": "NotePad",
"id": "d62904e5-41be-2090-31f2-f67f776f676e",
"x": 2352.2108518622163,
"y": 253.82408044604773,
"width": 218,
"height": 25,
"ports": [],
"text": "Core Components"
},
{
"type": "Parameter",
"name": "HbtLed",
"id": "7906fc95-7e4b-9ed1-dab9-abd07d17d0c2",
"ParameterType": "HbtLed",
"datatype": "int",
"pid": 50487,
"x": 2081.3588518622164,
"y": 172.79329343432897,
"width": 74,
"height": 40,
"constants": {
"pin": "5"
},
"up_data": {
"can_go_up": false,
"up": false
},
"debug": false,
"active": true,
"broadcast": false
},
{
"type": "Parameter",
"name": "can_slp",
"id": "3a429d50-899d-cb28-be24-195f5663a9ee",
"ParameterType": "DigitalOutput",
"datatype": "bool",
"pid": 11397,
"x": 2402.7108518622163,
"y": 156.82408044604773,
"width": 95,
"height": 50,
"constants": {
"pin": "2"
},
"up_data": {
"can_go_up": true,
"type": "input",
"order": 999,
"up": false
},
"debug": false,
"active": true,
"broadcast": false
},
{
"type": "Parameter",
"name": "led0",
"id": "96906580-3660-5cf8-b9b3-166f6e6ea5ca",
"ParameterType": "DigitalOutput",
"datatype": "bool",
"pid": 34645,
"x": 284.29035661711123,
"y": 401.0439972676866,
"width": 95,
"height": 50,
"constants": {
"pin": "15"
},
"up_data": {
"can_go_up": true,
"type": "input",
"order": 999,
"up": true
},
"debug": false,
"active": true,
"broadcast": false
},
{
"type": "Parameter",
"name": "led1",
"id": "6fbbd229-fc4a-97f9-9c6f-97000dd02f35",
"ParameterType": "DigitalOutput",
"datatype": "bool",
"pid": 41646,
"x": 539.2903566171112,
"y": 401.0439972676866,
"width": 95,
"height": 50,
"constants": {
"pin": "18"
},
"up_data": {
"can_go_up": true,
"type": "input",
"order": 999,
"up": true
},
"debug": false,
"active": true,
"broadcast": false
},
{
"type": "Parameter",
"name": "led2",
"id": "43362a2a-22f5-3d89-faf0-017c9d8a2d3a",
"ParameterType": "DigitalOutput",
"datatype": "bool",
"pid": 56094,
"x": 803.2903566171112,
"y": 401.0439972676866,
"width": 95,
"height": 50,
"constants": {
"pin": "19"
},
"up_data": {
"can_go_up": true,
"type": "input",
"order": 999,
"up": true
},
"debug": false,
"active": true,
"broadcast": false
},
{
"type": "Parameter",
"name": "led3",
"id": "9168f000-faea-9edf-99db-601cf242d227",
"ParameterType": "DigitalOutput",
"datatype": "bool",
"pid": 43505,
"x": 1078.2903566171112,
"y": 401.0439972676866,
"width": 95,
"height": 50,
"constants": {
"pin": "21"
},
"up_data": {
"can_go_up": true,
"type": "input",
"order": 999,
"up": true
},
"debug": false,
"active": true,
"broadcast": false
},
{
"type": "Parameter",
"name": "pot_a",
"id": "bc6689bc-6faa-2016-000d-c6e1322e3886",
"ParameterType": "AnalogInput",
"datatype": "float",
"pid": 54271,
"x": 539.2903566171112,
"y": 160.29329343432897,
"width": 95,
"height": 65,
"constants": {
"pin": "34",
"ring_size": 10,
"noise_reduction": ".05"
},
"up_data": {
"can_go_up": true,
"type": "output",
"order": 999,
"up": true
},
"debug": false,
"active": true,
"broadcast": true
},
{
"type": "Parameter",
"name": "pot_b",
"id": "ec2c4040-83a2-70f8-8adf-0ec319d9103e",
"ParameterType": "AnalogInput",
"datatype": "float",
"pid": 44395,
"x": 803.2903566171112,
"y": 161.8333282470703,
"width": 95,
"height": 65,
"constants": {
"pin": "35",
"ring_size": 10,
"noise_reduction": ".05"
},
"up_data": {
"can_go_up": true,
"type": "output",
"order": 999,
"up": true
},
"debug": false,
"active": true,
"broadcast": true
},
{
"type": "Parameter",
"name": "up",
"id": "f0ad4894-4b89-d253-ac1a-2d750ac12843",
"ParameterType": "DigitalInput",
"datatype": "bool",
"pid": 15531,
"x": 445.5,
"y": 663.8333129882812,
"width": 90,
"height": 45,
"constants": {
"pin": "25",
"pullup": "pullup",
"debounce": 200
},
"up_data": {
"can_go_up": true,
"type": "output",
"order": 999,
"up": true
},
"debug": false,
"active": true,
"broadcast": true
},
{
"type": "Parameter",
"name": "push",
"id": "35b74a58-0f1c-2f86-30b8-b791f7cd6d8d",
"ParameterType": "DigitalInput",
"datatype": "bool",
"pid": 21405,
"x": 445.5,
"y": 793.8333129882812,
"width": 90,
"height": 45,
"constants": {
"pin": "32",
"pullup": "pullup",
"debounce": 200
},
"up_data": {
"can_go_up": true,
"type": "output",
"order": 999,
"up": true
},
"debug": false,
"active": true,
"broadcast": true
},
{
"type": "Parameter",
"name": "down",
"id": "dde37652-3a7a-0bde-3f0d-291bef321dea",
"ParameterType": "DigitalInput",
"datatype": "bool",
"pid": 34263,
"x": 445.5,
"y": 931.8333129882812,
"width": 90,
"height": 45,
"constants": {
"pin": "27",
"pullup": "pullup",
"debounce": 200
},
"up_data": {
"can_go_up": true,
"type": "output",
"order": 999,
"up": true
},
"debug": false,
"active": true,
"broadcast": true
},
{
"type": "Parameter",
"name": "left",
"id": "d75f60a7-1e14-09b0-d4d7-22750ceee599",
"ParameterType": "DigitalInput",
"datatype": "bool",
"pid": 21221,
"x": 199.5,
"y": 793.8333129882812,
"width": 90,
"height": 45,
"constants": {
"pin": "33",
"pullup": "pullup",
"debounce": 200
},
"up_data": {
"can_go_up": true,
"type": "output",
"order": 999,
"up": true
},
"debug": false,
"active": true,
"broadcast": true
},
{
"type": "Parameter",
"name": "right",
"id": "27cbbfaf-6910-d42d-906e-d95b9204eacf",
"ParameterType": "DigitalInput",
"datatype": "bool",
"pid": 53170,
"x": 685.5,
"y": 793.8333129882812,
"width": 90,
"height": 45,
"constants": {
"pin": "26",
"pullup": "pullup",
"debounce": 200
},
"up_data": {
"can_go_up": true,
"type": "output",
"order": 999,
"up": true
},
"debug": false,
"active": true,
"broadcast": true
},
{
"type": "Parameter",
"name": "a",
"id": "59ce5ed0-b84c-a61f-9573-12de126698df",
"ParameterType": "DigitalInput",
"datatype": "bool",
"pid": 11454,
"x": 1120.5,
"y": 765.8333129882812,
"width": 90,
"height": 45,
"constants": {
"pin": "23",
"pullup": "pullup",
"debounce": 200
},
"up_data": {
"can_go_up": true,
"type": "output",
"order": 999,
"up": true
},
"debug": false,
"active": true,
"broadcast": true
},
{
"type": "Parameter",
"name": "b",
"id": "c7733af9-7b75-e2d5-1964-948352f5709f",
"ParameterType": "DigitalInput",
"datatype": "bool",
"pid": 31414,
"x": 1238.5,
"y": 926.8333129882812,
"width": 90,
"height": 45,
"constants": {
"pin": "22",
"pullup": "pullup",
"debounce": 200
},
"up_data": {
"can_go_up": true,
"type": "output",
"order": 999,
"up": true
},
"debug": false,
"active": true,
"broadcast": true
},
{
"type": "NotePad",
"id": "d9447393-1e0c-3cfe-6634-d6240a6fc591",
"x": 701,
"y": 90.83332824707031,
"width": 218,
"height": 25,
"ports": [],
"text": "pots"
},
{
"type": "NotePad",
"id": "a0be45e5-9db9-e2ac-a980-310e5a8e6dae",
"x": 701.5,
"y": 324.0728804460477,
"width": 218,
"height": 25,
"ports": [],
"text": "leds"
},
{
"type": "NotePad",
"id": "d8ad86eb-3616-c833-e956-83f87bf759f4",
"x": 668.5,
"y": 670.3333129882812,
"width": 218,
"height": 25,
"ports": [],
"text": "dpad"
},
{
"type": "NotePad",
"id": "4e4ac5ec-439b-d666-759e-6fbfe4940bf4",
"x": 1090.2570237924042,
"y": 874.8333129882812,
"width": 218,
"height": 25,
"ports": [],
"text": "buttons"
},
{
"type": "HoverConnection",
"id": "2b775f03-5aa3-3fe4-bb75-ac541beaf49c",
"bus": "local",
"vertex": [
{
"x": 2165.7108518622163,
"y": 283.7395471127144
},
{
"x": 2309.7108518622163,
"y": 283.7395471127144
},
{
"x": 2309.7108518622163,
"y": 385.58842330319055
},
{
"x": 2402.7108518622163,
"y": 385.58842330319055
}
],
"source": {
"node": "c02b1b9a-83a0-4dc8-6c78-b233f6794e97",
"port": "self"
},
"target": {
"node": "9e65d461-88ea-d923-2508-c70738045031",
"port": "neo_status"
}
},
{
"type": "HoverConnection",
"id": "825c8068-d774-af1f-4d9a-32a158ca9744",
"bus": "local",
"vertex": [
{
"x": 2155.3588518622164,
"y": 192.79329343432897
},
{
"x": 2327.7108518622163,
"y": 192.79329343432897
},
{
"x": 2327.7108518622163,
"y": 362.15985187461916
},
{
"x": 2402.7108518622163,
"y": 362.15985187461916
}
],
"source": {
"node": "7906fc95-7e4b-9ed1-dab9-abd07d17d0c2",
"port": "self"
},
"target": {
"node": "9e65d461-88ea-d923-2508-c70738045031",
"port": "hbt_led"
}
},
{
"type": "HoverConnection",
"id": "65be2b61-ca8d-e5e3-81ff-af3dd48ce324",
"bus": "local",
"vertex": [
{
"x": 2210.7108518622163,
"y": 341.0728804460477
},
{
"x": 2290.7108518622163,
"y": 341.0728804460477
},
{
"x": 2290.7108518622163,
"y": 409.016994731762
},
{
"x": 2402.7108518622163,
"y": 409.016994731762
}
],
"source": {
"node": "755f08c5-a527-574e-94c4-ec22787d7c83",
"port": "event"
},
"target": {
"node": "9e65d461-88ea-d923-2508-c70738045031",
"port": "function_button"
}
},
{
"type": "HoverConnection",
"id": "3f658083-625d-614a-c703-d4270120db8f",
"bus": "local",
"vertex": [
{
"x": 2223.7108518622163,
"y": 448.47208044604776
},
{
"x": 2293.2108518622163,
"y": 448.47208044604776
},
{
"x": 2293.2108518622163,
"y": 432.44556616033344
},
{
"x": 2402.7108518622163,
"y": 432.44556616033344
}
],
"source": {
"node": "094dfcb9-7772-56e1-d37f-10f852b3fd3e",
"port": "self"
},
"target": {
"node": "9e65d461-88ea-d923-2508-c70738045031",
"port": "bus"
}
}
]