This repository has been archived on 2022-12-29. You can view files and clone it, but cannot push or open issues or pull requests.
zeropod/graphics.py

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()