examples: add DMA LED blinker

This commit is contained in:
Sebastien Bourdeauducq 2017-03-01 18:37:58 +08:00
parent a4ece19614
commit 553b8046ff
1 changed files with 26 additions and 0 deletions

View File

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