Difference between revisions of "Unit HX8357D"

From Ultibo.org
Jump to: navigation, search
Line 214: Line 214:
 
----
 
----
  
''To be documented''
+
''None defined''
  
 
=== Function declarations ===
 
=== Function declarations ===

Revision as of 02:43, 30 December 2016

Return to Unit Reference


Description


Himax HX8357D TFT LCD Driver unit

The Himax HX8357D is a 320 x 480 RGB, 16M color TFT LCD Single Chip Driver that supports color depths of 16, 18 or 24bit. This driver supports the chip in both 16 and 24 bit depths using RGB888 or RGB565 formats.

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

Constants



HX8357D specific constants HX8357D_*
HX8357D_FRAMEBUFFER_DESCRIPTION = 'Himax HX8357D TFT LCD'; Description of HX8357D device


HX8357D SPI constants HX8357D_SPI_*
HX8357D_SPI_RATE = 32000000; Default SPI clock rate


HX8357D command constants HX8357D_CMD_*
See HX8357-D datasheet
 
HX8357D_CMD_NOP = $00; 6.2.1 NOP: No Operation
HX8357D_CMD_SWRESET = $01; 6.2.2 SWRESET: Software reset
 
HX8357D_CMD_RDDIDIF = $04; 6.2.3 Read display identification information
 
HX8357D_CMD_SLPIN = $10; 6.2.14 SLPIN: Sleep in (Enter the minimum power consumption mode) (Wait 120ms)
HX8357D_CMD_SLPOUT = $11; 6.2.15 SLPOUT: Sleep out (Wait 5ms)
 
HX8357D_CMD_PTLON = $12; 6.2.16 PTLON: Partial mode on (This command turns on partial mode. The partial mode window is described by the Partial Area command (30H))
HX8357D_CMD_NORON = $13; 6.2.17 NORON: Normal display mode on (This command returns the display to normal mode)
 
HX8357D_CMD_INVOFF = $20; 6.2.18 INVOFF: Display inversion off (This command is used to recover from display inversion mode)
HX8357D_CMD_INVON = $21; 6.2.19 INVON: Display inversion on (This command is used to enter into display inversion mode)
 
HX8357D_CMD_ALLPOFF = $22; 6.2.20 All pixel off (This command turns the display panel black in ‘Sleep Out’ mode)
HX8357D_CMD_ALLPON = $23; 6.2.21 All pixel on (This command turns the display panel white in ‘Sleep Out‘ mode)
 
HX8357D_CMD_DISPOFF = $28; 6.2.23 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)
HX8357D_CMD_DISPON = $29; 6.2.24 DISPON: Display on (This command is used to recover from DISPLAY OFF mode. Output from the Frame Memory is enabled)
 
HX8357D_CMD_CASET = $2A; 6.2.25 CASET: Column address set (This command is used to define area of frame memory where MCU can access)
HX8357D_CMD_PASET = $2B; 6.2.26 PASET: Page address set (This command is used to define area of frame memory where MCU can access)
HX8357D_CMD_RAMWR = $2C; 6.2.27 RAMWR: Memory write (This command is used to transfer data from MCU to frame memory)
HX8357D_CMD_RAMRD = $2E; 6.2.28 RAMRD: Memory read (This command is used to transfer data from frame memory to MCU)
 
HX8357D_CMD_TEON = $35; 6.2.32 TEON: Tearing effect line on
 
HX8357D_CMD_MADCTL = $36; 6.2.33 MADCTL: Memory access control
HX8357D_CMD_COLMOD = $3A; 6.2.37 COLMOD: Interface pixel format
 
HX8357D_CMD_TESL = $44; 6.2.40 TESL: Set tear scan line
 
HX8357D_CMD_SETOSC = $B0; 6.2.73 SETOSC: set internal oscillator
HX8357D_CMD_SETPOWER = $B1; 6.2.74 SETPOWER: set power control
HX8357D_CMD_SETRGB = $B3; 6.2.76 SETRGB: set RGB interface
HX8357D_CMD_SETCYC = $B4; 6.2.77 SETCYC: set display cycle register
HX8357D_CMD_SETCOM = $B6; 6.2.79 SETCOM: set VCOM voltage related register
 
HX8357D_CMD_SETEXTC = $B9; 6.2.81 SETEXTC: enable extension command (Enable: FFh,83h,57h / Disable: xxh,xxh,xxh)
 
HX8357D_CMD_SETSTBA = $C0; 6.2.82 SETSTBA: Set Source Option
 
