Skip to content

Commit 16d621d

Browse files
committed
Add support for 72x40 SSD1306B
1 parent aba9b4f commit 16d621d

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

adafruit_displayio_ssd1306.py

+19
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
* `Adafruit FeatherWing OLED - 128x32 OLED <https://www.adafruit.com/product/2900>`_
2424
* Monochrome 0.49" 64x32 I2C OLED graphic display
2525
* Monochrome 0.66" 64x48 I2C OLED graphic display (eg https://www.amazon.com/gp/product/B07QF7QK6P)
26+
* Miniature 0.42" OLED 72x40 Display with Resin Lens (https://www.tindie.com/products/questwise-ventures/miniature-042-oled-72x40-display-with-resin-lens/)
2627
* Might work on other sub-128 width display: Dots 72x40, 64x48, 96x16
2728
2829
**Software and Dependencies:**
@@ -91,6 +92,24 @@ def __init__(self, bus: Union[FourWire, I2CDisplayBus], **kwargs) -> None:
9192
row_offset = (
9293
col_offset if (kwargs["height"] != 48 or kwargs["width"] != 64) else 0
9394
) # fix for 0.66" 64x48 OLED
95+
96+
# for 72x40
97+
if kwargs["height"] == 40 and kwargs["width"] == 72:
98+
col_offset = 28
99+
row_offset = 0
100+
101+
# add Internal IREF Setting for the 0.42 OLED as per
102+
# https://github.com/olikraus/u8g2/issues/1047 and
103+
# SSD1306B rev 1.1 datasheet at
104+
# https://www.buydisplay.com/download/ic/SSD1306.pdf
105+
seq_length = len(init_sequence) - 2
106+
init_sequence[seq_length:seq_length] = bytearray(b"\xad\x01\x30")
107+
108+
if "rotation" in kwargs and kwargs["rotation"] % 180 != 0:
109+
init_sequence[16] = kwargs["height"] - 1
110+
kwargs["height"] = height
111+
kwargs["width"] = width
112+
94113
super().__init__(
95114
bus,
96115
init_sequence,

0 commit comments

Comments
 (0)