Ultibo API
C/C++ API for Ultibo Core
Loading...
Searching...
No Matches
hx8357d.h File Reference
#include "ultibo/gpio.h"
#include "ultibo/spi.h"
#include "ultibo/framebuffer.h"
#include "ultibo/tftframebuffer.h"

Go to the source code of this file.

Data Structures

struct  _HX8357D_FRAMEBUFFER

Macros

#define HX8357D_FRAMEBUFFER_DESCRIPTION   "Himax HX8357D TFT LCD"
 Description of HX8357D device.
#define HX8357D_SPI_RATE   32000000
 Default SPI clock rate.
#define HX8357D_CMD_NOP   0x00
 6.2.1 NOP: No Operation
#define HX8357D_CMD_SWRESET   0x01
 6.2.2 SWRESET: Software reset
#define HX8357D_CMD_RDDIDIF   0x04
 6.2.3 Read display identification information
#define HX8357D_CMD_SLPIN   0x10
 6.2.14 SLPIN: Sleep in (Enter the minimum power consumption mode) (Wait 120ms)
#define HX8357D_CMD_SLPOUT   0x11
 6.2.15 SLPOUT: Sleep out (Wait 5ms)
#define HX8357D_CMD_PTLON   0x12
 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))
#define HX8357D_CMD_NORON   0x13
 6.2.17 NORON: Normal display mode on (This command returns the display to normal mode)
#define HX8357D_CMD_INVOFF   0x20
 6.2.18 INVOFF: Display inversion off (This command is used to recover from display inversion mode)
#define HX8357D_CMD_INVON   0x21
 6.2.19 INVON: Display inversion on (This command is used to enter into display inversion mode)
#define HX8357D_CMD_ALLPOFF   0x22
 6.2.20 All pixel off (This command turns the display panel black in ‘Sleep Out’ mode)
#define HX8357D_CMD_ALLPON   0x23
 6.2.21 All pixel on (This command turns the display panel white in ‘Sleep Out‘ mode)
#define HX8357D_CMD_DISPOFF   0x28
 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)
#define HX8357D_CMD_DISPON   0x29
 6.2.24 DISPON: Display on (This command is used to recover from DISPLAY OFF mode. Output from the Frame Memory is enabled)
#define HX8357D_CMD_CASET   0x2A
 6.2.25 CASET: Column address set (This command is used to define area of frame memory where MCU can access)
#define HX8357D_CMD_PASET   0x2B
 6.2.26 PASET: Page address set (This command is used to define area of frame memory where MCU can access)
#define HX8357D_CMD_RAMWR   0x2C
 6.2.27 RAMWR: Memory write (This command is used to transfer data from MCU to frame memory)
#define HX8357D_CMD_RAMRD   0x2E
 6.2.28 RAMRD: Memory read (This command is used to transfer data from frame memory to MCU)
#define HX8357D_CMD_TEON   0x35
 6.2.32 TEON: Tearing effect line on
#define HX8357D_CMD_MADCTL   0x36
 6.2.33 MADCTL: Memory access control
#define HX8357D_CMD_COLMOD   0x3A
 6.2.37 COLMOD: Interface pixel format
#define HX8357D_CMD_TESL   0x44
 6.2.40 TESL: Set tear scan line
#define HX8357D_CMD_SETOSC   0xB0
 6.2.73 SETOSC: set internal oscillator
#define HX8357D_CMD_SETPOWER   0xB1
 6.2.74 SETPOWER: set power control
#define HX8357D_CMD_SETRGB   0xB3
 6.2.76 SETRGB: set RGB interface
#define HX8357D_CMD_SETCYC   0xB4
 6.2.77 SETCYC: set display cycle register
#define HX8357D_CMD_SETCOM   0xB6
 6.2.79 SETCOM: set VCOM voltage related register
#define HX8357D_CMD_SETEXTC   0xB9
 6.2.81 SETEXTC: enable extension command (Enable: FFh,83h,57h / Disable: xxh,xxh,xxh)
#define HX8357D_CMD_SETSTBA   0xC0
 6.2.82 SETSTBA: Set Source Option
#define HX8357D_CMD_SETPANEL   0xCC
 6.2.87 SETPanel: set panel characteristic
#define HX8357D_CMD_SETGAMMA   0xE0
 6.2.88 SETGamma: set gamma curve
#define HX8357D_CMD_MADCTL_MY   0x80
 Page Address Order.
#define HX8357D_CMD_MADCTL_MX   0x40
 Column Address Order.
#define HX8357D_CMD_MADCTL_MV   0x20
 Page / Column Selection.
#define HX8357D_CMD_MADCTL_ML   0x10
 Vertical Order.
