mirror of https://github.com/m-labs/artiq.git
novogorny: streamline gain setting method, style [nfc]
This commit is contained in:
parent
f5a1001114
commit
80903cead7
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
from artiq.language.core import kernel, delay, portable
|
from artiq.language.core import kernel, delay, portable
|
||||||
from artiq.language.units import ns
|
from artiq.language.units import ns
|
||||||
|
|
||||||
|
@ -93,11 +92,13 @@ class Novogorny:
|
||||||
:param channel: Channel index
|
:param channel: Channel index
|
||||||
:param gain: Gain setting
|
:param gain: Gain setting
|
||||||
"""
|
"""
|
||||||
self.gains &= ~(0b11 << (channel*2))
|
gains = self.gains
|
||||||
self.gains |= gain << (channel*2)
|
gains &= ~(0b11 << (channel*2))
|
||||||
|
gains |= gain << (channel*2)
|
||||||
self.bus.set_config_mu(SPI_CONFIG | spi.SPI_END,
|
self.bus.set_config_mu(SPI_CONFIG | spi.SPI_END,
|
||||||
16, self.div, SPI_CS_SR)
|
16, self.div, SPI_CS_SR)
|
||||||
self.bus.write(self.gains << 16)
|
self.bus.write(gains << 16)
|
||||||
|
self.gains = gains
|
||||||
|
|
||||||
@kernel
|
@kernel
|
||||||
def configure(self, data):
|
def configure(self, data):
|
||||||
|
|
Loading…
Reference in New Issue