Difference between revisions of "Unit TFT Framebuffer"
(8 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
=== Description === | === Description === | ||
---- | ---- | ||
+ | |||
+ | '''Ultibo TFT Framebuffer Driver Library unit''' | ||
This is a generic framebuffer device support unit for SPI based TFT screens using common chipsets. | This is a generic framebuffer device support unit for SPI based TFT screens using common chipsets. | ||
− | This unit implements the shared functionality that is common to all devices and provides a set of functions that device specific drivers must implement. For each supported device a driver unit is | + | This unit implements the shared functionality that is common to all devices and provides a set of functions that device specific drivers must implement. For each supported device a driver unit is required that implements the SPI communications to initialize the device, setup resolution and color depth as well as refreshing the framebuffer data to the device memory on change. |
− | required that implements the SPI communications to initialize the device, setup resolution and color depth as well as refreshing the framebuffer data to the device memory on change. | + | |
The resulting device created by the combination of this unit and a device specific driver is registered with Ultibo as a framebuffer device that can be accessed using all of the standard framebuffer API functions. | The resulting device created by the combination of this unit and a device specific driver is registered with Ultibo as a framebuffer device that can be accessed using all of the standard framebuffer API functions. | ||
Line 17: | Line 18: | ||
---- | ---- | ||
− | '' | + | |
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''TFT framebuffer specific constants''' <code> TFT_FRAMEBUFFER_* </code></div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>TFT_FRAMEBUFFER_FRAME_RATE_DEFAULT = 20;</code> | ||
+ | | Default frame rate of 20 frames per second refresh | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
=== Type definitions === | === Type definitions === | ||
---- | ---- | ||
− | '' | + | |
+ | '''TFT framebuffer initialize''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TTFTFramebufferInitialize = function(Framebuffer:PTFTFramebuffer; Defaults:PFramebufferProperties):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''TFT framebuffer deinitialize''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TTFTFramebufferDeinitialize = function(Framebuffer:PTFTFramebuffer):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''TFT framebuffer get defaults''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TTFTFramebufferGetDefaults = function(Framebuffer:PTFTFramebuffer; Properties,Defaults:PFramebufferProperties):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''TFT framebuffer set write address''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TTFTFramebufferSetWriteAddress = function(Framebuffer:PTFTFramebuffer; X1,Y1,X2,Y2:LongWord):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''TFT framebuffer write memory''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TTFTFramebufferWriteMemory = function(Framebuffer:PTFTFramebuffer; Address:PtrUInt; Size:LongWord):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''TFT framebuffer device''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PTFTFramebuffer = ^TTFTFramebuffer;</code> | ||
+ | |||
+ | <code>TTFTFramebuffer = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|''Framebuffer Properties'' | ||
+ | |- | ||
+ | | <code>Framebuffer:TFramebufferDevice;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|''TFT Properties'' | ||
+ | |- | ||
+ | | <code>SPI:PSPIDevice;</code> | ||
+ | | The SPI device this Framebuffer is connected to | ||
+ | |- | ||
+ | | <code>ChipSelect:Word;</code> | ||
+ | | The SPI chip select of the device | ||
+ | |- | ||
+ | | <code>RST:TGPIOInfo;</code> | ||
+ | | The GPIO information for the reset line | ||
+ | |- | ||
+ | | <code>DC:TGPIOInfo;</code> | ||
+ | | The GPIO information for the data/command line | ||
+ | |- | ||
+ | | <code>BL:TGPIOInfo;</code> | ||
+ | | The GPIO information for the backlight line | ||
+ | |- | ||
+ | | <code>Initialize:TTFTFramebufferInitialize;</code> | ||
+ | | A device specific Initialize method (Optional) | ||
+ | |- | ||
+ | | <code>Deinitialize:TTFTFramebufferDeinitialize;</code> | ||
+ | | A device specific Deinitialize method (Optional) | ||
+ | |- | ||
+ | | <code>GetDefaults:TTFTFramebufferGetDefaults;</code> | ||
+ | | A device specific GetDefaults method (Mandatory) | ||
+ | |- | ||
+ | | <code>SetWriteAddress:TTFTFramebufferSetWriteAddress;</code> | ||
+ | | A device specific SetWriteAddress method (Mandatory) | ||
+ | |- | ||
+ | | <code>WriteMemory:TTFTFramebufferWriteMemory;</code> | ||
+ | | A device specific WriteMemory method (Mandatory) | ||
+ | |- | ||
+ | |colspan="2"|''Driver Properties'' | ||
+ | |- | ||
+ | | <code>Width:LongWord;</code> | ||
+ | | Framebuffer Width in Pixels | ||
+ | |- | ||
+ | | <code>Height:LongWord;</code> | ||
+ | | Framebuffer Height in Pixels | ||
+ | |- | ||
+ | | <code>Rotation:LongWord;</code> | ||
+ | | Framebuffer Rotation (eg FRAMEBUFFER_ROTATION_180) | ||
+ | |- | ||
+ | | <code>DirtyY1:LongWord;</code> | ||
+ | | First line of dirty region (or Height - 1 if none dirty) | ||
+ | |- | ||
+ | | <code>DirtyY2:LongWord;</code> | ||
+ | | Last line of dirty region (or 0 if none dirty) | ||
+ | |- | ||
+ | | <code>Ready:LongBool;</code> | ||
+ | | If True timer should be enabled during Mark operation | ||
+ | |- | ||
+ | | <code>Lock:TMutexHandle;</code> | ||
+ | | Lock for dirty region redraw | ||
+ | |- | ||
+ | | <code>Timer:TTimerHandle;</code> | ||
+ | | Handle for dirty region redraw timer | ||
+ | |- | ||
+ | | <code>FrameRate:LongWord;</code> | ||
+ | | Frame rate for display refresh (in Frames Per Second) | ||
+ | |- | ||
+ | | <code>TransferSize:LongWord;</code> | ||
+ | | Maximum transfer size for the SPI device (or -1 if No Maximum) | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
=== Public variables === | === Public variables === | ||
---- | ---- | ||
− | '' | + | ''None defined'' |
=== Function declarations === | === Function declarations === | ||
Line 41: | Line 179: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
− | | Not intended to be called directly by applications, use FramebufferDeviceAllocate instead | + | | Not intended to be called directly by applications, use FramebufferDeviceAllocate instead. |
|- | |- | ||
|} | |} | ||
Line 53: | Line 191: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
− | | Not intended to be called directly by applications, use FramebufferDeviceRelease instead | + | | Not intended to be called directly by applications, use FramebufferDeviceRelease instead. |
|- | |- | ||
|} | |} | ||
Line 65: | Line 203: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
− | | Not intended to be called directly by applications, use FramebufferDeviceMark instead. Marks full lines only, X and Width are ignored for TFT Framebuffer. | + | | Not intended to be called directly by applications, use FramebufferDeviceMark instead. |
+ | Marks full lines only, X and Width are ignored for TFT Framebuffer. | ||
|- | |- | ||
|} | |} | ||
Line 72: | Line 211: | ||
<br /> | <br /> | ||
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
− | <pre style="border: 0; padding-bottom:0px;">function TFTFramebufferCommit(Framebuffer:PFramebufferDevice; Address | + | <pre style="border: 0; padding-bottom:0px;">function TFTFramebufferCommit(Framebuffer:PFramebufferDevice; Address:PtrUInt; Size,Flags:LongWord):LongWord;</pre> |
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of FramebufferDeviceCommit API for TFT Framebuffer</div> | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of FramebufferDeviceCommit API for TFT Framebuffer</div> | ||
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
− | | Not intended to be called directly by applications, use FramebufferDeviceCommit instead | + | | Not intended to be called directly by applications, use FramebufferDeviceCommit instead. |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
|- | |- | ||
|} | |} | ||
Line 101: | Line 228: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| Not intended to be called directly by applications | | Not intended to be called directly by applications | ||
|- | |- |
Latest revision as of 05:08, 23 November 2022
Return to Unit Reference
Description
Ultibo TFT Framebuffer Driver Library unit
This is a generic framebuffer device support unit for SPI based TFT screens using common chipsets.
This unit implements the shared functionality that is common to all devices and provides a set of functions that device specific drivers must implement. For each supported device a driver unit is required that implements the SPI communications to initialize the device, setup resolution and color depth as well as refreshing the framebuffer data to the device memory on change.
The resulting device created by the combination of this unit and a device specific driver is registered with Ultibo as a framebuffer device that can be accessed using all of the standard framebuffer API functions.
For examples of drivers that use this support unit see the HX8357D and ILI9340 units.
Constants
TFT_FRAMEBUFFER_*
TFT_FRAMEBUFFER_FRAME_RATE_DEFAULT = 20;
|
Default frame rate of 20 frames per second refresh |
Type definitions
TFT framebuffer initialize
TTFTFramebufferInitialize = function(Framebuffer:PTFTFramebuffer; Defaults:PFramebufferProperties):LongWord;
|
TFT framebuffer deinitialize
TTFTFramebufferDeinitialize = function(Framebuffer:PTFTFramebuffer):LongWord;
|
TFT framebuffer get defaults
TTFTFramebufferGetDefaults = function(Framebuffer:PTFTFramebuffer; Properties,Defaults:PFramebufferProperties):LongWord;
|
TFT framebuffer set write address
TTFTFramebufferSetWriteAddress = function(Framebuffer:PTFTFramebuffer; X1,Y1,X2,Y2:LongWord):LongWord;
|
TFT framebuffer write memory
TTFTFramebufferWriteMemory = function(Framebuffer:PTFTFramebuffer; Address:PtrUInt; Size:LongWord):LongWord;
|
TFT framebuffer device
PTFTFramebuffer = ^TTFTFramebuffer;
TTFTFramebuffer = record
Framebuffer Properties | |
Framebuffer:TFramebufferDevice;
|
|
TFT Properties | |
SPI:PSPIDevice;
|
The SPI device this Framebuffer is connected to |
ChipSelect:Word;
|
The SPI chip select of the device |
RST:TGPIOInfo;
|
The GPIO information for the reset line |
DC:TGPIOInfo;
|
The GPIO information for the data/command line |
BL:TGPIOInfo;
|
The GPIO information for the backlight line |
Initialize:TTFTFramebufferInitialize;
|
A device specific Initialize method (Optional) |
Deinitialize:TTFTFramebufferDeinitialize;
|
A device specific Deinitialize method (Optional) |
GetDefaults:TTFTFramebufferGetDefaults;
|
A device specific GetDefaults method (Mandatory) |
SetWriteAddress:TTFTFramebufferSetWriteAddress;
|
A device specific SetWriteAddress method (Mandatory) |
WriteMemory:TTFTFramebufferWriteMemory;
|
A device specific WriteMemory method (Mandatory) |
Driver Properties | |
Width:LongWord;
|
Framebuffer Width in Pixels |
Height:LongWord;
|
Framebuffer Height in Pixels |
Rotation:LongWord;
|
Framebuffer Rotation (eg FRAMEBUFFER_ROTATION_180) |
DirtyY1:LongWord;
|
First line of dirty region (or Height - 1 if none dirty) |
DirtyY2:LongWord;
|
Last line of dirty region (or 0 if none dirty) |
Ready:LongBool;
|
If True timer should be enabled during Mark operation |
Lock:TMutexHandle;
|
Lock for dirty region redraw |
Timer:TTimerHandle;
|
Handle for dirty region redraw timer |
FrameRate:LongWord;
|
Frame rate for display refresh (in Frames Per Second) |
TransferSize:LongWord;
|
Maximum transfer size for the SPI device (or -1 if No Maximum) |
Public variables
None defined
Function declarations
TFT framebuffer functions
function TFTFramebufferAllocate(Framebuffer:PFramebufferDevice; Properties:PFramebufferProperties):LongWord;
Note | Not intended to be called directly by applications, use FramebufferDeviceAllocate instead. |
---|
function TFTFramebufferRelease(Framebuffer:PFramebufferDevice):LongWord;
Note | Not intended to be called directly by applications, use FramebufferDeviceRelease instead. |
---|
function TFTFramebufferMark(Framebuffer:PFramebufferDevice; X,Y,Width,Height,Flags:LongWord):LongWord;
Note | Not intended to be called directly by applications, use FramebufferDeviceMark instead.
Marks full lines only, X and Width are ignored for TFT Framebuffer. |
---|
function TFTFramebufferCommit(Framebuffer:PFramebufferDevice; Address:PtrUInt; Size,Flags:LongWord):LongWord;
Note | Not intended to be called directly by applications, use FramebufferDeviceCommit instead. |
---|
procedure TFTFramebufferUpdateDisplay(Framebuffer:PTFTFramebuffer);
Note | Not intended to be called directly by applications |
---|
Return to Unit Reference