Performance upgrades to block method.

master
rdagger 1 year ago
parent 1a8e9eeeae
commit 6cf0a50140

@ -3,7 +3,6 @@ from time import sleep
from math import cos, sin, pi, radians from math import cos, sin, pi, radians
from sys import implementation from sys import implementation
from framebuf import FrameBuffer, RGB565 # type: ignore from framebuf import FrameBuffer, RGB565 # type: ignore
import ustruct # type: ignore
def color565(r, g, b): def color565(r, g, b):
@ -169,9 +168,10 @@ class Display(object):
y1 (int): Ending Y position. y1 (int): Ending Y position.
data (bytes): Data buffer to write. data (bytes): Data buffer to write.
""" """
self.write_cmd(self.SET_COLUMN, *ustruct.pack(">HH", x0, x1)) self.write_cmd(self.SET_COLUMN,
self.write_cmd(self.SET_PAGE, *ustruct.pack(">HH", y0, y1)) x0 >> 8, x0 & 0xff, x1 >> 8, x1 & 0xff)
self.write_cmd(self.SET_PAGE,
y0 >> 8, y0 & 0xff, y1 >> 8, y1 & 0xff)
self.write_cmd(self.WRITE_RAM) self.write_cmd(self.WRITE_RAM)
self.write_data(data) self.write_data(data)
@ -995,7 +995,6 @@ class Display(object):
else: else:
self.write_cmd(self.SLPOUT) self.write_cmd(self.SLPOUT)
def write_cmd_mpy(self, command, *args): def write_cmd_mpy(self, command, *args):
"""Write command to OLED (MicroPython). """Write command to OLED (MicroPython).

Loading…
Cancel
Save