Skip to content

Commit 57d3299

Browse files
authored
Add support for 0.49" inch 64x32 I2C
Tested on "OLED 0.49 Shield V1.0.0 for LOLIN (WEMOS) D1 mini D32 0.49" inch 64x32 IIC I2C" Based on the issue #20 and all the work from @adamcandy on the non DisplayIO library: https://github.com/adafruit/Adafruit_CircuitPython_SSD1306
1 parent 2bb23d9 commit 57d3299

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

adafruit_displayio_ssd1306.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
* `Monochrome 0.96" 128x64 OLED graphic display <https://www.adafruit.com/product/326>`_
2222
* `Monochrome 128x32 SPI OLED graphic display <https://www.adafruit.com/product/661>`_
2323
* `Adafruit FeatherWing OLED - 128x32 OLED <https://www.adafruit.com/product/2900>`_
24+
* Monochrome 0.49" 64x32 I2C OLED graphic display
25+
* Might work on other sub-128 width display: Dots 72x40, 64x48, 96x16
2426
2527
**Software and Dependencies:**
2628
@@ -73,15 +75,22 @@ def __init__(
7375
# Patch the init sequence for 32 pixel high displays.
7476
init_sequence = bytearray(_INIT_SEQUENCE)
7577
height = kwargs["height"]
78+
width = kwargs["width"]
7679
if "rotation" in kwargs and kwargs["rotation"] % 180 != 0:
7780
height = kwargs["width"]
81+
width = kwargs["height"]
7882
init_sequence[16] = height - 1 # patch mux ratio
79-
if kwargs["height"] == 32:
83+
if height == 32 and width == 64: # FIX ME
84+
init_sequence[16] = 64 - 1 # FORCED for 64x32 because it fail with formula
85+
if (height == 32 or height == 16) and (width != 64):
8086
init_sequence[25] = 0x02 # patch com configuration
87+
col_offset = 0 if width == 128 else (128 - width) // 2 # https://github.com/micropython/micropython/pull/7411
8188
super().__init__(
8289
bus,
8390
init_sequence,
8491
**kwargs,
92+
colstart=col_offset,
93+
rowstart=col_offset,
8594
color_depth=1,
8695
grayscale=True,
8796
pixels_in_byte_share_row=False,

0 commit comments

Comments
 (0)