drivers.OzLan.OzLan¶
UART bridge driver for wired LAN (Ethernet) communication via a SAMD co-processor.
This module exposes OzLan, a thin abstraction over a pyserial link
that talks to an external Arduino/SAMD board (typically W5500-based) responsible
for the physical Ethernet stack. Commands are exchanged as newline-terminated
JSON documents containing a packet identifier (pid) and payload (pay).
The driver opens and closes the underlying serial port around each transaction
to keep bus ownership short-lived and to play nicely with co-resident drivers
that share the same UART hardware.
Example
Send a configuration command and read the bridge’s reply:
>>> from drivers.OzLan.OzLan import OzLan
>>> lan = OzLan("/dev/ttyACM0", 115200)
>>> lan.send_command({"pid": "config", "pay": {"ip": "192.168.1.10"}}, recieve=True)
>>> reply = lan.read_response()
Note
The bridge enforces an OzLan.IDLE_DELAY settling time before every
transmission so the SAMD co-processor has time to finish any prior frame.
See OzLan for the full API and utils.oizom_logger for the
logging backend used by this module.
Attributes¶
Classes¶
UART-to-Ethernet bridge driver for exchanging JSON commands with a SAMD co-processor. |
Module Contents¶
- drivers.OzLan.OzLan.basic_logger¶
- drivers.OzLan.OzLan.context_logger¶
- drivers.OzLan.OzLan.ozlan¶