Skip to content

Commit

Permalink
Merge pull request #78 from tekktrik/dev/fix-mp-compat
Browse files Browse the repository at this point in the history
Fix compatibility with MicroPython
  • Loading branch information
tekktrik authored Oct 9, 2022
2 parents 82d48a8 + 7bef697 commit 70fd5fd
Showing 1 changed file with 7 additions and 1 deletion.
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

0 comments on commit 70fd5fd

Please sign in to comment.