Characteristic | Locus |
---|---|
Inheritance | object > Ssd130xBase > Ssd1306 |
Implements | IGraphicsDisplay ISpiPeripheral II2cPeripheral IDisposable |
Inherited Members | object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString() |
Namespace | Meadow.Foundation.Displays |
Assembly | Ssd130x.dll |
Syntax
public abstract class Ssd130xBase : IGraphicsDisplay, ISpiPeripheral, II2cPeripheral, IDisposable
Fields
Command
Helper bool for the data command port
Declaration
protected const bool Command = false
Field Value
Type | Description |
---|---|
bool |
Data
Helper bool for the data command port
Declaration
protected const bool Data = true
Field Value
Type | Description |
---|---|
bool |
PAGE_SIZE
The display page size in bytes
Declaration
protected const int PAGE_SIZE = 16
Field Value
Type | Description |
---|---|
int |
chipSelectPort
The chip select port
Declaration
protected IDigitalOutputPort? chipSelectPort
Field Value
Type | Description |
---|---|
IDigitalOutputPort |
commandBuffer
Display command buffer
Declaration
protected Memory<byte> commandBuffer
Field Value
Type | Description |
---|---|
Memory<byte> |
connectionType
The connection type (I2C or SPI)
Declaration
protected Ssd130xBase.ConnectionType connectionType
Field Value
Type | Description |
---|---|
Ssd130xBase.ConnectionType |
createdPorts
Did we create the port(s) used by the peripheral
Declaration
protected bool createdPorts
Field Value
Type | Description |
---|---|
bool |
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 |
i2cComms
I2C Communication bus used to communicate with the peripheral
Declaration
protected II2cCommunications? i2cComms
Field Value
Type | Description |
---|---|
II2cCommunications |
imageBuffer
Buffer holding the pixels in the display
Declaration
protected Buffer1bpp imageBuffer
Field Value
Type | Description |
---|---|
Buffer1bpp |
pageBuffer
Page buffer to hold one page of data
Declaration
protected byte[]? pageBuffer
Field Value
Type | Description |
---|---|
byte[] |
readBuffer
Read buffer
Declaration
protected byte[]? readBuffer
Field Value
Type | Description |
---|---|
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 |
---|---|
byte[] |
spiComms
SPI Communication bus used to communicate with the peripheral
Declaration
protected ISpiCommunications? spiComms
Field Value
Type | Description |
---|---|
ISpiCommunications |
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 |
---|---|
byte |
DefaultI2cAddress
The default I2C address for the peripheral
Declaration
public byte DefaultI2cAddress { get; }
Property Value
Type | Description |
---|---|
byte |
DefaultSpiBusMode
The default SPI bus mode for the device
Declaration
public SpiClockConfiguration.Mode DefaultSpiBusMode { get; }
Property Value
Type | Description |
---|---|
SpiClockConfiguration.Mode |
DefaultSpiBusSpeed
The default SPI bus speed for the device
Declaration
public Frequency DefaultSpiBusSpeed { get; }
Property Value
Type | Description |
---|---|
Frequency |
Height
The height of the display in pixels
Declaration
public int Height { get; }
Property Value
Type | Description |
---|---|
int |
InvertDisplay
Invert the entire display (true) or return to normal mode (false)
Declaration
public bool InvertDisplay { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
See section 10.1.10 in the datasheet.
IsDisposed
Is the object disposed
Declaration
public bool IsDisposed { get; }
Property Value
Type | Description |
---|---|
bool |
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<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<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<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<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<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 |
---|---|
bool |
SpiBusMode
The SPI bus mode for the device
Declaration
public SpiClockConfiguration.Mode SpiBusMode { get; set; }
Property Value
Type | Description |
---|---|
SpiClockConfiguration.Mode |
SpiBusSpeed
The SPI bus speed for the device
Declaration
public Frequency SpiBusSpeed { get; set; }
Property Value
Type | Description |
---|---|
Frequency |
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 |
---|---|
int |
Methods
Clear(bool)
Clear the display buffer
Declaration
public void Clear(bool updateDisplay = false)
Parameters
Type | Name | Description |
---|---|---|
bool | updateDisplay | Immediately update the display when true |
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
Dispose(bool)
Dispose of the object
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing | Is disposing |
DrawPixel(int, int, Color)
Draw pixel at a location
Declaration
public void DrawPixel(int x, int y, Color color)
Parameters
Type | Name | Description |
---|---|---|
int | x | x location in pixels |
int | y | y location in pixels |
Color | color | Black - pixel off, any color - turn on pixel |
DrawPixel(int, int, bool)
Draw pixel at a location
Declaration
public void DrawPixel(int x, int y, bool enabled)
Parameters
Type | Name | Description |
---|---|---|
int | x | x location in pixels |
int | y | y location in pixels |
bool | enabled | True = turn on pixel, false = turn off pixel |
Fill(Color, bool)
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 |
bool | updateDisplay | If 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
Declaration
public virtual void Fill(int x, int y, int width, int height, Color color)
Parameters
Type | Name | Description |
---|---|---|
int | x | The start x position in pixels |
int | y | The start y position in pixels |
int | width | The width to fill in pixels |
int | height | The height to fill in pixels |
Color | color | The color, will normalize to black/off or white/on |
InvertPixel(int, int)
Invert a pixel at a location
Declaration
public void InvertPixel(int x, int y)
Parameters
Type | Name | Description |
---|---|---|
int | x | Abscissa of the pixel to the set / reset |
int | 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<byte> | commands | List of commands to send |
Show()
Send the internal pixel buffer to display
Declaration
public void Show()
Show(int, int, int, int)
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 |
---|---|---|
int | left | The left position in pixels |
int | top | The top position in pixels |
int | right | The right position in pixels |
int | bottom | The bottom position in pixels |
StartScrolling(ScrollDirection)
Start the display scrolling 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(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 |
byte | startPage | Start page for the scroll |
byte | endPage | End page 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(int, int, IPixelBuffer)
Write a buffer to the display
Declaration
public virtual void WriteBuffer(int x, int y, IPixelBuffer displayBuffer)
Parameters
Type | Name | Description |
---|---|---|
int | x | The x start position in pixels |
int | y | The y start position in pixels |
IPixelBuffer | displayBuffer | The buffer to write/copy to the display |