configuration.py 文件源码

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

项目:pi-topSPEAKER 作者: pi-top 项目源码 文件源码
def _set_write_to_v1_speaker_enabled(address, enable):
    global _I2C_BUS

    if enable:
        PTLogger.info("Enabling write to pi-topSPEAKER (" + str(address) + ")")
    else:
        PTLogger.info("Disabling write to pi-topSPEAKER (" + str(address) + ")")

    try:
        _I2C_BUS = SMBus(_BUS_ID)
        value = 0x01 if enable else 0x00
        _I2C_BUS.write_byte_data(address, _v1_i2c_ce_reg, value)

    except Exception as e:
        PTLogger.info("Failed to write to pi-topSPEAKER: " + str(e))
        return False

    return True
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号