HX8357D_CMD_SETPANEL = $CC; 6.2.87 SETPanel: set panel characteristic
 
HX8357D_CMD_SETGAMMA = $E0; 6.2.88 SETGamma: set gamma curve


HX8357D memory access control constants HX8357D_CMD_MADCTL_*
See HX8357-D datasheet 6.2.33 Memory access control
 
HX8357D_CMD_MADCTL_MY = $80; Page Address Order
HX8357D_CMD_MADCTL_MX = $40; Column Address Order
HX8357D_CMD_MADCTL_MV = $20; Page / Column Selection
HX8357D_CMD_MADCTL_ML = $10; Vertical Order
HX8357D_CMD_MADCTL_RGB = $00; Colour selector switch control(0=RGB colour filter panel, 1=BGR colour filter panel)
HX8357D_CMD_MADCTL_BGR = $08;  
HX8357D_CMD_MADCTL_SS = $04; Horizontal Order
HX8357D_CMD_MADCTL_MH = HX8357D_CMD_MADCTL_SS;  


Type definitions


To be documented

Public variables


None defined

Function declarations



HX8357D functions

function HX8357DFramebufferCreate(SPI:PSPIDevice; ChipSelect:Word; const Name:String; Rotation,Width,Height:LongWord; RST,DC,BL:PGPIOInfo):PFramebufferDevice;
Description: Create, register and allocate a new HX8357D Framebuffer device which can be accessed using the framebuffer API
SPI The SPI device that this HX8357D 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)
Rotaion 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 HX8357DFramebufferDestroy(Framebuffer:PFramebufferDevice):LongWord;
Description: Release, deregister and destroy an HX8357D Framebuffer device created by this driver
Framebuffer The Framebuffer device to destroy
Return ERROR_SUCCESS if completed or another error code on failure


HX8357D framebuffer functions

function HX8357DFramebufferBlank(Framebuffer:PFramebufferDevice; Blank:Boolean):LongWord;
Description: Implementation of FramebufferDeviceBlank API for HX8357D
Note Not intended to be called directly by applications, use FramebufferDeviceBlank instead


function HX8357DFramebufferSetBacklight(Framebuffer:PFramebufferDevice; Brightness:LongWord):LongWord;
Description: Implementation of FramebufferDeviceSetBacklight API for HX8357D
Note Not intended to be called directly by applications, use FramebufferDeviceSetBacklight instead


HX8357D TFT framebuffer functions

function HX8357DTFTFramebufferInitialize(Framebuffer:PTFTFramebuffer; Defaults:PFramebufferProperties):LongWord;
Description: Implementation of TFTFramebufferInitialize API for HX8357D
Note Not intended to be called directly by applications


function HX8357DTFTFramebufferDeinitialize(Framebuffer:PTFTFramebuffer):LongWord;
Description: Implementation of TFTFramebufferDeinitialize API for HX8357D
Note Not intended to be called directly by applications


function HX8357DTFTFramebufferGetDefaults(Framebuffer:PTFTFramebuffer; Properties,Defaults:PFramebufferProperties):LongWord;
Description: Implementation of TFTFramebufferGetDefaults API for HX8357D
Note Not intended to be called directly by applications


function HX8357DTFTFramebufferSetWriteAddress(Framebuffer:PTFTFramebuffer; X1,Y1,X2,Y2:LongWord):LongWord;
Description: Implementation of TFTFramebufferSetWriteAddress API for HX8357D
Note Not intended to be called directly by applications


function HX8357DTFTFramebufferWriteMemory(Framebuffer:PTFTFramebuffer; Address,Size:LongWord):LongWord;
Description: Implementation of TFTFramebufferWriteMemory API for HX8357D
Note Not intended to be called directly by applications


HX8357D helper functions

function HX8357DWriteCommand(Framebuffer:PTFTFramebuffer; Value:Byte):LongWord;
Description: Write a single command value to the HX8357D
Note None documented


function HX8357DWriteCommandEx(Framebuffer:PTFTFramebuffer; const Values:array of Byte):LongWord;
Description: Write multiple command values to the HX8357D
Note None documented


function HX8357DWriteData(Framebuffer:PTFTFramebuffer; Value:Byte):LongWord;
Description: Write a single data value to the HX8357D
Note None documented


function HX8357DWriteDataEx(Framebuffer:PTFTFramebuffer; const Values:array of Byte):LongWord;
Description: Write multiple data values to the HX8357D
Note None documented


Return to Unit Reference