From 041540089aef87b165710981354b923ff792a1b6 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sun, 20 Jul 2014 18:36:17 -0600 Subject: [PATCH] devices: add RTIO support --- artiq/devices/runtime.py | 3 ++- artiq/devices/ttl_core.py | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 artiq/devices/ttl_core.py diff --git a/artiq/devices/runtime.py b/artiq/devices/runtime.py index 2563abb12..3b9330201 100644 --- a/artiq/devices/runtime.py +++ b/artiq/devices/runtime.py @@ -5,7 +5,8 @@ lt.initialize_all() _syscalls = [ ("rpc", "i+:i"), - ("gpio_set", "ii:v") + ("gpio_set", "ii:v"), + ("rtio_set", "iii:v") ] def _str_to_functype(s): diff --git a/artiq/devices/ttl_core.py b/artiq/devices/ttl_core.py new file mode 100644 index 000000000..eda921c1d --- /dev/null +++ b/artiq/devices/ttl_core.py @@ -0,0 +1,10 @@ +from artiq.language.core import * + +class TTLOut(MPO): + parameters = "channel" + + @kernel + def pulse(self, duration): + syscall("rtio_set", now(), self.channel, 1) + delay(duration) + syscall("rtio_set", now(), self.channel, 0)