forked from M-Labs/artiq
1
0
Fork 0

novogorny: streamline gain setting method, style [nfc]

This commit is contained in:
Robert Jördens 2018-03-21 08:22:48 +00:00
parent f5a1001114
commit 80903cead7
1 changed files with 9 additions and 8 deletions

View File

@ -1,4 +1,3 @@
from artiq.language.core import kernel, delay, portable
from artiq.language.units import ns
@ -93,11 +92,13 @@ class Novogorny:
:param channel: Channel index
:param gain: Gain setting
"""
self.gains &= ~(0b11 << (channel*2))
self.gains |= gain << (channel*2)
gains = self.gains
gains &= ~(0b11 << (channel*2))
gains |= gain << (channel*2)
self.bus.set_config_mu(SPI_CONFIG | spi.SPI_END,
16, self.div, SPI_CS_SR)
self.bus.write(self.gains << 16)
self.bus.write(gains << 16)
self.gains = gains
@kernel
def configure(self, data):