#!   /usr/bin/env   python
#    coding: utf8

# Copyright CERN, 2011
# Author: Matthieu Cattin <matthieu.cattin@cern.ch>
# Licence: GPL v2 or later.
# Website: http://www.ohwr.org
# Last modifications: 4/6/2012

# Import system modules
import sys
import time
import os

# Add common modules and libraries location to path
sys.path.append('usb_box')
sys.path.append('cp210x')

# Import specific modules
from calibr_box import *
from find_usb_tty import *

"""
test18: Test calibration box

"""
BOX_USB_VENDOR_ID = 0x10c4 # Cygnal Integrated Products, Inc.
BOX_USB_DEVICE_ID = 0xea60 # CP210x Composite Device
box_tty = CttyUSB().find_usb_tty(BOX_USB_VENDOR_ID, BOX_USB_DEVICE_ID)
print("Device: %s" % box_tty[0])

box = CCalibr_box(box_tty[0])
box.select_trigger_loopback(0)
box.select_output(2)

time.sleep(100)



"""
while True:
    box.select_trigger_loopback(1)
    time.sleep(1)
    box.select_trigger_loopback(0)
    time.sleep(1)
"""
