Skip to main content

Class Ssd130xBase

Represents the SSD130x family of OLED displays

Assembly: Ssd130x.dll
View Source
public abstract class Ssd130xBase : IGraphicsDisplay, ISpiPeripheral, II2cPeripheral, IDisposable

Derived:
Meadow.Foundation.Displays.Ssd1306

Implements:
Meadow.Foundation.Graphics.IGraphicsDisplay, Meadow.Hardware.ISpiPeripheral, Meadow.Hardware.II2cPeripheral, System.IDisposable

Properties

ColorMode

The display color mode

View Source
public ColorMode ColorMode { get; }

SupportedColorModes

The Color mode supported by the display

View Source
public ColorMode SupportedColorModes { get; }

Width

The width of the display in pixels

View Source
public int Width { get; }

Height

The height of the display in pixels

View Source
public int Height { get; }

PixelBuffer

The buffer the holds the pixel data for the display

View Source
public IPixelBuffer PixelBuffer { get; }

DefaultSpiBusSpeed

The default SPI bus speed for the device

View Source
public Frequency DefaultSpiBusSpeed { get; }

SpiBusSpeed

The SPI bus speed for the device

View Source
public Frequency SpiBusSpeed { get; set; }

DefaultI2cAddress

The default I2C address for the peripheral

View Source
public byte DefaultI2cAddress { get; }

DefaultSpiBusMode

The default SPI bus mode for the device

View Source
public SpiClockConfiguration.Mode DefaultSpiBusMode { get; }

SpiBusMode

The SPI bus mode for the device

View Source
public SpiClockConfiguration.Mode SpiBusMode { get; set; }

IsDisposed

Is the object disposed

View Source
public bool IsDisposed { get; }

InvertDisplay

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

View Source
public bool InvertDisplay { get; set; }

Contrast

Get / Set the contrast of the display

View Source
public byte Contrast { get; set; }

Sleep

Put the display to sleep (turns the display off)

View Source
public bool Sleep { get; set; }

Oled128x64SetupSequence

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

View Source
protected Span<byte> Oled128x64SetupSequence { get; }

Oled128x32SetupSequence

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

View Source
protected Span<byte> Oled128x32SetupSequence { get; }

Oled72x40SetupSequence

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

View Source
protected Span<byte> Oled72x40SetupSequence { get; }

Oled96x16SetupSequence

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

View Source
protected Span<byte> Oled96x16SetupSequence { get; }

Oled64x48SetupSequence

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

View Source
protected Span<byte> Oled64x48SetupSequence { get; }

Fields

createdPorts

Did we create the port(s) used by the peripheral

View Source
protected bool createdPorts

spiComms

SPI Communication bus used to communicate with the peripheral

View Source
protected ISpiCommunications? spiComms

dataCommandPort

The data command port

View Source
protected IDigitalOutputPort? dataCommandPort

resetPort

The reset port

View Source
protected IDigitalOutputPort? resetPort

chipSelectPort

The chip select port

View Source
protected IDigitalOutputPort? chipSelectPort

connectionType

The connection type (I2C or SPI)

View Source
protected Ssd130xBase.ConnectionType connectionType

Data

Helper bool for the data command port

View Source
protected const bool Data = true

Command

Helper bool for the data command port

View Source
protected const bool Command = false

PAGE_SIZE

The display page size in bytes

View Source
protected const int PAGE_SIZE = 16

i2cComms

I2C Communication bus used to communicate with the peripheral

View Source
protected II2cCommunications? i2cComms

imageBuffer

Buffer holding the pixels in the display

View Source
protected Buffer1bpp imageBuffer

readBuffer

Read buffer

View Source
protected byte[]? readBuffer

commandBuffer

Display command buffer

View Source
protected Memory<byte> commandBuffer

pageBuffer

Page buffer to hold one page of data

View Source
protected byte[]? pageBuffer

showPreamble

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

View Source
protected byte[]? showPreamble

displayType

The Ssd1306 display type used to specify the resolution

