def Close(): Click.Close()
def WriteReg(reg, data): print "Write Reg [", reg, "] =", data, if Click.WriteI2C(WR_PTR, reg >> 7, reg & 0x7F): if Click.WriteI2C(WR_IND, data, 0): print "OK" return #else print "Fail" # init the Click I2C interface Click.InitI2C() # test the error cmd #Write( WR_ERR, 0, 0) #Read( RD_ERR) #write to CCPR2L reg WriteReg(0x298, 0x5A) #write to DACCON1 reg WriteReg(0x119, 0xA5) # read register CCPR2L back ReadReg(0x298) # read register DACCON1 back ReadReg(0x119) Click.Close()