configuration.py 文件源码

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

项目:pi-topPULSE 作者: pi-top 项目源码 文件源码
def _read_device_state():
    """INTERNAL. Read from the I2C bus to get the current state of the pulse. Caller should handle exceptions"""

    try:
        PTLogger.debug("Connecting to bus...")
        i2c_bus = SMBus(_bus_id)

        current_state = i2c_bus.read_byte(_device_addr) & 0x0F

        return int(current_state)

    except:
        PTLogger.warning("Error: There was a problem reading from the device")
        # Best to re-raise as we can't recover from this
        raise
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号