-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGPI_RP.py
174 lines (132 loc) · 3.43 KB
/
GPI_RP.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import math
import numpy as np
from koheron import command
class GPI_RP(object):
def __init__(self, client):
self.client = client
# self.n_pts = 16384
self.n_pts = 8192
self.fs = 125e6 # sampling frequency (Hz)
self.adc = np.zeros((2, self.n_pts))
self.dac = np.zeros((2, self.n_pts))
@command()
def set_led(self, led):
pass
@command()
def set_analog_out(self, analog_out):
'''
Controls the 4 analog output pins on E2. AO0 is controlled by 0b0000/0b0001, AO1 with
0b0000/0b0010, etc.
'''
pass
@command()
def get_fifo_length(self):
return self.client.recv_uint32()
@command()
def get_buffer_length(self):
return self.client.recv_uint32()
@command()
def get_GPI_data(self):
return self.client.recv_vector(dtype='uint32')
@command()
def reset_fifo(self):
pass
@command()
def set_GPI_safe_state(self, state):
pass
@command()
def set_slow_1(self, state):
pass
@command()
def set_slow_2(self, state):
pass
@command()
def set_slow_3(self, state):
pass
@command()
def set_slow_4(self, state):
pass
@command()
def reset_time(self, state):
pass
@command()
def set_fast(self, state):
pass
@command()
def set_fast_permission_1(self, state):
pass
@command()
def set_fast_permission_2(self, state):
pass
@command()
def set_fast_permission_3(self, state):
pass
@command()
def set_fast_permission_4(self, state):
pass
@command()
def set_fast_delay_1(self, state):
pass
@command()
def set_fast_delay_2(self, state):
pass
@command()
def set_fast_delay_3(self, state):
pass
@command()
def set_fast_delay_4(self, state):
pass
@command()
def set_fast_duration_1(self, state):
pass
@command()
def set_fast_duration_2(self, state):
pass
@command()
def set_fast_duration_3(self, state):
pass
@command()
def set_fast_duration_4(self, state):
pass
@command()
def send_T1(self, state):
pass
@command()
def get_W7X_permission(self):
return self.client.recv_uint32()
@command()
def get_W7X_T1(self):
return self.client.recv_uint32()
@command()
def get_analog_out(self):
return self.client.recv_uint32()
@command()
def get_abs_gauge(self):
return self.client.recv_uint32()
@command()
def get_diff_gauge(self):
return self.client.recv_uint32()
@command()
def get_analog_input_0(self):
return self.client.recv_uint32()
@command()
def get_analog_input_1(self):
return self.client.recv_uint32()
@command()
def get_slow_1_sts(self):
return self.client.recv_uint32()
@command()
def get_slow_2_sts(self):
return self.client.recv_uint32()
@command()
def get_slow_3_sts(self):
return self.client.recv_uint32()
@command()
def get_slow_4_sts(self):
return self.client.recv_uint32()
@command()
def get_fast_sts(self):
return self.client.recv_uint32()