1 /*
2  * Copyright (c) 2016, Freescale Semiconductor, Inc.
3  * Copyright 2016-2017, 2019-2020, 2022 NXP
4  * All rights reserved.
5  *
6  * SPDX-License-Identifier: BSD-3-Clause
7  */
8 
9 #ifndef _FSL_ILI9341_H_
10 #define _FSL_ILI9341_H_
11 
12 #include "fsl_common.h"
13 
14 /*
15  * Change log:
16  *
17  *   1.0.2
18  *     - Add FT9341_Init1.
19  *
20  *   1.0.1
21  *     - Fix MISRA 2012 issues.
22  *
23  *   1.0.0
24  *     - Initial version
25  */
26 
27 /*!
28  * @addtogroup ili9341
29  * @{
30  */
31 
32 /*******************************************************************************
33  * Definitions
34  ******************************************************************************/
35 
36 /* Register defines */
37 #define ILI9341_CMD_RST          0x01
38 #define ILI9341_CMD_SLEEPOUT     0x11
39 #define ILI9341_CMD_GAMMA        0x26
40 #define ILI9341_CMD_DISPLAYOFF   0x28
41 #define ILI9341_CMD_DISPLAYON    0x29
42 #define ILI9341_CMD_COLADDR      0x2A
43 #define ILI9341_CMD_PAGEADDR     0x2B
44 #define ILI9341_CMD_GRAM         0x2C
45 #define ILI9341_CMD_MAC          0x36
46 #define ILI9341_CMD_PIXELFORMAT  0x3A
47 #define ILI9341_CMD_WDB          0x51
48 #define ILI9341_CMD_WCD          0x53
49 #define ILI9341_CMD_RGBINTERFACE 0xB0
50 #define ILI9341_CMD_FRC          0xB1
51 #define ILI9341_CMD_BPC          0xB5
52 #define ILI9341_CMD_DFC          0xB6
53 #define ILI9341_CMD_PWR1         0xC0
54 #define ILI9341_CMD_PWR2         0xC1
55 #define ILI9341_CMD_VCOM1        0xC5
56 #define ILI9341_CMD_VCOM2        0xC7
57 #define ILI9341_CMD_PWRA         0xCB
58 #define ILI9341_CMD_PWRB         0xCF
59 #define ILI9341_CMD_PGAMMA       0xE0
60 #define ILI9341_CMD_NGAMMA       0xE1
61 #define ILI9341_CMD_DTCA         0xE8
62 #define ILI9341_CMD_DTCB         0xEA
63 #define ILI9341_CMD_PWRSEQ       0xED
64 #define ILI9341_CMD_3GAMMAEN     0xF2
65 #define ILI9341_CMD_INTERFACE    0xF6
66 #define ILI9341_CMD_PRC          0xF7
67 #define ILI9341_CMD_INVON        0x21
68 #define ILI9341_CMD_INVOFF       0x20
69 
70 /* 120ms is necessary after reset, for loading ID bytes, VCOM setting,
71  * and other settings from NV memory to registers.
72  */
73 #define ILI9341_RESET_CANCEL_MS 120U
74 
75 typedef void (*ili9341_send_byte_t)(uint8_t dataToSend);
76 typedef void (*ili9341_send_cmd_data_t)(uint8_t cmd, const uint8_t *data, uint32_t dataLen);
77 
78 void FT9341_Init(ili9341_send_byte_t _writeData, ili9341_send_byte_t _writeCommand);
79 
80 void FT9341_Init1(ili9341_send_cmd_data_t sendCmdData);
81 
82 #endif
83