From 85c39cd48e54ce1b695f67c0bdeb2548f017cc68 Mon Sep 17 00:00:00 2001 From: Chris Redpath Date: Fri, 13 Oct 2017 08:12:04 +0100 Subject: [PATCH] instrumentation: Add support for Devlib's monsoon instrument The parameter support is untested as the defaults match what my system does. Signed-off-by: Chris Redpath --- wa/instrumentation/energy_measurement.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/wa/instrumentation/energy_measurement.py b/wa/instrumentation/energy_measurement.py index d4d77c76..5380ba8b 100644 --- a/wa/instrumentation/energy_measurement.py +++ b/wa/instrumentation/energy_measurement.py @@ -24,6 +24,7 @@ from devlib.instrument import CONTINUOUS from devlib.instrument.energy_probe import EnergyProbeInstrument from devlib.instrument.daq import DaqInstrument from devlib.instrument.acmecape import AcmeCapeInstrument +from devlib.instrument.monsoon import MonsoonInstrument from devlib.utils.misc import which from wa import Instrument, Parameter @@ -200,6 +201,25 @@ class AcmeCapeBackend(EnergyInstrumentBackend): iio_device=iio_device, buffer_size=buffer_size) return ret +class MonsoonBackend(EnergyInstrumentBackend): + + name = 'monsoon' + + parameters = [ + Parameter('monsoon_bin', default=which('monsoon.py'), + description=""" + Path to monsoon.py executable. If not provided, + ``$PATH`` is searched. + """), + Parameter('tty_device', default='/dev/ttyACM0', + description=""" + TTY device to use to communicate with the Power + Monitor. If not provided, /dev/ttyACM0 is used. + """) + ] + + instrument = MonsoonInstrument + class EnergyMeasurement(Instrument): @@ -212,7 +232,7 @@ class EnergyMeasurement(Instrument): parameters = [ Parameter('instrument', kind=str, mandatory=True, - allowed_values=['daq', 'energy_probe', 'acme_cape'], + allowed_values=['daq', 'energy_probe', 'acme_cape', 'monsoon'], description=""" Specify the energy instrumentation to be enabled. """),