devices/dds_core: document

This commit is contained in:
Sebastien Bourdeauducq 2014-09-30 17:38:52 +08:00
parent 5ac42e42c1
commit cb036a30c7
2 changed files with 35 additions and 0 deletions

View File

@ -4,6 +4,20 @@ from artiq.devices import rtio_core
class DDS(AutoContext):
"""Core device Direct Digital Synthesis (DDS) driver.
This driver controls DDS devices managed directly by the core device's
runtime. It also uses a RTIO channel (through
:class:`artiq.devices.rtio_core.RTIOOut`) to control a RF switch that
gates the output of the DDS device.
:param dds_sysclk: DDS system frequency, used for computing the frequency
tuning words.
:param reg_channel: channel number of the DDS device to control.
:param rtio_channel: RTIO channel number of the RF switch associated with
the DDS device.
"""
parameters = "dds_sysclk reg_channel rtio_channel"
def build(self):
@ -14,6 +28,12 @@ class DDS(AutoContext):
@kernel
def on(self, frequency):
"""Sets the DDS channel to the specified frequency and turns it on.
If the DDS channel was already on, a real-time frequency update is
performed.
"""
if self.previous_frequency != frequency:
if self.sw.previous_timestamp != now():
self.sw.sync()
@ -35,10 +55,19 @@ class DDS(AutoContext):
@kernel
def off(self):
"""Turns the DDS channel off.
"""
self.sw.off()
@kernel
def pulse(self, frequency, duration):
"""Pulses the DDS channel for the specified duration at the specified
frequency.
Equivalent to a ``on``, ``delay``, ``off`` sequence.
"""
self.on(frequency)
delay(duration)
self.off()

View File

@ -6,3 +6,9 @@ Drivers reference
.. automodule:: artiq.devices.rtio_core
:members:
:mod:`artiq.devices.dds_core` module
-------------------------------------
.. automodule:: artiq.devices.dds_core
:members: