예제 #1
0
파일: AsI2c.py 프로젝트: Wailshire/armadeus
 def readRegByte(self, aReg):
     """ Read one byte at aReg register address
     """
     try:
         return wrapper.i2c_read_reg_byte(self.__device, aReg)
     except Exception, e:
         raise AsI2cError(str(e))
예제 #2
0
 def readReg(self, aReg, aNumber):
     """ read a list of bytes at aReg register address
     """
     try:
         rString = wrapper.i2c_read_reg(self.__device, aReg, aNumber)
     except Exception, e:
         raise AsI2cError(str(e))
예제 #3
0
 def getSlaveAddr(self):
     """ Get address of slave
     """
     try:
         return wrapper.i2c_get_slave_addr(self.__device)
     except Exception, e:
         raise AsI2cError(str(e))
예제 #4
0
 def read(self, aNumber):
     """ read aNumber of bytes on i2c bus
     """
     try:
         rString = wrapper.i2c_read(self.__device, aNumber)
     except Exception, e:
         raise AsI2cError(str(e))
예제 #5
0
파일: AsI2c.py 프로젝트: Wailshire/armadeus
 def setSlaveAddr(self, aAddr):
     """ Set address of slave
     """
     try:
         return wrapper.i2c_set_slave_addr(self.__device, aAddr)
     except Exception, e:
         raise AsI2cError(str(e))
예제 #6
0
 def setSlaveAddr(self, aAddr):
     """ Set address of slave
     """
     try:
         return wrapper.i2c_set_slave_addr(self.__device, aAddr)
     except Exception, e:
         raise AsI2cError(str(e))
예제 #7
0
파일: AsI2c.py 프로젝트: Wailshire/armadeus
 def read(self, aNumber):
     """ read aNumber of bytes on i2c bus
     """
     try:
        rString = wrapper.i2c_read(self.__device, aNumber)
     except Exception, e:
         raise AsI2cError(str(e))
예제 #8
0
파일: AsI2c.py 프로젝트: Wailshire/armadeus
 def getSlaveAddr(self):
     """ Get address of slave
     """
     try:
         return wrapper.i2c_get_slave_addr(self.__device)
     except Exception, e:
         raise AsI2cError(str(e))
예제 #9
0
 def writeRegByte(self, aReg, aValue):
     """ write one byte at aReg register address
     """
     try:
         return wrapper.i2c_write_reg_byte(self.__device, aReg, aValue)
     except Exception, e:
         raise AsI2cError(str(e))
예제 #10
0
 def readRegByte(self, aReg):
     """ Read one byte at aReg register address
     """
     try:
         return wrapper.i2c_read_reg_byte(self.__device, aReg)
     except Exception, e:
         raise AsI2cError(str(e))
예제 #11
0
파일: AsI2c.py 프로젝트: Wailshire/armadeus
 def writeRegByte(self, aReg, aValue):
     """ write one byte at aReg register address
     """
     try:
         return wrapper.i2c_write_reg_byte(self.__device, aReg, aValue)
     except Exception, e:
         raise AsI2cError(str(e))
예제 #12
0
파일: AsI2c.py 프로젝트: Wailshire/armadeus
 def readReg(self, aReg, aNumber):
     """ read a list of bytes at aReg register address
     """
     try:
        rString = wrapper.i2c_read_reg(self.__device, aReg, aNumber)
     except Exception, e:
         raise AsI2cError(str(e))
예제 #13
0
파일: AsI2c.py 프로젝트: Wailshire/armadeus
 def writeReg(self, aReg, aList):
     """ write a list of bytes at aReg register address
     """
     aString = ''
     for character in aList:
         aString += chr(character)
     try:
         return wrapper.i2c_write_reg(self.__device, aReg, aString)
     except Exception, e:
         raise AsI2cError(str(e))
예제 #14
0
 def writeReg(self, aReg, aList):
     """ write a list of bytes at aReg register address
     """
     aString = ''
     for character in aList:
         aString += chr(character)
     try:
         return wrapper.i2c_write_reg(self.__device, aReg, aString)
     except Exception, e:
         raise AsI2cError(str(e))
예제 #15
0
 def write(self, aList):
     """ read a list of bytes on i2c bus
     """
     aString = ''
     for character in aList:
         aString += chr(character)
     try:
         return wrapper.i2c_write(self.__device, aString)
     except Exception, e:
         raise AsI2cError(str(e))
예제 #16
0
파일: AsI2c.py 프로젝트: Wailshire/armadeus
 def write(self, aList):
     """ read a list of bytes on i2c bus
     """
     aString = ''
     for character in aList:
         aString += chr(character)
     try:
         return wrapper.i2c_write(self.__device, aString)
     except Exception, e:
         raise AsI2cError(str(e))
예제 #17
0
 def readMsg(self, aWrList, aReadSize):
     """ Write message wrote in aWrList, and read 
         aReadSize of byte after a repeated start
     """
     aWString = ''
     for character in aWrList:
         aWString += chr(character)
     try:
         Rstring = wrapper.i2c_read_msg(self.__device, aWString, aReadSize)
     except Exception, e:
         raise AsI2cError(str(e))
예제 #18
0
파일: AsI2c.py 프로젝트: Wailshire/armadeus
 def readMsg(self, aWrList, aReadSize):
     """ Write message wrote in aWrList, and read 
         aReadSize of byte after a repeated start
     """
     aWString = ''
     for character in aWrList:
         aWString += chr(character)
     try:
         Rstring = wrapper.i2c_read_msg(self.__device, aWString, aReadSize) 
     except Exception, e:
         raise AsI2cError(str(e))
예제 #19
0
 def __del__(self):
     try:
         wrapper.i2c_close(self.__device)
     except Exception, e:
         pass
예제 #20
0
 def __init__(self, aBusNumber):
     try:
         self.__device = wrapper.i2c_open(aBusNumber)
     except Exception, e:
         raise AsI2cError("Can't open i2c bus number "+str(aBusNumber)+\
                             ": "+str(e))
예제 #21
0
 def __del__(self):
     try:
         wrapper.i2c_close(self.__device)
     except Exception, e:
         pass
예제 #22
0
파일: AsI2c.py 프로젝트: Wailshire/armadeus
 def __init__(self, aBusNumber):
     try:
         self.__device = wrapper.i2c_open(aBusNumber)
     except Exception, e:
         raise AsI2cError("Can't open i2c bus number "+str(aBusNumber)+\
                             ": "+str(e))