Remarks
Uc8151c | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
MicroGraphics graphics;
public override Task Initialize()
{
Resolver.Log.Info("Initialize ...");
var display = new Uc8151c(
spiBus: Device.CreateSpiBus(),
chipSelectPin: Device.Pins.D03,
dcPin: Device.Pins.D02,
resetPin: Device.Pins.D01,
busyPin: Device.Pins.D00,
width: 152,
height: 152);
graphics = new MicroGraphics(display);
return Task.CompletedTask;
}
public override Task Run()
{
Resolver.Log.Info("Run");
for (int i = 0; i < 100; i++)
{
graphics.DrawPixel(i, i, Color.Black);
}
graphics.DrawRectangle(10, 40, 120, 60, Color.Black, true);
graphics.DrawRectangle(20, 80, 120, 90, Color.Red, true);
graphics.CurrentFont = new Font12x16();
graphics.DrawText(2, 20, "Meadow F7", Color.Black);
graphics.DrawText(30, 50, "Color", Color.Red);
graphics.DrawText(50, 90, "Black", Color.Black);
graphics.DrawText(50, 120, "White", Color.White);
graphics.Show();
Resolver.Log.Info("Run complete");
return Task.CompletedTask;
}
Sample project(s) available on GitHub
Syntax
public class Uc8151c : EPaperTriColorBase, IGraphicsDisplay
Constructors
Uc8151c(ISpiBus, IDigitalOutputPort, IDigitalOutputPort, IDigitalOutputPort, IDigitalInputPort, Int32, Int32)
Create a new Uc8151c ePaper display object
Declaration
public Uc8151c(ISpiBus spiBus, IDigitalOutputPort chipSelectPort, IDigitalOutputPort dataCommandPort, IDigitalOutputPort resetPort, IDigitalInputPort busyPort, int width, int height)
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 |
IDigitalInputPort | busyPort | Busy input port |
System.Int32 | width | Width of display in pixels |
System.Int32 | height | Height of display in pixels |
Uc8151c(ISpiBus, IPin, IPin, IPin, IPin, Int32, Int32)
Create a new Uc8151c object
Declaration
public Uc8151c(ISpiBus spiBus, IPin chipSelectPin, IPin dcPin, IPin resetPin, IPin busyPin, int width, int height)
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 |
IPin | busyPin | Busy pin |
System.Int32 | width | Width of display in pixels |
System.Int32 | height | Height of display in pixels |
Properties
IsBlackInverted
Is black inverted on this display
Declaration
protected override bool IsBlackInverted { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Overrides
IsColorInverted
Is color inverted on this display
Declaration
protected override bool IsColorInverted { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Overrides
Methods
ClearFrame()
Clears the SRAM on the display controller Doesn't update the display
Declaration
protected void ClearFrame()
DisplayFrame()
Display data from the display controller SRAM
Declaration
public void DisplayFrame()
Initialize()
Initialize the display
Declaration
protected override void Initialize()
Overrides
SetPartialWindow(Byte[], Byte[], Int32, Int32, Int32, Int32)
Set partial window for display updates
Declaration
protected void SetPartialWindow(byte[] bufferBlack, byte[] bufferColor, int x, int y, int width, int height)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | bufferBlack | The buffer with black pixel data |
System.Byte[] | bufferColor | The buffer with color pixel data |
System.Int32 | x | The x start position in pixels |
System.Int32 | y | The y stary position in pixels |
System.Int32 | width | The width to update in pixels |
System.Int32 | height | The height to update in pixels |
SetPartialWindowBlack(Byte[], Int32, Int32, Int32, Int32)
Set partial window for display updates
Declaration
protected void SetPartialWindowBlack(byte[] bufferBlack, int x, int y, int width, int height)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | bufferBlack | The buffer with black pixel data |
System.Int32 | x | The x start position in pixels |
System.Int32 | y | The y stary position in pixels |
System.Int32 | width | The width to update in pixels |
System.Int32 | height | The height to update in pixels |
SetPartialWindowColor(Byte[], Int32, Int32, Int32, Int32)
Set partial window for display updates
Declaration
protected void SetPartialWindowColor(byte[] bufferColor, int x, int y, int width, int height)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | bufferColor | The buffer with color pixel data |
System.Int32 | x | The x start position in pixels |
System.Int32 | y | The y stary position in pixels |
System.Int32 | width | The width to update in pixels |
System.Int32 | height | The height to update in pixels |
Show()
Update the display from the offscreen buffer
Declaration
public override void Show()
Overrides
Show(Int32, Int32, Int32, Int32)
Update a region of the display from the offscreen buffer
Declaration
public override 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 |
Overrides
Sleep()
Set the sensor to sleep state
Declaration
protected virtual void Sleep()