From 9e1447d104604615b0b728be2bf294bc3214771b Mon Sep 17 00:00:00 2001 From: occheung Date: Mon, 18 Sep 2023 19:55:47 -0700 Subject: [PATCH] adc: implement standby & power-down/up --- artiq/coredevice/shuttler.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/artiq/coredevice/shuttler.py b/artiq/coredevice/shuttler.py index 97d0ee6f5..3519103d6 100644 --- a/artiq/coredevice/shuttler.py +++ b/artiq/coredevice/shuttler.py @@ -228,7 +228,23 @@ class ADC: delay(100*us) adc_code = self.read24(_AD4115_REG_DATA) return ((adc_code / (1 << 23)) - 1) * 2.5 / 0.1 - + + @kernel + def standby(self): + # Selecting internal XO (0b00) also disables clock during standby + self.write16(_AD4115_REG_ADCMODE, 0x8020) + + @kernel + def power_down(self): + self.write16(_AD4115_REG_ADCMODE, 0x8030) + + @kernel + def exit_power_down(self): + self.reset() + # Although the datasheet claims 500 us reset wait time, only waiting + # for ~500 us can result in DOUT pin stuck in high + delay(2500*us) + @kernel def calibrate(self, volts, trigger, config, samples=[-5.0, 0.0, 5.0]): assert len(volts) == 16