例如原来ssd1306 OLED驱动中:写入数据的用法:
- def write_data(self, buf):
- self.temp[0] = self.addr << 1
- self.temp[1] = 0x40 # Co=0, D/C#=1
- self.i2c.start()
- self.i2c.write(self.temp)
- self.i2c.write(buf)
- self.i2c.stop()
现在变为:
- def write_data(self, buf):
- self.write_list[1] = buf
- self.i2c.writevto(self.addr, self.write_list)