25 lines
557 B
Python
25 lines
557 B
Python
from board import SCL, SDA
|
|
from busio import I2C
|
|
from adafruit_ssd1306 import SSD1306_I2C
|
|
|
|
class Graphics:
|
|
OLED_WIDTH = 128
|
|
OLED_HEIGHT = 64
|
|
OLED_ADDR = 0x3C
|
|
LINE_HEIGHT = 9
|
|
MAX_LINES = 7
|
|
|
|
def __init__(self):
|
|
i2c = I2C(SCL, SDA)
|
|
self._display = SSD1306_I2C(
|
|
self.OLED_WIDTH, self.OLED_HEIGHT, i2c, addr = self.OLED_ADDR)
|
|
|
|
def clear(self):
|
|
self._display.fill(0)
|
|
|
|
def text(self, text, x, y, c):
|
|
self._display.text(text, x, y, c)
|
|
|
|
def show(self):
|
|
self._display.show()
|