Remarks
Sh1106 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
MicroGraphics graphics;
public override Task Initialize()
{
Resolver.Log.Info("Initializing...");
var sh1106 = new Sh1106
(
spiBus: Device.CreateSpiBus(),
chipSelectPin: Device.Pins.D02,
dcPin: Device.Pins.D01,
resetPin: Device.Pins.D00
);
graphics = new MicroGraphics(sh1106);
graphics.CurrentFont = new Font8x8();
graphics.Rotation = RotationType._180Degrees;
return base.Initialize();
}
public override Task Run()
{
graphics.Clear();
graphics.DrawRectangle(0, 0, 128, 64, false);
graphics.DrawTriangle(10, 10, 50, 50, 10, 50, false);
graphics.DrawRectangle(20, 15, 40, 20, true);
graphics.DrawText(5, 5, "SH1106");
graphics.Show();
return base.Run();
}
Sample project(s) available on GitHub
Syntax
public class Sh1106 : Sh110x, IGraphicsDisplay, ISpiPeripheral, II2cPeripheral
Constructors
Sh1106(II2cBus, byte, int, int)
Create a new Sh1106 object
Declaration
public Sh1106(II2cBus i2cBus, byte address, int width, int height)
Parameters
Type | Name | Description |
---|---|---|
II2cBus | i2cBus | I2C bus connected to display |
byte | address | I2C address |
int | width | Display width in pixels |
int | height | Display height in pixels |
Remarks
Sh1106 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
MicroGraphics graphics;
public override Task Initialize()
{
Resolver.Log.Info("Initializing...");
var sh1106 = new Sh1106
(
spiBus: Device.CreateSpiBus(),
chipSelectPin: Device.Pins.D02,
dcPin: Device.Pins.D01,
resetPin: Device.Pins.D00
);
graphics = new MicroGraphics(sh1106);
graphics.CurrentFont = new Font8x8();
graphics.Rotation = RotationType._180Degrees;
return base.Initialize();
}
public override Task Run()
{
graphics.Clear();
graphics.DrawRectangle(0, 0, 128, 64, false);
graphics.DrawTriangle(10, 10, 50, 50, 10, 50, false);
graphics.DrawRectangle(20, 15, 40, 20, true);
graphics.DrawText(5, 5, "SH1106");
graphics.Show();
return base.Run();
}
Sh1106(ISpiBus, IDigitalOutputPort, IDigitalOutputPort, IDigitalOutputPort, int, int)
Create a new Sh1106 display object
Declaration
public Sh1106(ISpiBus spiBus, IDigitalOutputPort chipSelectPort, IDigitalOutputPort dataCommandPort, IDigitalOutputPort resetPort, int width = 128, int height = 64)
Parameters
Type | Name | Description |
---|---|---|
ISpiBus | spiBus | SPI bus connected to display |
IDigitalOutputPort | chipSelectPort | Chip select output port |
IDigitalOutputPort | dataCommandPort | Data command output port |
IDigitalOutputPort | resetPort | Reset output port |
int | width | Display width in pixels |
int | height | Display height in pixels |
Remarks
Sh1106 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
MicroGraphics graphics;
public override Task Initialize()
{
Resolver.Log.Info("Initializing...");
var sh1106 = new Sh1106
(
spiBus: Device.CreateSpiBus(),
chipSelectPin: Device.Pins.D02,
dcPin: Device.Pins.D01,
resetPin: Device.Pins.D00
);
graphics = new MicroGraphics(sh1106);
graphics.CurrentFont = new Font8x8();
graphics.Rotation = RotationType._180Degrees;
return base.Initialize();
}
public override Task Run()
{
graphics.Clear();
graphics.DrawRectangle(0, 0, 128, 64, false);
graphics.DrawTriangle(10, 10, 50, 50, 10, 50, false);
graphics.DrawRectangle(20, 15, 40, 20, true);
graphics.DrawText(5, 5, "SH1106");
graphics.Show();
return base.Run();
}
Sh1106(ISpiBus, IPin, IPin, IPin, int, int)
Create a new Sh1106 object
Declaration
public Sh1106(ISpiBus spiBus, IPin chipSelectPin, IPin dcPin, IPin resetPin, int width = 128, int height = 64)
Parameters
Type | Name | Description |
---|---|---|
ISpiBus | spiBus | SPI bus connected to display |
IPin | chipSelectPin | Chip select pin |
IPin | dcPin | Data command pin |
IPin | resetPin | Reset pin |
int | width | Display width in pixels |
int | height | Display height in pixels |
Remarks
Sh1106 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
MicroGraphics graphics;
public override Task Initialize()
{
Resolver.Log.Info("Initializing...");
var sh1106 = new Sh1106
(
spiBus: Device.CreateSpiBus(),
chipSelectPin: Device.Pins.D02,
dcPin: Device.Pins.D01,
resetPin: Device.Pins.D00
);
graphics = new MicroGraphics(sh1106);
graphics.CurrentFont = new Font8x8();
graphics.Rotation = RotationType._180Degrees;
return base.Initialize();
}
public override Task Run()
{
graphics.Clear();
graphics.DrawRectangle(0, 0, 128, 64, false);
graphics.DrawTriangle(10, 10, 50, 50, 10, 50, false);
graphics.DrawRectangle(20, 15, 40, 20, true);
graphics.DrawText(5, 5, "SH1106");
graphics.Show();
return base.Run();
}
Methods
Initialize()
Initialize the Sh1106
Declaration
protected override void Initialize()
Overrides
Remarks
Sh1106 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
MicroGraphics graphics;
public override Task Initialize()
{
Resolver.Log.Info("Initializing...");
var sh1106 = new Sh1106
(
spiBus: Device.CreateSpiBus(),
chipSelectPin: Device.Pins.D02,
dcPin: Device.Pins.D01,
resetPin: Device.Pins.D00
);
graphics = new MicroGraphics(sh1106);
graphics.CurrentFont = new Font8x8();
graphics.Rotation = RotationType._180Degrees;
return base.Initialize();
}
public override Task Run()
{
graphics.Clear();
graphics.DrawRectangle(0, 0, 128, 64, false);
graphics.DrawTriangle(10, 10, 50, 50, 10, 50, false);
graphics.DrawRectangle(20, 15, 40, 20, true);
graphics.DrawText(5, 5, "SH1106");
graphics.Show();
return base.Run();
}