Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
whuie2
experiment-control
Commits
3893d91b
Commit
3893d91b
authored
Dec 22, 2021
by
whooie
Browse files
add convenience function for setting the output mode of the ad5791 DAC
parent
3cf46df9
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/__init__.py
View file @
3893d91b
...
...
@@ -26,6 +26,7 @@ from lib.system import (
CONNECTIONS
,
FLIR
,
MOGRF
,
ad5791_init_val
,
)
from
lib.dataio
import
(
get_timestamp
,
...
...
lib/system.py
View file @
3893d91b
...
...
@@ -74,3 +74,20 @@ 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
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment