esp8266_i2c_lcd.py 文件源码

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

项目:uPython-ESP8266-01-umqtt 作者: phieber 项目源码 文件源码
def hal_write_command(self, cmd):
        """Writes a command to the LCD.

        Data is latched on the falling edge of E.
        """
        byte=((self.backlight << SHIFT_BACKLIGHT) |
                (((cmd >> 4) & 0x0f) << SHIFT_DATA))
        self.i2c.writeto(self.i2c_addr, bytes([byte | MASK_E]))
        self.i2c.writeto(self.i2c_addr, bytes([byte]))
        byte=((self.backlight << SHIFT_BACKLIGHT) |
                ((cmd & 0x0f) << SHIFT_DATA))
        self.i2c.writeto(self.i2c_addr, bytes([byte | MASK_E]))
        self.i2c.writeto(self.i2c_addr, bytes([byte]))
        if cmd <= 3:
            # The home and clear commands require a worst
            # case sleep_ms of 4.1 msec
            sleep_ms(5)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号