forked from M-Labs/nac3
1
0
Fork 0

nac3artiq: work around #56

This commit is contained in:
Sebastien Bourdeauducq 2021-10-09 15:52:45 +08:00
parent 6ba74ed9f6
commit a22552a012
1 changed files with 13 additions and 4 deletions

View File

@ -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()