Class SSD1306

java.lang.Object
com.diozero.devices.oled.SsdOled
com.diozero.devices.oled.SSD1306
All Implemented Interfaces:
DeviceInterface, AutoCloseable

public class SSD1306
extends SsdOled

128x64 Dot Matrix OLED/PLED Segment/Common Driver (128 segments and 64 commons).
Segment = column (x), Common = row (y)

The size of the RAM is 128 x 64 bits (1024 bytes) and the RAM is divided into eight pages, from PAGE0 to PAGE7, which are used for monochrome 128x64 dot matrix display. Each page is 128 bytes.

        COM   Page   COM (Row re-mapping)
        0-7    0    63-56
        8-15   1    55-48
       16-23   2    47-40
       24-31   3    39-32
       32-39   4    31-24
       40-47   5    23-16
       48-55   6    15-8
       56-63   7     7-0
 Segment   0 ..... 127
 Segment 127 ..... 0   (Column re-mapping)
 

A byte of data in GDDRAM represents values for all rows of the current column and page.

Enlargement of GDDRAM for Page 2 (No row re-mapping and column-remapping): Each + represents one bit of image data.

                       1 1 1 1 1 
        <- Segment ->  2 2 2 2 2
     D 0 1 2 3 4 5 ... 3 4 5 6 7 COM
 LSB 0 + + + + + + + + + + + + + 16
     1 + + + + + + + + + + + + + 17
     2 + + + + + + + + + + + + + 18
     3 + + + + + + + + + + + + + 19
     4 + + + + + + + + + + + + + 20
     5 + + + + + + + + + + + + + 21
     6 + + + + + + + + + + + + + 22
 MSB 7 + + + + + + + + + + + + + 23
 

Wiring

 GND .... Ground
 Vcc .... 3v3
 D0  .... SCLK (SPI)
 D1  .... MOSI (SPI)
 RES .... Reset (GPIO) [27]
 DC  .... Data/Command Select (GPIO) [22]
 CS  .... Chip Select (SPI)
 

Links

  • Field Details

  • Constructor Details

  • Method Details

    • init

      protected void init()
      Specified by:
      init in class SsdOled
    • goTo

      protected void goTo​(int x, int y)
      Specified by:
      goTo in class SsdOled
    • home

      protected void home()
      Specified by:
      home in class SsdOled
    • display

      public void display​(BufferedImage image)
      Specified by:
      display in class SsdOled
    • display

      public void display​(BufferedImage image, int threshold)
    • setPixel

      public void setPixel​(int x, int y, boolean on)
    • setContrast

      public void setContrast​(byte contrast)
      Sets the display contract. Apparently not really working.
      Parameters:
      contrast - Contrast
    • invertDisplay

      public void invertDisplay​(boolean invert)
      Sets if the display should be inverted
      Specified by:
      invertDisplay in class SsdOled
      Parameters:
      invert - Invert state