Start using DMA sampling with ADC

The various code used to make DMA-based sampling work.
Tested (except for some non-functional changes to improve code) on
cart, although not extensively or under any real load.

Change-Id: I187066e857e5077cb017f9f371c8eeaf0a2e2d15
diff --git a/motors/fet12/current_equalize.py b/motors/fet12/current_equalize.py
index 698983f..ea44916 100755
--- a/motors/fet12/current_equalize.py
+++ b/motors/fet12/current_equalize.py
@@ -2,8 +2,9 @@
 
 import numpy
 import sys
+import calib_sensors
 
-def main():
+def manual_calibrate():
     #  38  27 -84
     #  36 -64  39
     # -74  21  35
@@ -17,6 +18,13 @@
                       [-current / 2.0, current, -current / 2.0],
                       [-current / 2.0, -current / 2.0, current]])
     transform = I * numpy.linalg.inv(Is)
+    return transform
+
+def main():
+    transform = manual_calibrate()
+
+    if len(sys.argv) > 1:
+      transform = calib_sensors.calibrate(sys.argv[1:])
 
     print("#ifndef MOTORS_FET12_CURRENT_MATRIX_")
     print("#define MOTORS_FET12_CURRENT_MATRIX_")