Skip to main content

Meadow.Foundation.Displays.Ssd1327

Ssd1327
StatusStatus badge: working
Source codeGitHub
Datasheet(s)GitHub
NuGet packageNuGet Gallery for Meadow.Foundation.Displays.Ssd1327

Code Example

MicroGraphics graphics;

public override Task Initialize()
{
Resolver.Log.Info("Initialize display...");

var spiBus = Device.CreateSpiBus();

var display = new Ssd1327(spiBus, Device.Pins.D02, Device.Pins.D01, Device.Pins.D00);

display.SetContrast(60);

graphics = new MicroGraphics(display);
graphics.CurrentFont = new Font8x12();

return base.Initialize();
}

public override Task Run()
{
graphics.Clear();

for (int i = 10; i > 0; i--)
{ //iterate across different brightnesses
graphics.DrawText(0, i * 11, "SSD1327", Color.FromRgb(i * 0.1, i * 0.1, i * 0.1));
}

graphics.Show();

return base.Run();
}

Sample project(s) available on GitHub

Wiring Example

To wire a Ssd1327 to your Meadow board, connect the following:

Ssd1327Meadow Pin
GNDGND
VCC3V3
SCLSCK
SDACOPI
RESETD00
DCD01
CSD02

It should look like the following diagram:

Wiring a Ssd1327 to a Meadow F7

Class Ssd1327

Provides an interface to the Ssd1327 grayscale OLED display

Assembly: Ssd1327.dll
View Source
Declaration
public class Ssd1327 : IPixelDisplay, IDisplay, ISpiPeripheral, IDisposable

Implements:
Meadow.Peripherals.Displays.IPixelDisplay, Meadow.Peripherals.Displays.IDisplay, Meadow.Hardware.ISpiPeripheral, 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; }

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; }

Fields

spiComms

SPI Communication bus used to communicate with the peripheral

View Source
Declaration
protected ISpiCommunications spiComms

Methods

SetContrast(byte)

Set the display contrast

View Source
Declaration
public void SetContrast(byte contrast)
Parameters
TypeNameDescription
System.BytecontrastThe contrast value (0-255)

Initialize()

Initialize the display

View Source
Declaration
protected void Initialize()

Clear(bool)

Clear the display buffer

View Source
Declaration
public void Clear(bool updateDisplay = false)
Parameters
TypeNameDescription
System.BooleanupdateDisplayIf true, update the display

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.ColorcolorThe pixel color which will be transformed to 4bpp grayscale

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

DrawPixel(int, int, byte)

Draw pixel at a location

View Source
Declaration
public void DrawPixel(int x, int y, byte gray)
Parameters
TypeNameDescription
System.Int32xx location in pixels
System.Int32yy location in pixels
System.BytegrayThe pixel color as a 4 bit grayscale value

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

Show(int, int, int, int)

Update a region of the display from the offscreen buffer

View Source
Declaration
public void Show(int left, int top, int right, int bottom)
Parameters
TypeNameDescription
System.Int32leftLeft bounds in pixels
System.Int32topTop bounds in pixels
System.Int32rightRight bounds in pixels
System.Int32bottomBottom bounds in pixels

Show()

Update the display

View Source
Declaration
public void Show()

Fill(Color, bool)

Fill display buffer with a color

View Source
Declaration
public void Fill(Color color, bool updateDisplay = false)
Parameters
TypeNameDescription
Meadow.ColorcolorThe fill color
System.BooleanupdateDisplayIf true, update display

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

Fill with a color

View Source
Declaration
public void Fill(int x, int y, int width, int height, Color color)
Parameters
TypeNameDescription
System.Int32xX start position in pixels
System.Int32yY start position in pixels
System.Int32widthWidth in pixels
System.Int32heightHeight in pixels
Meadow.ColorcolorThe fill color

WriteBuffer(int, int, IPixelBuffer)

Write a buffer to the display offscreen buffer

View Source
Declaration
public void WriteBuffer(int x, int y, IPixelBuffer displayBuffer)
Parameters
TypeNameDescription
System.Int32xThe x position in pixels to write the buffer
System.Int32yThe y position in pixels to write the buffer
Meadow.Peripherals.Displays.IPixelBufferdisplayBufferThe buffer to write

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
  • System.IDisposable