#define HX8357D_CMD_MADCTL_RGB   0x00
 Colour selector switch control(0=RGB colour filter panel, 1=BGR colour filter panel).
#define HX8357D_CMD_MADCTL_BGR   0x08
#define HX8357D_CMD_MADCTL_SS   0x04
 Horizontal Order.
#define HX8357D_CMD_MADCTL_MH   HX8357D_CMD_MADCTL_SS

Typedefs

typedef struct _HX8357D_FRAMEBUFFER HX8357D_FRAMEBUFFER

Functions

FRAMEBUFFER_DEVICE *STDCALL hx8357d_framebuffer_create (SPI_DEVICE *spi, uint16_t chipselect, char *name, uint32_t rotation, uint32_t width, uint32_t height, GPIO_INFO *rst, GPIO_INFO *dc, GPIO_INFO *bl)
 Create, register and allocate a new HX8357D Framebuffer device which can be accessed using the framebuffer API.
uint32_t STDCALL hx8357d_framebuffer_destroy (FRAMEBUFFER_DEVICE *framebuffer)
 Release, deregister and destroy an HX8357D Framebuffer device created by this driver.

Macro Definition Documentation

◆ HX8357D_FRAMEBUFFER_DESCRIPTION

#define HX8357D_FRAMEBUFFER_DESCRIPTION   "Himax HX8357D TFT LCD"

Description of HX8357D device.

HX8357D specific constants

◆ HX8357D_SPI_RATE

#define HX8357D_SPI_RATE   32000000

Default SPI clock rate.

HX8357D SPI constants

◆ HX8357D_CMD_NOP

#define HX8357D_CMD_NOP   0x00

6.2.1 NOP: No Operation

HX8357D Command constants (See HX8357-D datasheet)

◆ HX8357D_CMD_SWRESET

#define HX8357D_CMD_SWRESET   0x01

6.2.2 SWRESET: Software reset

◆ HX8357D_CMD_RDDIDIF

#define HX8357D_CMD_RDDIDIF   0x04

6.2.3 Read display identification information

◆ HX8357D_CMD_SLPIN

#define HX8357D_CMD_SLPIN   0x10

6.2.14 SLPIN: Sleep in (Enter the minimum power consumption mode) (Wait 120ms)

◆ HX8357D_CMD_SLPOUT

#define HX8357D_CMD_SLPOUT   0x11

6.2.15 SLPOUT: Sleep out (Wait 5ms)

◆ HX8357D_CMD_PTLON

#define HX8357D_CMD_PTLON   0x12

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

#define HX8357D_CMD_NORON   0x13

6.2.17 NORON: Normal display mode on (This command returns the display to normal mode)

◆ HX8357D_CMD_INVOFF

#define HX8357D_CMD_INVOFF   0x20

6.2.18 INVOFF: Display inversion off (This command is used to recover from display inversion mode)

◆ HX8357D_CMD_INVON

#define HX8357D_CMD_INVON   0x21

6.2.19 INVON: Display inversion on (This command is used to enter into display inversion mode)

◆ HX8357D_CMD_ALLPOFF

#define HX8357D_CMD_ALLPOFF   0x22

6.2.20 All pixel off (This command turns the display panel black in ‘Sleep Out’ mode)

◆ HX8357D_CMD_ALLPON

#define HX8357D_CMD_ALLPON   0x23

6.2.21 All pixel on (This command turns the display panel white in ‘Sleep Out‘ mode)

◆ HX8357D_CMD_DISPOFF

#define HX8357D_CMD_DISPOFF   0x28

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

#define HX8357D_CMD_DISPON   0x29

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

#define HX8357D_CMD_CASET   0x2A

6.2.25 CASET: Column address set (This command is used to define area of frame memory where MCU can access)

◆ HX8357D_CMD_PASET

#define HX8357D_CMD_PASET   0x2B

6.2.26 PASET: Page address set (This command is used to define area of frame memory where MCU can access)

◆ HX8357D_CMD_RAMWR

#define HX8357D_CMD_RAMWR   0x2C

6.2.27 RAMWR: Memory write (This command is used to transfer data from MCU to frame memory)

◆ HX8357D_CMD_RAMRD

#define HX8357D_CMD_RAMRD   0x2E

6.2.28 RAMRD: Memory read (This command is used to transfer data from frame memory to MCU)

◆ HX8357D_CMD_TEON

#define HX8357D_CMD_TEON   0x35

6.2.32 TEON: Tearing effect line on

◆ HX8357D_CMD_MADCTL

#define HX8357D_CMD_MADCTL   0x36

6.2.33 MADCTL: Memory access control

◆ HX8357D_CMD_COLMOD

