from nmigen.build import *
-__all__ = ["UARTResource"]
+__all__ = ["UARTResource", "IrDAResource"]
def UARTResource(number, *, rx, tx, rts=None, cts=None, dtr=None, dsr=None, dcd=None, ri=None,
if attrs is not None:
io.append(attrs)
return Resource("uart", number, *io)
+
+
+def IrDAResource(number, *, rx, tx, en=None, sd=None, attrs=None):
+ # Exactly one of en (active-high enable) or sd (shutdown, active-low enable) should
+ # be specified, and it is mapped to a logic level en subsignal.
+ assert (en is not None) ^ (sd is not None)
+ io = []
+ io.append(Subsignal("rx", Pins(rx, dir="i")))
+ io.append(Subsignal("tx", Pins(rx, dir="o")))
+ if en is not None:
+ io.append(Subsignal("en", Pins(en, dir="o")))
+ if sd is not None:
+ io.append(Subsignal("en", PinsN(sd, dir="o")))
+ if attrs is not None:
+ io.append(attrs)
+ return Resource("irda", number, *io)
from nmigen.build import *
from nmigen.vendor.lattice_ice40 import *
from .dev import *
+from .dev.uart import IrDAResource
__all__ = ["ICEStickPlatform"]
attrs=Attrs(IO_STANDARD="SB_LVTTL", PULLUP="1")
),
- Resource("irda", 0,
- Subsignal("rx", Pins("106", dir="i")),
- Subsignal("tx", Pins("105", dir="o")),
- Subsignal("sd", Pins("107", dir="o")),
- Attrs(IO_STANDARD="SB_LVCMOS33")
+ IrDAResource(0,
+ rx="106", tx="105", sd="107",
+ attrs=Attrs(IO_STANDARD="SB_LVCMOS33")
),
*SPIFlashResources(0,