forked from sinara-hw/datasheets
30 lines
694 B
Python
30 lines
694 B
Python
|
from artiq.experiment import *
|
||
|
|
||
|
|
||
|
class DMA(EnvExperiment):
|
||
|
def build(self):
|
||
|
self.setattr_device("core")
|
||
|
self.setattr_device("core_dma")
|
||
|
self.setattr_device("led0")
|
||
|
|
||
|
@kernel
|
||
|
def record(self):
|
||
|
with self.core_dma.record("led_blink"):
|
||
|
delay(100*ms)
|
||
|
self.led0.on()
|
||
|
delay(100*ms)
|
||
|
self.led0.off()
|
||
|
|
||
|
@kernel
|
||
|
def playback(self, n):
|
||
|
handle = self.core_dma.get_handle("led_blink")
|
||
|
self.core.break_realtime()
|
||
|
for _ in range(n):
|
||
|
self.core_dma.playback_handle(handle)
|
||
|
|
||
|
@kernel
|
||
|
def run(self):
|
||
|
self.core.reset()
|
||
|
self.record()
|
||
|
self.playback(2)
|