def power_vusb():
    try:
        logfunc(">> Starting power-vusb\n")
        # V-USB > On, testing V-USB.
        GPIO.output(18, GPIO.HIGH)
        logfunc(">>> Vusb is powered on\n")
        sleep(2)

        adcUSB = check_adc_usb_on()
        adc3v = check_adc_3v_on()
        adc5v = check_adc_5v_on()
        adc9v = check_adc_vin_off()
        values = ">>> vin: " + str(adc9v) + " 3v: " + str(adc3v) + " 5v: " + str(adc5v) + " usb: " + str(adcUSB)
        logfunc(values)

        if not adcUSB or not adc3v or not adc5v or not adc9v:
            logfunc(">>> Power-vusb unccesful\n")
            # Power test was unsuccesful.
            GPIO.output(18, GPIO.LOW)
            logfunc(">>> Vusb is powered off\n")
            finish_test(0)

        logfunc(">>> Power-vin succesful\n")
        logfunc(">> Finished power-vusb\n")
    except Exception, e:
        result = traceback.format_exc()
        logfunc("********************************\n")
        logfunc("********************************\n")
        logfunc("Failure: power-vusb\n")
        logfunc(result)
        logfunc("DONE -----------------------------------\n\n\n")
        finish_test(0)
def start_monitoring_ldo():
    try:
        logfunc("\n\nStarted: minotor-ldo-process\n")
        while 1:
            adcUSB = check_adc_usb_on()
            adc9v = check_adc_vin_off()
            adc3v = check_adc_3v_on()
            adc5v = check_adc_5v_on()
            if not adcUSB or not adc9v or not adc3v or not adc5v:
                logfunc("\n\Failure: minotor-ldo-process, unsuccesful\n")
                finish_test(0)
    except Exception, e:
        result = traceback.format_exc()
        logfunc("********************************\n")
        logfunc("********************************\n")
        logfunc("Failure: monitor-ldo process\n")
        logfunc(result)
        logfunc("DONE -----------------------------------\n\n\n")
        finish_test(0)