resources: allow UARTResource without control signals to have no role.
authorwhitequark <whitequark@whitequark.org>
Mon, 22 Jun 2020 15:07:54 +0000 (15:07 +0000)
committerwhitequark <whitequark@whitequark.org>
Mon, 22 Jun 2020 15:07:54 +0000 (15:07 +0000)
nmigen_boards/resources/interface.py

index 97489e202500b7d1b2a12c91f6f46954c0834df8..848e1b8a98ab96749d1e4e244d4d4262a851fe0a 100644 (file)
@@ -6,7 +6,8 @@ __all__ = ["UARTResource", "IrDAResource", "SPIResource"]
 
 def UARTResource(*args, rx, tx, rts=None, cts=None, dtr=None, dsr=None, dcd=None, ri=None,
                  conn=None, attrs=None, role=None):
-    assert role in ("dce", "dte")
+    if any(line is not None for line in (rts, cts, dtr, dsr, dcd, ri)):
+        assert role in ("dce", "dte")
     if role == "dte":
         dce_to_dte = "i"
         dte_to_dce = "o"