Example #1
0
def svn_update():
    """
    @brief SVN Update
    """
    c = get_connection() # SVN Update

    c.update()
Example #2
0
def test_i2c_detect():
    """
    @param None
    @returns None
    @brief Test I2C Detect
    """
    c = get_connection()

    print c.i2c_detect()
Example #3
0
def test_all():
    """
    @brief Test
    """

    # TODO - prints stuff to SSH console instead of this one...

    c = get_connection()

    c.test_all()
Example #4
0
def test_mcp23008():
    """
    @param None
    @returns None
    @brief Test mcp23008
    """
    c = get_connection()

    mcp23008 = c.I2C(0x20) # 40 (8-bit)

    print mcp23008.read(0x00, 16)

    mcp23008.write(0x00, 0x00) # IODIR - I/O DIRECTION REGISTER (ADDR 0x00)
    time.sleep(0.25)

    mcp23008.write(0x09, 0x55) # GPIO - GENERAL PURPOSE I/O PORT REGISTER (ADDR 0x09)
    time.sleep(0.25)

    mcp23008.write(0x09, 0xAA) # GPIO - GENERAL PURPOSE I/O PORT REGISTER (ADDR 0x09)
    time.sleep(0.25)

    mcp23008.write(0x09, 0x00) # GPIO - GENERAL PURPOSE I/O PORT REGISTER (ADDR 0x09)
    time.sleep(0.10)

    mcp23008.write(0x09, 0x01)
    time.sleep(0.10)

    mcp23008.write(0x09, 0x02)
    time.sleep(0.10)

    mcp23008.write(0x09, 0x04)
    time.sleep(0.10)

    mcp23008.write(0x09, 0x08)
    time.sleep(0.10)

    mcp23008.write(0x09, 0x10)
    time.sleep(0.10)

    mcp23008.write(0x09, 0x20)
    time.sleep(0.10)

    mcp23008.write(0x09, 0x40)
    time.sleep(0.10)

    mcp23008.write(0x09, 0x80)
    time.sleep(0.10)

    mcp23008.write(0x09, 0xFF)
    time.sleep(0.25)

    mcp23008.write(0x09, 0x00)
Example #5
0
def test_adc():
    """
    @param None
    @returns None
    @brief Test ADC
    """

    c = get_connection()

    #adc = c.ADC()

    #print adc.read("P9_40")
    #print 'AIN0', adc.read("AIN0") # 0.0
    #print 'AIN1', adc.read("AIN1") # 0.0
    #print 'AIN2', adc.read("AIN2") # 0.0
    #print 'AIN3', adc.read("AIN3") # 0.0
    #print 'AIN4', adc.read("AIN4") # 0.0
    #print 'AIN5', adc.read("AIN5") # 0.0
    #print 'AIN6', adc.read("AIN6") # 0.120555557311
    #print 'AIN7', adc.read("AIN7") # 1682

    ADC_STEP = 1.80 / 4096 # 12-bit resolution -> 2^12

    #print 'AIN0', c.read_adc(0) # 3674
    #print 'AIN1', c.read_adc(1) # 3244
    #print 'AIN2', c.read_adc(2) # 3388
    #print 'AIN3', c.read_adc(3) # 2466
    #print 'AIN4', c.read_adc(4) # PMIC MUX_OUT 757
    #print 'AIN5', c.read_adc(5) # VDD_1V8B 57
    #print 'AIN6', c.read_adc(6) # VDD_2V5B* 2 / 1000.0 # 218
    #print 'AIN7', c.read_adc(7) # VDD_3V3B* 2 / 1000.0 # 1683

    # output from ADC is 0 to 4095 (12-bit) 1.8 VREF
    # mulitply by 0.000439453125 (1.8 / 4096) to get the real voltage as a float
    #PMIC_OUT = c.read_adc(4) * ADC_STEP * 2.0 # /2 voltaage divider
    VDD_1V8B = c.read_adc(5) * ADC_STEP * 2.0 # /2 voltaage divider
    VDD_2V5B = c.read_adc(6) * ADC_STEP * 2.0 # /2 voltaage divider
    VDD_3V3B = c.read_adc(7) * ADC_STEP * 2.0 # /2 voltaage divider

    #print 'PMIC_OUT (AIN4) = {:.2f}'.format(PMIC_OUT)
    print 'VDD_1V8B (AIN5) = {:.2f}'.format(VDD_1V8B)
    print 'VDD_2V5B (AIN6) = {:.2f}'.format(VDD_2V5B)
    print 'VDD_3V3B (AIN7) = {:.2f}'.format(VDD_3V3B)


    #Analog multiplexer selection MUX[2:0]
    #000 ? MUX is disabled, output is HiZ
    #001 ? VBAT
    #010 ? VSYS
    #011 ? VTS
    #100 ? VICHARGE
    #101 ? MUX_IN (external input)
    #110 ? MUX is disabled, output is HiZ
    #111 ? MUX is disabled, output is HiZ
    i2c_address = 0x48
    MUXCTRL = 0x09 # MUX CONTROL REGISTER (MUXCTRL @ 0x09)

    #exposed_i2c_set(self, address, register, data, i2c_bus=0)

    #c.i2c_set(i2c_address, MUXCTRL, 0x00)
    #PMIC_OUT = c.read_adc(4) * ADC_STEP * 2.0 # /2 voltaage divider
    #print 'PMIC_OUT (AIN4) = {:.2f} (MUX is disabled, output is HiZ)'.format(PMIC_OUT)

    c.i2c_set(i2c_address, MUXCTRL, 0x01)
    PMIC_OUT = c.read_adc(4) * ADC_STEP * 3.0 # /3 voltaage divider
    print 'PMIC_OUT (AIN4) = {:.2f} VBAT (Battery Sense Voltage)'.format(PMIC_OUT)

    c.i2c_set(i2c_address, MUXCTRL, 0x02)
    PMIC_OUT = c.read_adc(4) * ADC_STEP * 3.0 # /3 voltaage divider
    print 'PMIC_OUT (AIN4) = {:.2f} VSYS (System Voltage)'.format(PMIC_OUT)

    c.i2c_set(i2c_address, MUXCTRL, 0x03)
    PMIC_OUT = c.read_adc(4) * ADC_STEP #* 2.0 # /2 voltaage divider
    print 'PMIC_OUT (AIN4) = {:.2f} VTS (Thermistor Voltage)'.format(PMIC_OUT)

    c.i2c_set(i2c_address, MUXCTRL, 0x04)
    PMIC_OUT = c.read_adc(4) * ADC_STEP #* 2.0 # /2 voltaage divider
    print 'PMIC_OUT (AIN4) = {:.2f} VICH / VICHARGE (Voltage Proportional to Charge Current)'.format(PMIC_OUT)

    c.i2c_set(i2c_address, MUXCTRL, 0x05)
    PMIC_OUT = c.read_adc(4) * ADC_STEP * 2.0 # /2 voltaage divider / external input = VDD_3V3B / 2
    print 'PMIC_OUT (AIN4) = {:.2f} MUX_IN (external input = VDD_3V3B)'.format(PMIC_OUT)
Example #6
0
 def setUpClass(cls):
     #cls._connection = createExpensiveConnectionObject()
     cls._connection = get_connection()