Difference between revisions of "Unit TFT Framebuffer"

From Ultibo.org
Jump to: navigation, search
 
Line 218: Line 218:
 
! Note
 
! Note
 
| Not intended to be called directly by applications, use FramebufferDeviceCommit instead.
 
| Not intended to be called directly by applications, use FramebufferDeviceCommit instead.
|-
 
|}
 
</div></div>
 
<br />
 
<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 TFTFramebufferSetProperties(Framebuffer:PFramebufferDevice; Properties:PFramebufferProperties):LongWord;</pre>
 
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of FramebufferDeviceSetProperties API for TFT Framebuffer</div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
! Note
 
| Not intended to be called directly by applications, use FramebufferDeviceSetProperties instead.
 
 
|-
 
|-
 
|}
 
|}

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 specific 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;
Description: Implementation of FramebufferDeviceAllocate API for TFT Framebuffer
Note Not intended to be called directly by applications, use FramebufferDeviceAllocate instead.


function TFTFramebufferRelease(Framebuffer:PFramebufferDevice):LongWord;
Description: Implementation of FramebufferDeviceRelease API for TFT Framebuffer
Note Not intended to be called directly by applications, use FramebufferDeviceRelease instead.


function TFTFramebufferMark(Framebuffer:PFramebufferDevice; X,Y,Width,Height,Flags:LongWord):LongWord;
Description: Implementation of FramebufferDeviceMark API for TFT Framebuffer
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;
Description: Implementation of FramebufferDeviceCommit API for TFT Framebuffer
Note Not intended to be called directly by applications, use FramebufferDeviceCommit instead.


procedure TFTFramebufferUpdateDisplay(Framebuffer:PTFTFramebuffer);
Description: Timer function for display dirty region redraw
Note Not intended to be called directly by applications


Return to Unit Reference