forked from M-Labs/artiq
examples: add DMA LED blinker
This commit is contained in:
parent
a4ece19614
commit
553b8046ff
|
@ -0,0 +1,26 @@
|
||||||
|
from artiq.experiment import *
|
||||||
|
|
||||||
|
|
||||||
|
class DMABlink(EnvExperiment):
|
||||||
|
def build(self):
|
||||||
|
self.setattr_device("core")
|
||||||
|
self.setattr_device("core_dma")
|
||||||
|
self.setattr_device("led")
|
||||||
|
|
||||||
|
@kernel
|
||||||
|
def record(self):
|
||||||
|
with self.core_dma.record("blink"):
|
||||||
|
for i in range(5):
|
||||||
|
self.led.pulse(100*ms)
|
||||||
|
delay(100*ms)
|
||||||
|
for i in range(5):
|
||||||
|
self.led.pulse(50*ms)
|
||||||
|
delay(50*ms)
|
||||||
|
|
||||||
|
@kernel
|
||||||
|
def run(self):
|
||||||
|
self.core.reset()
|
||||||
|
self.record()
|
||||||
|
self.core.break_realtime()
|
||||||
|
for i in range(5):
|
||||||
|
self.core_dma.replay("blink")
|
Loading…
Reference in New Issue