View Source
protected Ssd130xBase.DisplayType displayType

Methods

SendCommands(Span<byte>)

Send a sequence of commands to the display

View Source
protected void SendCommands(Span<byte> commands)
Parameters
TypeNameDescription
System.Span<System.Byte>commandsList of commands to send

Show()

Send the internal pixel buffer to display

View Source
public void Show()

Show(int, int, int, int)

Copy a region of the display buffer to the screen

View Source
public void Show(int left, int top, int right, int bottom)
Parameters
TypeNameDescription
System.Int32leftThe left position in pixels
System.Int32topThe top position in pixels
System.Int32rightThe right position in pixels
System.Int32bottomThe bottom position in pixels

Clear(bool)

Clear the display buffer

View Source
public void Clear(bool updateDisplay = false)
Parameters
TypeNameDescription
System.BooleanupdateDisplayImmediately update the display when true

DrawPixel(int, int, Color)

Draw pixel at a location

View Source
public void DrawPixel(int x, int y, Color color)
Parameters
TypeNameDescription
System.Int32xx location in pixels
System.Int32yy location in pixels
Meadow.ColorcolorBlack - pixel off, any color - turn on pixel

DrawPixel(int, int, bool)

Draw pixel at a location

View Source
public void DrawPixel(int x, int y, bool enabled)
Parameters
TypeNameDescription
System.Int32xx location in pixels
System.Int32yy location in pixels
System.BooleanenabledTrue = turn on pixel, false = turn off pixel

InvertPixel(int, int)

Invert a pixel at a location

View Source
public void InvertPixel(int x, int y)
Parameters
TypeNameDescription
System.Int32xAbscissa of the pixel to the set / reset
System.Int32yOrdinate of the pixel to the set / reset

StartScrolling(ScrollDirection)

Start the display scrolling in the specified direction

View Source
public void StartScrolling(Ssd130xBase.ScrollDirection direction)
Parameters
TypeNameDescription
Meadow.Foundation.Displays.Ssd130xBase.ScrollDirectiondirectionDirection that the display should scroll

StartScrolling(ScrollDirection, byte, byte)

Start the display scrolling

View Source
public void StartScrolling(Ssd130xBase.ScrollDirection direction, byte startPage, byte endPage)
Parameters
TypeNameDescription
Meadow.Foundation.Displays.Ssd130xBase.ScrollDirectiondirectionDirection that the display should scroll
System.BytestartPageStart page for the scroll
System.ByteendPageEnd page for the scroll

StopScrolling()

Turn off scrolling

View Source
public void StopScrolling()

Fill(Color, bool)

Fill the display with a normalized color

View Source
public virtual void Fill(Color color, bool updateDisplay = false)
Parameters
TypeNameDescription
Meadow.ColorcolorThe color used to fill the display, will normalize to black/off or white/on
System.BooleanupdateDisplayIf true, update the display, if false, only update the off-screen buffer

Fill(int, int, int, int, Color)

Fill the display with a normalized color

View Source
public virtual void Fill(int x, int y, int width, int height, Color color)
Parameters
TypeNameDescription
System.Int32xThe start x position in pixels
System.Int32yThe start y position in pixels
System.Int32widthThe width to fill in pixels
System.Int32heightThe height to fill in pixels
Meadow.ColorcolorThe color, will normalize to black/off or white/on

WriteBuffer(int, int, IPixelBuffer)

Write a buffer to the display

View Source
public virtual void WriteBuffer(int x, int y, IPixelBuffer displayBuffer)
Parameters
TypeNameDescription
System.Int32xThe x start position in pixels
System.Int32yThe y start position in pixels
Meadow.Foundation.Graphics.Buffers.IPixelBufferdisplayBufferThe buffer to write/copy to the display

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

View Source
public void Dispose()

Dispose(bool)

Dispose of the object

View Source
protected virtual void Dispose(bool disposing)
Parameters
TypeNameDescription
System.BooleandisposingIs disposing

Implements