an element or list of the specific elements to be calibrated, leaving
others alone.
+ returns: (offsets, stats)
+
NB: The calibration routines only modify the relevant ota.offset values,
and sets the .cal bit for the chains. All other settings (.fast, cint,
etc) are left un-touched.
x0[j,i] = chain.h[i].ota[j].offset
offsets, stats = secant_opt(func, x0, limits,
elements=elements, verbose=verbose)
-
elif name == 'mux':
#save mux state
old_mode = [mux.ota[i].mode for i in range(2)]
arb = None
amux = None
+
+def close_usb():
+ """
+ Close the three MPSSE ports from the usb side. If the serial port is also
+ closed, the kernel will suspend the device. This makes the SUSPEND pin go
+ low on the usbio board and allows a circuit to cut power to the devboard.
+ """
+ print 'closing usb ports'
+ for c in (spi0.context, spi1.context, i2c.context):
+ usbio.ftdi.usb_close(c)
+ print 'sleeping...'
+ sleep(5)
+
+
def init_devboard(name='devboard-defaults.yaml'):
"""Initialize devboard <-> usbio with a known configuration. `name` may be
a string filename, defaulting to 'devboard-defaults.yaml' or an integer
#blank the slate
if is_initialized:
+ close_usb()
_config = {}
spi0 = None
spi1 = None
--- /dev/null
+#!/bin/bash
+
+#
+# turn on autosuspend for usbio
+#
+
+for f in /sys/bus/usb/devices/* ; do
+ if [ -e $f/manufacturer ]; then
+ if [ "$(cat $f/manufacturer)" == "White Audio" ]; then
+ echo $f
+ echo "0" | sudo tee $f/power/autosuspend_delay_ms
+ echo "auto" | sudo tee $f/power/control
+ fi
+ fi
+done
+
--- /dev/null
+#!/usr/bin/env python
+
+from time import sleep
+
+import devboard as dev
+dev.init_devboard(1)
+
+from calibrate import calibrate
+
+
+
+
+
+sleep(5)
+dev.init_devboard(1)
+
+
+
+