Commit e350a8d3 authored by whooie's avatar whooie
Browse files

add stuff for a5791 dac

parent 3893d91b
......@@ -26,7 +26,9 @@ from lib.system import (
CONNECTIONS,
FLIR,
MOGRF,
ad5791_init_val,
AD5791_INIT,
AD5791_CTRL,
AD5791_DAC,
)
from lib.dataio import (
get_timestamp,
......
......@@ -40,6 +40,9 @@ CONNECTIONS = ConnectionLayout(
mot3_coils_onoff = Digital(0, 2, 1),
mot3_coils_cur = Analog(0, 3.45),
mot3_coils_vol = Analog(1, 7.00),
mot3_coils_sig = Digital(0, 8, 0),
mot3_coils_clk = Digital(0, 10, 0),
mot3_coils_sync = Digital(0, 14, 1),
shim_coils_ud = Analog(2, 0.00),
shim_coils_lr = Analog(3, 0.00),
shim_coils_fb = Analog(4, 0.00),
......@@ -74,20 +77,7 @@ FLIR = Grasshopper(FLIR_SERIAL)
MOGRF_COM = 3
MOGRF = MOGDriver("COM", MOGRF_COM)
def ad5791_init_val(register: int, value: int) -> int:
"""
Returns the 24-bit integer value to send to the AD5791 DAC encoding the
operation mode.
Parameters
----------
register : uint8
value : uint24
"""
r = register % 256
B10 = value % 65536
B2 = (value >> 16) % 256
return (((B2 & 0x0f) | r) << 16) + B10
AD5791_CTRL = ad5791_init_val(0x20, 0x0012)
AD5791_CTRL = 0b0010
AD5791_INIT = 0b00000000000000010010
AD5791_DAC = 0b0001
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment