Remarks
Sh1107 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
MicroGraphics graphics;
public override Task Initialize()
{
Resolver.Log.Info("Initializing...");
var sh1107 = new Sh1107
(
i2cBus: Device.CreateI2cBus(),
address: (byte)Addresses.Address_0x3C,
width: 128,
height: 128
);
graphics = new MicroGraphics(sh1107)
{
CurrentFont = new Font12x16(),
Rotation = RotationType._180Degrees
};
return base.Initialize();
}
public override Task Run()
{
graphics.Clear();
graphics.DrawRectangle(0, 0, graphics.Width, graphics.Height, false);
graphics.DrawTriangle(10, 10, 50, 50, 10, 50, false);
graphics.DrawRectangle(20, 15, 40, 20, true);
graphics.DrawText(5, 5, "SH1107");
graphics.Show();
return base.Run();
}
Sample project(s) available on GitHub
Syntax
public class Sh1107 : Sh110x, IGraphicsDisplay, ISpiPeripheral, II2cPeripheral, IDisposable
Constructors
Sh1107(II2cBus, byte, int, int)
Create a new Sh1107 object
Declaration
public Sh1107(II2cBus i2cBus, byte address, int width = 128, int height = 128)
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
Sh1107 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
MicroGraphics graphics;
public override Task Initialize()
{
Resolver.Log.Info("Initializing...");
var sh1107 = new Sh1107
(
i2cBus: Device.CreateI2cBus(),
address: (byte)Addresses.Address_0x3C,
width: 128,
height: 128
);
graphics = new MicroGraphics(sh1107)
{
CurrentFont = new Font12x16(),
Rotation = RotationType._180Degrees
};
return base.Initialize();
}
public override Task Run()
{
graphics.Clear();
graphics.DrawRectangle(0, 0, graphics.Width, graphics.Height, false);
graphics.DrawTriangle(10, 10, 50, 50, 10, 50, false);
graphics.DrawRectangle(20, 15, 40, 20, true);
graphics.DrawText(5, 5, "SH1107");
graphics.Show();
return base.Run();
}
Sh1107(ISpiBus, IDigitalOutputPort, IDigitalOutputPort, IDigitalOutputPort, int, int)
Create a new Sh1107 display object
Declaration
public Sh1107(ISpiBus spiBus, IDigitalOutputPort chipSelectPort, IDigitalOutputPort dataCommandPort, IDigitalOutputPort resetPort, int width = 128, int height = 128)
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
Sh1107 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
MicroGraphics graphics;
public override Task Initialize()
{
Resolver.Log.Info("Initializing...");
var sh1107 = new Sh1107
(
i2cBus: Device.CreateI2cBus(),
address: (byte)Addresses.Address_0x3C,
width: 128,
height: 128
);
graphics = new MicroGraphics(sh1107)
{
CurrentFont = new Font12x16(),
Rotation = RotationType._180Degrees
};
return base.Initialize();
}
public override Task Run()
{
graphics.Clear();
graphics.DrawRectangle(0, 0, graphics.Width, graphics.Height, false);
graphics.DrawTriangle(10, 10, 50, 50, 10, 50, false);
graphics.DrawRectangle(20, 15, 40, 20, true);
graphics.DrawText(5, 5, "SH1107");
graphics.Show();
return base.Run();
}
Sh1107(ISpiBus, IPin, IPin, IPin, int, int)
Create a new Sh1107 object
Declaration
public Sh1107(ISpiBus spiBus, IPin chipSelectPin, IPin dcPin, IPin resetPin, int width = 128, int height = 128)
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
Sh1107 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
MicroGraphics graphics;
public override Task Initialize()
{
Resolver.Log.Info("Initializing...");
var sh1107 = new Sh1107
(
i2cBus: Device.CreateI2cBus(),
address: (byte)Addresses.Address_0x3C,
width: 128,
height: 128
);
graphics = new MicroGraphics(sh1107)
{
CurrentFont = new Font12x16(),
Rotation = RotationType._180Degrees
};
return base.Initialize();
}
public override Task Run()
{
graphics.Clear();
graphics.DrawRectangle(0, 0, graphics.Width, graphics.Height, false);
graphics.DrawTriangle(10, 10, 50, 50, 10, 50, false);
graphics.DrawRectangle(20, 15, 40, 20, true);
graphics.DrawText(5, 5, "SH1107");
graphics.Show();
return base.Run();
}
Methods
Initialize()
Initialize the Sh1107
Declaration
protected override void Initialize()
Overrides
Remarks
Sh1107 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
MicroGraphics graphics;
public override Task Initialize()
{
Resolver.Log.Info("Initializing...");
var sh1107 = new Sh1107
(
i2cBus: Device.CreateI2cBus(),
address: (byte)Addresses.Address_0x3C,
width: 128,
height: 128
);
graphics = new MicroGraphics(sh1107)
{
CurrentFont = new Font12x16(),
Rotation = RotationType._180Degrees
};
return base.Initialize();
}
public override Task Run()
{
graphics.Clear();
graphics.DrawRectangle(0, 0, graphics.Width, graphics.Height, false);
graphics.DrawTriangle(10, 10, 50, 50, 10, 50, false);
graphics.DrawRectangle(20, 15, 40, 20, true);
graphics.DrawText(5, 5, "SH1107");
graphics.Show();
return base.Run();
}