Skip to main content

Class Ssd130xBase

Represents the SSD130x family of OLED displays

Assembly: Ssd130x.dll
View Source
Declaration
public abstract class Ssd130xBase : IPixelDisplay, IDisplay, ISpiPeripheral, II2cPeripheral, IDisposable

Derived:
Meadow.Foundation.Displays.Ssd1306

Implements:
Meadow.Peripherals.Displays.IPixelDisplay, Meadow.Peripherals.Displays.IDisplay, Meadow.Hardware.ISpiPeripheral, Meadow.Hardware.II2cPeripheral, System.IDisposable

Properties

ColorMode

The currently set color mode for the display

View Source
Declaration
public ColorMode ColorMode { get; }

SupportedColorModes

The Color mode supported by the display

View Source
Declaration
public ColorMode SupportedColorModes { get; }

Width

Width of the display in pixels

View Source
Declaration
public int Width { get; }

Height

Height of the display in pixels

View Source
Declaration
public int Height { get; }

PixelBuffer

Provide a buffer that matches this display's color depth, height, and width This should be the buffer that is sent to the device when Show is called

View Source
Declaration
public IPixelBuffer PixelBuffer { get; }

DefaultSpiBusSpeed

The default SPI bus speed for the device

View Source
Declaration
public Frequency DefaultSpiBusSpeed { get; }

SpiBusSpeed

The SPI bus speed for the device

View Source
Declaration
public Frequency SpiBusSpeed { get; set; }

DefaultI2cAddress

The default I2C address for the peripheral

View Source
Declaration
public byte DefaultI2cAddress { get; }

DefaultSpiBusMode

The default SPI bus mode for the device

View Source
Declaration
public SpiClockConfiguration.Mode DefaultSpiBusMode { get; }

SpiBusMode

The SPI bus mode for the device

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

IsDisposed

Is the object disposed

View Source
Declaration
public bool IsDisposed { get; }

InvertDisplay

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

View Source
Declaration
public bool InvertDisplay { get; set; }

Contrast

Get / Set the contrast of the display

View Source
Declaration
public byte Contrast { get; set; }

Sleep

Put the display to sleep (turns the display off)

View Source
Declaration
public bool Sleep { get; set; }

Oled128x64SetupSequence

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

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

Oled128x32SetupSequence

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

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

Oled72x40SetupSequence

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

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

Oled96x16SetupSequence

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

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

Oled64x48SetupSequence

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

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

Fields

createdPorts

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

View Source
Declaration
protected bool createdPorts

spiComms

SPI Communication bus used to communicate with the peripheral

View Source
Declaration
protected ISpiCommunications? spiComms

dataCommandPort

The data command port

View Source
Declaration
protected IDigitalOutputPort? dataCommandPort

resetPort

The reset port

View Source
Declaration
protected IDigitalOutputPort? resetPort

chipSelectPort

The chip select port

View Source
Declaration
protected IDigitalOutputPort? chipSelectPort

connectionType

The connection type (I2C or SPI)

View Source
Declaration
protected Ssd130xBase.ConnectionType connectionType

Data

Helper bool for the data command port

View Source
Declaration
protected const bool Data = true

Command

Helper bool for the data command port

View Source
Declaration
protected const bool Command = false

PAGE_SIZE

The display page size in bytes

View Source
Declaration
protected const int PAGE_SIZE = 16

i2cComms

I2C Communication bus used to communicate with the peripheral

View Source
Declaration
protected II2cCommunications? i2cComms

imageBuffer

Buffer holding the pixels in the display

View Source
Declaration
protected Buffer1bpp imageBuffer

readBuffer

Read buffer

View Source
Declaration
protected byte[]? readBuffer

commandBuffer

Display command buffer

View Source
Declaration
protected Memory<byte> commandBuffer

pageBuffer

Page buffer to hold one page of data

View Source
Declaration
protected byte[]? pageBuffer

showPreamble

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

View Source
Declaration
protected byte[]? showPreamble

displayType

The Ssd1306 display type used to specify the resolution

View Source
Declaration
protected Ssd130xBase.DisplayType displayType

Methods

SendCommands(Span<byte>)

Send a sequence of commands to the display

View Source
Declaration
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
Declaration
public void Show()

Show(int, int, int, int)

Copy a region of the display buffer to the screen

View Source
Declaration
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
Declaration
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
Declaration
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
Declaration
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
Declaration
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
Declaration
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
Declaration
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
Declaration
public void StopScrolling()

Fill(Color, bool)

Fill the display with a normalized color

View Source
Declaration
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
Declaration
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
Declaration
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.Peripherals.Displays.IPixelBufferdisplayBufferThe buffer to write/copy to the display

Dispose()

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

View Source
Declaration
public void Dispose()

Dispose(bool)

Dispose of the object

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

Implements

  • Meadow.Peripherals.Displays.IPixelDisplay
  • Meadow.Peripherals.Displays.IDisplay
  • Meadow.Hardware.ISpiPeripheral
  • Meadow.Hardware.II2cPeripheral
  • System.IDisposable