Barmaja-PyArduino 2.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- Barmaja_PyArduino/BARMAJA_PyArduino.ico +0 -0
- Barmaja_PyArduino/__init__.py +528 -0
- Barmaja_PyArduino/__init__.pyi +331 -0
- Barmaja_PyArduino/__main__.py +2 -0
- Barmaja_PyArduino/adapters/__init__.py +35 -0
- Barmaja_PyArduino/api_registry.py +459 -0
- Barmaja_PyArduino/backend/__init__.py +3 -0
- Barmaja_PyArduino/backend/uno_cpp.py +1680 -0
- Barmaja_PyArduino/board.py +80 -0
- Barmaja_PyArduino/cli.py +223 -0
- Barmaja_PyArduino/compiler.py +1721 -0
- Barmaja_PyArduino/console.py +217 -0
- Barmaja_PyArduino/device_packs.py +367 -0
- Barmaja_PyArduino/device_packs_builtin/Button/arduino/Barmaja_Button/library.properties +9 -0
- Barmaja_PyArduino/device_packs_builtin/Button/arduino/Barmaja_Button/src/Barmaja_Button.h +18 -0
- Barmaja_PyArduino/device_packs_builtin/Button/example.py +10 -0
- Barmaja_PyArduino/device_packs_builtin/Button/pack.json +40 -0
- Barmaja_PyArduino/device_packs_builtin/ClockDS3231/arduino/Barmaja_ClockDS3231/library.properties +9 -0
- Barmaja_PyArduino/device_packs_builtin/ClockDS3231/arduino/Barmaja_ClockDS3231/src/Barmaja_ClockDS3231.h +20 -0
- Barmaja_PyArduino/device_packs_builtin/ClockDS3231/example.py +8 -0
- Barmaja_PyArduino/device_packs_builtin/ClockDS3231/pack.json +136 -0
- Barmaja_PyArduino/device_packs_builtin/DistanceVL53L0X/arduino/Barmaja_DistanceVL53L0X/library.properties +9 -0
- Barmaja_PyArduino/device_packs_builtin/DistanceVL53L0X/arduino/Barmaja_DistanceVL53L0X/src/Barmaja_DistanceVL53L0X.h +12 -0
- Barmaja_PyArduino/device_packs_builtin/DistanceVL53L0X/example.py +8 -0
- Barmaja_PyArduino/device_packs_builtin/DistanceVL53L0X/pack.json +48 -0
- Barmaja_PyArduino/device_packs_builtin/LCDParallel/arduino/Barmaja_LCDParallel/library.properties +9 -0
- Barmaja_PyArduino/device_packs_builtin/LCDParallel/arduino/Barmaja_LCDParallel/src/Barmaja_LCDParallel.h +17 -0
- Barmaja_PyArduino/device_packs_builtin/LCDParallel/example.py +10 -0
- Barmaja_PyArduino/device_packs_builtin/LCDParallel/pack.json +137 -0
- Barmaja_PyArduino/device_packs_builtin/LoadCellHX711/arduino/Barmaja_LoadCellHX711/library.properties +9 -0
- Barmaja_PyArduino/device_packs_builtin/LoadCellHX711/arduino/Barmaja_LoadCellHX711/src/Barmaja_LoadCellHX711.h +16 -0
- Barmaja_PyArduino/device_packs_builtin/LoadCellHX711/example.py +11 -0
- Barmaja_PyArduino/device_packs_builtin/LoadCellHX711/pack.json +74 -0
- Barmaja_PyArduino/device_packs_builtin/NeoPixelStrip/arduino/Barmaja_NeoPixelStrip/library.properties +9 -0
- Barmaja_PyArduino/device_packs_builtin/NeoPixelStrip/arduino/Barmaja_NeoPixelStrip/src/Barmaja_NeoPixelStrip.h +15 -0
- Barmaja_PyArduino/device_packs_builtin/NeoPixelStrip/example.py +13 -0
- Barmaja_PyArduino/device_packs_builtin/NeoPixelStrip/pack.json +114 -0
- Barmaja_PyArduino/device_packs_builtin/OLEDText/arduino/Barmaja_OLEDText/library.properties +9 -0
- Barmaja_PyArduino/device_packs_builtin/OLEDText/arduino/Barmaja_OLEDText/src/Barmaja_OLEDText.h +21 -0
- Barmaja_PyArduino/device_packs_builtin/OLEDText/example.py +9 -0
- Barmaja_PyArduino/device_packs_builtin/OLEDText/pack.json +103 -0
- Barmaja_PyArduino/device_packs_builtin/PressureBMP280/arduino/Barmaja_PressureBMP280/library.properties +9 -0
- Barmaja_PyArduino/device_packs_builtin/PressureBMP280/arduino/Barmaja_PressureBMP280/src/Barmaja_PressureBMP280.h +16 -0
- Barmaja_PyArduino/device_packs_builtin/PressureBMP280/example.py +8 -0
- Barmaja_PyArduino/device_packs_builtin/PressureBMP280/pack.json +92 -0
- Barmaja_PyArduino/device_packs_builtin/RotaryEncoder/arduino/Barmaja_RotaryEncoder/library.properties +9 -0
- Barmaja_PyArduino/device_packs_builtin/RotaryEncoder/arduino/Barmaja_RotaryEncoder/src/Barmaja_RotaryEncoder.h +18 -0
- Barmaja_PyArduino/device_packs_builtin/RotaryEncoder/example.py +10 -0
- Barmaja_PyArduino/device_packs_builtin/RotaryEncoder/pack.json +44 -0
- Barmaja_PyArduino/device_packs_builtin/ServoDriverPCA9685/arduino/Barmaja_ServoDriverPCA9685/library.properties +9 -0
- Barmaja_PyArduino/device_packs_builtin/ServoDriverPCA9685/arduino/Barmaja_ServoDriverPCA9685/src/Barmaja_ServoDriverPCA9685.h +15 -0
- Barmaja_PyArduino/device_packs_builtin/ServoDriverPCA9685/example.py +10 -0
- Barmaja_PyArduino/device_packs_builtin/ServoDriverPCA9685/pack.json +117 -0
- Barmaja_PyArduino/device_packs_builtin/ShiftRegister595/arduino/Barmaja_ShiftRegister595/library.properties +9 -0
- Barmaja_PyArduino/device_packs_builtin/ShiftRegister595/arduino/Barmaja_ShiftRegister595/src/Barmaja_ShiftRegister595.h +14 -0
- Barmaja_PyArduino/device_packs_builtin/ShiftRegister595/example.py +9 -0
- Barmaja_PyArduino/device_packs_builtin/ShiftRegister595/pack.json +83 -0
- Barmaja_PyArduino/device_packs_builtin/TemperatureDS18B20/arduino/Barmaja_TemperatureDS18B20/library.properties +9 -0
- Barmaja_PyArduino/device_packs_builtin/TemperatureDS18B20/arduino/Barmaja_TemperatureDS18B20/src/Barmaja_TemperatureDS18B20.h +16 -0
- Barmaja_PyArduino/device_packs_builtin/TemperatureDS18B20/example.py +8 -0
- Barmaja_PyArduino/device_packs_builtin/TemperatureDS18B20/pack.json +63 -0
- Barmaja_PyArduino/doctor.py +406 -0
- Barmaja_PyArduino/environment.py +595 -0
- Barmaja_PyArduino/errors.py +166 -0
- Barmaja_PyArduino/flow.py +754 -0
- Barmaja_PyArduino/frontend.py +611 -0
- Barmaja_PyArduino/installer.py +151 -0
- Barmaja_PyArduino/ir.py +660 -0
- Barmaja_PyArduino/library_adder.py +440 -0
- Barmaja_PyArduino/live.py +859 -0
- Barmaja_PyArduino/lowering.py +596 -0
- Barmaja_PyArduino/numeric.py +748 -0
- Barmaja_PyArduino/pack_builder.py +544 -0
- Barmaja_PyArduino/py.typed +0 -0
- Barmaja_PyArduino/serial_monitor.py +172 -0
- Barmaja_PyArduino/source.py +184 -0
- Barmaja_PyArduino/stubgen.py +148 -0
- Barmaja_PyArduino/symbols.py +646 -0
- Barmaja_PyArduino/target.py +1631 -0
- Barmaja_PyArduino/toolchain.py +506 -0
- Barmaja_PyArduino/typesys.py +917 -0
- Barmaja_PyArduino/workflow.py +213 -0
- barmaja_pyarduino-2.0.0.dist-info/METADATA +39 -0
- barmaja_pyarduino-2.0.0.dist-info/RECORD +87 -0
- barmaja_pyarduino-2.0.0.dist-info/WHEEL +5 -0
- barmaja_pyarduino-2.0.0.dist-info/licenses/LICENSE.txt +7 -0
- barmaja_pyarduino-2.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,459 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from enum import Enum
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class ApiKind(Enum):
|
|
8
|
+
CONSTANT = "constant"
|
|
9
|
+
CORE_FUNCTION = "core_function"
|
|
10
|
+
HARDWARE_CLASS = "hardware_class"
|
|
11
|
+
SINGLETON = "singleton"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@dataclass(frozen=True)
|
|
15
|
+
class SignatureSpec:
|
|
16
|
+
"""Declarative student-facing API signature.
|
|
17
|
+
|
|
18
|
+
Type tokens are intentionally backend/type-system neutral. The type phase
|
|
19
|
+
maps these tokens to Barmaja types; board/range/lifecycle constraints are
|
|
20
|
+
interpreted by later target analysis.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
args: tuple[str, ...]
|
|
24
|
+
returns: str
|
|
25
|
+
constraints: tuple[str, ...] = ()
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@dataclass(frozen=True)
|
|
29
|
+
class MethodSpec:
|
|
30
|
+
name: str
|
|
31
|
+
signatures: tuple[SignatureSpec, ...]
|
|
32
|
+
lifecycle: str | None = None
|
|
33
|
+
resources: tuple[str, ...] = ()
|
|
34
|
+
|
|
35
|
+
@property
|
|
36
|
+
def arities(self) -> frozenset[int]:
|
|
37
|
+
return frozenset(len(sig.args) for sig in self.signatures)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@dataclass(frozen=True)
|
|
41
|
+
class FunctionSpec:
|
|
42
|
+
name: str
|
|
43
|
+
signatures: tuple[SignatureSpec, ...]
|
|
44
|
+
include: str | None = None
|
|
45
|
+
dependency_id: str | None = None
|
|
46
|
+
resources: tuple[str, ...] = ()
|
|
47
|
+
|
|
48
|
+
@property
|
|
49
|
+
def arities(self) -> frozenset[int]:
|
|
50
|
+
return frozenset(len(sig.args) for sig in self.signatures)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
@dataclass(frozen=True)
|
|
54
|
+
class HardwareClassSpec:
|
|
55
|
+
name: str
|
|
56
|
+
constructors: tuple[SignatureSpec, ...]
|
|
57
|
+
methods: dict[str, MethodSpec]
|
|
58
|
+
includes: tuple[str, ...]
|
|
59
|
+
dependency_ids: tuple[str, ...]
|
|
60
|
+
resources: tuple[str, ...] = ()
|
|
61
|
+
|
|
62
|
+
@property
|
|
63
|
+
def constructor_arities(self) -> frozenset[int]:
|
|
64
|
+
return frozenset(len(sig.args) for sig in self.constructors)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
@dataclass(frozen=True)
|
|
68
|
+
class SingletonSpec:
|
|
69
|
+
name: str
|
|
70
|
+
methods: dict[str, MethodSpec]
|
|
71
|
+
includes: tuple[str, ...] = ()
|
|
72
|
+
dependency_ids: tuple[str, ...] = ()
|
|
73
|
+
resources: tuple[str, ...] = ()
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
@dataclass(frozen=True)
|
|
77
|
+
class DependencySpec:
|
|
78
|
+
dependency_id: str
|
|
79
|
+
display_name: str
|
|
80
|
+
version: str
|
|
81
|
+
include: str | None
|
|
82
|
+
source_identity: str
|
|
83
|
+
transitive: tuple[str, ...] = ()
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
CONSTANT_VALUES: dict[str, int] = {
|
|
87
|
+
"HIGH": 1,
|
|
88
|
+
"LOW": 0,
|
|
89
|
+
"INPUT": 0,
|
|
90
|
+
"OUTPUT": 1,
|
|
91
|
+
"INPUT_PULLUP": 2,
|
|
92
|
+
"A0": 14,
|
|
93
|
+
"A1": 15,
|
|
94
|
+
"A2": 16,
|
|
95
|
+
"A3": 17,
|
|
96
|
+
"A4": 18,
|
|
97
|
+
"A5": 19,
|
|
98
|
+
"DHT11": 11,
|
|
99
|
+
"DHT22": 22,
|
|
100
|
+
# Pinned Erick Simoes Ultrasonic 3.0.0 constants.
|
|
101
|
+
"CM": 28,
|
|
102
|
+
"INC": 71,
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
CORE_FUNCTIONS: dict[str, FunctionSpec] = {
|
|
107
|
+
"pinMode": FunctionSpec("pinMode", (SignatureSpec(("Int", "Int"), "Void", ("digital_pin", "pin_mode")),)),
|
|
108
|
+
"digitalWrite": FunctionSpec("digitalWrite", (SignatureSpec(("Int", "IntOrBool"), "Void", ("digital_pin", "digital_level")),)),
|
|
109
|
+
"digitalRead": FunctionSpec("digitalRead", (SignatureSpec(("Int",), "Int", ("digital_pin", "returns_low_high")),)),
|
|
110
|
+
"analogRead": FunctionSpec("analogRead", (SignatureSpec(("Int",), "Int", ("analog_pin", "range_0_1023")),)),
|
|
111
|
+
"analogWrite": FunctionSpec("analogWrite", (SignatureSpec(("Int", "Int"), "Void", ("pwm_pin", "range_0_255")),), resources=("pwm",)),
|
|
112
|
+
"delay": FunctionSpec("delay", (SignatureSpec(("Int",), "Void", ("non_negative",)),)),
|
|
113
|
+
"millis": FunctionSpec("millis", (SignatureSpec((), "TimeU32", ("wrap_u32",)),)),
|
|
114
|
+
# V1.1 Stage 1: Arduino built-ins, no third-party library required.
|
|
115
|
+
"tone": FunctionSpec("tone", (
|
|
116
|
+
SignatureSpec(("Int", "Int"), "Void", ("digital_pin", "tone_frequency")),
|
|
117
|
+
SignatureSpec(("Int", "Int", "Int"), "Void", ("digital_pin", "tone_frequency", "tone_duration")),
|
|
118
|
+
), resources=("timer2",)),
|
|
119
|
+
"noTone": FunctionSpec("noTone", (SignatureSpec(("Int",), "Void", ("digital_pin",)),), resources=("timer2",)),
|
|
120
|
+
"micros": FunctionSpec("micros", (SignatureSpec((), "TimeU32", ("wrap_u32",)),)),
|
|
121
|
+
"delayMicroseconds": FunctionSpec("delayMicroseconds", (SignatureSpec(("Int",), "Void", ("range_0_16383",)),)),
|
|
122
|
+
"map": FunctionSpec("map", (SignatureSpec(("Int", "Int", "Int", "Int", "Int"), "Int", ("map_distinct_input_bounds",)),)),
|
|
123
|
+
"constrain": FunctionSpec("constrain", (SignatureSpec(("Int", "Int", "Int"), "Int", ("ordered_bounds",)),)),
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
HARDWARE_CLASSES: dict[str, HardwareClassSpec] = {
|
|
128
|
+
# V1.1 Stage 4: module-dependent, standalone only. The Uno R3 has no built-in radio/networking.
|
|
129
|
+
"BluetoothSerial": HardwareClassSpec(
|
|
130
|
+
"BluetoothSerial", (SignatureSpec(("Int", "Int"), "Hardware[BluetoothSerial]", ("digital_pin", "digital_pin")),),
|
|
131
|
+
methods={
|
|
132
|
+
"begin": MethodSpec("begin", (SignatureSpec(("Int",), "Void", ("positive_constant",)),)),
|
|
133
|
+
"listen": MethodSpec("listen", (SignatureSpec((), "Bool"),)),
|
|
134
|
+
"available": MethodSpec("available", (SignatureSpec((), "Int"),)),
|
|
135
|
+
"read": MethodSpec("read", (SignatureSpec((), "Int"),)),
|
|
136
|
+
"write": MethodSpec("write", (SignatureSpec(("Int",), "Int", ("range_0_255",)),)),
|
|
137
|
+
}, includes=("Barmaja_BluetoothSerial.h",), dependency_ids=("barmaja-bluetooth-serial", "arduino-softwareserial-core"), resources=("softserial",),
|
|
138
|
+
),
|
|
139
|
+
"MPU6050Sensor": HardwareClassSpec(
|
|
140
|
+
"MPU6050Sensor", (SignatureSpec((), "Hardware[MPU6050Sensor]"),),
|
|
141
|
+
methods={
|
|
142
|
+
"begin": MethodSpec("begin", (SignatureSpec((), "Bool"),)),
|
|
143
|
+
"update": MethodSpec("update", (SignatureSpec((), "Void"),)),
|
|
144
|
+
"angleX": MethodSpec("angleX", (SignatureSpec((), "Float"),)),
|
|
145
|
+
"angleY": MethodSpec("angleY", (SignatureSpec((), "Float"),)),
|
|
146
|
+
"angleZ": MethodSpec("angleZ", (SignatureSpec((), "Float"),)),
|
|
147
|
+
"accelX": MethodSpec("accelX", (SignatureSpec((), "Float"),)),
|
|
148
|
+
"accelY": MethodSpec("accelY", (SignatureSpec((), "Float"),)),
|
|
149
|
+
"accelZ": MethodSpec("accelZ", (SignatureSpec((), "Float"),)),
|
|
150
|
+
"gyroX": MethodSpec("gyroX", (SignatureSpec((), "Float"),)),
|
|
151
|
+
"gyroY": MethodSpec("gyroY", (SignatureSpec((), "Float"),)),
|
|
152
|
+
"gyroZ": MethodSpec("gyroZ", (SignatureSpec((), "Float"),)),
|
|
153
|
+
}, includes=("Barmaja_MPU6050Sensor.h",), dependency_ids=("barmaja-mpu6050-adapter", "rfetick-mpu6050-light"), resources=("i2c",),
|
|
154
|
+
),
|
|
155
|
+
"GPSModule": HardwareClassSpec(
|
|
156
|
+
"GPSModule", (SignatureSpec(("Int", "Int"), "Hardware[GPSModule]", ("digital_pin", "digital_pin")),),
|
|
157
|
+
methods={
|
|
158
|
+
"begin": MethodSpec("begin", (SignatureSpec(("Int",), "Void", ("positive_constant",)),)),
|
|
159
|
+
"update": MethodSpec("update", (SignatureSpec((), "Bool"),)),
|
|
160
|
+
"hasFix": MethodSpec("hasFix", (SignatureSpec((), "Bool"),)),
|
|
161
|
+
"latitude": MethodSpec("latitude", (SignatureSpec((), "Float"),)),
|
|
162
|
+
"longitude": MethodSpec("longitude", (SignatureSpec((), "Float"),)),
|
|
163
|
+
"satellites": MethodSpec("satellites", (SignatureSpec((), "Int"),)),
|
|
164
|
+
}, includes=("Barmaja_GPSModule.h",), dependency_ids=("barmaja-gps-adapter", "mikalhart-tinygpsplus", "arduino-softwareserial-core"), resources=("softserial",),
|
|
165
|
+
),
|
|
166
|
+
"EthernetW5500": HardwareClassSpec(
|
|
167
|
+
"EthernetW5500", (SignatureSpec(("Int", "Int", "Int", "Int", "Int", "Int", "Int"), "Hardware[EthernetW5500]"),),
|
|
168
|
+
methods={
|
|
169
|
+
"beginIP": MethodSpec("beginIP", (SignatureSpec(("Int", "Int", "Int", "Int"), "Void"),)),
|
|
170
|
+
"connect": MethodSpec("connect", (SignatureSpec(("Int", "Int", "Int", "Int", "Int"), "Bool"),)),
|
|
171
|
+
"connected": MethodSpec("connected", (SignatureSpec((), "Bool"),)),
|
|
172
|
+
"write": MethodSpec("write", (SignatureSpec(("Int",), "Int", ("range_0_255",)),)),
|
|
173
|
+
"available": MethodSpec("available", (SignatureSpec((), "Int"),)),
|
|
174
|
+
"read": MethodSpec("read", (SignatureSpec((), "Int"),)),
|
|
175
|
+
"stop": MethodSpec("stop", (SignatureSpec((), "Void"),)),
|
|
176
|
+
}, includes=("Barmaja_EthernetW5500.h",), dependency_ids=("barmaja-ethernet-adapter", "arduino-ethernet"), resources=("spi",),
|
|
177
|
+
),
|
|
178
|
+
"WiFiESPAT": HardwareClassSpec(
|
|
179
|
+
"WiFiESPAT", (SignatureSpec(("Int", "Int"), "Hardware[WiFiESPAT]", ("digital_pin", "digital_pin")),),
|
|
180
|
+
methods={
|
|
181
|
+
"begin": MethodSpec("begin", (SignatureSpec(("Int",), "Void", ("positive_constant",)),)),
|
|
182
|
+
"connect": MethodSpec("connect", (SignatureSpec(("String", "String"), "Bool"),)),
|
|
183
|
+
"connected": MethodSpec("connected", (SignatureSpec((), "Bool"),)),
|
|
184
|
+
"tcpConnect": MethodSpec("tcpConnect", (SignatureSpec(("Int", "Int", "Int", "Int", "Int"), "Bool"),)),
|
|
185
|
+
"write": MethodSpec("write", (SignatureSpec(("Int",), "Int", ("range_0_255",)),)),
|
|
186
|
+
"available": MethodSpec("available", (SignatureSpec((), "Int"),)),
|
|
187
|
+
"read": MethodSpec("read", (SignatureSpec((), "Int"),)),
|
|
188
|
+
"stop": MethodSpec("stop", (SignatureSpec((), "Void"),)),
|
|
189
|
+
}, includes=("Barmaja_WiFiESPAT.h",), dependency_ids=("barmaja-wifiespat-adapter", "jandrassy-wifiespat", "arduino-softwareserial-core"), resources=("softserial",),
|
|
190
|
+
),
|
|
191
|
+
# V1.1 Stage 2: standalone Arduino Uno modules (LiveRun deliberately not exposed).
|
|
192
|
+
"RFID": HardwareClassSpec(
|
|
193
|
+
"RFID", (SignatureSpec(("Int", "Int"), "Hardware[RFID]", ("digital_pin", "digital_pin")),),
|
|
194
|
+
methods={
|
|
195
|
+
"begin": MethodSpec("begin", (SignatureSpec((), "Void"),), lifecycle="rfid_begin"),
|
|
196
|
+
"readUID": MethodSpec("readUID", (SignatureSpec((), "String"),), lifecycle="requires_rfid_begin"),
|
|
197
|
+
}, includes=("Barmaja_RFID.h",), dependency_ids=("barmaja-rfid-adapter", "mfrc522-v1"), resources=("spi",),
|
|
198
|
+
),
|
|
199
|
+
"IRRemote": HardwareClassSpec(
|
|
200
|
+
"IRRemote", (SignatureSpec(("Int",), "Hardware[IRRemote]", ("digital_pin",)),),
|
|
201
|
+
methods={
|
|
202
|
+
"begin": MethodSpec("begin", (SignatureSpec((), "Void"),), lifecycle="ir_begin"),
|
|
203
|
+
"readCommand": MethodSpec("readCommand", (SignatureSpec((), "Int"),), lifecycle="requires_ir_begin"),
|
|
204
|
+
}, includes=("Barmaja_IRRemote.h",), dependency_ids=("barmaja-ir-adapter", "arduino-irremote"), resources=("ir_timer",),
|
|
205
|
+
),
|
|
206
|
+
"Keypad4x4": HardwareClassSpec(
|
|
207
|
+
"Keypad4x4", (SignatureSpec(("Int", "Int", "Int", "Int", "Int", "Int", "Int", "Int"), "Hardware[Keypad4x4]", ("keypad_pins",)),),
|
|
208
|
+
methods={"getKey": MethodSpec("getKey", (SignatureSpec((), "String"),))},
|
|
209
|
+
includes=("Barmaja_Keypad.h",), dependency_ids=("barmaja-keypad-adapter",),
|
|
210
|
+
),
|
|
211
|
+
"StepperMotor": HardwareClassSpec(
|
|
212
|
+
"StepperMotor", (SignatureSpec(("Int", "Int", "Int", "Int"), "Hardware[StepperMotor]", ("digital_pin",)),),
|
|
213
|
+
methods={
|
|
214
|
+
"setMaxSpeed": MethodSpec("setMaxSpeed", (SignatureSpec(("Float",), "Void"), SignatureSpec(("Int",), "Void"))),
|
|
215
|
+
"setAcceleration": MethodSpec("setAcceleration", (SignatureSpec(("Float",), "Void"), SignatureSpec(("Int",), "Void"))),
|
|
216
|
+
"moveTo": MethodSpec("moveTo", (SignatureSpec(("Int",), "Void"),)),
|
|
217
|
+
"move": MethodSpec("move", (SignatureSpec(("Int",), "Void"),)),
|
|
218
|
+
"run": MethodSpec("run", (SignatureSpec((), "Bool"),)),
|
|
219
|
+
"distanceToGo": MethodSpec("distanceToGo", (SignatureSpec((), "Int"),)),
|
|
220
|
+
"currentPosition": MethodSpec("currentPosition", (SignatureSpec((), "Int"),)),
|
|
221
|
+
"setCurrentPosition": MethodSpec("setCurrentPosition", (SignatureSpec(("Int",), "Void"),)),
|
|
222
|
+
}, includes=("Barmaja_Stepper.h",), dependency_ids=("barmaja-stepper-adapter", "airspayce-accelstepper"),
|
|
223
|
+
),
|
|
224
|
+
"OneWireBus": HardwareClassSpec(
|
|
225
|
+
"OneWireBus", (SignatureSpec(("Int",), "Hardware[OneWireBus]", ("digital_pin",)),),
|
|
226
|
+
methods={
|
|
227
|
+
"reset": MethodSpec("reset", (SignatureSpec((), "Int"),)),
|
|
228
|
+
"write": MethodSpec("write", (SignatureSpec(("Int",), "Void", ("range_0_255",)),)),
|
|
229
|
+
"read": MethodSpec("read", (SignatureSpec((), "Int"),)),
|
|
230
|
+
}, includes=("Barmaja_OneWireBus.h",), dependency_ids=("barmaja-onewire-adapter", "paulstoffregen-onewire"),
|
|
231
|
+
),
|
|
232
|
+
# OPTIONAL: ONLY for a MAX7219/MAX7221 driven matrix, NOT bare 8x8 matrices.
|
|
233
|
+
"LEDMatrixMAX7219": HardwareClassSpec(
|
|
234
|
+
"LEDMatrixMAX7219", (SignatureSpec(("Int", "Int", "Int"), "Hardware[LEDMatrixMAX7219]", ("digital_pin", "digital_pin", "digital_pin")),),
|
|
235
|
+
methods={
|
|
236
|
+
"begin": MethodSpec("begin", (SignatureSpec((), "Void"),)),
|
|
237
|
+
"clear": MethodSpec("clear", (SignatureSpec((), "Void"),)),
|
|
238
|
+
"setPixel": MethodSpec("setPixel", (SignatureSpec(("Int", "Int", "Bool"), "Void"), SignatureSpec(("Int", "Int", "Int"), "Void"))),
|
|
239
|
+
"setRow": MethodSpec("setRow", (SignatureSpec(("Int", "Int"), "Void"),)),
|
|
240
|
+
"setBrightness": MethodSpec("setBrightness", (SignatureSpec(("Int",), "Void"),)),
|
|
241
|
+
}, includes=("Barmaja_LEDMatrixMAX7219.h",), dependency_ids=("barmaja-matrix-adapter", "wayoda-ledcontrol"),
|
|
242
|
+
),
|
|
243
|
+
# OPTIONAL: ONLY for CLK/DIO TM1637 4-digit modules, NOT multiplexed bare displays.
|
|
244
|
+
"FourDigitTM1637": HardwareClassSpec(
|
|
245
|
+
"FourDigitTM1637", (SignatureSpec(("Int", "Int"), "Hardware[FourDigitTM1637]", ("digital_pin", "digital_pin")),),
|
|
246
|
+
methods={
|
|
247
|
+
"setBrightness": MethodSpec("setBrightness", (SignatureSpec(("Int",), "Void"),)),
|
|
248
|
+
"showNumber": MethodSpec("showNumber", (SignatureSpec(("Int",), "Void"),)),
|
|
249
|
+
"clear": MethodSpec("clear", (SignatureSpec((), "Void"),)),
|
|
250
|
+
}, includes=("Barmaja_FourDigitTM1637.h",), dependency_ids=("barmaja-tm1637-adapter", "avishorp-tm1637"),
|
|
251
|
+
),
|
|
252
|
+
"Servo": HardwareClassSpec(
|
|
253
|
+
"Servo",
|
|
254
|
+
constructors=(SignatureSpec((), "Hardware[Servo]"),),
|
|
255
|
+
methods={
|
|
256
|
+
"attach": MethodSpec("attach", (
|
|
257
|
+
SignatureSpec(("Int",), "Int", ("digital_pin",)),
|
|
258
|
+
SignatureSpec(("Int", "Int", "Int"), "Int", ("digital_pin", "servo_pulse_bounds")),
|
|
259
|
+
), resources=("timer1",)),
|
|
260
|
+
"write": MethodSpec("write", (SignatureSpec(("Int",), "Void", ("range_0_180",)),), resources=("timer1",)),
|
|
261
|
+
"writeMicroseconds": MethodSpec("writeMicroseconds", (SignatureSpec(("Int",), "Void", ("servo_pulse",)),), resources=("timer1",)),
|
|
262
|
+
"read": MethodSpec("read", (SignatureSpec((), "Int"),), resources=("timer1",)),
|
|
263
|
+
"detach": MethodSpec("detach", (SignatureSpec((), "Void"),), resources=("timer1",)),
|
|
264
|
+
"attached": MethodSpec("attached", (SignatureSpec((), "Bool"),), resources=("timer1",)),
|
|
265
|
+
},
|
|
266
|
+
includes=("Servo.h",),
|
|
267
|
+
dependency_ids=("arduino-servo",),
|
|
268
|
+
resources=("timer1",),
|
|
269
|
+
),
|
|
270
|
+
"Ultrasonic": HardwareClassSpec(
|
|
271
|
+
"Ultrasonic",
|
|
272
|
+
constructors=(SignatureSpec(("Int", "Int"), "Hardware[Ultrasonic]", ("digital_pin", "digital_pin")),),
|
|
273
|
+
methods={
|
|
274
|
+
"read": MethodSpec("read", (
|
|
275
|
+
SignatureSpec((), "Int", ("non_negative_result",)),
|
|
276
|
+
SignatureSpec(("UltrasonicUnit",), "Int", ("non_negative_result",)),
|
|
277
|
+
)),
|
|
278
|
+
"setTimeout": MethodSpec("setTimeout", (SignatureSpec(("Int",), "Void", ("non_negative", "ultrasonic_timeout")),)),
|
|
279
|
+
},
|
|
280
|
+
includes=("Ultrasonic.h",),
|
|
281
|
+
dependency_ids=("erick-simoes-ultrasonic",),
|
|
282
|
+
),
|
|
283
|
+
"DHT": HardwareClassSpec(
|
|
284
|
+
"DHT",
|
|
285
|
+
constructors=(SignatureSpec(("Int", "DHTType"), "Hardware[DHT]", ("digital_pin", "dht_sensor_type")),),
|
|
286
|
+
methods={
|
|
287
|
+
"begin": MethodSpec("begin", (SignatureSpec((), "Void"),), lifecycle="dht_begin"),
|
|
288
|
+
"readTemperature": MethodSpec("readTemperature", (SignatureSpec((), "Float", ("may_nan",)),), lifecycle="requires_dht_begin"),
|
|
289
|
+
"readHumidity": MethodSpec("readHumidity", (SignatureSpec((), "Float", ("may_nan",)),), lifecycle="requires_dht_begin"),
|
|
290
|
+
},
|
|
291
|
+
includes=("DHT.h",),
|
|
292
|
+
dependency_ids=("adafruit-dht", "adafruit-unified-sensor"),
|
|
293
|
+
),
|
|
294
|
+
"LiquidCrystal_I2C": HardwareClassSpec(
|
|
295
|
+
"LiquidCrystal_I2C",
|
|
296
|
+
constructors=(SignatureSpec(("Int", "Int", "Int"), "Hardware[LiquidCrystal_I2C]", ("i2c_address", "lcd_dimension", "lcd_dimension")),),
|
|
297
|
+
methods={
|
|
298
|
+
"init": MethodSpec("init", (SignatureSpec((), "Void"),), lifecycle="lcd_init"),
|
|
299
|
+
"begin": MethodSpec("begin", (
|
|
300
|
+
SignatureSpec(("Int", "Int"), "Void", ("lcd_dimension", "lcd_dimension")),
|
|
301
|
+
SignatureSpec(("Int", "Int", "Int"), "Void", ("lcd_dimension", "lcd_dimension", "lcd_charsize")),
|
|
302
|
+
), lifecycle="lcd_init"),
|
|
303
|
+
"clear": MethodSpec("clear", (SignatureSpec((), "Void"),), lifecycle="requires_lcd_init"),
|
|
304
|
+
"home": MethodSpec("home", (SignatureSpec((), "Void"),), lifecycle="requires_lcd_init"),
|
|
305
|
+
# Pinned 1.1.4 setCursor(uint8_t col, uint8_t row) indexes a 4-entry
|
|
306
|
+
# HD44780 row_offsets table; larger rows read past it and negative/>255
|
|
307
|
+
# values would silently narrow to uint8_t.
|
|
308
|
+
"setCursor": MethodSpec("setCursor", (SignatureSpec(("Int", "Int"), "Void", ("lcd_cursor_column", "lcd_cursor_row")),), lifecycle="requires_lcd_init"),
|
|
309
|
+
"print": MethodSpec("print", (SignatureSpec(("Scalar",), "Void"),), lifecycle="requires_lcd_init"),
|
|
310
|
+
"backlight": MethodSpec("backlight", (SignatureSpec((), "Void"),), lifecycle="requires_lcd_init"),
|
|
311
|
+
"noBacklight": MethodSpec("noBacklight", (SignatureSpec((), "Void"),), lifecycle="requires_lcd_init"),
|
|
312
|
+
"display": MethodSpec("display", (SignatureSpec((), "Void"),), lifecycle="requires_lcd_init"),
|
|
313
|
+
"noDisplay": MethodSpec("noDisplay", (SignatureSpec((), "Void"),), lifecycle="requires_lcd_init"),
|
|
314
|
+
},
|
|
315
|
+
includes=("Wire.h", "LiquidCrystal_I2C.h"),
|
|
316
|
+
dependency_ids=("arduino-wire-core", "liquidcrystal-i2c-frank-de-brabander"),
|
|
317
|
+
resources=("i2c",),
|
|
318
|
+
),
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
SINGLETONS: dict[str, SingletonSpec] = {
|
|
323
|
+
"EEPROM": SingletonSpec(
|
|
324
|
+
"EEPROM",
|
|
325
|
+
methods={
|
|
326
|
+
"read": MethodSpec("read", (SignatureSpec(("Int",), "Int"),)),
|
|
327
|
+
"write": MethodSpec("write", (SignatureSpec(("Int", "Int"), "Void"),)),
|
|
328
|
+
"update": MethodSpec("update", (SignatureSpec(("Int", "Int"), "Void"),)),
|
|
329
|
+
"length": MethodSpec("length", (SignatureSpec((), "Int"),)),
|
|
330
|
+
}, includes=("EEPROM.h",), dependency_ids=("arduino-eeprom-core",),
|
|
331
|
+
),
|
|
332
|
+
"SPI": SingletonSpec(
|
|
333
|
+
"SPI",
|
|
334
|
+
methods={
|
|
335
|
+
"begin": MethodSpec("begin", (SignatureSpec((), "Void"),)),
|
|
336
|
+
"transfer": MethodSpec("transfer", (SignatureSpec(("Int",), "Int"),)),
|
|
337
|
+
"end": MethodSpec("end", (SignatureSpec((), "Void"),)),
|
|
338
|
+
}, includes=("SPI.h",), dependency_ids=("arduino-spi-core",), resources=("spi",),
|
|
339
|
+
),
|
|
340
|
+
"Serial": SingletonSpec(
|
|
341
|
+
"Serial",
|
|
342
|
+
methods={
|
|
343
|
+
"begin": MethodSpec("begin", (SignatureSpec(("Int",), "Void", ("positive_constant",)),), lifecycle="serial_begin", resources=("uart",)),
|
|
344
|
+
"print": MethodSpec("print", (
|
|
345
|
+
SignatureSpec(("Scalar",), "Void"),
|
|
346
|
+
SignatureSpec(("NumericOrBool", "Int"), "Void", ("arduino_format",)),
|
|
347
|
+
), lifecycle="requires_serial_begin", resources=("uart",)),
|
|
348
|
+
"println": MethodSpec("println", (
|
|
349
|
+
SignatureSpec((), "Void"),
|
|
350
|
+
SignatureSpec(("Scalar",), "Void"),
|
|
351
|
+
SignatureSpec(("NumericOrBool", "Int"), "Void", ("arduino_format",)),
|
|
352
|
+
), lifecycle="requires_serial_begin", resources=("uart",)),
|
|
353
|
+
"available": MethodSpec("available", (SignatureSpec((), "Int", ("non_negative_result",)),), lifecycle="requires_serial_begin", resources=("uart",)),
|
|
354
|
+
"read": MethodSpec("read", (SignatureSpec((), "Int", ("range_-1_255",)),), lifecycle="requires_serial_begin", resources=("uart",)),
|
|
355
|
+
},
|
|
356
|
+
resources=("uart",),
|
|
357
|
+
),
|
|
358
|
+
"Wire": SingletonSpec(
|
|
359
|
+
"Wire",
|
|
360
|
+
methods={
|
|
361
|
+
"begin": MethodSpec("begin", (SignatureSpec((), "Void"),), lifecycle="wire_begin", resources=("i2c",)),
|
|
362
|
+
"beginTransmission": MethodSpec("beginTransmission", (SignatureSpec(("Int",), "Void", ("i2c_address",)),), lifecycle="requires_wire_begin", resources=("i2c",)),
|
|
363
|
+
"write": MethodSpec("write", (SignatureSpec(("Int",), "Int", ("range_0_255",)),), lifecycle="requires_wire_begin", resources=("i2c",)),
|
|
364
|
+
"endTransmission": MethodSpec("endTransmission", (SignatureSpec((), "Int"),), lifecycle="requires_wire_begin", resources=("i2c",)),
|
|
365
|
+
"requestFrom": MethodSpec("requestFrom", (SignatureSpec(("Int", "Int"), "Int", ("i2c_address", "wire_request_count")),), lifecycle="requires_wire_begin", resources=("i2c",)),
|
|
366
|
+
"available": MethodSpec("available", (SignatureSpec((), "Int", ("non_negative_result",)),), lifecycle="requires_wire_begin", resources=("i2c",)),
|
|
367
|
+
"read": MethodSpec("read", (SignatureSpec((), "Int", ("range_-1_255",)),), lifecycle="requires_wire_begin", resources=("i2c",)),
|
|
368
|
+
},
|
|
369
|
+
includes=("Wire.h",),
|
|
370
|
+
dependency_ids=("arduino-wire-core",),
|
|
371
|
+
resources=("i2c",),
|
|
372
|
+
),
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
DEPENDENCIES: dict[str, DependencySpec] = {
|
|
377
|
+
"arduino-softwareserial-core": DependencySpec("arduino-softwareserial-core", "SoftwareSerial", "arduino:avr 1.8.8", "SoftwareSerial.h", "Arduino AVR core already in V1"),
|
|
378
|
+
"barmaja-bluetooth-serial": DependencySpec("barmaja-bluetooth-serial", "BluetoothSerial adapter", "1.1.dev", "Barmaja_BluetoothSerial.h", "BARMAJA owned HC-05 UART transport"),
|
|
379
|
+
"barmaja-mpu6050-adapter": DependencySpec("barmaja-mpu6050-adapter", "MPU6050 sensor adapter", "1.1.dev", "Barmaja_MPU6050Sensor.h", "BARMAJA owned adapter"),
|
|
380
|
+
"rfetick-mpu6050-light": DependencySpec("rfetick-mpu6050-light", "MPU6050_light", "1.2.1", "MPU6050_light.h", "rfetick/MPU6050_light v1.2.1 MIT; acquire exact release", ("arduino-wire-core",)),
|
|
381
|
+
"barmaja-gps-adapter": DependencySpec("barmaja-gps-adapter", "GPS module adapter", "1.1.dev", "Barmaja_GPSModule.h", "BARMAJA owned adapter"),
|
|
382
|
+
"mikalhart-tinygpsplus": DependencySpec("mikalhart-tinygpsplus", "TinyGPSPlus", "1.0.3", "TinyGPS++.h", "mikalhart/TinyGPSPlus 1.0.3; verify exact source tag and license"),
|
|
383
|
+
"barmaja-ethernet-adapter": DependencySpec("barmaja-ethernet-adapter", "W5500 Ethernet adapter", "1.1.dev", "Barmaja_EthernetW5500.h", "BARMAJA owned adapter"),
|
|
384
|
+
"arduino-ethernet": DependencySpec("arduino-ethernet", "Ethernet", "2.0.2", "Ethernet.h", "arduino-libraries/Ethernet; pin official exact tag"),
|
|
385
|
+
"barmaja-wifiespat-adapter": DependencySpec("barmaja-wifiespat-adapter", "ESP AT Wi-Fi adapter", "1.1.dev", "Barmaja_WiFiESPAT.h", "BARMAJA owned adapter"),
|
|
386
|
+
"jandrassy-wifiespat": DependencySpec("jandrassy-wifiespat", "WiFiEspAT", "1.5.0", "WiFiEspAT.h", "JAndrassy/WiFiEspAT LGPL-2.1; select exact release + compatible ESP AT firmware"),
|
|
387
|
+
"arduino-eeprom-core": DependencySpec("arduino-eeprom-core", "EEPROM", "arduino:avr 1.8.8", "EEPROM.h", "Arduino AVR core already in V1"),
|
|
388
|
+
"arduino-spi-core": DependencySpec("arduino-spi-core", "SPI", "arduino:avr 1.8.8", "SPI.h", "Arduino AVR core already in V1"),
|
|
389
|
+
"paulstoffregen-onewire": DependencySpec("paulstoffregen-onewire", "OneWire", "2.3.8", "OneWire.h", "OneWire 2.3.8 already in V1"),
|
|
390
|
+
"wayoda-ledcontrol": DependencySpec("wayoda-ledcontrol", "LedControl", "1.0.6", "LedControl.h", "wayoda/LedControl 1.0.6; conditional hardware; obtain official tagged release"),
|
|
391
|
+
"avishorp-tm1637": DependencySpec("avishorp-tm1637", "TM1637Display", "1.2.0", "TM1637Display.h", "avishorp/TM1637 v1.2.0 LGPL; conditional hardware; obtain official tagged release"),
|
|
392
|
+
"barmaja-onewire-adapter": DependencySpec("barmaja-onewire-adapter", "Barmaja OneWire adapter", "1.1.dev", "Barmaja_OneWireBus.h", "BARMAJA owned wrapper"),
|
|
393
|
+
"barmaja-matrix-adapter": DependencySpec("barmaja-matrix-adapter", "Barmaja MAX7219 adapter", "1.1.dev", "Barmaja_LEDMatrixMAX7219.h", "BARMAJA-owned conditional wrapper"),
|
|
394
|
+
"barmaja-tm1637-adapter": DependencySpec("barmaja-tm1637-adapter", "Barmaja TM1637 adapter", "1.1.dev", "Barmaja_FourDigitTM1637.h", "BARMAJA-owned conditional wrapper"),
|
|
395
|
+
"mfrc522-v1": DependencySpec("mfrc522-v1", "MFRC522", "1.4.12", "MFRC522.h", "miguelbalboa/rfid 1.4.12 (Unlicense)"),
|
|
396
|
+
"arduino-irremote": DependencySpec("arduino-irremote", "IRremote", "4.7.1", "IRremote.hpp", "Arduino-IRremote (LGPL-2.1 or later; verify pinned exact tag)"),
|
|
397
|
+
"airspayce-accelstepper": DependencySpec("airspayce-accelstepper", "AccelStepper", "1.64", "AccelStepper.h", "Already bundled in V1"),
|
|
398
|
+
"barmaja-rfid-adapter": DependencySpec("barmaja-rfid-adapter", "Barmaja RFID adapter", "1.1.dev", "Barmaja_RFID.h", "BARMAJA owned wrapper header"),
|
|
399
|
+
"barmaja-ir-adapter": DependencySpec("barmaja-ir-adapter", "Barmaja IR adapter", "1.1.dev", "Barmaja_IRRemote.h", "BARMAJA owned wrapper header"),
|
|
400
|
+
"barmaja-keypad-adapter": DependencySpec("barmaja-keypad-adapter", "Barmaja Keypad adapter", "1.1.dev", "Barmaja_Keypad.h", "BARMAJA owned wrapper header"),
|
|
401
|
+
"barmaja-stepper-adapter": DependencySpec("barmaja-stepper-adapter", "Barmaja Stepper adapter", "1.1.dev", "Barmaja_Stepper.h", "BARMAJA owned wrapper header"),
|
|
402
|
+
"arduino-wire-core": DependencySpec(
|
|
403
|
+
"arduino-wire-core", "Wire", "arduino:avr 1.8.8", "Wire.h", "Arduino AVR core bundled library"
|
|
404
|
+
),
|
|
405
|
+
"arduino-servo": DependencySpec(
|
|
406
|
+
"arduino-servo", "Servo", "1.3.0", "Servo.h", "official Arduino Servo release 1.3.0"
|
|
407
|
+
),
|
|
408
|
+
"erick-simoes-ultrasonic": DependencySpec(
|
|
409
|
+
"erick-simoes-ultrasonic", "Ultrasonic", "3.0.0", "Ultrasonic.h", "Erick Simoes release tag/commit c1a28b5"
|
|
410
|
+
),
|
|
411
|
+
"adafruit-unified-sensor": DependencySpec(
|
|
412
|
+
"adafruit-unified-sensor", "Adafruit Unified Sensor", "1.1.15", "Adafruit_Sensor.h", "Adafruit release 1.1.15"
|
|
413
|
+
),
|
|
414
|
+
"adafruit-dht": DependencySpec(
|
|
415
|
+
"adafruit-dht", "DHT sensor library", "1.4.7", "DHT.h", "Adafruit release 1.4.7", ("adafruit-unified-sensor",)
|
|
416
|
+
),
|
|
417
|
+
"liquidcrystal-i2c-frank-de-brabander": DependencySpec(
|
|
418
|
+
"liquidcrystal-i2c-frank-de-brabander", "LiquidCrystal_I2C", "1.1.4", "LiquidCrystal_I2C.h", "Frank de Brabander / johnrickman lineage 1.1.4", ("arduino-wire-core",)
|
|
419
|
+
),
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
# Host workflow commands. They run on the PC (PictoBlox or any Python IDE), never
|
|
424
|
+
# on the Arduino: a top-level `upload()` line compiles and uploads the file it is
|
|
425
|
+
# written in, then stops the desktop run. The compiler removes these lines.
|
|
426
|
+
HOST_COMMANDS: dict[str, str] = {
|
|
427
|
+
"upload": "Compile this program and upload it to the connected Arduino Uno.",
|
|
428
|
+
"verify": "Compile this program for the Arduino Uno without uploading.",
|
|
429
|
+
"show_code": "Print the generated Arduino C++ for this program.",
|
|
430
|
+
"LiveRun": "Start live PC/PictoBlox control of the connected Arduino Uno.",
|
|
431
|
+
"LiveStop": "Stop the active LiveRun connection.",
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
# ---- Device packs (1.1.0.dev7): extra Arduino libraries/sensors declared in JSON.
|
|
436
|
+
# Loaded once, before PUBLIC_API_NAMES, so every compiler phase sees them as
|
|
437
|
+
# ordinary hardware classes. Invalid packs are skipped (see device_packs.LOAD_ERRORS).
|
|
438
|
+
from . import device_packs as _device_packs # noqa: E402
|
|
439
|
+
|
|
440
|
+
_device_packs.load_packs({*CONSTANT_VALUES, *CORE_FUNCTIONS, *HARDWARE_CLASSES, *SINGLETONS, *HOST_COMMANDS})
|
|
441
|
+
_device_packs.register_into(HARDWARE_CLASSES, DEPENDENCIES, (SignatureSpec, MethodSpec, HardwareClassSpec, DependencySpec))
|
|
442
|
+
|
|
443
|
+
PUBLIC_API_NAMES = frozenset({*CONSTANT_VALUES, *CORE_FUNCTIONS, *HARDWARE_CLASSES, *SINGLETONS, *HOST_COMMANDS})
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
def hardware_method_names(class_name: str) -> frozenset[str]:
|
|
447
|
+
return frozenset(HARDWARE_CLASSES[class_name].methods)
|
|
448
|
+
|
|
449
|
+
|
|
450
|
+
def singleton_method_names(singleton: str) -> frozenset[str]:
|
|
451
|
+
return frozenset(SINGLETONS[singleton].methods)
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
def arity_range(arities: frozenset[int]) -> tuple[int, int]:
|
|
455
|
+
return min(arities), max(arities)
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
def matching_signatures(signatures: tuple[SignatureSpec, ...], argc: int) -> tuple[SignatureSpec, ...]:
|
|
459
|
+
return tuple(sig for sig in signatures if len(sig.args) == argc)
|