add some commands to HP8904 device

Thu, 26 Mar 2009 20:56:18 +0100

author
David Douard <david.douard@logilab.fr>
date
Thu, 26 Mar 2009 20:56:18 +0100
changeset 80
89e31bd2524b
parent 79
b8eec4f9db52
child 81
19e4da44795e

add some commands to HP8904 device

pygpibtoolkit/HP3562A/HP356X.py file | annotate | diff | comparison | revisions
pygpibtoolkit/HP8904.py file | annotate | diff | comparison | revisions
--- a/pygpibtoolkit/HP3562A/HP356X.py	Wed Mar 18 00:26:27 2009 +0100
+++ b/pygpibtoolkit/HP3562A/HP356X.py	Thu Mar 26 20:56:18 2009 +0100
@@ -10,7 +10,7 @@
 # You should have received a copy of the GNU General Public License along with
 # this program; if not, write to the Free Software Foundation, Inc.,
 # 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-""" Copyright (c) 2007-2008 David Douard (Paris, FRANCE).
+""" Copyright (c) 2007-2009 David Douard (Paris, FRANCE).
 http://www.logilab.org/project/pygpibtoolkit -- mailto:david.douard@logilab.fr
 
 """
--- a/pygpibtoolkit/HP8904.py	Wed Mar 18 00:26:27 2009 +0100
+++ b/pygpibtoolkit/HP8904.py	Thu Mar 26 20:56:18 2009 +0100
@@ -18,10 +18,57 @@
 
 from pygpibtoolkit.pygpib import Constants, Command
 from pygpibtoolkit.pygpib import Mode, ModeCommand
+from pygpibtoolkit.pygpib import VoltageValue
 from pygpibtoolkit.pygpib import WriteOnlyMode
+
 from pygpibtoolkit.gpibcontroller import AbstractGPIBDevice, deviceRegister
 
+class _VoltageValue(VoltageValue):
+    _units = "VL","MV","UV"
 
+class APA(_VoltageValue):
+    "CHAN A AMP - Channel A amplitude"
+class APB(_VoltageValue):
+    "CHAN A AMP - Channel A amplitude"
+class APC(_VoltageValue):
+    "CHAN A AMP - Channel A amplitude"
+class APD(_VoltageValue):
+    "CHAN A AMP - Channel A amplitude"
+
+class Backlight(WriteOnlyMode):
+    "Backlight"
+    _init_value = "BO"
+
+    BF = ModeCommand("Off", "OFF")
+    BO = ModeCommand("On", "ON")
+
+class _PerOutputMode(WriteOnlyMode):
+    
+    def __init__(self):
+        self._cmds = []
+        for cmdname, cmd in self.__class__.__dict__.items():
+            if isinstance(cmd, ModeCommand):
+                self._cmds.append(self._prefix + cmdname)
+
+    def build_set_cmd(self, value):
+        # XXX HERE: todo: make it work with value not in self._cmds
+        # (eg. value=="AU", cmds == ['FS1AU')
+        assert value in self._cmds
+        return value, value
+
+    
+class Filter1(_PerOutputMode):
+    "Filter for output 1"
+    _prefix = "FS1"
+    _init_value = "AU"
+    SH = ModeCommand("Elliptic (sharp cutoff)", "ELIPT.")
+    LO = ModeCommand("Gaussian (low overshoot)", "GAUSS.")
+    AU = ModeCommand("Automatic", "AUTO")
+
+class Filter2(Filter1):
+    "Filter for output 2"
+    _prefix = "FS2"
+    
     
 class HP8904Device(AbstractGPIBDevice):
     _accepts = ["^(?P<model>HP *8904A).*$",]

mercurial