forked from M-Labs/nix-servo
loopback read CH1
This commit is contained in:
parent
e1ee2f53cb
commit
232c9e3bb3
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue