1
0
Fork 0

loopback read CH1

This commit is contained in:
Florian Agbuya 2024-08-21 14:29:08 +08:00
parent 25524856b9
commit 125611f51e
1 changed files with 7 additions and 8 deletions

View File

@ -1,25 +1,24 @@
import time
from pyfastservo import adc, dac
from pyfastservo.common import (
ADC_CH0_HIGH_ADDR,
ADC_CH0_LOW_ADDR,
CH0_HIGH_WORD_ADDR,
CH0_LOW_WORD_ADDR,
ADC_CH1_HIGH_ADDR,
ADC_CH1_LOW_ADDR,
CH1_HIGH_WORD_ADDR,
CH1_LOW_WORD_ADDR,
read_from_memory,
write_to_memory
)
###
def read_adc():
adc_value = adc.read_adc_channel(ADC_CH0_HIGH_ADDR, ADC_CH0_LOW_ADDR)
adc_value = adc.read_adc_channel(ADC_CH1_HIGH_ADDR, ADC_CH1_LOW_ADDR)
return adc_value
def write_dac(value):
dac.set_dac_output(value)
def read_dac():
high_word = read_from_memory(CH0_HIGH_WORD_ADDR, 1)[0]
low_word = read_from_memory(CH0_LOW_WORD_ADDR, 1)[0]
high_word = read_from_memory(CH1_HIGH_WORD_ADDR, 1)[0]
low_word = read_from_memory(CH1_LOW_WORD_ADDR, 1)[0]
return (high_word << 8) | low_word
def perform_loopback_test(test_value):