-def bytes2str(self, c):
+def bytes2str(c):
r = c
if not isinstance(c, str):
if isinstance(c, (tuple, list)):
raise TypeError, 'Cannot convert type %s to raw string.' % type(c)
return r
+
def mkcfg(n):
return ''.join(map(chr, np.random.randint(0, 256, n)))
+
def str2hex(x):
return ''.join(map(lambda h: '%02x' % ord(h), x))
print str2hex(code[-4:]), str2hex(c2[-4:])
+if 0:
+ raw_input()
+ cm = 0.9
+ vos = 0.2
+ dac.vcmi(cm)
+ while True:
+ for i in range(1000):
+ a = 0.2*sin(2*pi*i/1000.0)
+ a = 0.2 * (i - 500.0)/1000.0
+ va = cm + a + vos
+ vb = cm - a + vos
+ print '%3i %6.3f %6.3f %6.3f' % (i, a, va, vb)
+ dac.vina(va)
+ dac.vinb(vb)
+ sleep(0.01)
+
+
##############################################################################
# drop into an IPython shell
#
IPython.embed()
+