Characteristic | Locus |
---|---|
Inheritance | System.Object > TftSpiBase > Gc9a01 > Hx8357d > Ili9163 > Ili9341 > Ili9481 > Ili9486 > Ili9488 > Rm68140 > S6D02A1 > Ssd1331 > Ssd1351 > St7735 > St7789 > St7796s |
Implements | IGraphicsDisplay |
Namespace | Meadow.Foundation.Displays |
Assembly | TftSpi.dll |
Syntax
public abstract class TftSpiBase : object, IGraphicsDisplay
Constructors
TftSpiBase(ISpiBus, IDigitalOutputPort, IDigitalOutputPort, IDigitalOutputPort, Int32, Int32, ColorMode)
Represents an abstract TftSpiBase object
Declaration
public TftSpiBase(ISpiBus spiBus, IDigitalOutputPort chipSelectPort, IDigitalOutputPort dataCommandPort, IDigitalOutputPort resetPort, int width, int height, ColorMode colorMode = default(ColorMode))
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 |
System.Int32 | width | Width of display in pixels |
System.Int32 | height | Height of display in pixels |
ColorMode | colorMode | The color mode to use for the display buffer |
TftSpiBase(ISpiBus, IPin, IPin, IPin, Int32, Int32, ColorMode)
Represents an abstract TftSpiBase object
Declaration
public TftSpiBase(ISpiBus spiBus, IPin chipSelectPin, IPin dcPin, IPin resetPin, int width, int height, ColorMode colorMode = default(ColorMode))
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 |
System.Int32 | width | Width of display in pixels |
System.Int32 | height | Height of display in pixels |
ColorMode | colorMode | The color mode to use for the display buffer |
Fields
chipSelectPort
The chip select port
Declaration
protected IDigitalOutputPort chipSelectPort
Field Value
Type | Description |
---|---|
IDigitalOutputPort |
Command
Command convenience bool
Declaration
protected const bool Command = null
Field Value
Type | Description |
---|---|
System.Boolean |
Data
Data convience bool
Declaration
protected const bool Data = null
Field Value
Type | Description |
---|---|
System.Boolean |
dataCommandPort
The data command port
Declaration
protected IDigitalOutputPort dataCommandPort
Field Value
Type | Description |
---|---|
IDigitalOutputPort |
imageBuffer
The offscreen image buffer
Declaration
protected IPixelBuffer imageBuffer
Field Value
Type | Description |
---|---|
IPixelBuffer |
readBuffer
The read buffer
Declaration
protected Memory<byte> readBuffer
Field Value
Type | Description |
---|---|
Memory<System.Byte> |
resetPort
The reset port
Declaration
protected IDigitalOutputPort resetPort
Field Value
Type | Description |
---|---|
IDigitalOutputPort |
spiDisplay
The spi peripheral for the display
Declaration
protected ISpiPeripheral spiDisplay
Field Value
Type | Description |
---|---|
ISpiPeripheral |
Properties
ColorMode
The current display color mode
Declaration
public ColorMode ColorMode { get; }
Property Value
Type | Description |
---|---|
ColorMode |
DefautColorMode
The display default color mode
Declaration
public abstract ColorMode DefautColorMode { get; }
Property Value
Type | Description |
---|---|
ColorMode |
Height
Height of display in pixels
Declaration
public int Height { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
PixelBuffer
The buffer used to store the pixel data for the display
Declaration
public IPixelBuffer PixelBuffer { get; }
Property Value
Type | Description |
---|---|
IPixelBuffer |
Rotation
The current rotation of the display
Declaration
public RotationType Rotation { get; set; }
Property Value
Type | Description |
---|---|
RotationType |
SupportedColorModes
The color modes supported by the display
Declaration
public abstract ColorMode SupportedColorModes { get; }
Property Value
Type | Description |
---|---|
ColorMode |
Width
Width of display in pixels
Declaration
public int Width { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
Clear(Color)
Clear the display buffer to a color
Declaration
public void Clear(Color color)
Parameters
Type | Name | Description |
---|---|---|
Color | color | The clear color |
Clear(Boolean)
Clear the display.
Declaration
public void Clear(bool updateDisplay = false)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | updateDisplay | Update the dipslay once the buffer has been cleared when true. |
CreateBuffer(ColorMode, Int32, Int32)
Create an offscreen buffer for the display
Declaration
protected void CreateBuffer(ColorMode colorType, int width, int height)
Parameters
Type | Name | Description |
---|---|---|
ColorMode | colorType | |
System.Int32 | width | The width in pixels |
System.Int32 | height | The height in pixels |
DelayMs(Int32)
Delay
Declaration
protected void DelayMs(int millseconds)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | millseconds | Milliseconds to delay |
DrawPixel(Int32, Int32, Color)
Draw a single pixel
Declaration
public void DrawPixel(int x, int y, Color color)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | x | x location in pixels |
System.Int32 | y | y location in pixels |
Color | color | Color of pixel. |
DrawPixel(Int32, Int32, Boolean)
Draw pixel at a location Primarily used for monochrome displays, prefer overload that accepts a Color
Declaration
public void DrawPixel(int x, int y, bool enabled)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | x | x location in pixels |
System.Int32 | y | y location in pixels |
System.Boolean | enabled | Turn the pixel on (true) or off (false). |
DrawPixel(Int32, Int32, Byte, Byte, Byte)
Draw a single pixel
Declaration
public void DrawPixel(int x, int y, byte r, byte g, byte b)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | x | x location in pixels |
System.Int32 | y | y location in pixels |
System.Byte | r | 8 bit red value |
System.Byte | g | 8 bit green value |
System.Byte | b | 8 bit blue value |
Fill(Color, Boolean)
Fill the display buffer with a color
Declaration
public void Fill(Color color, bool updateDisplay = false)
Parameters
Type | Name | Description |
---|---|---|
Color | color | The fill color |
System.Boolean | updateDisplay | If true, update the display after filling the buffer |
Fill(Int32, Int32, Int32, Int32, Color)
Fill with a color
Declaration
public void Fill(int x, int y, int width, int height, Color color)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | x | X start position in pixels |
System.Int32 | y | Y start position in pixels |
System.Int32 | width | Width in pixels |
System.Int32 | height | Height in pixels |
Color | color | The fill color |
Initialize()
Initalize the display
Declaration
protected abstract void Initialize()
InvertPixel(Int32, Int32)
Invert the color of a single pixel as represented in the display buffer
Declaration
public void InvertPixel(int x, int y)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | x | x location in pixels |
System.Int32 | y | y location in pixels |
IsColorTypeSupported(ColorMode)
Is the color mode supported on this display
Declaration
public virtual bool IsColorTypeSupported(ColorMode colorType)
Parameters
Type | Name | Description |
---|---|---|
ColorMode | colorType | The color mode |
Returns
Type | Description |
---|---|
System.Boolean | true if supported |
SendCommand(TftSpiBase.LcdCommand)
Send a command to the display
Declaration
protected void SendCommand(TftSpiBase.LcdCommand command)
Parameters
Type | Name | Description |
---|---|---|
TftSpiBase.LcdCommand | command | The command to send as an LcdCommand |
SendCommand(TftSpiBase.Register)
Send a command to the display
Declaration
protected void SendCommand(TftSpiBase.Register command)
Parameters
Type | Name | Description |
---|---|---|
TftSpiBase.Register | command | The command to send |
SendCommand(Byte)
Send a command to the display
Declaration
protected void SendCommand(byte command)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | command | The command to send as a byte |
SendData(Byte)
Send a single byte to the display
Declaration
protected void SendData(byte data)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | data | The byte to send |
SendData(Byte[])
Send a byte array of data to the display
Declaration
protected void SendData(byte[] data)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | data | The data |
SendData(Int32)
Send a single byte to the display (convenience method)
Declaration
protected void SendData(int data)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | data | The data to send |
SetAddressWindow(Int32, Int32, Int32, Int32)
Set addrees window for display updates
Declaration
protected abstract void SetAddressWindow(int x0, int y0, int x1, int y1)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | x0 | X start in pixels |
System.Int32 | y0 | Y start in pixels |
System.Int32 | x1 | X end in pixels |
System.Int32 | y1 | Y end in pixels |
Show()
Draw the display buffer to screen
Declaration
public void Show()
Show(Int32, Int32, Int32, Int32)
Transfer part of the contents of the buffer to the display bounded by left, top, right and bottom Only supported in 16Bpp565 mode
Declaration
public void Show(int left, int top, int right, int bottom)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | left | |
System.Int32 | top | |
System.Int32 | right | |
System.Int32 | bottom |
Write(Byte)
Write a byte to the display
Declaration
protected void Write(byte value)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | value | The byte to send |
Write(Byte[])
Write a buffer to the display
Declaration
protected void Write(byte[] data)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | data | The data to send |
WriteBuffer(Int32, Int32, IPixelBuffer)
Write a buffer to the display offscreen buffer
Declaration
public void WriteBuffer(int x, int y, IPixelBuffer buffer)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | x | The x position in pixels to write the buffer |
System.Int32 | y | The y position in pixels to write the buffer |
IPixelBuffer | buffer | The buffer to write |