forked from M-Labs/artiq
ad9912: clean up
This commit is contained in:
parent
d8dbab024d
commit
cef40eef43
|
@ -1,11 +1,5 @@
|
||||||
"""
|
from artiq.language.core import kernel, delay_mu, delay, portable
|
||||||
Driver for the AD9912 DDS.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
from artiq.language.core import kernel, delay_mu, delay
|
|
||||||
from artiq.language.units import us, ns
|
from artiq.language.units import us, ns
|
||||||
from artiq.coredevice import spi, urukul
|
|
||||||
from artiq.coredevice.ad9912_reg import *
|
from artiq.coredevice.ad9912_reg import *
|
||||||
|
|
||||||
from numpy import int32, int64
|
from numpy import int32, int64
|
||||||
|
@ -13,7 +7,7 @@ from numpy import int32, int64
|
||||||
|
|
||||||
class AD9912:
|
class AD9912:
|
||||||
"""
|
"""
|
||||||
Support for the Analog devices AD9912 DDS
|
Support for the AD9912 DDS on Urukul
|
||||||
|
|
||||||
:param chip_select: Chip select configuration.
|
:param chip_select: Chip select configuration.
|
||||||
:param cpld_device: Name of the Urukul CPLD this device is on.
|
:param cpld_device: Name of the Urukul CPLD this device is on.
|
||||||
|
@ -43,9 +37,7 @@ class AD9912:
|
||||||
self.bus.write((addr | ((length - 1) << 13)) << 16)
|
self.bus.write((addr | ((length - 1) << 13)) << 16)
|
||||||
delay_mu(-self.bus.xfer_period_mu)
|
delay_mu(-self.bus.xfer_period_mu)
|
||||||
self.bus.set_xfer(self.chip_select, length*8, 0)
|
self.bus.set_xfer(self.chip_select, length*8, 0)
|
||||||
if length < 4:
|
self.bus.write(data << (32 - length*8))
|
||||||
data <<= 32 - length*8
|
|
||||||
self.bus.write(data)
|
|
||||||
delay_mu(self.bus.xfer_period_mu - self.bus.write_period_mu)
|
delay_mu(self.bus.xfer_period_mu - self.bus.write_period_mu)
|
||||||
|
|
||||||
@kernel
|
@kernel
|
||||||
|
|
Loading…
Reference in New Issue