ad9912: add ftw_to_frequency

This commit is contained in:
Robert Jördens 2018-08-02 11:19:04 +00:00
parent e518a1f1d0
commit 7d6a1b528d
1 changed files with 7 additions and 0 deletions

View File

@ -157,6 +157,13 @@ class AD9912:
""" """
return int64(round(self.ftw_per_hz*frequency)) return int64(round(self.ftw_per_hz*frequency))
@portable(flags={"fast-math"})
def ftw_to_frequency(self, ftw):
"""Returns the frequency corresponding to the given
frequency tuning word.
"""
return ftw/self.ftw_per_hz
@portable(flags={"fast-math"}) @portable(flags={"fast-math"})
def turns_to_pow(self, phase): def turns_to_pow(self, phase):
"""Returns the phase offset word corresponding to the given """Returns the phase offset word corresponding to the given