Characteristic Locus
Inheritance System.Object > Ssd130xBase > Ssd1306
Namespace Meadow.Foundation.Displays
Assembly Ssd130x.dll

Syntax

public abstract class Ssd130xBase : IGraphicsDisplay

Fields

chipSelectPort

The chip select port

Declaration
protected IDigitalOutputPort chipSelectPort

Field Value

Type Description
IDigitalOutputPort

Command

Helper bool for the data command port

Declaration
protected const bool Command = null

Field Value

Type Description
System.Boolean

commandBuffer

Display command buffer

Declaration
protected Memory<byte> commandBuffer

Field Value

Type Description
Memory<System.Byte>

connectionType

The connection type (I2C or SPI)

Declaration
protected Ssd130xBase.ConnectionType connectionType

Field Value

Type Description
Ssd130xBase.ConnectionType

Data

Helper bool for the data command port

Declaration
protected const bool Data = null

Field Value

Type Description
System.Boolean

dataCommandPort

The data command port

Declaration
protected IDigitalOutputPort dataCommandPort

Field Value

Type Description
IDigitalOutputPort

displayType

The Ssd1306 display type used to specify the resolution

Declaration
protected Ssd130xBase.DisplayType displayType

Field Value

Type Description
Ssd130xBase.DisplayType

i2cPeripheral

SSD1306 I2C display

Declaration
protected II2cPeripheral i2cPeripheral

Field Value

Type Description
II2cPeripheral

imageBuffer

Buffer holding the pixels in the display

Declaration
protected Buffer1bpp imageBuffer

Field Value

Type Description
Buffer1bpp

PAGE_SIZE

The display page size in bytes

Declaration
protected const int PAGE_SIZE = null

Field Value

Type Description
System.Int32

pageBuffer

Page buffer to hold one page of data

Declaration
protected byte[] pageBuffer

Field Value

Type Description
System.Byte[]

readBuffer

Read buffer

Declaration
protected byte[] readBuffer

Field Value

Type Description
System.Byte[]

resetPort

The reset port

Declaration
protected IDigitalOutputPort resetPort

Field Value

Type Description
IDigitalOutputPort

showPreamble

Sequence of command bytes that must be sent to the display before

Declaration
protected byte[] showPreamble

Field Value

Type Description
System.Byte[]

spiPeripheral

SSD1306 SPI display

Declaration
protected ISpiPeripheral spiPeripheral

Field Value

Type Description
ISpiPeripheral

Properties

ColorMode

The display color mode

Declaration
public ColorMode ColorMode { get; }

Property Value

Type Description
ColorMode

Contrast

Get / Set the contrast of the display

Declaration
public byte Contrast { get; set; }

Property Value

Type Description
System.Byte

Height

The height of the display in pixels

Declaration
public int Height { get; }

Property Value

Type Description
System.Int32

InvertDisplay

Invert the entire display (true) or return to normal mode (false)

Declaration
public bool InvertDisplay { get; set; }

Property Value

Type Description
System.Boolean

Remarks

See section 10.1.10 in the datasheet.

Oled128x32SetupSequence

Sequence of bytes that should be sent to a 128x32 OLED display to setup the device.

Declaration
protected Span<byte> Oled128x32SetupSequence { get; }

Property Value

Type Description
Span<System.Byte>

Oled128x64SetupSequence

Sequence of bytes that should be sent to a 128x64 OLED display to setup the device.

Declaration
protected Span<byte> Oled128x64SetupSequence { get; }

Property Value

Type Description
Span<System.Byte>

Oled64x48SetupSequence

Sequence of bytes that should be sent to a 64x48 OLED display to setup the device.

Declaration
protected Span<byte> Oled64x48SetupSequence { get; }

Property Value

Type Description
Span<System.Byte>

Oled72x40SetupSequence

Sequence of bytes that should be sent to a 72x40 OLED display to setup the device.

Declaration
protected Span<byte> Oled72x40SetupSequence { get; }

Property Value

Type Description
Span<System.Byte>

Oled96x16SetupSequence

Sequence of bytes that should be sent to a 96x16 OLED display to setup the device.

Declaration
protected Span<byte> Oled96x16SetupSequence { get; }

Property Value

Type Description
Span<System.Byte>

PixelBuffer

The buffer the holds the pixel data for the display

Declaration
public IPixelBuffer PixelBuffer { get; }