#define HX8357D_CMD_COLMOD   0x3A

6.2.37 COLMOD: Interface pixel format

◆ HX8357D_CMD_TESL

#define HX8357D_CMD_TESL   0x44

6.2.40 TESL: Set tear scan line

◆ HX8357D_CMD_SETOSC

#define HX8357D_CMD_SETOSC   0xB0

6.2.73 SETOSC: set internal oscillator

◆ HX8357D_CMD_SETPOWER

#define HX8357D_CMD_SETPOWER   0xB1

6.2.74 SETPOWER: set power control

◆ HX8357D_CMD_SETRGB

#define HX8357D_CMD_SETRGB   0xB3

6.2.76 SETRGB: set RGB interface

◆ HX8357D_CMD_SETCYC

#define HX8357D_CMD_SETCYC   0xB4

6.2.77 SETCYC: set display cycle register

◆ HX8357D_CMD_SETCOM

#define HX8357D_CMD_SETCOM   0xB6

6.2.79 SETCOM: set VCOM voltage related register

◆ HX8357D_CMD_SETEXTC

#define HX8357D_CMD_SETEXTC   0xB9

6.2.81 SETEXTC: enable extension command (Enable: FFh,83h,57h / Disable: xxh,xxh,xxh)

◆ HX8357D_CMD_SETSTBA

#define HX8357D_CMD_SETSTBA   0xC0

6.2.82 SETSTBA: Set Source Option

◆ HX8357D_CMD_SETPANEL

#define HX8357D_CMD_SETPANEL   0xCC

6.2.87 SETPanel: set panel characteristic

◆ HX8357D_CMD_SETGAMMA

#define HX8357D_CMD_SETGAMMA   0xE0

6.2.88 SETGamma: set gamma curve

◆ HX8357D_CMD_MADCTL_MY

#define HX8357D_CMD_MADCTL_MY   0x80

Page Address Order.

HX8357D Memory access control constants (See HX8357-D datasheet 6.2.33 Memory access control)

◆ HX8357D_CMD_MADCTL_MX

#define HX8357D_CMD_MADCTL_MX   0x40

Column Address Order.

◆ HX8357D_CMD_MADCTL_MV

#define HX8357D_CMD_MADCTL_MV   0x20

Page / Column Selection.

◆ HX8357D_CMD_MADCTL_ML

#define HX8357D_CMD_MADCTL_ML   0x10

Vertical Order.

◆ HX8357D_CMD_MADCTL_RGB

#define HX8357D_CMD_MADCTL_RGB   0x00

Colour selector switch control(0=RGB colour filter panel, 1=BGR colour filter panel).

◆ HX8357D_CMD_MADCTL_BGR

#define HX8357D_CMD_MADCTL_BGR   0x08

◆ HX8357D_CMD_MADCTL_SS

#define HX8357D_CMD_MADCTL_SS   0x04

Horizontal Order.

◆ HX8357D_CMD_MADCTL_MH

#define HX8357D_CMD_MADCTL_MH   HX8357D_CMD_MADCTL_SS

Typedef Documentation

◆ HX8357D_FRAMEBUFFER

HX8357D specific types

Function Documentation

◆ hx8357d_framebuffer_create()

FRAMEBUFFER_DEVICE *STDCALL hx8357d_framebuffer_create ( SPI_DEVICE * spi,
uint16_t chipselect,
char * name,
uint32_t rotation,
uint32_t width,
uint32_t height,
GPIO_INFO * rst,
GPIO_INFO * dc,
GPIO_INFO * bl )

Create, register and allocate a new HX8357D Framebuffer device which can be accessed using the framebuffer API.

HX8357D Functions

Parameters
SPIThe SPI device that this HX8357D is connected to
ChipSelectThe SPI chip select to use when communicating with this device
NameThe text description of this device which will should in the device list (Optional)
RotationThe rotation value for the framebuffer device (eg FRAMEBUFFER_ROTATION_180)
WidthThe width of the framebuffer in pixels
HeightThe height of the framebuffer in pixels
RSTGPIO pin information for the Reset pin (Optional)
DCGPIO pin information for the Data/Command pin
BLGPIO pin information for the Backlight pin (Optional)
Returns
Pointer to the new Framebuffer device or nil if the framebuffer device could not be created

◆ hx8357d_framebuffer_destroy()

uint32_t STDCALL hx8357d_framebuffer_destroy ( FRAMEBUFFER_DEVICE * framebuffer)

Release, deregister and destroy an HX8357D Framebuffer device created by this driver.

Parameters
FramebufferThe Framebuffer device to destroy
Returns
ERROR_SUCCESS if completed or another error code on failure