fix adc and dac initialization
This commit is contained in:
parent
db88e5db59
commit
c9d34348bc
@ -54,7 +54,7 @@ def main_adc_config(test_pattern):
|
|||||||
spi.open(MAIN_ADC_BUS, MAIN_ADC_DEVICE)
|
spi.open(MAIN_ADC_BUS, MAIN_ADC_DEVICE)
|
||||||
spi.max_speed_hz = 50000
|
spi.max_speed_hz = 50000
|
||||||
spi.mode = 0b00 # CPOL = 0 CPHA = 0
|
spi.mode = 0b00 # CPOL = 0 CPHA = 0
|
||||||
spi.cshigh = True
|
spi.cshigh = False
|
||||||
# spi.read0 = False
|
# spi.read0 = False
|
||||||
|
|
||||||
spi_buffer = [0x00, 0x80] # reset
|
spi_buffer = [0x00, 0x80] # reset
|
||||||
@ -121,7 +121,7 @@ def main_adc_test_mode(enable):
|
|||||||
spi.open(MAIN_ADC_BUS, MAIN_ADC_DEVICE)
|
spi.open(MAIN_ADC_BUS, MAIN_ADC_DEVICE)
|
||||||
spi.max_speed_hz = 50000
|
spi.max_speed_hz = 50000
|
||||||
spi.mode = 0b00 # CPOL = 0 CPHA = 0
|
spi.mode = 0b00 # CPOL = 0 CPHA = 0
|
||||||
spi.cshigh = True
|
spi.cshigh = False
|
||||||
# spi.read0 = True
|
# spi.read0 = True
|
||||||
|
|
||||||
reg_contents = (
|
reg_contents = (
|
||||||
@ -292,7 +292,7 @@ def adc_aux_read(port, type, pin):
|
|||||||
spi.open(1, 3) # AUX ADC 1?
|
spi.open(1, 3) # AUX ADC 1?
|
||||||
spi.max_speed_hz = 5000
|
spi.max_speed_hz = 5000
|
||||||
spi.mode = 0b00
|
spi.mode = 0b00
|
||||||
spi.cshigh = True
|
spi.cshigh = False
|
||||||
|
|
||||||
read_buffer = spi.xfer2(write_buffer)
|
read_buffer = spi.xfer2(write_buffer)
|
||||||
mu_voltage = read_buffer[0] << 8 | read_buffer[1] >> 2
|
mu_voltage = read_buffer[0] << 8 | read_buffer[1] >> 2
|
||||||
|
@ -45,7 +45,7 @@ def main_dac_init():
|
|||||||
spi.open(MAIN_DAC_BUS, MAIN_DAC_DEVICE)
|
spi.open(MAIN_DAC_BUS, MAIN_DAC_DEVICE)
|
||||||
spi.max_speed_hz = 5000
|
spi.max_speed_hz = 5000
|
||||||
spi.mode = 0b00 # CPOL = 0 CPHA = 0
|
spi.mode = 0b00 # CPOL = 0 CPHA = 0
|
||||||
spi.cshigh = True
|
spi.cshigh = False
|
||||||
|
|
||||||
spi_buffer = [0x00, 0x10] # software reset
|
spi_buffer = [0x00, 0x10] # software reset
|
||||||
spi.xfer2(spi_buffer)
|
spi.xfer2(spi_buffer)
|
||||||
|
Loading…
Reference in New Issue
Block a user