forked from M-Labs/artiq
1
0
Fork 0

devices/dds_core: use new compiler features to compute tuning word trivially

This commit is contained in:
Sebastien Bourdeauducq 2014-08-18 23:53:10 +08:00
parent 7a90f4f4ec
commit 62b872ad94
1 changed files with 1 additions and 2 deletions

View File

@ -13,8 +13,7 @@ class DDS(AutoContext):
def pulse(self, frequency, duration): def pulse(self, frequency, duration):
if self._previous_frequency != frequency: if self._previous_frequency != frequency:
syscall("rtio_sync", self.rtio_channel) # wait until output is off syscall("rtio_sync", self.rtio_channel) # wait until output is off
syscall("dds_program", self.reg_channel, syscall("dds_program", self.reg_channel, int(2**32*frequency/self.dds_sysclk))
(frequency << 2)//(self.dds_sysclk >> 15) << 15)
self._previous_frequency = frequency self._previous_frequency = frequency
syscall("rtio_set", now(), self.rtio_channel, 1) syscall("rtio_set", now(), self.rtio_channel, 1)
delay(duration) delay(duration)