forked from M-Labs/artiq
1
0
Fork 0

examples: add RTIO loopback

This commit is contained in:
Sebastien Bourdeauducq 2014-09-17 19:54:20 +08:00
parent f0f65ba3a7
commit 3d6fab676f
1 changed files with 31 additions and 0 deletions

31
examples/rtio_loopback.py Normal file
View File

@ -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()