Difference between revisions of "Unit ILI9340"
From Ultibo.org
Line 140: | Line 140: | ||
|- | |- | ||
| <code>ILI9340_CMD_MADCTL_MV = $20;</code> | | <code>ILI9340_CMD_MADCTL_MV = $20;</code> | ||
− | | Row / Column Exchange | + | | Row/Column Exchange |
|- | |- | ||
| <code>ILI9340_CMD_MADCTL_ML = $10;</code> | | <code>ILI9340_CMD_MADCTL_ML = $10;</code> |
Revision as of 04:13, 13 April 2017
Return to Unit Reference
Description
ILITEK ILI9340 TFT LCD Driver unit
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
ILI9340 specific constants
ILI9340_FRAMEBUFFER_*
ILI9340_FRAMEBUFFER_DESCRIPTION = 'ILITEK ILI9340 TFT LCD';
|
Description of ILI9340 device |
ILI9340 SPI
ILI9340_SPI_*
ILI9340_SPI_RATE = 32000000;
|
Default SPI clock rate |
ILI9340 command
ILI9340_CMD_*
ILI9340_CMD_NOP = $00;
|
8.2.1. NOP: No Operation |
ILI9340_CMD_SWRESET = $01;
|
8.2.2. SWRESET: Software Reset |
ILI9340_CMD_SLPOUT = $11;
|
8.2.12. SLPOUT: Sleep Out (This command turns off sleep mode) |
ILI9340_CMD_GAMSET = $26;
|
8.2.17. GAMSET: Gamma Set (This command is used to select the desired Gamma curve for the current display) |
ILI9340_CMD_DISPOFF $28;
|
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) |
ILI9340_CMD_DISPON = $29;
|
8.2.19. DISPON: Display ON (This command is used to recover from DISPLAY OFF mode. Output from the Frame Memory is enabled) |
ILI9340_CMD_CASET = $2A;
|
8.2.20. CASET: Column Address Set (This command is used to define area of frame memory where MCU can access) |
ILI9340_CMD_PASET = $2B;
|
8.2.21. PASET: Page Address Set (This command is used to define area of frame memory where MCU can access) |
ILI9340_CMD_RAMWR = $2C;
|
8.2.22. Memory Write (This command is used to transfer data from MCU to frame memory) |
ILI9340_CMD_MADCTL = $36;
|
8.2.29. MADCTL: Memory Access Control (This command defines read/write scanning direction of frame memory) |
ILI9340_CMD_COLMOD = $3A;
|
8.2.33. COLMOD: Pixel Format Set (This command sets the pixel format for the RGB image data used by the interface) |
ILI9340_CMD_FRMCTR1 = $B1;
|
8.3.2. FRMCTR1: Frame Rate Control (In Normal Mode/Full Colors) |
ILI9340_CMD_DISCTRL = $B6;
|
8.3.7. DISCTRL: Display Function Control |
ILI9340_CMD_PWCTRL1 = $C0;
|
8.3.16. PWCTRL1: Power Control 1 |
ILI9340_CMD_PWCTRL2 = $C1;
|
8.3.17. PWCTRL2: Power Control 2 |
ILI9340_CMD_VMCTRL1 = $C5;
|
8.3.21. VMCTRL1: VCOM Control 1 |
ILI9340_CMD_VMCTRL2 = $C7;
|
8.3.22. VMCTRL2: VCOM Control 2 |
ILI9340_CMD_PGAMCTRL = $E0;
|
8.3.27. PGAMCTRL: Positive Gamma Correction (Set the gray scale voltage to adjust the gamma characteristics of the TFT panel) |
ILI9340_CMD_NGAMCTRL = $E1;
|
8.3.28. NGAMCTRL: Negative Gamma Correction (Set the gray scale voltage to adjust the gamma characteristics of the TFT panel) |
ILI9340 memory access control
ILI9340_CMD_MADCTL_*
See ILI9340 datasheet 8.2.29. Memory Access Control | |
ILI9340_CMD_MADCTL_MY = $80;
|
Row Address Order |
ILI9340_CMD_MADCTL_MX = $40;
|
Column Address Order |
ILI9340_CMD_MADCTL_MV = $20;
|
Row/Column Exchange |
ILI9340_CMD_MADCTL_ML = $10;
|
Vertical Refresh Order |
ILI9340_CMD_MADCTL_RGB = $00;
|
Colour selector switch control(0=RGB colour filter panel, 1=BGR colour filter panel) |
ILI9340_CMD_MADCTL_BGR = $08;
|
|
ILI9340_CMD_MADCTL_MH = $04;
|
Horizontal Refresh Order |
Type definitions
ILI9340 framebuffer
PILI9340Framebuffer = ^TILI9340Framebuffer;
TILI9340Framebuffer = record
TFT Properties | |
TFT:TTFTFramebuffer;
|
Public variables
None defined
Function declarations
ILI9340 functions
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
SPI | The SPI device that this ILI9340 is connected to |
---|---|
ChipSelect | The SPI chip select to use when communicating with this device |
Name | The text description of this device which will should in the device list (Optional) |
Rotation | The rotation value for the framebuffer device (eg FRAMEBUFFER_ROTATION_180) |
Width | The width of the framebuffer in pixels |
Height | The height of the framebuffer in pixels |
RST | GPIO pin information for the Reset pin (Optional) |
DC | GPIO pin information for the Data/Command pin |
BL | GPIO pin information for the Backlight pin (Optional) |
Return | Pointer to the new Framebuffer device or nil if the framebuffer device could not be created |
function ILI9340FramebufferDestroy(Framebuffer:PFramebufferDevice):LongWord;
Description: Release, deregister and destroy an ILI9340 Framebuffer device created by this driver
Framebuffer | The Framebuffer device to destroy |
---|---|
Return | ERROR_SUCCESS if completed or another error code on failure |
ILI9340 framebuffer functions
function ILI9340FramebufferBlank(Framebuffer:PFramebufferDevice; Blank:Boolean):LongWord;
Description: Implementation of FramebufferDeviceBlank API for ILI9340
Note | Not intended to be called directly by applications, use FramebufferDeviceBlank instead |
---|
function ILI9340FramebufferSetBacklight(Framebuffer:PFramebufferDevice; Brightness:LongWord):LongWord;
Description: Implementation of FramebufferDeviceSetBacklight API for ILI9340
Note | Not intended to be called directly by applications, use FramebufferDeviceSetBacklight instead |
---|
ILI9340 TFT framebuffer functions
function ILI9340TFTFramebufferInitialize(Framebuffer:PTFTFramebuffer; Defaults:PFramebufferProperties):LongWord;
Description: Implementation of TFTFramebufferInitialize API for ILI9340
Note | Not intended to be called directly by applications |
---|
function ILI9340TFTFramebufferDeinitialize(Framebuffer:PTFTFramebuffer):LongWord;
Description: Implementation of TFTFramebufferDeinitialize API for ILI9340
Note | Not intended to be called directly by applications |
---|
function ILI9340TFTFramebufferGetDefaults(Framebuffer:PTFTFramebuffer; Properties,Defaults:PFramebufferProperties):LongWord;
Description: Implementation of TFTFramebufferGetDefaults API for ILI9340
Note | Not intended to be called directly by applications |
---|
function ILI9340TFTFramebufferSetWriteAddress(Framebuffer:PTFTFramebuffer; X1,Y1,X2,Y2:LongWord):LongWord;
Description: Implementation of TFTFramebufferSetWriteAddress API for ILI9340
Note | Not intended to be called directly by applications |
---|
function ILI9340TFTFramebufferWriteMemory(Framebuffer:PTFTFramebuffer; Address,Size:LongWord):LongWord;
Description: Implementation of TFTFramebufferWriteMemory API for ILI9340
Note | Not intended to be called directly by applications |
---|
ILI9340 helper functions
function ILI9340WriteCommand(Framebuffer:PTFTFramebuffer; Value:Byte):LongWord;
Description: Write a single command value to the ILI9340
Note | None documented |
---|
function ILI9340WriteCommandEx(Framebuffer:PTFTFramebuffer; const Values:array of Byte):LongWord;
Description: Write multiple command values to the ILI9340
Note | None documented |
---|
function ILI9340WriteData(Framebuffer:PTFTFramebuffer; Value:Byte):LongWord;
Description: Write a single data value to the ILI9340
Note | None documented |
---|
function ILI9340WriteDataEx(Framebuffer:PTFTFramebuffer; const Values:array of Byte):LongWord;
Description: Write multiple data values to the ILI9340
Note | None documented |
---|
Return to Unit Reference