2021-10-08 23:41:41 +08:00
|
|
|
from min_artiq import *
|
2021-09-24 11:39:26 +08:00
|
|
|
from numpy import int32, int64
|
|
|
|
|
|
|
|
|
2021-09-24 14:45:44 +08:00
|
|
|
@kernel
|
2021-10-08 23:41:41 +08:00
|
|
|
class Demo:
|
|
|
|
core: Core
|
|
|
|
led: TTLOut
|
2021-09-25 14:17:11 +08:00
|
|
|
|
2021-10-09 15:52:45 +08:00
|
|
|
@portable # FIXME: why does it still compile if @portable is removed?
|
2021-10-08 23:41:41 +08:00
|
|
|
def __init__(self):
|
|
|
|
self.core = Core()
|
|
|
|
self.led = TTLOut(0)
|
2020-12-18 23:44:45 +08:00
|
|
|
|
|
|
|
@kernel
|
2021-10-09 15:52:45 +08:00
|
|
|
def run(self):
|
2021-10-08 23:41:41 +08:00
|
|
|
self.core.reset()
|
2021-09-25 14:17:11 +08:00
|
|
|
while True:
|
2021-10-08 23:41:41 +08:00
|
|
|
self.led.pulse_mu(int64(100000000))
|
2021-09-25 14:17:11 +08:00
|
|
|
delay_mu(int64(100000000))
|
2020-12-18 23:44:45 +08:00
|
|
|
|
2021-10-09 15:52:45 +08:00
|
|
|
|
|
|
|
@kernel
|
|
|
|
class Workaround56:
|
|
|
|
@kernel
|
2021-10-08 23:41:41 +08:00
|
|
|
def run(self):
|
2021-10-09 15:52:45 +08:00
|
|
|
demo = Demo()
|
|
|
|
demo.run()
|
2021-10-08 23:41:41 +08:00
|
|
|
|
2021-10-09 15:52:45 +08:00
|
|
|
def run_host(self):
|
|
|
|
core = Core()
|
|
|
|
core.run(self.run) # works because run() never uses its self argument
|
2020-12-18 23:44:45 +08:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2021-10-09 15:52:45 +08:00
|
|
|
Workaround56().run_host()
|