forked from M-Labs/artiq
1
0
Fork 0

adc: use a generous upper bound

This commit is contained in:
occheung 2023-09-18 19:55:16 -07:00 committed by Sébastien Bourdeauducq
parent c2d136f669
commit 870020bc9f
1 changed files with 3 additions and 0 deletions

View File

@ -224,6 +224,9 @@ class ADC:
self.bus.set_config_mu(
ADC_SPI_CONFIG | spi.SPI_END, 32, SPIT_ADC_WR, CS_ADC)
self.bus.write(addr << 24 | (data & 0xffffff))
delay(100*us)
adc_code = self.read24(_AD4115_REG_DATA)
return ((adc_code / (1 << 23)) - 1) * 2.5 / 0.1
@kernel