Skip to content

Fix compatibility with MicroPython #78

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion adafruit_ssd1306.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,16 @@
from adafruit_bus_device import i2c_device, spi_device

try:
# MicroPython framebuf import
import framebuf

_FRAMEBUF_FORMAT = framebuf.MONO_VLSB
except ImportError:
# CircuitPython framebuf import
import adafruit_framebuf as framebuf

_FRAMEBUF_FORMAT = framebuf.MVLSB

try:
# Used only for typing
from typing import Optional
Expand Down Expand Up @@ -67,7 +73,7 @@ def __init__(
reset: Optional[digitalio.DigitalInOut],
page_addressing: bool
):
super().__init__(buffer, width, height)
super().__init__(buffer, width, height, _FRAMEBUF_FORMAT)
self.width = width
self.height = height
self.external_vcc = external_vcc
Expand Down