Beispiel #1
0
from __future__ import print_function
import os
import sys
import pickle
import errno
import subprocess
import json
import time
import hashlib
import logging
import logging.handlers
from collections import OrderedDict, Counter
import MySQLdb

from PyExpLabSys.common.supported_versions import python3_only
python3_only(__file__)

# Set this for whether it is running in cron
RUNNING_IN_CRON = os.getenv('CRONTAB') == 'true'

# Configure logging
LOGFILE = os.path.join(
    os.path.dirname(os.path.realpath(__file__)), 'always_lint.log'
)
LOG = logging.getLogger('always_lint')
LOG.setLevel(logging.DEBUG)
ROTATING_FILE_HANDLER = logging.handlers.RotatingFileHandler(
    LOGFILE, maxBytes=10485760, backupCount=10
)
ROTATING_FILE_HANDLER.setLevel(logging.DEBUG)
FORMATTER = logging.Formatter(
Beispiel #2
0
"""Driver for the Analog Devices AD5667 2 channel analog output DAC

Implemented from the manual located `here
<http://www.analog.com/media/en/technical-documentation/data-sheets/AD5627R_5647R_5667R_
5627_5667.pdf>`__ and the examples located `here
<https://github.com/ControlEverythingCommunity/AD5667>`__.

"""

import time
import smbus
from PyExpLabSys.common.supported_versions import python3_only
python3_only(__file__)


class AD5667:

    """Driver for the Analog Devices AD5667 2 channel analog output DAC"""

    def __init__(self):
        """Initialize object properties"""
        # Get I2C bus
        self.bus = smbus.SMBus(1)

        self.address = 0x0E
        self.dac_and_input_register = {
            'both': 0x1F,
            'A': 0x18,
            'B': 0x19,
        }