Meadow.Foundation.Displays.Ssd1327
Ssd1327 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
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:
Ssd1327 | Meadow Pin |
---|---|
GND | GND |
VCC | 3V3 |
SCL | SCK |
SDA | COPI |
RESET | D00 |
DC | D01 |
CS | D02 |
It should look like the following diagram:
Class Ssd1327
Provides an interface to the Ssd1327 grayscale OLED display
Assembly: Ssd1327.dll
View Source
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
public ColorMode ColorMode { get; }
SupportedColorModes
The Color mode supported by the display
View Source
public ColorMode SupportedColorModes { get; }
Width
Width of the display in pixels
View Source
public int Width { get; }
Height
Height of the display in pixels
View Source
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
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; }
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; }
Fields
spiComms
SPI Communication bus used to communicate with the peripheral
View Source
protected ISpiCommunications spiComms
Methods
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) |
Initialize()
Initialize the display
View Source
protected void Initialize()
Clear(bool)
Clear the display buffer
View Source
public void Clear(bool updateDisplay = false)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | updateDisplay | If true, update the display |
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 | x location in pixels |
System.Int32 | y | y location in pixels |
Meadow.Color | color | The pixel color which will be transformed to 4bpp grayscale |
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 | x location in pixels |
System.Int32 | y | y location in pixels |
System.Boolean | enabled | True = turn on pixel, false = turn off pixel |
DrawPixel(int, int, byte)
Draw pixel at a location
View Source
public void DrawPixel(int x, int y, byte gray)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | x | x location in pixels |
System.Int32 | y | y location in pixels |
System.Byte | gray | The pixel color as a 4 bit grayscale value |
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 |
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 |
System.Int32 | top | Top bounds in pixels |
System.Int32 | right | Right bounds in pixels |
System.Int32 | bottom | Bottom bounds in pixels |
Show()
Update the display
View Source
public void Show()
Fill(Color, bool)
Fill display buffer with a color
View Source
public void Fill(Color color, bool updateDisplay = false)
Parameters
Type | Name | Description |
---|---|---|
Meadow.Color | color | 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.Peripherals.Displays.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.Peripherals.Displays.IPixelDisplay
Meadow.Peripherals.Displays.IDisplay
Meadow.Hardware.ISpiPeripheral
System.IDisposable