Property Value

Type Description
IPixelBuffer

Sleep

Put the display to sleep (turns the display off)

Declaration
public bool Sleep { get; set; }

Property Value

Type Description
System.Boolean

SupportedColorModes

The Color mode supported by the display

Declaration
public ColorMode SupportedColorModes { get; }

Property Value

Type Description
ColorMode

Width

The width of the display in pixels

Declaration
public int Width { get; }

Property Value

Type Description
System.Int32

Methods

Clear(Boolean)

Clear the display buffer

Declaration
public void Clear(bool updateDisplay = false)

Parameters

Type Name Description
System.Boolean updateDisplay

Immediately update the display when true

DrawPixel(Int32, Int32, Color)

Draw pixel at a location

Declaration
public void DrawPixel(int x, int y, Color color)

Parameters

Type Name Description
System.Int32 x

x location in pixels

System.Int32 y

y location in pixels

Color color

Black - pixel off, any color - turn on pixel

DrawPixel(Int32, Int32, Boolean)

Draw pixel at a location

Declaration
public void DrawPixel(int x, int y, bool enabled)

Parameters

Type Name Description
System.Int32 x

x location in pixels

System.Int32 y

y location in pixels

System.Boolean enabled

True = turn on pixel, false = turn off pixel

Fill(Color, Boolean)

Fill the display with a normalized color

Declaration
public virtual void Fill(Color color, bool updateDisplay = false)

Parameters

Type Name Description
Color color

The color used to fill the display, will normalize to black/off or white/on

System.Boolean updateDisplay

If true, update the display, if false, only update the offscreen buffer

Fill(Int32, Int32, Int32, Int32, Color)

Fill the display with a normalized color

Declaration
public virtual void Fill(int x, int y, int width, int height, Color color)

Parameters

Type Name Description
System.Int32 x

The start x position in pixels

System.Int32 y

The start y position in pixels

System.Int32 width

The width to fill in pixels

System.Int32 height

The height to fill in pixels

Color color

The color, will normalize to black/off or white/on

InvertPixel(Int32, Int32)

Invert a pixel at a location

Declaration
public void InvertPixel(int x, int y)

Parameters

Type Name Description
System.Int32 x

Abscissa of the pixel to the set / reset

System.Int32 y

Ordinate of the pixel to the set / reset

SendCommands(Span<Byte>)

Send a sequence of commands to the display

Declaration
protected void SendCommands(Span<byte> commands)

Parameters

Type Name Description
Span<System.Byte> commands

List of commands to send

Show()

Send the internal pixel buffer to display

Declaration
public void Show()

Show(Int32, Int32, Int32, Int32)

Copy a region of the display buffer to the screen

Declaration
public void Show(int left, int top, int right, int bottom)

Parameters

Type Name Description
System.Int32 left

The left position in pixels

System.Int32 top

The top position in pixels

System.Int32 right

The right position in pixels

System.Int32 bottom

The bottom position in pixels

StartScrolling(Ssd130xBase.ScrollDirection)

Start the display scrollling in the specified direction

Declaration
public void StartScrolling(Ssd130xBase.ScrollDirection direction)

Parameters

Type Name Description
Ssd130xBase.ScrollDirection direction

Direction that the display should scroll

StartScrolling(Ssd130xBase.ScrollDirection, Byte, Byte)

Start the display scrolling

Declaration
public void StartScrolling(Ssd130xBase.ScrollDirection direction, byte startPage, byte endPage)

Parameters

Type Name Description
Ssd130xBase.ScrollDirection direction

Direction that the display should scroll

System.Byte startPage

Start page for the scroll

System.Byte endPage

End oage for the scroll

Remarks

In most cases setting startPage to 0x00 and endPage to 0xff will achieve an acceptable scrolling effect.

StopScrolling()

Turn off scrolling

Declaration
public void StopScrolling()

Remarks

Datasheet states that scrolling must be turned off before changing the scroll direction in order to prevent RAM corruption.

WriteBuffer(Int32, Int32, IPixelBuffer)

Write a buffer to the display

Declaration
public virtual void WriteBuffer(int x, int y, IPixelBuffer displayBuffer)

Parameters

Type Name Description
System.Int32 x

The x start position in pixels

System.Int32 y

The y start position in pixels

IPixelBuffer displayBuffer

The buffer to write/copy to the display