Difference between revisions of "Unit ILI9340"

From Ultibo.org
Jump to: navigation, search
Line 12: Line 12:
 
----
 
----
  
''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;">'''ILI9340 specific constants''' <code> ILI9340_FRAMEBUFFER_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>ILI9340_FRAMEBUFFER_DESCRIPTION = 'ILITEK ILI9340 TFT LCD';</code>
 +
| Description of ILI9340 device
 +
|-
 +
|}
 +
</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;">'''ILI9340 SPI constants''' <code> ILI9340_SPI_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>ILI9340_SPI_RATE = 32000000;</code>
 +
| Default SPI clock rate
 +
|-
 +
|}
 +
</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;">'''ILI9340 command constants''' <code> ILI9340_CMD_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>ILI9340_CMD_NOP = $00;</code>
 +
| 8.2.1. NOP: No Operation
 +
|-
 +
| <code>ILI9340_CMD_SWRESET = $01;</code>
 +
| 8.2.2. SWRESET: Software Reset
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>ILI9340_CMD_SLPOUT = $11;</code>
 +
| 8.2.12. SLPOUT: Sleep Out (This command turns off sleep mode)
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>ILI9340_CMD_GAMSET = $26;</code>
 +
| 8.2.17. GAMSET: Gamma Set (This command is used to select the desired Gamma curve for the current display)
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>ILI9340_CMD_DISPOFF  $28;</code>
 +
| 8.2.18. DISPOFF: Display OFF (This command is used to enter into DISPLAY OFF mode. In this mode, the output from Frame Memory is disabled and blank page inserted)
 +
|-
 +
| <code>ILI9340_CMD_DISPON = $29;</code>
 +
| 8.2.19. DISPON: Display ON (This command is used to recover from DISPLAY OFF mode. Output from the Frame Memory is enabled)
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>ILI9340_CMD_CASET = $2A;</code>
 +
| 8.2.20. CASET: Column Address Set (This command is used to define area of frame memory where MCU can access)
 +
|-
 +
| <code>ILI9340_CMD_PASET = $2B;</code>
 +
| 8.2.21. PASET: Page Address Set (This command is used to define area of frame memory where MCU can access)
 +
|-
 +
| <code>ILI9340_CMD_RAMWR = $2C;</code>
 +
| 8.2.22. Memory Write (This command is used to transfer data from MCU to frame memory)
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>ILI9340_CMD_MADCTL = $36;</code>
 +
| 8.2.29. MADCTL: Memory Access Control (This command defines read/write scanning direction of frame memory)
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>ILI9340_CMD_COLMOD = $3A;</code>
 +
| 8.2.33. COLMOD: Pixel Format Set (This command sets the pixel format for the RGB image data used by the interface)
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>ILI9340_CMD_FRMCTR1 = $B1;</code>
 +
| 8.3.2. FRMCTR1: Frame Rate Control (In Normal Mode/Full Colors)
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>ILI9340_CMD_DISCTRL = $B6;</code>
 +
| 8.3.7. DISCTRL: Display Function Control
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>ILI9340_CMD_PWCTRL1 = $C0;</code>
 +
| 8.3.16. PWCTRL1: Power Control 1
 +
|-
 +
| <code>ILI9340_CMD_PWCTRL2 = $C1;</code>
 +
| 8.3.17. PWCTRL2: Power Control 2
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>ILI9340_CMD_VMCTRL1 = $C5;</code>
 +
| 8.3.21. VMCTRL1: VCOM Control 1
 +
|-
 +
| <code>ILI9340_CMD_VMCTRL2 = $C7;</code>
 +
| 8.3.22. VMCTRL2: VCOM Control 2
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>ILI9340_CMD_PGAMCTRL = $E0;</code>
 +
| 8.3.27. PGAMCTRL: Positive Gamma Correction (Set the gray scale voltage to adjust the gamma characteristics of the TFT panel)
 +
|-
 +
| <code>ILI9340_CMD_NGAMCTRL = $E1;</code>
 +
| 8.3.28. NGAMCTRL: Negative Gamma Correction (Set the gray scale voltage to adjust the gamma characteristics of the TFT panel)
 +
|-
 +
|}
 +
</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;">'''ILI9340 memory access control constants''' <code> ILI9340_CMD_MADCTL_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|See ILI9340 datasheet 8.2.29. Memory Access Control
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>ILI9340_CMD_MADCTL_MY = $80;</code>
 +
| Row Address Order
 +
|-
 +
| <code>ILI9340_CMD_MADCTL_MX = $40;</code>
 +
| Column Address Order
 +
|-
 +
