Ultibo API
C/C++ API for Ultibo Core
Loading...
Searching...
No Matches
ili9340.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  _ILI9340_FRAMEBUFFER

Macros

#define ILI9340_FRAMEBUFFER_DESCRIPTION   "ILITEK ILI9340 TFT LCD"
 Description of ILI9340 device.
#define ILI9340_SPI_RATE   32000000
 Default SPI clock rate.
#define ILI9340_CMD_NOP   0x00
 8.2.1. NOP: No Operation
#define ILI9340_CMD_SWRESET   0x01
 8.2.2. SWRESET: Software Reset
#define ILI9340_CMD_SLPOUT   0x11
 8.2.12. SLPOUT: Sleep Out (This command turns off sleep mode)
#define ILI9340_CMD_GAMSET   0x26
 8.2.17. GAMSET: Gamma Set (This command is used to select the desired Gamma curve for the current display)
#define ILI9340_CMD_DISPOFF   0x28
 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)
#define ILI9340_CMD_DISPON   0x29
 8.2.19. DISPON: Display ON (This command is used to recover from DISPLAY OFF mode. Output from the Frame Memory is enabled)
#define ILI9340_CMD_CASET   0x2A
 8.2.20. CASET: Column Address Set (This command is used to define area of frame memory where MCU can access)
#define ILI9340_CMD_PASET   0x2B
 8.2.21. PASET: Page Address Set (This command is used to define area of frame memory where MCU can access)
#define ILI9340_CMD_RAMWR   0x2C
 8.2.22. Memory Write (This command is used to transfer data from MCU to frame memory)
#define ILI9340_CMD_MADCTL   0x36
 8.2.29. MADCTL: Memory Access Control (This command defines read/write scanning direction of frame memory)
#define ILI9340_CMD_COLMOD   0x3A
 8.2.33. COLMOD: Pixel Format Set (This command sets the pixel format for the RGB image data used by the interface)
#define ILI9340_CMD_FRMCTR1   0xB1
 8.3.2. FRMCTR1: Frame Rate Control (In Normal Mode/Full Colors)
#define ILI9340_CMD_DISCTRL   0xB6
 8.3.7. DISCTRL: Display Function Control
#define ILI9340_CMD_PWCTRL1   0xC0
 8.3.16. PWCTRL1: Power Control 1
#define ILI9340_CMD_PWCTRL2   0xC1
 8.3.17. PWCTRL2: Power Control 2
#define ILI9340_CMD_VMCTRL1   0xC5
 8.3.21. VMCTRL1: VCOM Control 1
#define ILI9340_CMD_VMCTRL2   0xC7
 8.3.22. VMCTRL2: VCOM Control 2
#define ILI9340_CMD_PGAMCTRL   0xE0
 8.3.27. PGAMCTRL: Positive Gamma Correction (Set the gray scale voltage to adjust the gamma characteristics of the TFT panel)
#define ILI9340_CMD_NGAMCTRL   0xE1
 8.3.28. NGAMCTRL: Negative Gamma Correction (Set the gray scale voltage to adjust the gamma characteristics of the TFT panel)
#define ILI9340_CMD_MADCTL_MY   0x80
 Row Address Order.
#define ILI9340_CMD_MADCTL_MX   0x40
 Column Address Order.
#define ILI9340_CMD_MADCTL_MV   0x20
 Row / Column Exchange.
#define ILI9340_CMD_MADCTL_ML   0x10
 Vertical Refresh Order.
#define ILI9340_CMD_MADCTL_RGB   0x00
 Colour selector switch control(0=RGB colour filter panel, 1=BGR colour filter panel).
#define ILI9340_CMD_MADCTL_BGR   0x08
#define ILI9340_CMD_MADCTL_MH   0x04
 Horizontal Refresh Order.

Typedefs

typedef struct _ILI9340_FRAMEBUFFER ILI9340_FRAMEBUFFER

Functions

FRAMEBUFFER_DEVICE *STDCALL ili9340_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 ILI9340 Framebuffer device which can be accessed using the framebuffer API.
uint32_t STDCALL ili9340_framebuffer_destroy (FRAMEBUFFER_DEVICE *framebuffer)
 Release, deregister and destroy an ILI9340 Framebuffer device created by this driver.

Macro Definition Documentation

◆ ILI9340_FRAMEBUFFER_DESCRIPTION

#define ILI9340_FRAMEBUFFER_DESCRIPTION   "ILITEK ILI9340 TFT LCD"

Description of ILI9340 device.

ILI9340 specific constants

◆ ILI9340_SPI_RATE

#define ILI9340_SPI_RATE   32000000

Default SPI clock rate.

ILI9340 SPI constants

◆ ILI9340_CMD_NOP

#define ILI9340_CMD_NOP   0x00

8.2.1. NOP: No Operation

ILI9340 Command constants

