API Documentation¶
OLED display driver for SSD1306, SSD1325, SSD1331 and SH1106 devices.
Breaking changes¶
Warning
Version 2.0.0 was released on 11 January 2017: this came with a rename of the project in github from ssd1306 to luma.oled to reflect the changing nature of the codebase. It introduces some structural changes to the package structure, namely breaking the library up into smaller components and renaming existing packages.
This should largely be restricted to having to update import statements only. To upgrade any existing code that uses the old package structure:
- rename instances of
oled.device
toluma.oled.device
. - rename any other usages of
oled.*
toluma.core.*
.
This breaking change was necessary to be able to add different classes of devices, so that they could reuse core components.
luma.oled.device
¶
-
class
luma.oled.device.
sh1106
(serial_interface=None, width=128, height=64, rotate=0)[source]¶ Bases:
luma.core.device.device
Encapsulates the serial interface to the monochrome SH1106 OLED display hardware. On creation, an initialization sequence is pumped to the display to properly configure it. Further control commands can then be called to affect the brightness and other settings.
-
class
luma.oled.device.
ssd1306
(serial_interface=None, width=128, height=64, rotate=0)[source]¶ Bases:
luma.core.device.device
Encapsulates the serial interface to the monochrome SSD1306 OLED display hardware. On creation, an initialization sequence is pumped to the display to properly configure it. Further control commands can then be called to affect the brightness and other settings.
-
class
luma.oled.device.
ssd1325
(serial_interface=None, width=128, height=64, rotate=0)[source]¶ Bases:
luma.core.device.device
Encapsulates the serial interface to the 4-bit greyscale SSD1325 OLED display hardware. On creation, an initialization sequence is pumped to the display to properly configure it. Further control commands can then be called to affect the brightness and other settings.
-
class
luma.oled.device.
ssd1331
(serial_interface=None, width=96, height=64, rotate=0)[source]¶ Bases:
luma.core.device.device
Encapsulates the serial interface to the 16-bit color (5-6-5 RGB) SSD1331 OLED display hardware. On creation, an initialization sequence is pumped to the display to properly configure it. Further control commands can then be called to affect the brightness and other settings.
-
contrast
(level)[source]¶ Switches the display contrast to the desired level, in the range 0-255. Note that setting the level to a low (or zero) value will not necessarily dim the display to nearly off. In other words, this method is NOT suitable for fade-in/out animation.
Parameters: level (int) – Desired contrast level in the range of 0-255.
-