nac3artiq: work around #56
This commit is contained in:
parent
6ba74ed9f6
commit
a22552a012
|
@ -7,20 +7,29 @@ class Demo:
|
||||||
core: Core
|
core: Core
|
||||||
led: TTLOut
|
led: TTLOut
|
||||||
|
|
||||||
|
@portable # FIXME: why does it still compile if @portable is removed?
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.core = Core()
|
self.core = Core()
|
||||||
self.led = TTLOut(0)
|
self.led = TTLOut(0)
|
||||||
|
|
||||||
@kernel
|
@kernel
|
||||||
def main_kernel(self):
|
def run(self):
|
||||||
self.core.reset()
|
self.core.reset()
|
||||||
while True:
|
while True:
|
||||||
self.led.pulse_mu(int64(100000000))
|
self.led.pulse_mu(int64(100000000))
|
||||||
delay_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__":
|
if __name__ == "__main__":
|
||||||
Demo().run()
|
Workaround56().run_host()
|
||||||
|
|
Loading…
Reference in New Issue