Blame view

redpitaya/server/tests/test_dac_offsets.py 734 Bytes
bd35fd256   bmarechal   -
1
2
3
4
5
  #!/usr/bin/env python
  import ctypes, argparse
  import liboscimp_fpga
  
  def parse():
1a31d75ad   bmarechal   replace 4 spaces ...
6
7
8
9
10
11
12
13
14
15
16
17
18
  	parser = argparse.ArgumentParser(description = 'Set offsets to DAC1 and DAC2')
  	parser.add_argument('-of1',
  						action='store',
  						dest='of1',
  						default=0,
  						help='DAC1 offset (bits)')
  	parser.add_argument('-of2',
  						action='store',
  						dest='of2',
  						default=0,
  						help='DAC2 offset (bits)')
  	args = parser.parse_args()
  	return args
bd35fd256   bmarechal   -
19
20
  
  def main():
1a31d75ad   bmarechal   replace 4 spaces ...
21
22
23
24
25
26
27
  	args = parse()
  	of1 = int(args.of1)
  	of2 = int(args.of2)
  	liboscimp_fpga.add_const_set_offset("/dev/add_const_0", of1)
  	liboscimp_fpga.add_const_set_offset("/dev/add_const_1", of2)
  	print('offset DAC1 : %i'%of1)
  	print('offset DAC2 : %i'%of2)
bd35fd256   bmarechal   -
28
29
  
  if __name__ == "__main__":
1a31d75ad   bmarechal   replace 4 spaces ...
30
  	main()