From 553b8046ff4df677fd5c49cd148605c4db542f1a Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Wed, 1 Mar 2017 18:37:58 +0800 Subject: [PATCH] examples: add DMA LED blinker --- .../coredevice_examples/simple/dma_blink.py | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 artiq/examples/master/repository/coredevice_examples/simple/dma_blink.py diff --git a/artiq/examples/master/repository/coredevice_examples/simple/dma_blink.py b/artiq/examples/master/repository/coredevice_examples/simple/dma_blink.py new file mode 100644 index 000000000..aedb5c535 --- /dev/null +++ b/artiq/examples/master/repository/coredevice_examples/simple/dma_blink.py @@ -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")