forked from M-Labs/nac3
27 lines
776 B
Python
27 lines
776 B
Python
|
from artiq.experiment import *
|
||
|
|
||
|
class DMAPulses(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("pulses"):
|
||
|
# all RTIO operations now go to the "pulses"
|
||
|
# DMA buffer, instead of being executed immediately.
|
||
|
self.led0.pulse(100*ns)
|
||
|
delay(100*ns)
|
||
|
|
||
|
@kernel
|
||
|
def run(self):
|
||
|
self.core.reset()
|
||
|
self.record()
|
||
|
# prefetch the address of the DMA buffer
|
||
|
# for faster playback trigger
|
||
|
pulses_handle = self.core_dma.get_handle("pulses")
|
||
|
self.core.break_realtime()
|
||
|
self.core_dma.playback_handle(pulses_handle)
|
||
|
|