forked from M-Labs/artiq
devices/dds_core: use new compiler features to compute tuning word trivially
This commit is contained in:
parent
7a90f4f4ec
commit
62b872ad94
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue