Difference between revisions of "Unit IPSTFT19"
From Ultibo.org
								
												
				| (3 intermediate revisions by the same user not shown) | |||
| Line 82: | Line 82: | ||
----  | ----  | ||
| − | ''  | + | |
| + | '''IPSTFT19 specific types'''  | ||
| + | |||
| + | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">  | ||
| + | <code>PIPSTFT19LCD = ^TIPSTFT19LCD;</code>  | ||
| + | |||
| + | <code>TIPSTFT19LCD = record</code>  | ||
| + | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">  | ||
| + | {| class="wikitable" style="font-size: 14px; background: white;"  | ||
| + | |-  | ||
| + | | <code>Signature:LongWord;</code>  | ||
| + | | Signature for entry validation  | ||
| + | |-  | ||
| + | | <code>Rotation:LongWord;</code>  | ||
| + | | Framebuffer rotation (eg FRAMEBUFFER_ROTATION_180)  | ||
| + | |-  | ||
| + | | <code>SPI:PSPIDevice;</code>  | ||
| + | | SPI device for this display  | ||
| + | |-  | ||
| + | | <code>GPIO:PGPIODevice;</code>  | ||
| + | | GPIO device for this display  | ||
| + | |-  | ||
| + | | <code>Framebuffer:PFramebufferDevice;</code>  | ||
| + | | Framebuffer (ST7789) device for this display  | ||
| + | |-  | ||
| + | |}  | ||
| + | </div></div>  | ||
| + | <br />  | ||
=== Public variables ===  | === Public variables ===  | ||
----  | ----  | ||
| − | ''  | + | |
| + | '''IPSTFT19 specific variables'''  | ||
| + | |||
| + | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"  | ||
| + | |-  | ||
| + | | <code>IPSTFT19_SPI_DEVICE:String = 'SPI0';</code>  | ||
| + | | style="width: 40%;"|  | ||
| + | |-  | ||
| + | |}  | ||
| + | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"  | ||
| + | |-  | ||
| + | | <code>IPSTFT19_LCD_CHIPSELECT:Word = SPI_CS_0;</code>  | ||
| + | | style="width: 40%;"|  | ||
| + | |-  | ||
| + | |}  | ||
| + | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"  | ||
| + | |-  | ||
| + | | <code>IPSTFT19_BL_PWM_ENABLE:LongBool = True;</code>  | ||
| + | | style="width: 40%;"|  | ||
| + | |-  | ||
| + | |}  | ||
| + | <br />  | ||
=== Function declarations ===  | === Function declarations ===  | ||
----  | ----  | ||
| − | |||
| + | '''Initialization functions'''  | ||
| + | |||
| + | <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;">procedure IPSTFT19Init;</pre>  | ||
| + | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Initialize the IPSTFT19 unit and parameters</div>  | ||
| + | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">  | ||
| + | {| class="wikitable" style="font-size: 14px; background: white;"  | ||
| + | |-  | ||
| + | ! Note  | ||
| + | | Called only during system startup  | ||
| + | |-  | ||
| + | |}  | ||
| + | </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 IPSTFT19Start(Rotation:LongWord; const Device:String; DisplaySelect:word):THandle;</pre>  | ||
| + | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Start the IPSTFT19 driver and Framebuffer device associated with the display</div>  | ||
| + | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">  | ||
| + | {| class="wikitable" style="font-size: 14px; background: white;"  | ||
| + | |-  | ||
| + | ! Rotation  | ||
| + | | The rotation of the display (eg FRAMEBUFFER_ROTATION_180)  | ||
| + | |-  | ||
| + | ! Device  | ||
| + | | The SPI device that the ST7789 device is connected to  | ||
| + | |-  | ||
| + | ! DisplaySelect  | ||
| + | | The SPI chip select of the ST7789 LCD controller  | ||
| + | |-  | ||
| + | ! Return  | ||
| + | | The handle of the IPSTFT19 on success or INVALID_HANDLE_VALUE on failure  | ||
| + | |-  | ||
| + | ! Note  | ||
| + | | This function will be called during startup if the parameter IPSTFT19_AUTOSTART is True. Can be called multiple times to support more than one IPSTFT LCD display.  | ||
| + | |-  | ||
| + | |}  | ||
| + | </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 IPSTFT19Stop(Handle:THandle):Boolean;</pre>  | ||
| + | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Stop the IPSTFT19 driver and Framebuffer device associated with the display</div>  | ||
| + | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">  | ||
| + | {| class="wikitable" style="font-size: 14px; background: white;"  | ||
| + | |-  | ||
| + | ! Handle  | ||
| + | | The handle of the IPSTFT19 or INVALID_HANDLE_VALUE for the default display  | ||
| + | |-  | ||
| + | ! Return  | ||
| + | | True if completed or False on failure  | ||
| + | |-  | ||
| + | |}  | ||
| + | </div></div>  | ||
| + | <br />  | ||
Return to [[Unit_Reference|Unit Reference]]  | Return to [[Unit_Reference|Unit Reference]]  | ||
Latest revision as of 05:16, 14 November 2023
Return to Unit Reference
Description
Adafruit 1.9" 320x170 Color IPS TFT Display LCD Driver unit
Adafruit 1.9" 320x170 Color IPS TFT display has 320x170 16-bit full-color pixels and is an IPS display, so the color looks great up to 80 degrees off-axis in any direction.
The TFT driver (Sitronix ST7789) is very similar to the popular ST7735.
Details:
ST7789
Width: 170 Height: 320
SPI Mode: 0 SPI Frequency: 42000000 SPI Chip Select: SPI_CS_0
DC GPIO: GPIO_PIN_25 (Pull: GPIO_PULL_NONE) RST GPIO: GPIO_PIN_27 (Pull: GPIO_PULL_NONE)
Backlight GPIO: GPIO_PIN_18 (GPIO / PWM)
Constants
IPSTFT19 specific constants 
 IPSTFT19_*  IPSTFT19_FRAMEBUFFER_DESCRIPTION = 'Adafruit 1.9" IPS TFT';
 | 
