forked from M-Labs/nix-servo
loopback read CH1
This commit is contained in:
parent
25524856b9
commit
125611f51e
|
@ -1,25 +1,24 @@
|
||||||
import time
|
import time
|
||||||
from pyfastservo import adc, dac
|
from pyfastservo import adc, dac
|
||||||
from pyfastservo.common import (
|
from pyfastservo.common import (
|
||||||
ADC_CH0_HIGH_ADDR,
|
ADC_CH1_HIGH_ADDR,
|
||||||
ADC_CH0_LOW_ADDR,
|
ADC_CH1_LOW_ADDR,
|
||||||
CH0_HIGH_WORD_ADDR,
|
CH1_HIGH_WORD_ADDR,
|
||||||
CH0_LOW_WORD_ADDR,
|
CH1_LOW_WORD_ADDR,
|
||||||
read_from_memory,
|
read_from_memory,
|
||||||
write_to_memory
|
write_to_memory
|
||||||
)
|
)
|
||||||
###
|
|
||||||
|
|
||||||
def read_adc():
|
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
|
return adc_value
|
||||||
|
|
||||||
def write_dac(value):
|
def write_dac(value):
|
||||||
dac.set_dac_output(value)
|
dac.set_dac_output(value)
|
||||||
|
|
||||||
def read_dac():
|
def read_dac():
|
||||||
high_word = read_from_memory(CH0_HIGH_WORD_ADDR, 1)[0]
|
high_word = read_from_memory(CH1_HIGH_WORD_ADDR, 1)[0]
|
||||||
low_word = read_from_memory(CH0_LOW_WORD_ADDR, 1)[0]
|
low_word = read_from_memory(CH1_LOW_WORD_ADDR, 1)[0]
|
||||||
return (high_word << 8) | low_word
|
return (high_word << 8) | low_word
|
||||||
|
|
||||||
def perform_loopback_test(test_value):
|
def perform_loopback_test(test_value):
|
||||||
|
|
Loading…
Reference in New Issue