Class Sh110x
Provide an interface to the Sh110x family of displays
Assembly: Sh110x.dll
View Source
public abstract class Sh110x : IGraphicsDisplay, ISpiPeripheral, II2cPeripheral, IDisposable
Derived:
Meadow.Foundation.Displays.Sh1106, Meadow.Foundation.Displays.Sh1107
Implements:
Meadow.Foundation.Graphics.IGraphicsDisplay, Meadow.Hardware.ISpiPeripheral
, Meadow.Hardware.II2cPeripheral
, System.IDisposable
Properties
ColorMode
The display color mode - 1 bit per pixel monochrome
View Source
public ColorMode ColorMode { get; }
SupportedColorModes
The Color mode supported by the display
View Source
public ColorMode SupportedColorModes { get; }
Width
The display width in pixels
View Source
public int Width { get; protected set; }
Height
The display height in pixels
View Source
public int Height { get; protected set; }
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; }
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; }
DefaultI2cAddress
The default I2C address for the peripheral
View Source
public byte DefaultI2cAddress { get; }
PixelBuffer
The buffer the holds the pixel data for the display
View Source
public IPixelBuffer PixelBuffer { get; }
IsDisposed
Is the object disposed
View Source
public bool IsDisposed { get; }
Fields
connectionType
The connection type (I2C or SPI)
View Source
protected Sh110x.ConnectionType connectionType
i2cComms
I2C Communication bus used to communicate with the peripheral
View Source
protected readonly II2cCommunications? i2cComms
spiComms
SPI Communication bus used to communicate with the peripheral
View Source
protected ISpiCommunications? spiComms
commandBuffer
Display command buffer
View Source
protected Memory<byte> commandBuffer
Methods
SetDisplayOffsets(byte, byte)
This varies between manufacturers If the display is misaligned horizontally, try offset values like 0x00, 0x20, 0x40, etc. If the display is misaligned vertically, try offset values like 0x00, 0x20, 0x40, etc.
View Source
public abstract void SetDisplayOffsets(byte startLine = 0, byte offset = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | startLine | Line number in display RAM to display at the top of the screen |
System.Byte | offset | Column number in display RAM to offset the screen |
SetDisplayOffset(byte)
This varies between manufacturers If the display is misaligned horizontally, try offset values like 0x00, 0x20, 0x40, etc.
View Source
public void SetDisplayOffset(byte offset = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | offset | Column number in display RAM to offset the screen |
InvertDisplay(bool)
Invert the entire display (true) or return to normal mode (false)
View Source
public void InvertDisplay(bool invert)
Parameters
Type | Name |
---|---|
System.Boolean | invert |
PowerSaveMode()
Set display into power saving mode
View Source
public void PowerSaveMode()
Reset()
Reset for SPI displays
View Source
protected void Reset()
Initialize()
Initialize the display
View Source
protected abstract void Initialize()
SetContrast(byte)
Set the display contrast
View Source
public void SetContrast(byte contrast)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | contrast | The contrast value (0-255) |
Show()
Send the internal pixel buffer to display
View Source
public void Show()
Show(int, int, int, int)
Update a region of the display from the offscreen buffer.
View Source
public void Show(int left, int top, int right, int bottom)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | left | Left bounds in pixels (Currently ignored) |
System.Int32 | top | Top bounds in pixels |
System.Int32 | right | Right bounds in pixels (Currently ignored) |
System.Int32 | bottom | Bottom bounds in pixels |
Clear(bool)
Clear the display buffer
View Source
public void Clear(bool updateDisplay = false)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | updateDisplay | Immediately 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
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 |
Meadow.Color | color | Any color = turn on pixel, black = turn off pixel |
DrawPixel(int, int, bool)
Draw pixel at a location
View Source
public void DrawPixel(int x, int y, bool enabled)
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 |
System.Boolean | enabled | True = 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
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 |
StartScrolling(ScrollDirection)
Start the display scrolling in the specified direction.
View Source
public void StartScrolling(Sh110x.ScrollDirection direction)
Parameters
Type | Name | Description |
---|---|---|
Meadow.Foundation.Displays.Sh110x.ScrollDirection | direction | Direction that the display should scroll |
StartScrolling(ScrollDirection, byte, byte)
Start the display scrolling
View Source
public void StartScrolling(Sh110x.ScrollDirection direction, byte startPage, byte endPage)
Parameters
Type | Name | Description |
---|---|---|
Meadow.Foundation.Displays.Sh110x.ScrollDirection | direction | Direction that the display should scroll |
System.Byte | startPage | Start page for the scroll |
System.Byte | endPage | End page for the scroll |
StopScrolling()
Turn off scrolling
View Source
public void StopScrolling()
Fill(Color, bool)
Fill display buffer with a color
View Source
public void Fill(Color clearColor, bool updateDisplay = false)
Parameters
Type | Name | Description |
---|---|---|
Meadow.Color | clearColor | The fill color |
System.Boolean | updateDisplay | If true, update display |
Fill(int, int, int, int, Color)
Fill with a color
View Source
public void Fill(int x, int y, int width, int height, Color color)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | x | X start position in pixels |
System.Int32 | y | Y start position in pixels |
System.Int32 | width | Width in pixels |
System.Int32 | height | Height in pixels |
Meadow.Color | color | The fill color |
WriteBuffer(int, int, IPixelBuffer)
Write a buffer to the display offscreen buffer
View Source
public void WriteBuffer(int x, int y, IPixelBuffer displayBuffer)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | x | The x position in pixels to write the buffer |
System.Int32 | y | The y position in pixels to write the buffer |
Meadow.Foundation.Graphics.Buffers.IPixelBuffer | displayBuffer | The buffer to write |
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
Type | Name | Description |
---|---|---|
System.Boolean | disposing | Is disposing |
Implements
- Meadow.Foundation.Graphics.IGraphicsDisplay
Meadow.Hardware.ISpiPeripheral
Meadow.Hardware.II2cPeripheral
System.IDisposable