def set_test_mode(roach, zdok_n,counter=True): if counter: use_counter_test(roach, zdok_n) else: use_strobe_test(roach, zdok_n) orig_control = get_spi_control(roach, zdok_n) if hasattr(roach, "adc5g_control"): roach.adc5g_control[zdok_n] = orig_control else: roach.adc5g_control = {zdok_n: orig_control} new_control = orig_control.copy() new_control['test'] = 1 set_spi_control(roach, zdok_n, **new_control)
def set_test_mode(roach, zdok_n, counter=True): if counter: use_counter_test(roach, zdok_n) else: use_strobe_test(roach, zdok_n) orig_control = get_spi_control(roach, zdok_n) if hasattr(roach, "adc5g_control"): roach.adc5g_control[zdok_n] = orig_control else: roach.adc5g_control = {zdok_n: orig_control} new_control = orig_control.copy() new_control['test'] = 1 set_spi_control(roach, zdok_n, **new_control)
def set_test_mode(roach, zdok_n,counter=True): if counter: use_counter_test(roach, zdok_n) else: use_strobe_test(roach, zdok_n) if zdok_n == 1: logger.warning("DIRTY HACK ALERT: Reading control reg from ZDOK 0 to set ZDOK 1") orig_control = get_spi_control(roach, 0)#zdok_n) #sometimes the zdok 1 read interface doesn't work (really worth figuring out why) if hasattr(roach, "adc5g_control"): roach.adc5g_control[zdok_n] = orig_control else: roach.adc5g_control = {zdok_n: orig_control} new_control = orig_control.copy() new_control['test'] = 1 set_spi_control(roach, zdok_n, **new_control)
def set_test_mode(roach, zdok_n, counter=True): if counter: use_counter_test(roach, zdok_n) else: use_strobe_test(roach, zdok_n) if zdok_n == 1: logger.warning( "DIRTY HACK ALERT: Reading control reg from ZDOK 0 to set ZDOK 1") orig_control = get_spi_control( roach, 0 ) #zdok_n) #sometimes the zdok 1 read interface doesn't work (really worth figuring out why) if hasattr(roach, "adc5g_control"): roach.adc5g_control[zdok_n] = orig_control else: roach.adc5g_control = {zdok_n: orig_control} new_control = orig_control.copy() new_control['test'] = 1 set_spi_control(roach, zdok_n, **new_control)
def unset_test_mode(roach, zdok_n): test_mode(roach, zdok_n, on=False) control = get_spi_control(roach, zdok_n) if control['test'] != 0: raise RuntimeError, "Un-set test mode failed!"
def set_test_mode(roach, zdok_n): test_mode(roach, zdok_n, on=True) control = get_spi_control(roach, zdok_n) if control['test'] != 1: raise RuntimeError, "Set test mode failed!"
def test_mode(roach, zdok_n, on): curr_control = get_spi_control(roach, zdok_n) new_control = curr_control.copy() new_control['test'] = int(on) set_spi_control(roach, zdok_n, **new_control)