forked from M-Labs/artiq
1
0
Fork 0

suservo: use new rtio_output() API

This commit is contained in:
Sebastien Bourdeauducq 2018-11-08 20:13:14 +08:00
parent e8d58b35b4
commit bec25cbaa0
1 changed files with 4 additions and 4 deletions

View File

@ -1,4 +1,4 @@
from artiq.language.core import kernel, delay, now_mu, delay_mu, portable from artiq.language.core import kernel, delay, delay_mu, portable
from artiq.language.units import us, ns from artiq.language.units import us, ns
from artiq.coredevice.rtio import rtio_output, rtio_input_data from artiq.coredevice.rtio import rtio_output, rtio_input_data
from artiq.coredevice import spi2 as spi from artiq.coredevice import spi2 as spi
@ -129,7 +129,7 @@ class SUServo:
:param addr: Memory location address. :param addr: Memory location address.
:param value: Data to be written. :param value: Data to be written.
""" """
rtio_output(now_mu(), self.channel, addr | WE, value) rtio_output((self.channel << 8) | addr | WE, value)
delay_mu(self.ref_period_mu) delay_mu(self.ref_period_mu)
@kernel @kernel
@ -140,7 +140,7 @@ class SUServo:
:param addr: Memory location address. :param addr: Memory location address.
""" """
rtio_output(now_mu(), self.channel, addr, 0) rtio_output((self.channel << 8) | addr, 0)
return rtio_input_data(self.channel) return rtio_input_data(self.channel)
@kernel @kernel
@ -262,7 +262,7 @@ class Channel:
:param en_iir: IIR updates enable :param en_iir: IIR updates enable
:param profile: Active profile (0-31) :param profile: Active profile (0-31)
""" """
rtio_output(now_mu(), self.channel, 0, rtio_output(self.channel << 8,
en_out | (en_iir << 1) | (profile << 2)) en_out | (en_iir << 1) | (profile << 2))
@kernel @kernel