Description of IPSTFT19 device | 
 IPSTFT19_SIGNATURE = $AF000019;
 | 
|
 IPSTFT19_SCREEN_WIDTH = 170;
 | 
|
 IPSTFT19_SCREEN_HEIGHT = 320;
 | 
|
 IPSTFT19_COLSTART = 35;
 | 
|
 IPSTFT19_DEFAULT_ROTATION = FRAMEBUFFER_ROTATION_90;
 | 
|
IPSTFT19 GPIO 
 IPSTFT19_LCD_*  IPSTFT19_LCD_DC = GPIO_PIN_25;
 | 
|
 IPSTFT19_LCD_RST = GPIO_PIN_27;
 | 
|
 IPSTFT19_LCD_BL = GPIO_PIN_18;
 | 
Type definitions
IPSTFT19 specific types
PIPSTFT19LCD = ^TIPSTFT19LCD;
TIPSTFT19LCD = record
 Signature:LongWord;
 | 
Signature for entry validation | 
 Rotation:LongWord;
 | 
Framebuffer rotation (eg FRAMEBUFFER_ROTATION_180) | 
 SPI:PSPIDevice;
 | 
SPI device for this display | 
 GPIO:PGPIODevice;
 | 
GPIO device for this display | 
 Framebuffer:PFramebufferDevice;
 | 
Framebuffer (ST7789) device for this display | 
Public variables
IPSTFT19 specific variables
 IPSTFT19_SPI_DEVICE:String = 'SPI0';
 | 
 IPSTFT19_LCD_CHIPSELECT:Word = SPI_CS_0;
 | 
 IPSTFT19_BL_PWM_ENABLE:LongBool = True;
 | 
Function declarations
Initialization functions
procedure IPSTFT19Init;
Description: Initialize the IPSTFT19 unit and parameters
| Note | Called only during system startup | 
|---|
function IPSTFT19Start(Rotation:LongWord; const Device:String; DisplaySelect:word):THandle;
Description: Start the IPSTFT19 driver and Framebuffer device associated with the display
| Rotation | The rotation of the display (eg FRAMEBUFFER_ROTATION_180) | 
|---|---|
| Device | The SPI device that the ST7789 device is connected to | 
| DisplaySelect | The SPI chip select of the ST7789 LCD controller | 
| Return | The handle of the IPSTFT19 on success or INVALID_HANDLE_VALUE on failure | 
| Note | This function will be called during startup if the parameter IPSTFT19_AUTOSTART is True. Can be called multiple times to support more than one IPSTFT LCD display. | 
function IPSTFT19Stop(Handle:THandle):Boolean;
Description: Stop the IPSTFT19 driver and Framebuffer device associated with the display
| Handle | The handle of the IPSTFT19 or INVALID_HANDLE_VALUE for the default display | 
|---|---|
| Return | True if completed or False on failure | 
Return to Unit Reference