mirror of https://github.com/m-labs/artiq.git
examples: add RTIO loopback
This commit is contained in:
parent
f0f65ba3a7
commit
3d6fab676f
|
@ -0,0 +1,31 @@
|
||||||
|
from artiq.language.core import *
|
||||||
|
from artiq.language.units import *
|
||||||
|
from artiq.devices import corecom_serial, core, rtio_core
|
||||||
|
|
||||||
|
|
||||||
|
class RTIOLoopback(AutoContext):
|
||||||
|
parameters = "i o"
|
||||||
|
|
||||||
|
def report(self, n):
|
||||||
|
print(n)
|
||||||
|
|
||||||
|
@kernel
|
||||||
|
def run(self):
|
||||||
|
with parallel:
|
||||||
|
with sequential:
|
||||||
|
for i in range(4):
|
||||||
|
delay(25*ns)
|
||||||
|
self.o.pulse(25*ns)
|
||||||
|
self.i.count_rising(1*us)
|
||||||
|
self.report(self.i.sync())
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
with corecom_serial.CoreCom() as com:
|
||||||
|
coredev = core.Core(com)
|
||||||
|
exp = RTIOLoopback(
|
||||||
|
core=coredev,
|
||||||
|
i=rtio_core.RTIOCounter(core=coredev, channel=0),
|
||||||
|
o=rtio_core.RTIOOut(core=coredev, channel=1)
|
||||||
|
)
|
||||||
|
exp.run()
|
Loading…
Reference in New Issue