pijuice.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:PiJuice 作者: PiSupply 项目源码 文件源码
def __init__(self, bus=1, address=0x14):
        """Create a new PiJuice instance.  Bus is an optional parameter that
        specifies the I2C bus number to use, for example 1 would use device
        /dev/i2c-1.  If bus is not specified then the open function should be
        called to open the bus.
        """
        I2C_SLAVE             = 0x0703  # Use this slave address
        I2C_SLAVE_FORCE       = 0x0706  # Use this slave address, even if
                                # is already in use by a driver!
        I2C_PEC               = 0x0708  # != 0 to use PEC with SMBus

        self.i2cbus=SMBus(bus)
        self.addr=address
        #self._device = open('/dev/i2c-{0}'.format(bus), 'r+b', buffering=0)
        #ioctl(self._device.fileno(), I2C_SLAVE_FORCE, self.addr & 0x7F)
        self.t = None
        self.comError = False
        self.errTime = 0
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号