◆ ILI9340_CMD_SWRESET

#define ILI9340_CMD_SWRESET   0x01

8.2.2. SWRESET: Software Reset

◆ ILI9340_CMD_SLPOUT

#define ILI9340_CMD_SLPOUT   0x11

8.2.12. SLPOUT: Sleep Out (This command turns off sleep mode)

◆ ILI9340_CMD_GAMSET

#define ILI9340_CMD_GAMSET   0x26

8.2.17. GAMSET: Gamma Set (This command is used to select the desired Gamma curve for the current display)

◆ ILI9340_CMD_DISPOFF

#define ILI9340_CMD_DISPOFF   0x28

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

#define ILI9340_CMD_DISPON   0x29

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

#define ILI9340_CMD_CASET   0x2A

8.2.20. CASET: Column Address Set (This command is used to define area of frame memory where MCU can access)

◆ ILI9340_CMD_PASET

#define ILI9340_CMD_PASET   0x2B

8.2.21. PASET: Page Address Set (This command is used to define area of frame memory where MCU can access)

◆ ILI9340_CMD_RAMWR

#define ILI9340_CMD_RAMWR   0x2C

8.2.22. Memory Write (This command is used to transfer data from MCU to frame memory)

◆ ILI9340_CMD_MADCTL

#define ILI9340_CMD_MADCTL   0x36

8.2.29. MADCTL: Memory Access Control (This command defines read/write scanning direction of frame memory)

◆ ILI9340_CMD_COLMOD

#define ILI9340_CMD_COLMOD   0x3A

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

#define ILI9340_CMD_FRMCTR1   0xB1

8.3.2. FRMCTR1: Frame Rate Control (In Normal Mode/Full Colors)

◆ ILI9340_CMD_DISCTRL

#define ILI9340_CMD_DISCTRL   0xB6

8.3.7. DISCTRL: Display Function Control

◆ ILI9340_CMD_PWCTRL1

#define ILI9340_CMD_PWCTRL1   0xC0

8.3.16. PWCTRL1: Power Control 1

◆ ILI9340_CMD_PWCTRL2

#define ILI9340_CMD_PWCTRL2   0xC1

8.3.17. PWCTRL2: Power Control 2

◆ ILI9340_CMD_VMCTRL1

#define ILI9340_CMD_VMCTRL1   0xC5

8.3.21. VMCTRL1: VCOM Control 1

◆ ILI9340_CMD_VMCTRL2

#define ILI9340_CMD_VMCTRL2   0xC7

8.3.22. VMCTRL2: VCOM Control 2

◆ ILI9340_CMD_PGAMCTRL

#define ILI9340_CMD_PGAMCTRL   0xE0

8.3.27. PGAMCTRL: Positive Gamma Correction (Set the gray scale voltage to adjust the gamma characteristics of the TFT panel)

◆ ILI9340_CMD_NGAMCTRL

#define ILI9340_CMD_NGAMCTRL   0xE1

8.3.28. NGAMCTRL: Negative Gamma Correction (Set the gray scale voltage to adjust the gamma characteristics of the TFT panel)

◆ ILI9340_CMD_MADCTL_MY

#define ILI9340_CMD_MADCTL_MY   0x80

Row Address Order.

ILI9340 Memory access control constants (See ILI9340 datasheet 8.2.29. Memory Access Control)

◆ ILI9340_CMD_MADCTL_MX

#define ILI9340_CMD_MADCTL_MX   0x40

Column Address Order.

◆ ILI9340_CMD_MADCTL_MV

#define ILI9340_CMD_MADCTL_MV   0x20

Row / Column Exchange.

◆ ILI9340_CMD_MADCTL_ML

#define ILI9340_CMD_MADCTL_ML   0x10

Vertical Refresh Order.

◆ ILI9340_CMD_MADCTL_RGB

#define ILI9340_CMD_MADCTL_RGB   0x00

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

◆ ILI9340_CMD_MADCTL_BGR

#define ILI9340_CMD_MADCTL_BGR   0x08

◆ ILI9340_CMD_MADCTL_MH

#define ILI9340_CMD_MADCTL_MH   0x04

Horizontal Refresh Order.

Typedef Documentation

◆ ILI9340_FRAMEBUFFER

ILI9340 specific types

Function Documentation

◆ ili9340_framebuffer_create()

FRAMEBUFFER_DEVICE *STDCALL ili9340_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 ILI9340 Framebuffer device which can be accessed using the framebuffer API.

ILI9340 Functions

Parameters
SPIThe SPI device that this ILI9340 is connected to
ChipSelectThe SPI chip select to use when communicating with this device
NameThe text description of this device which will show 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

◆ ili9340_framebuffer_destroy()

uint32_t STDCALL ili9340_framebuffer_destroy ( FRAMEBUFFER_DEVICE * framebuffer)

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

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