2024-07-12 09:58:33 +08:00
|
|
|
from numpy import int64
|
2021-10-08 23:41:41 +08:00
|
|
|
from min_artiq import *
|
2022-02-21 17:52:34 +08:00
|
|
|
|
2024-07-12 09:58:33 +08:00
|
|
|
@nac3
|
|
|
|
class A:
|
|
|
|
pass
|
|
|
|
@nac3
|
|
|
|
class B(A):
|
|
|
|
pass
|
|
|
|
@nac3
|
|
|
|
class C(B):
|
|
|
|
pass
|
|
|
|
|
|
|
|
@kernel
|
|
|
|
def test():
|
|
|
|
pass
|
2022-02-21 17:52:34 +08:00
|
|
|
|
2021-11-05 18:07:43 +08:00
|
|
|
@nac3
|
2021-10-08 23:41:41 +08:00
|
|
|
class Demo:
|
2024-07-12 09:58:33 +08:00
|
|
|
core: Kernel[Core]
|
|
|
|
led0: Kernel[TTLOut]
|
|
|
|
optt: Kernel[float]
|
|
|
|
t_mu: Kernel[int64]
|
2021-09-25 14:17:11 +08:00
|
|
|
|
2021-10-08 23:41:41 +08:00
|
|
|
def __init__(self):
|
|
|
|
self.core = Core()
|
2021-11-05 18:07:18 +08:00
|
|
|
self.led0 = TTLOut(self.core, 18)
|
2024-07-12 09:58:33 +08:00
|
|
|
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)
|
2020-12-18 23:44:45 +08:00
|
|
|
|
|
|
|
@kernel
|
2021-11-06 18:41:59 +08:00
|
|
|
def run(self):
|
2024-07-12 09:58:33 +08:00
|
|
|
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)
|
2020-12-18 23:44:45 +08:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2024-07-12 09:58:33 +08:00
|
|
|
Demo().run()
|