Remarks
ST7565 | |
---|---|
Status | |
Source code | GitHub |
NuGet package |
Code Example
public class MeadowApp : App<F7Micro, MeadowApp>
{
St7565 sT7565;
GraphicsLibrary graphics;
public MeadowApp()
{
Console.WriteLine("Initializing...");
sT7565 = new St7565
(
device: Device,
spiBus: Device.CreateSpiBus(),
chipSelectPin: Device.Pins.D02,
dcPin: Device.Pins.D00,
resetPin: Device.Pins.D01,
width: 128,
height: 64
);
graphics = new GraphicsLibrary(sT7565);
TestST7565();
}
void TestST7565()
{
Console.WriteLine("TestST7565...");
// Drawing with Display Graphics Library
graphics.CurrentFont = new Font8x8();
graphics.Clear();
graphics.DrawTriangle(10, 10, 50, 50, 10, 50, Meadow.Foundation.Color.Red);
graphics.DrawRectangle(20, 15, 40, 20, Meadow.Foundation.Color.Yellow, true);
graphics.DrawText(5, 5, "ST7565");
graphics.Show();
}
}
Sample projects available on GitHub
Wiring Example
To wire a ST7565 to your Meadow board, connect the following:
ST7565 | Meadow Pin |
---|---|
LEDA | GND |
GND | GND |
VCC | 3V3 |
SDA | MOSI |
SCL | SCK |
A0 | D00 |
RST | D01 |
CS | D02 |
Characteristic | Locus |
---|---|
Inheritance | System.Object DisplayBase > St7565 |
Inherited Members | DisplayBase.IgnoreOutOfBoundsPixels |
Namespace | Meadow.Foundation.Displays |
Assembly | St7565.dll |
Syntax
public class St7565 : DisplayBase
Constructors
St7565(IIODevice, ISpiBus, IPin, IPin, IPin, UInt32, UInt32)
Create a new ST7565 object using the default parameters for
Declaration
public St7565(IIODevice device, ISpiBus spiBus, IPin chipSelectPin, IPin dcPin, IPin resetPin, uint width = 128U, uint height = 64U)
Parameters
Type | Name | Description |
---|---|---|
IIODevice | device | |
ISpiBus | spiBus | |
IPin | chipSelectPin | |
IPin | dcPin | |
IPin | resetPin | |
System.UInt32 | width | |
System.UInt32 | height |
Fields
chipSelectPort
Declaration
protected IDigitalOutputPort chipSelectPort
Field Value
Type | Description |
---|---|
IDigitalOutputPort |
Command
Declaration
protected const bool Command = false
Field Value
Type | Description |
---|---|
System.Boolean |
ContrastHigh
Declaration
public const uint ContrastHigh = 34U
Field Value
Type | Description |
---|---|
System.UInt32 |
ContrastLow
Declaration
public const uint ContrastLow = 15U
Field Value
Type | Description |
---|---|
System.UInt32 |
ContrastMedium
Declaration
public const uint ContrastMedium = 24U
Field Value
Type | Description |
---|---|
System.UInt32 |
currentPen
Declaration
protected Color currentPen
Field Value
Type | Description |
---|---|
Color |
Data
Declaration
protected const bool Data = true
Field Value
Type | Description |
---|---|
System.Boolean |
dataCommandPort
Declaration
protected IDigitalOutputPort dataCommandPort
Field Value
Type | Description |
---|---|
IDigitalOutputPort |
pageBuffer
Declaration
protected byte[] pageBuffer
Field Value
Type | Description |
---|---|
System.Byte[] |
pageReference
Declaration
protected int[] pageReference
Field Value
Type | Description |
---|---|
System.Int32[] |
pageSize
Declaration
protected const int pageSize = 128
Field Value
Type | Description |
---|---|
System.Int32 |
resetPort
Declaration
protected IDigitalOutputPort resetPort
Field Value
Type | Description |
---|---|
IDigitalOutputPort |
spiPerihperal
SPI object
Declaration
protected ISpiPeripheral spiPerihperal
Field Value
Type | Description |
---|---|
ISpiPeripheral |
StartColumnOffset
Declaration
protected const int StartColumnOffset = 0
Field Value
Type | Description |
---|---|
System.Int32 |
Properties
ColorMode
Declaration
public override DisplayBase.DisplayColorMode ColorMode { get; }
Property Value
Type | Description |
---|---|
DisplayBase.DisplayColorMode |
Overrides
Height
Declaration
public override uint Height { get; }
Property Value
Type | Description |
---|---|
System.UInt32 |
Overrides
Width
Declaration
public override uint Width { get; }
Property Value
Type | Description |
---|---|
System.UInt32 |
Overrides
Methods
Clear(Boolean)
Clear the display buffer.
Declaration
public override void Clear(bool updateDisplay = false)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | updateDisplay | Immediately update the display when true. |
Overrides
DrawPixel(Int32, Int32)
Draw pixel using current pen
Declaration
public override void DrawPixel(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. |
Overrides
DrawPixel(Int32, Int32, Color)
Coordinates start with index 0
Declaration
public override 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. |
Color | color | Any color = turn on pixel, black = turn off pixel |
Overrides
DrawPixel(Int32, Int32, Boolean)
Coordinates start with index 0
Declaration
public override void DrawPixel(int x, int y, bool colored)
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 | colored | True = turn on pixel, false = turn off pixel |
Overrides
InvertDisplay(Boolean)
Invert the entire display (true) or return to normal mode (false).
Declaration
public void InvertDisplay(bool cmd)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | cmd |
InvertPixel(Int32, Int32)
Declaration
public override void InvertPixel(int x, int y)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | x | |
System.Int32 | y |
Overrides
PowerSaveMode()
Declaration
public void PowerSaveMode()
SetContrast(UInt32)
Declaration
public void SetContrast(uint contrast)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | contrast |
SetPenColor(Color)
Declaration
public override void SetPenColor(Color pen)
Parameters
Type | Name | Description |
---|---|---|
Color | pen |
Overrides
Show()
Send the internal pixel buffer to display.
Declaration
public override void Show()
Overrides
StartScrolling(St7565.ScrollDirection)
Start the display scrollling in the specified direction.
Declaration
public void StartScrolling(St7565.ScrollDirection direction)
Parameters
Type | Name | Description |
---|---|---|
St7565.ScrollDirection | direction | Direction that the display should scroll. |
StartScrolling(St7565.ScrollDirection, Byte, Byte)
Start the display scrolling.
Declaration
public void StartScrolling(St7565.ScrollDirection direction, byte startPage, byte endPage)
Parameters
Type | Name | Description |
---|---|---|
St7565.ScrollDirection | direction | Direction that the display should scroll. |
System.Byte | startPage | Start page for the scroll. |
System.Byte | endPage | End oage 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.