| <code>ILI9340_CMD_MADCTL_MV = $20;</code>
 +
| Row / Column Exchange
 +
|-
 +
| <code>ILI9340_CMD_MADCTL_ML = $10;</code>
 +
| Vertical Refresh Order
 +
|-
 +
| <code>ILI9340_CMD_MADCTL_RGB = $00;</code>
 +
| Colour selector switch control(0=RGB colour filter panel, 1=BGR colour filter panel)
 +
|-
 +
| <code>ILI9340_CMD_MADCTL_BGR = $08;</code>
 +
| &nbsp;
 +
|-
 +
| <code>ILI9340_CMD_MADCTL_MH = $04;</code>
 +
| Horizontal Refresh Order
 +
|-
 +
|}
 +
</div></div>
 +
<br />
  
 
=== Type definitions ===
 
=== Type definitions ===

Revision as of 03:08, 13 December 2016

Return to Unit Reference


Description


The ILITEK ILI9340 is a 240x320 Resolution RGB 262K color TFT LCD Single Chip Driver that supports color depths of 16 or 18bit. This driver supports the chip only in 16 bit depth using RGB565 format.

The chip provides an SPI interface at up to 32MHz and supports rotations of 0, 90, 180 and 270 degrees.

Constants



[Expand]
ILI9340 specific constants ILI9340_FRAMEBUFFER_*


[Expand]
ILI9340 SPI constants ILI9340_SPI_*


[Expand]
ILI9340 command constants ILI9340_CMD_*


[Expand]
ILI9340 memory access control constants ILI9340_CMD_MADCTL_*


Type definitions


To be documented

Public variables


To be documented

Function declarations



ILI9340 functions

[Expand]
function ILI9340FramebufferCreate(SPI:PSPIDevice; ChipSelect:Word; const Name:String; Rotation,Width,Height:LongWord; RST,DC,BL:PGPIOInfo):PFramebufferDevice;
Description: Create, register and allocate a new ILI9340 Framebuffer device which can be accessed using the framebuffer API


[Expand]
function ILI9340FramebufferDestroy(Framebuffer:PFramebufferDevice):LongWord;
Description: Release, deregister and destroy an ILI9340 Framebuffer device created by this driver


ILI9340 framebuffer functions

[Expand]
function ILI9340FramebufferBlank(Framebuffer:PFramebufferDevice; Blank:Boolean):LongWord;
Description: Implementation of FramebufferDeviceBlank API for ILI9340


[Expand]
function ILI9340FramebufferSetBacklight(Framebuffer:PFramebufferDevice; Brightness:LongWord):LongWord;
Description: Implementation of FramebufferDeviceSetBacklight API for ILI9340


ILI9340 TFT framebuffer functions

[Expand]
function ILI9340TFTFramebufferInitialize(Framebuffer:PTFTFramebuffer; Defaults:PFramebufferProperties):LongWord;
Description: Implementation of TFTFramebufferInitialize API for ILI9340


[Expand]
function ILI9340TFTFramebufferDeinitialize(Framebuffer:PTFTFramebuffer):LongWord;
Description: Implementation of TFTFramebufferDeinitialize API for ILI9340


[Expand]
function ILI9340TFTFramebufferGetDefaults(Framebuffer:PTFTFramebuffer; Properties,Defaults:PFramebufferProperties):LongWord;
Description: Implementation of TFTFramebufferGetDefaults API for ILI9340


[Expand]
function ILI9340TFTFramebufferSetWriteAddress(Framebuffer:PTFTFramebuffer; X1,Y1,X2,Y2:LongWord):LongWord;
Description: Implementation of TFTFramebufferSetWriteAddress API for ILI9340


[Expand]
function ILI9340TFTFramebufferWriteMemory(Framebuffer:PTFTFramebuffer; Address,Size:LongWord):LongWord;
Description: Implementation of TFTFramebufferWriteMemory API for ILI9340


ILI9340 helper functions

[Expand]
function ILI9340WriteCommand(Framebuffer:PTFTFramebuffer; Value:Byte):LongWord;
Description: Write a single command value to the ILI9340


[Expand]
function ILI9340WriteCommandEx(Framebuffer:PTFTFramebuffer; const Values:array of Byte):LongWord;
Description: Write multiple command values to the ILI9340


[Expand]
function ILI9340WriteData(Framebuffer:PTFTFramebuffer; Value:Byte):LongWord;
Description: Write a single data value to the ILI9340


[Expand]
function ILI9340WriteDataEx(Framebuffer:PTFTFramebuffer; const Values:array of Byte):LongWord;
Description: Write multiple data values to the ILI9340


Return to Unit Reference