forked from M-Labs/artiq
1
0
Fork 0

added docstrings to ad9910.py

This commit is contained in:
Garrett 2019-11-11 15:50:40 -06:00 committed by Robert Jördens
parent 4ad3651022
commit 3a19ba7e62
1 changed files with 22 additions and 2 deletions

View File

@ -529,14 +529,26 @@ class AD9910:
@kernel @kernel
def set_ftw(self, ftw): def set_ftw(self, ftw):
"""Set the value stored to the AD9910's frequency tuning word (FTW) register.
:param ftw: Frequency tuning word to be stored, range: 0 to 0xffffffff.
"""
self.write32(_AD9910_REG_FTW, ftw) self.write32(_AD9910_REG_FTW, ftw)
@kernel @kernel
def set_asf(self, asf): def set_asf(self, asf):
"""Set the value stored to the AD9910's amplitude scale factor (ASF) register.
:param asf: Amplitude scale factor to be stored, range: 0 to 0x3ffe.
"""
self.write32(_AD9910_REG_ASF, asf<<2) self.write32(_AD9910_REG_ASF, asf<<2)
@kernel @kernel
def set_pow(self, pow_): def set_pow(self, pow_):
"""Set the value stored to the AD9910's phase offset word (POW) register.
:param pow_: Phase offset word to be stored, range: 0 to 0xffff.
"""
self.write32(_AD9910_REG_POW, pow_) self.write32(_AD9910_REG_POW, pow_)
@portable(flags={"fast-math"}) @portable(flags={"fast-math"})
@ -633,18 +645,26 @@ class AD9910:
@kernel @kernel
def set_frequency(self, frequency): def set_frequency(self, frequency):
"""Set the value stored to the AD9910's FTW register """Set the value stored to the AD9910's frequency tuning word (FTW) register.
:param frequency: frequency to be stored, in Hz :param frequency: frequency to be stored, in Hz.
""" """
return self.set_ftw(self.frequency_to_ftw(frequency)) return self.set_ftw(self.frequency_to_ftw(frequency))
@kernel @kernel
def set_amplitude(self, amplitude): def set_amplitude(self, amplitude):
"""Set the value stored to the AD9910's amplitude scale factor (ASF) register.
:param amplitude: amplitude to be stored, in units of full scale.
"""
return self.set_asf(self.amplitude_to_asf(amplitude)) return self.set_asf(self.amplitude_to_asf(amplitude))
@kernel @kernel
def set_phase(self, turns): def set_phase(self, turns):
"""Set the value stored to the AD9910's phase offset word (POW) register.
:param turns: phase offset to be stored, in turns.
"""
return self.set_pow(self.turns_to_pow(turns)) return self.set_pow(self.turns_to_pow(turns))
@kernel @kernel