最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Micropython OR bitshift operations - Stack Overflow

programmeradmin0浏览0评论

Trying to modify a driver for a load sense amplifier to work in Micropython. I've gotten rid of the smbus calls replacing them with machine.I2C, but am stuck on the drivers bitshifting operations, which produces incompatible type errors in Micropython

  # Mask & set a given bit within a register
    def setBit(self, bitNumber, registerAddress):    # Mask & set a given bit within a register
        value = self.getRegister(registerAddress)
        value |= (1 << bitNumber)    # Set this bit
        return self.setRegister(registerAddress, value)
TypeError: unsupported types for __or__: 'bytes', 'int'

what do I need to do to rework these bitshifting operations so they work in Micropython for my PICO?

发布评论

评论列表(0)

  1. 暂无评论