Source code for cmd_dio_ki_6517

#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# 
# Copyright 2012-2017 Frédéric Magniette, Miguel Rubio-Roy
# This file is part of Pyrame.
# 
# Pyrame is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# 
# Pyrame is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License for more details.
# 
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrame.  If not, see <http://www.gnu.org/licenses/>

import scpi

# CLASS ##########################################################

class dio_ki_6517_class(scpi.scpi):
    # Available channels
    channels=["1","2","3","4"]

    def __init__(self):
        super(dio_ki_6517_class,self).__init__("dio_ki_6517")

    def set_digital(self,ki_6517_id,level):
        if level not in ["high","low"]:
            return 0,"invalid level %s (high/low)"%(level)
        command=r":OUTP2:TTL{channel}:LSEN A%s\n"%(level.upper())
        command+=":SOUR:TTL{channel}:LEV ON"
        return self.simple_command(ki_6517_id,command)

# CREATE POOL ####################################################

me=dio_ki_6517_class()

# COMMANDS #######################################################

def init():
    scpi.submod=submod

# Functions

[docs]def init_dio_ki_6517(dio_ki_6517_id,conf_string): """Initialize dio_ki_6517 power supply identified by *dio_ki_6517_id* *conf_string* must include the parameter: - bus: conf_string of the underlying link module (GPIB, TCP, ...) - channel: channel on which the id will act""" return me.init(dio_ki_6517_id,conf_string)
[docs]def deinit_dio_ki_6517(dio_ki_6517_id): "Deinitialize an dio_ki_6517" return me.deinit(dio_ki_6517_id)
[docs]def config_dio_ki_6517(dio_ki_6517_id): "Configure an dio_ki_6517" return me.config(dio_ki_6517_id)
[docs]def inval_dio_ki_6517(dio_ki_6517_id): "Invalidate an dio_ki_6517" return me.inval(dio_ki_6517_id)
[docs]def set_digital_dio_ki_6517(dio_ki_6517_id,level): "Set digital output to *level* high or low" return me.set_digital(dio_ki_6517_id,level)