diff options
Diffstat (limited to 'api_layers/port_registry.py')
| -rw-r--r-- | api_layers/port_registry.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/api_layers/port_registry.py b/api_layers/port_registry.py index e3c85fd..4328bb2 100644 --- a/api_layers/port_registry.py +++ b/api_layers/port_registry.py @@ -3,10 +3,10 @@ api_layers/port_registry.py PortRegistry — ensures one ArduinoLayer per physical serial port. -Problem: if both an AnalogInputDevice and a DigitalIODevice are -configured for the same Arduino (/dev/ttyUSB0), they would each -create their own ArduinoLayer and both try to open the same serial -port → "device reports readiness to read but returned no data". +Problem: if two ArduinoDevice instances are configured for the same +physical Arduino (/dev/ttyUSB0), they would each create their own +ArduinoLayer and both try to open the same serial port → "device +reports readiness to read but returned no data". Solution: all devices call PortRegistry.get_layer(port, baud) instead of constructing ArduinoLayer directly. The registry returns an @@ -14,9 +14,9 @@ existing layer if one is already open on that port, or creates a new one. All reads/writes go through the single shared layer. The registry also merges analog_pins across devices so the layer -caches values for all channels on the Arduino. +caches values for all signals on the Arduino. -Usage (handled automatically by AnalogInputDevice and DigitalIODevice): +Usage (handled automatically by ArduinoDevice): from api_layers.port_registry import port_registry layer = port_registry.get_layer("/dev/ttyUSB0", 115200, simulate=False) |
