nac3/nac3artiq/demo/demo.py
2024-07-12 09:58:33 +08:00

46 lines
835 B
Python

from numpy import int64
from min_artiq import *
@nac3
class A:
pass
@nac3
class B(A):
pass
@nac3
class C(B):
pass
@kernel
def test():
pass
@nac3
class Demo:
core: Kernel[Core]
led0: Kernel[TTLOut]
optt: Kernel[float]
t_mu: Kernel[int64]
def __init__(self):
self.core = Core()
self.led0 = TTLOut(self.core, 18)
self.optt = 0.0
self.t_mu = int64(0)
@kernel
def set_time_kernel(self, t: float):
self.optt = t
self.t_mu = self.core.seconds_to_mu(self.optt)
@kernel
def run(self):
for t in [20.*us, 15.*us, 10.*us, 5.*us, 2.*us, 1.*us]:
self.set_time_kernel(t)
self.core.reset()
for _ in range(10000):
self.led0.pulse(self.optt)
if __name__ == "__main__":
Demo().run()