Difference between revisions of "Unit PiTFT35"

From Ultibo.org
Jump to: navigation, search
(Created page with "Return to Unit Reference === Description === ---- ''To be documented'' === Constants === ---- ''To be documented'' === Type definitions === ---- ''To...")
 
 
(10 intermediate revisions by the same user not shown)
Line 5: Line 5:
 
----
 
----
  
''To be documented''
+
'''Adafruit PiTFT 3.5" LCD Driver unit'''
 +
 
 +
The Adafruit PiTFT 3.5" LCD is a 480 x 320 pixel TFT with resistive touchscreen using a Himax HX8357 driver and a STMicroelectronics STMPE610 resistive touchscreen controller.
 +
 +
This unit ties together the various components needed to make one of these boards work with Ultibo by finding the correct SPI device, creating the STMPE610 Touch device, creating the HX8357D Framebuffer device and registering all of it with the correct parameters for the Adafruit board.
 +
 +
Details:
 +
 +
'''HX8357D'''
 +
 
 +
Width:  320
 +
 
 +
Height:  480
 +
 +
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_UNKNOWN
 +
 
 +
Backlight GPIO:
 +
 
 +
GPIO_PIN_2  (STMPE GPIO)
 +
 
 +
GPIO_PIN_18 (PWM)
 +
     
 +
'''STMPE'''
 +
 
 +
Chip: STMPE_CHIP_610
 +
 +
SPI Mode: 0
 +
 
 +
SPI Frequency: 500000
 +
 
 +
SPI Chip Select: SPI_CS_1
 +
 
 +
IRQ GPIO: GPIO_PIN_24 (Trigger: GPIO_TRIGGER_FALLING)(Pull: GPIO_PULL_UP)
  
 
=== Constants ===
 
=== Constants ===
 
----
 
----
  
''To be documented''
+
 
 +
<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;">'''PiTFT35 specific constants''' <code> PITFT35_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>PITFT35_FRAMEBUFFER_DESCRIPTION = 'Adafruit PiTFT 3.5" LCD';</code>
 +
| Description of PiTFT35 device
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>PITFT35_SIGNATURE = $AF000035;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>PITFT35_SCREEN_WIDTH  = 320;</code>
 +
| &nbsp;
 +
|-
 +
| <code>PITFT35_SCREEN_HEIGHT = 480;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<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;">'''PiTFT35 GPIO''' <code> PITFT35_LCD_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>PITFT35_LCD_DC = GPIO_PIN_25;</code>
 +
| &nbsp;
 +
|-
 +
| <code>PITFT35_TOUCH_IRQ = GPIO_PIN_24;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>PITFT35_LCD_BL = GPIO_PIN_2;</code>
 +
| STMPE GPIO
 +
|-
 +
| <code>PITFT35_LCD_BL_PWM = GPIO_PIN_18;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
  
 
=== Type definitions ===
 
=== Type definitions ===
 
----
 
----
  
''To be documented''
+
 
 +
'''PiTFT35 specific types'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PPiTFT35LCD = ^TPiTFT35LCD;</code>
 +
 
 +
<code>TPiTFT35LCD = 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>Touch:PTouchDevice;</code>
 +
| Touch (STMPE) device for this display
 +
|-
 +
| <code>Backlight:PGPIODevice;</code>
 +
| Backlight GPIO (STMPE) device for this display
 +
|-
 +
| <code>Framebuffer:PFramebufferDevice;</code>
 +
| Framebuffer (HX8357D) device for this display
 +
|-
 +
|}
 +
</div></div>
 +
<br />
  
 
=== Public variables ===
 
=== Public variables ===
 
----
 
----
  
''To be documented''
+
 
 +
'''PiTFT35 specific variables'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>PITFT35_SPI_DEVICE:String = 'SPI0';</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>PITFT35_LCD_CHIPSELECT:Word = SPI_CS_0;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>PITFT35_TOUCH_CHIPSELECT:Word = SPI_CS_1;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>PITFT35_BL_PWM_ENABLE:LongBool = True;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
<br />
  
 
=== Function declarations ===
 
=== Function declarations ===
 
----
 
----
  
''To be documented''
 
  
 +
'''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 PiTFT35Init;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Initialize the PiTFT35 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 PiTFT35Start(Rotation:LongWord; const Device:String; DisplaySelect,TouchSelect:Word):THandle;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Start the PiTFT35 driver and register the Touch, Backlight (GPIO) and Framebuffer devices 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 HX8357D and STMPE610 devices are connected to
 +
|-
 +
! DisplaySelect
 +
| The SPI chip select of the HX8357D LCD controller
 +
|-
 +
! TouchSelect
 +
| The SPI chip select of the STMPE610 touch controller
 +
|-
 +
! Return
 +
| The handle of the PiTFT35 on success or INVALID_HANDLE_VALUE on failure
 +
|-
 +
! Note
 +
| This function will be called during startup if the parameter PITFT35_AUTOSTART is True
 +
Can be called multiple times to support more than one PiTFT 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 PiTFT35Stop(Handle:THandle):Boolean;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Stop the PiTFT35 driver and deregister the Touch, Backlight (GPIO) and Framebuffer devices 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 PiTFT35 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:11, 13 September 2022

Return to Unit Reference


Description


Adafruit PiTFT 3.5" LCD Driver unit

The Adafruit PiTFT 3.5" LCD is a 480 x 320 pixel TFT with resistive touchscreen using a Himax HX8357 driver and a STMicroelectronics STMPE610 resistive touchscreen controller.

This unit ties together the various components needed to make one of these boards work with Ultibo by finding the correct SPI device, creating the STMPE610 Touch device, creating the HX8357D Framebuffer device and registering all of it with the correct parameters for the Adafruit board.

Details:

HX8357D

Width: 320

Height: 480

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_UNKNOWN

Backlight GPIO:

GPIO_PIN_2 (STMPE GPIO)

GPIO_PIN_18 (PWM)

STMPE

Chip: STMPE_CHIP_610

SPI Mode: 0

SPI Frequency: 500000

SPI Chip Select: SPI_CS_1

IRQ GPIO: GPIO_PIN_24 (Trigger: GPIO_TRIGGER_FALLING)(Pull: GPIO_PULL_UP)

Constants



[Expand]
PiTFT35 specific constants PITFT35_*


[Expand]
PiTFT35 GPIO PITFT35_LCD_*


Type definitions



PiTFT35 specific types

[Expand]

PPiTFT35LCD = ^TPiTFT35LCD;

TPiTFT35LCD = record


Public variables



PiTFT35 specific variables

PITFT35_SPI_DEVICE:String = 'SPI0';
PITFT35_LCD_CHIPSELECT:Word = SPI_CS_0;
PITFT35_TOUCH_CHIPSELECT:Word = SPI_CS_1;
PITFT35_BL_PWM_ENABLE:LongBool = True;


Function declarations



Initialization functions

[Expand]
procedure PiTFT35Init;
Description: Initialize the PiTFT35 unit and parameters


[Expand]
function PiTFT35Start(Rotation:LongWord; const Device:String; DisplaySelect,TouchSelect:Word):THandle;
Description: Start the PiTFT35 driver and register the Touch, Backlight (GPIO) and Framebuffer devices associated with the display


[Expand]
function PiTFT35Stop(Handle:THandle):Boolean;
Description: Stop the PiTFT35 driver and deregister the Touch, Backlight (GPIO) and Framebuffer devices associated with the display


Return to Unit Reference