Remarks
Hx8357d | |
---|---|
Status | |
Source code | GitHub |
NuGet package |
Code Example
public class MeadowApp : App<F7Micro, MeadowApp>
{
Hx8357d display;
GraphicsLibrary graphics;
public MeadowApp ()
{
var config = new SpiClockConfiguration(6000, SpiClockConfiguration.Mode.Mode0);
var spiBus = Device.CreateSpiBus(Device.Pins.SCK, Device.Pins.MOSI, Device.Pins.MISO, config);
display = new Hx8357d(
device: Device,
spiBus: spiBus,
resetPin: Device.Pins.D00,
dcPin: Device.Pins.D01,
chipSelectPin: Device.Pins.D02,
width: 320, height: 480);
graphics = new GraphicsLibrary(display);
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, false);
graphics.DrawCircle(50, 50, 40, Meadow.Foundation.Color.Blue, false);
graphics.DrawText(5, 5, "Meadow F7 SPI");
graphics.Show();
}
}
Sample projects available on GitHub
Circuit Example
To wire a Hx8357d to your Meadow board, connect the following:
Hx8357b | Meadow Pin |
---|---|
GND | GND |
VCC | 3V3 |
SCL | SCK |
SDA | MOSI |
RESET | D00 |
DC | D01 |
CS | D02 |
It should look like the following diagram:
Syntax
public class Hx8357d : TftSpiBase, IDisposable
Constructors
Hx8357d(IIODevice, ISpiBus, IPin, IPin, IPin, Int32, Int32, DisplayBase.DisplayColorMode)
Declaration
public Hx8357d(IIODevice device, ISpiBus spiBus, IPin chipSelectPin, IPin dcPin, IPin resetPin, int width = 320, int height = 480, DisplayBase.DisplayColorMode displayColorMode = DisplayBase.DisplayColorMode.Format16bppRgb565)
Parameters
Type | Name | Description |
---|---|---|
IIODevice | device | |
ISpiBus | spiBus | |
IPin | chipSelectPin | |
IPin | dcPin | |
IPin | resetPin | |
System.Int32 | width | |
System.Int32 | height | |
DisplayBase.DisplayColorMode | displayColorMode |
Fields
HX8357_DISPOFF
Declaration
protected const byte HX8357_DISPOFF = 40
Field Value
Type | Description |
---|---|
System.Byte |
HX8357_DISPON
Declaration
protected const byte HX8357_DISPON = 41
Field Value
Type | Description |
---|---|
System.Byte |
HX8357_INVOFF
Declaration
protected const byte HX8357_INVOFF = 32
Field Value
Type | Description |
---|---|
System.Byte |
HX8357_INVON
Declaration
protected const byte HX8357_INVON = 33
Field Value
Type | Description |
---|---|
System.Byte |
HX8357_NOP
Declaration
protected const byte HX8357_NOP = 0
Field Value
Type | Description |
---|---|
System.Byte |
HX8357_RDCOLMOD
Declaration
protected const byte HX8357_RDCOLMOD = 12
Field Value
Type | Description |
---|---|
System.Byte |
HX8357_RDDID
Declaration
protected const byte HX8357_RDDID = 4
Field Value
Type | Description |
---|---|
System.Byte |
HX8357_RDDIM
Declaration
protected const byte HX8357_RDDIM = 13
Field Value
Type | Description |
---|---|
System.Byte |
HX8357_RDDSDR
Declaration
protected const byte HX8357_RDDSDR = 15
Field Value
Type | Description |
---|---|
System.Byte |
HX8357_RDDST
Declaration
protected const byte HX8357_RDDST = 9
Field Value
Type | Description |
---|---|
System.Byte |
HX8357_RDMADCTL
Declaration
protected const byte HX8357_RDMADCTL = 11
Field Value
Type | Description |
---|---|
System.Byte |
HX8357_RDPOWMODE
Declaration
protected const byte HX8357_RDPOWMODE = 10
Field Value
Type | Description |
---|---|
System.Byte |
HX8357_SETOSC
Declaration
protected const byte HX8357_SETOSC = 176
Field Value
Type | Description |
---|---|
System.Byte |
HX8357_SETPANEL
Declaration
protected const byte HX8357_SETPANEL = 204
Field Value
Type | Description |
---|---|
System.Byte |
HX8357_SETPWR1
Declaration
protected const byte HX8357_SETPWR1 = 177
Field Value
Type | Description |
---|---|
System.Byte |
HX8357_SETRGB
Declaration
protected const byte HX8357_SETRGB = 179
Field Value
Type | Description |
---|---|
System.Byte |
HX8357_SLPIN
Declaration
protected const byte HX8357_SLPIN = 16
Field Value
Type | Description |
---|---|
System.Byte |
HX8357_SLPOUT
Declaration
protected const byte HX8357_SLPOUT = 17
Field Value
Type | Description |
---|---|
System.Byte |
HX8357_SWRESET
Declaration
protected const byte HX8357_SWRESET = 1
Field Value
Type | Description |
---|---|
System.Byte |
HX8357_TEARLINE
Declaration
protected const byte HX8357_TEARLINE = 68
Field Value
Type | Description |
---|---|
System.Byte |
HX8357_TEON
Declaration
protected const byte HX8357_TEON = 53
Field Value
Type | Description |
---|---|
System.Byte |
HX8357D_SETC
Declaration
protected const byte HX8357D_SETC = 185
Field Value
Type | Description |
---|---|
System.Byte |
HX8357D_SETCOM
Declaration
protected const byte HX8357D_SETCOM = 182
Field Value
Type | Description |
---|---|
System.Byte |
HX8357D_SETCYC
Declaration
protected const byte HX8357D_SETCYC = 180
Field Value
Type | Description |
---|---|
System.Byte |
HX8357D_SETGAMMA
Declaration
protected const byte HX8357D_SETGAMMA = 224
Field Value
Type | Description |
---|---|
System.Byte |
HX8357D_SETSTBA
Declaration
protected const byte HX8357D_SETSTBA = 192
Field Value
Type | Description |
---|---|
System.Byte |
Properties
DefautColorMode
Declaration
public override DisplayBase.DisplayColorMode DefautColorMode { get; }
Property Value
Type | Description |
---|---|
DisplayBase.DisplayColorMode |
Overrides
Methods
Initialize()
Declaration
protected override void Initialize()
Overrides
IsColorModeSupported(DisplayBase.DisplayColorMode)
Declaration
public override bool IsColorModeSupported(DisplayBase.DisplayColorMode mode)
Parameters
Type | Name | Description |
---|---|---|
DisplayBase.DisplayColorMode | mode |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
SetAddressWindow(Int32, Int32, Int32, Int32)
Declaration
protected override void SetAddressWindow(int x0, int y0, int x1, int y1)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | x0 | |
System.Int32 | y0 | |
System.Int32 | x1 | |
System.Int32 | y1 |
Overrides
SetRotation(TftSpiBase.Rotation)
Declaration
public void SetRotation(TftSpiBase.Rotation rotation)
Parameters
Type | Name | Description |
---|---|---|
TftSpiBase.Rotation | rotation |