From a22552a0125cc641e115c02a1d254a3f38fd5858 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sat, 9 Oct 2021 15:52:45 +0800 Subject: [PATCH] nac3artiq: work around #56 --- nac3artiq/demo.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/nac3artiq/demo.py b/nac3artiq/demo.py index 448aacad..45882411 100644 --- a/nac3artiq/demo.py +++ b/nac3artiq/demo.py @@ -7,20 +7,29 @@ class Demo: core: Core led: TTLOut + @portable # FIXME: why does it still compile if @portable is removed? def __init__(self): self.core = Core() self.led = TTLOut(0) @kernel - def main_kernel(self): + def run(self): self.core.reset() while True: self.led.pulse_mu(int64(100000000)) delay_mu(int64(100000000)) - def run(self): - self.core.run(self.main_kernel) +@kernel +class Workaround56: + @kernel + def run(self): + demo = Demo() + demo.run() + + def run_host(self): + core = Core() + core.run(self.run) # works because run() never uses its self argument if __name__ == "__main__": - Demo().run() + Workaround56().run_host()