pyfastservo dac: power_down -> power_down_afe

This commit is contained in:
linuswck 2024-11-08 15:33:40 +08:00
parent 51c8b755d2
commit 6705b182d5
1 changed files with 6 additions and 3 deletions

View File

@ -90,7 +90,7 @@ def manual_override(enable=True):
to_write = reg_contents | 0b1 if enable else reg_contents & 0b110 to_write = reg_contents | 0b1 if enable else reg_contents & 0b110
write_to_memory(CTRL_ADDR, to_write) write_to_memory(CTRL_ADDR, to_write)
def power_down(channel, power_down=True): def power_down_afe(channel, power_down=True):
assert channel in (0, 1) assert channel in (0, 1)
bitmask = 1 << (channel + 1) & 0b111 bitmask = 1 << (channel + 1) & 0b111
@ -137,6 +137,9 @@ def configure_ad9117():
print("Unrecognized DAC version") print("Unrecognized DAC version")
return False return False
power_down_afe(0, True)
power_down_afe(1, True)
configure_dac(spi) configure_dac(spi)
check_clk_relationship(spi) check_clk_relationship(spi)
dac_self_calibration(spi) dac_self_calibration(spi)
@ -144,8 +147,8 @@ def configure_ad9117():
# Enable DAC outputs # Enable DAC outputs
spi_write(spi, 0x01, spi_read(spi, 0x01) & ~((1 << 4) | (1 << 3))) spi_write(spi, 0x01, spi_read(spi, 0x01) & ~((1 << 4) | (1 << 3)))
power_down(0, False) power_down_afe(0, False)
power_down(1, False) power_down_afe(1, False)
manual_override(False) manual_override(False)
print("AD9117 configuration completed successfully") print("AD9117 configuration completed successfully")