Commit 02afc0d2 authored by Damien George's avatar Damien George

drivers/display/ssd1306.py: Change to use new i2c.writevto() method.

Fixes issue #3482.
parent b10d0664
......@@ -96,6 +96,7 @@ class SSD1306_I2C(SSD1306):
self.i2c = i2c
self.addr = addr
self.temp = bytearray(2)
self.write_list = [b'\x40', None] # Co=0, D/C#=1
super().__init__(width, height, external_vcc)
def write_cmd(self, cmd):
......@@ -104,12 +105,8 @@ class SSD1306_I2C(SSD1306):
self.i2c.writeto(self.addr, self.temp)
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()
self.write_list[1] = buf
self.i2c.writevto(self.addr, self.write_list)
class SSD1306_SPI(SSD1306):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment