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 /* Use DBI interface */ 36 #ifndef ILI9341_USE_DBI_IFACE 37 #define ILI9341_USE_DBI_IFACE 0 38 #endif 39 40 /* Register defines */ 41 #define ILI9341_CMD_RST 0x01 42 #define ILI9341_CMD_SLEEPOUT 0x11 43 #define ILI9341_CMD_GAMMA 0x26 44 #define ILI9341_CMD_DISPLAYOFF 0x28 45 #define ILI9341_CMD_DISPLAYON 0x29 46 #define ILI9341_CMD_COLADDR 0x2A 47 #define ILI9341_CMD_PAGEADDR 0x2B 48 #define ILI9341_CMD_GRAM 0x2C 49 #define ILI9341_CMD_MAC 0x36 50 #define ILI9341_CMD_PIXELFORMAT 0x3A 51 #define ILI9341_CMD_WDB 0x51 52 #define ILI9341_CMD_WCD 0x53 53 #define ILI9341_CMD_RGBINTERFACE 0xB0 54 #define ILI9341_CMD_FRC 0xB1 55 #define ILI9341_CMD_BPC 0xB5 56 #define ILI9341_CMD_DFC 0xB6 57 #define ILI9341_CMD_PWR1 0xC0 58 #define ILI9341_CMD_PWR2 0xC1 59 #define ILI9341_CMD_VCOM1 0xC5 60 #define ILI9341_CMD_VCOM2 0xC7 61 #define ILI9341_CMD_PWRA 0xCB 62 #define ILI9341_CMD_PWRB 0xCF 63 #define ILI9341_CMD_PGAMMA 0xE0 64 #define ILI9341_CMD_NGAMMA 0xE1 65 #define ILI9341_CMD_DTCA 0xE8 66 #define ILI9341_CMD_DTCB 0xEA 67 #define ILI9341_CMD_PWRSEQ 0xED 68 #define ILI9341_CMD_3GAMMAEN 0xF2 69 #define ILI9341_CMD_INTERFACE 0xF6 70 #define ILI9341_CMD_PRC 0xF7 71 #define ILI9341_CMD_INVON 0x21 72 #define ILI9341_CMD_INVOFF 0x20 73 74 #if ILI9341_USE_DBI_IFACE 75 #include "fsl_dbi.h" 76 77 typedef struct _ili9341_handle 78 { 79 dbi_iface_t *dbiIface; 80 } ili9341_handle_t; 81 82 typedef struct _ili9341_config 83 { 84 uint32_t reserved; 85 } ili9341_config_t; 86 87 #endif /* ILI9341_USE_DBI_IFACE */ 88 89 /* 120ms is necessary after reset, for loading ID bytes, VCOM setting, 90 * and other settings from NV memory to registers. 91 */ 92 #define ILI9341_RESET_CANCEL_MS 120U 93 94 typedef void (*ili9341_send_byte_t)(uint8_t dataToSend); 95 96 typedef void (*ili9341_send_cmd_data_t)(uint8_t cmd, const uint8_t *data, uint32_t dataLen); 97 98 void FT9341_Init(ili9341_send_byte_t _writeData, ili9341_send_byte_t _writeCommand); 99 100 void FT9341_Init1(ili9341_send_cmd_data_t sendCmdData); 101 102 #if ILI9341_USE_DBI_IFACE 103 status_t ILI9341_InitDBI(ili9341_handle_t *handle, const ili9341_config_t *config, dbi_iface_t *dbiIface); 104 #endif 105 106 /*! @} */ 107 108 #endif /* _FSL_ILI9341_H_ */ 109