STM32F469NI Discovery board drivers

Dependents:   DISCO-F469NI_LCDTS_GUI_demo Configurable_Robots DISCO-F469NI_LCD_demo DISCO-F469NI_SD_demo ... more

Committer:
aa6164
Date:
Wed Jun 09 12:45:23 2021 +0000
Revision:
4:27609b3a44ed
Parent:
2:123b894b49dd
Updated wait_ms() to thread_sleep_for() for Mbed OS 6+

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jerome Coutant 2:123b894b49dd 1 /**
Jerome Coutant 2:123b894b49dd 2 ******************************************************************************
Jerome Coutant 2:123b894b49dd 3 * @file otm8009a.c
Jerome Coutant 2:123b894b49dd 4 * @author MCD Application Team
Jerome Coutant 2:123b894b49dd 5 * @version V1.0.2
Jerome Coutant 2:123b894b49dd 6 * @date 27-January-2017
Jerome Coutant 2:123b894b49dd 7 * @brief This file provides the LCD Driver for KoD KM-040TMP-02-0621 (WVGA)
Jerome Coutant 2:123b894b49dd 8 * DSI LCD Display OTM8009A.
Jerome Coutant 2:123b894b49dd 9 ******************************************************************************
Jerome Coutant 2:123b894b49dd 10 * @attention
Jerome Coutant 2:123b894b49dd 11 *
Jerome Coutant 2:123b894b49dd 12 * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
Jerome Coutant 2:123b894b49dd 13 *
Jerome Coutant 2:123b894b49dd 14 * Redistribution and use in source and binary forms, with or without modification,
Jerome Coutant 2:123b894b49dd 15 * are permitted provided that the following conditions are met:
Jerome Coutant 2:123b894b49dd 16 * 1. Redistributions of source code must retain the above copyright notice,
Jerome Coutant 2:123b894b49dd 17 * this list of conditions and the following disclaimer.
Jerome Coutant 2:123b894b49dd 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
Jerome Coutant 2:123b894b49dd 19 * this list of conditions and the following disclaimer in the documentation
Jerome Coutant 2:123b894b49dd 20 * and/or other materials provided with the distribution.
Jerome Coutant 2:123b894b49dd 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Jerome Coutant 2:123b894b49dd 22 * may be used to endorse or promote products derived from this software
Jerome Coutant 2:123b894b49dd 23 * without specific prior written permission.
Jerome Coutant 2:123b894b49dd 24 *
Jerome Coutant 2:123b894b49dd 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Jerome Coutant 2:123b894b49dd 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Jerome Coutant 2:123b894b49dd 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Jerome Coutant 2:123b894b49dd 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Jerome Coutant 2:123b894b49dd 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Jerome Coutant 2:123b894b49dd 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Jerome Coutant 2:123b894b49dd 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Jerome Coutant 2:123b894b49dd 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Jerome Coutant 2:123b894b49dd 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Jerome Coutant 2:123b894b49dd 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Jerome Coutant 2:123b894b49dd 35 *
Jerome Coutant 2:123b894b49dd 36 ******************************************************************************
Jerome Coutant 2:123b894b49dd 37 */
Jerome Coutant 2:123b894b49dd 38
Jerome Coutant 2:123b894b49dd 39 /* Includes ------------------------------------------------------------------*/
Jerome Coutant 2:123b894b49dd 40 #include "otm8009a.h"
Jerome Coutant 2:123b894b49dd 41
Jerome Coutant 2:123b894b49dd 42 /** @addtogroup BSP
Jerome Coutant 2:123b894b49dd 43 * @{
Jerome Coutant 2:123b894b49dd 44 */
Jerome Coutant 2:123b894b49dd 45
Jerome Coutant 2:123b894b49dd 46 /** @addtogroup Components
Jerome Coutant 2:123b894b49dd 47 * @{
Jerome Coutant 2:123b894b49dd 48 */
Jerome Coutant 2:123b894b49dd 49
Jerome Coutant 2:123b894b49dd 50 /** @defgroup OTM8009A OTM8009A
Jerome Coutant 2:123b894b49dd 51 * @brief This file provides a set of functions needed to drive the
Jerome Coutant 2:123b894b49dd 52 * otm8009a IC display driver.
Jerome Coutant 2:123b894b49dd 53 * @{
Jerome Coutant 2:123b894b49dd 54 */
Jerome Coutant 2:123b894b49dd 55
Jerome Coutant 2:123b894b49dd 56 /* Private types -------------------------------------------------------------*/
Jerome Coutant 2:123b894b49dd 57 /* Private variables ---------------------------------------------------------*/
Jerome Coutant 2:123b894b49dd 58 /* Private constants ---------------------------------------------------------*/
Jerome Coutant 2:123b894b49dd 59 /** @defgroup OTM8009A_Private_Constants OTM8009A Private Constants
Jerome Coutant 2:123b894b49dd 60 * @{
Jerome Coutant 2:123b894b49dd 61 */
Jerome Coutant 2:123b894b49dd 62
Jerome Coutant 2:123b894b49dd 63 /*
Jerome Coutant 2:123b894b49dd 64 * @brief Constant tables of register settings used to transmit DSI
Jerome Coutant 2:123b894b49dd 65 * command packets as power up initialization sequence of the KoD LCD (OTM8009A LCD Driver)
Jerome Coutant 2:123b894b49dd 66 */
Jerome Coutant 2:123b894b49dd 67 const uint8_t lcdRegData1[] = {0x80,0x09,0x01,0xFF};
Jerome Coutant 2:123b894b49dd 68 const uint8_t lcdRegData2[] = {0x80,0x09,0xFF};
Jerome Coutant 2:123b894b49dd 69 const uint8_t lcdRegData3[] = {0x00,0x09,0x0F,0x0E,0x07,0x10,0x0B,0x0A,0x04,0x07,0x0B,0x08,0x0F,0x10,0x0A,0x01,0xE1};
Jerome Coutant 2:123b894b49dd 70 const uint8_t lcdRegData4[] = {0x00,0x09,0x0F,0x0E,0x07,0x10,0x0B,0x0A,0x04,0x07,0x0B,0x08,0x0F,0x10,0x0A,0x01,0xE2};
Jerome Coutant 2:123b894b49dd 71 const uint8_t lcdRegData5[] = {0x79,0x79,0xD8};
Jerome Coutant 2:123b894b49dd 72 const uint8_t lcdRegData6[] = {0x00,0x01,0xB3};
Jerome Coutant 2:123b894b49dd 73 const uint8_t lcdRegData7[] = {0x85,0x01,0x00,0x84,0x01,0x00,0xCE};
Jerome Coutant 2:123b894b49dd 74 const uint8_t lcdRegData8[] = {0x18,0x04,0x03,0x39,0x00,0x00,0x00,0x18,0x03,0x03,0x3A,0x00,0x00,0x00,0xCE};
Jerome Coutant 2:123b894b49dd 75 const uint8_t lcdRegData9[] = {0x18,0x02,0x03,0x3B,0x00,0x00,0x00,0x18,0x01,0x03,0x3C,0x00,0x00,0x00,0xCE};
Jerome Coutant 2:123b894b49dd 76 const uint8_t lcdRegData10[] = {0x01,0x01,0x20,0x20,0x00,0x00,0x01,0x02,0x00,0x00,0xCF};
Jerome Coutant 2:123b894b49dd 77 const uint8_t lcdRegData11[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xCB};
Jerome Coutant 2:123b894b49dd 78 const uint8_t lcdRegData12[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xCB};
Jerome Coutant 2:123b894b49dd 79 const uint8_t lcdRegData13[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xCB};
Jerome Coutant 2:123b894b49dd 80 const uint8_t lcdRegData14[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xCB};
Jerome Coutant 2:123b894b49dd 81 const uint8_t lcdRegData15[] = {0x00,0x04,0x04,0x04,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xCB};
Jerome Coutant 2:123b894b49dd 82 const uint8_t lcdRegData16[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x04,0x04,0x04,0x00,0x00,0x00,0x00,0xCB};
Jerome Coutant 2:123b894b49dd 83 const uint8_t lcdRegData17[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xCB};
Jerome Coutant 2:123b894b49dd 84 const uint8_t lcdRegData18[] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xCB};
Jerome Coutant 2:123b894b49dd 85 const uint8_t lcdRegData19[] = {0x00,0x26,0x09,0x0B,0x01,0x25,0x00,0x00,0x00,0x00,0xCC};
Jerome Coutant 2:123b894b49dd 86 const uint8_t lcdRegData20[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x26,0x0A,0x0C,0x02,0xCC};
Jerome Coutant 2:123b894b49dd 87 const uint8_t lcdRegData21[] = {0x25,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xCC};
Jerome Coutant 2:123b894b49dd 88 const uint8_t lcdRegData22[] = {0x00,0x25,0x0C,0x0A,0x02,0x26,0x00,0x00,0x00,0x00,0xCC};
Jerome Coutant 2:123b894b49dd 89 const uint8_t lcdRegData23[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x25,0x0B,0x09,0x01,0xCC};
Jerome Coutant 2:123b894b49dd 90 const uint8_t lcdRegData24[] = {0x26,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xCC};
Jerome Coutant 2:123b894b49dd 91 const uint8_t lcdRegData25[] = {0xFF,0xFF,0xFF,0xFF};
Jerome Coutant 2:123b894b49dd 92 /*
Jerome Coutant 2:123b894b49dd 93 * CASET value (Column Address Set) : X direction LCD GRAM boundaries
Jerome Coutant 2:123b894b49dd 94 * depending on LCD orientation mode and PASET value (Page Address Set) : Y direction
Jerome Coutant 2:123b894b49dd 95 * LCD GRAM boundaries depending on LCD orientation mode
Jerome Coutant 2:123b894b49dd 96 * XS[15:0] = 0x000 = 0, XE[15:0] = 0x31F = 799 for landscape mode : apply to CASET
Jerome Coutant 2:123b894b49dd 97 * YS[15:0] = 0x000 = 0, YE[15:0] = 0x31F = 799 for portrait mode : : apply to PASET
Jerome Coutant 2:123b894b49dd 98 */
Jerome Coutant 2:123b894b49dd 99 const uint8_t lcdRegData27[] = {0x00, 0x00, 0x03, 0x1F, OTM8009A_CMD_CASET};
Jerome Coutant 2:123b894b49dd 100 /*
Jerome Coutant 2:123b894b49dd 101 * XS[15:0] = 0x000 = 0, XE[15:0] = 0x1DF = 479 for portrait mode : apply to CASET
Jerome Coutant 2:123b894b49dd 102 * YS[15:0] = 0x000 = 0, YE[15:0] = 0x1DF = 479 for landscape mode : apply to PASET
Jerome Coutant 2:123b894b49dd 103 */
Jerome Coutant 2:123b894b49dd 104 const uint8_t lcdRegData28[] = {0x00, 0x00, 0x01, 0xDF, OTM8009A_CMD_PASET};
Jerome Coutant 2:123b894b49dd 105
Jerome Coutant 2:123b894b49dd 106
Jerome Coutant 2:123b894b49dd 107 const uint8_t ShortRegData1[] = {OTM8009A_CMD_NOP, 0x00};
Jerome Coutant 2:123b894b49dd 108 const uint8_t ShortRegData2[] = {OTM8009A_CMD_NOP, 0x80};
Jerome Coutant 2:123b894b49dd 109 const uint8_t ShortRegData3[] = {0xC4, 0x30};
Jerome Coutant 2:123b894b49dd 110 const uint8_t ShortRegData4[] = {OTM8009A_CMD_NOP, 0x8A};
Jerome Coutant 2:123b894b49dd 111 const uint8_t ShortRegData5[] = {0xC4, 0x40};
Jerome Coutant 2:123b894b49dd 112 const uint8_t ShortRegData6[] = {OTM8009A_CMD_NOP, 0xB1};
Jerome Coutant 2:123b894b49dd 113 const uint8_t ShortRegData7[] = {0xC5, 0xA9};
Jerome Coutant 2:123b894b49dd 114 const uint8_t ShortRegData8[] = {OTM8009A_CMD_NOP, 0x91};
Jerome Coutant 2:123b894b49dd 115 const uint8_t ShortRegData9[] = {0xC5, 0x34};
Jerome Coutant 2:123b894b49dd 116 const uint8_t ShortRegData10[] = {OTM8009A_CMD_NOP, 0xB4};
Jerome Coutant 2:123b894b49dd 117 const uint8_t ShortRegData11[] = {0xC0, 0x50};
Jerome Coutant 2:123b894b49dd 118 const uint8_t ShortRegData12[] = {0xD9, 0x4E};
Jerome Coutant 2:123b894b49dd 119 const uint8_t ShortRegData13[] = {OTM8009A_CMD_NOP, 0x81};
Jerome Coutant 2:123b894b49dd 120 const uint8_t ShortRegData14[] = {0xC1, 0x66};
Jerome Coutant 2:123b894b49dd 121 const uint8_t ShortRegData15[] = {OTM8009A_CMD_NOP, 0xA1};
Jerome Coutant 2:123b894b49dd 122 const uint8_t ShortRegData16[] = {0xC1, 0x08};
Jerome Coutant 2:123b894b49dd 123 const uint8_t ShortRegData17[] = {OTM8009A_CMD_NOP, 0x92};
Jerome Coutant 2:123b894b49dd 124 const uint8_t ShortRegData18[] = {0xC5, 0x01};
Jerome Coutant 2:123b894b49dd 125 const uint8_t ShortRegData19[] = {OTM8009A_CMD_NOP, 0x95};
Jerome Coutant 2:123b894b49dd 126 const uint8_t ShortRegData20[] = {OTM8009A_CMD_NOP, 0x94};
Jerome Coutant 2:123b894b49dd 127 const uint8_t ShortRegData21[] = {0xC5, 0x33};
Jerome Coutant 2:123b894b49dd 128 const uint8_t ShortRegData22[] = {OTM8009A_CMD_NOP, 0xA3};
Jerome Coutant 2:123b894b49dd 129 const uint8_t ShortRegData23[] = {0xC0, 0x1B};
Jerome Coutant 2:123b894b49dd 130 const uint8_t ShortRegData24[] = {OTM8009A_CMD_NOP, 0x82};
Jerome Coutant 2:123b894b49dd 131 const uint8_t ShortRegData25[] = {0xC5, 0x83};
Jerome Coutant 2:123b894b49dd 132 const uint8_t ShortRegData26[] = {0xC4, 0x83};
Jerome Coutant 2:123b894b49dd 133 const uint8_t ShortRegData27[] = {0xC1, 0x0E};
Jerome Coutant 2:123b894b49dd 134 const uint8_t ShortRegData28[] = {OTM8009A_CMD_NOP, 0xA6};
Jerome Coutant 2:123b894b49dd 135 const uint8_t ShortRegData29[] = {OTM8009A_CMD_NOP, 0xA0};
Jerome Coutant 2:123b894b49dd 136 const uint8_t ShortRegData30[] = {OTM8009A_CMD_NOP, 0xB0};
Jerome Coutant 2:123b894b49dd 137 const uint8_t ShortRegData31[] = {OTM8009A_CMD_NOP, 0xC0};
Jerome Coutant 2:123b894b49dd 138 const uint8_t ShortRegData32[] = {OTM8009A_CMD_NOP, 0xD0};
Jerome Coutant 2:123b894b49dd 139 const uint8_t ShortRegData33[] = {OTM8009A_CMD_NOP, 0x90};
Jerome Coutant 2:123b894b49dd 140 const uint8_t ShortRegData34[] = {OTM8009A_CMD_NOP, 0xE0};
Jerome Coutant 2:123b894b49dd 141 const uint8_t ShortRegData35[] = {OTM8009A_CMD_NOP, 0xF0};
Jerome Coutant 2:123b894b49dd 142 const uint8_t ShortRegData36[] = {OTM8009A_CMD_SLPOUT, 0x00};
Jerome Coutant 2:123b894b49dd 143 const uint8_t ShortRegData37[] = {OTM8009A_CMD_COLMOD, OTM8009A_COLMOD_RGB565};
Jerome Coutant 2:123b894b49dd 144 const uint8_t ShortRegData38[] = {OTM8009A_CMD_COLMOD, OTM8009A_COLMOD_RGB888};
Jerome Coutant 2:123b894b49dd 145 const uint8_t ShortRegData39[] = {OTM8009A_CMD_MADCTR, OTM8009A_MADCTR_MODE_LANDSCAPE};
Jerome Coutant 2:123b894b49dd 146 const uint8_t ShortRegData40[] = {OTM8009A_CMD_WRDISBV, 0x7F};
Jerome Coutant 2:123b894b49dd 147 const uint8_t ShortRegData41[] = {OTM8009A_CMD_WRCTRLD, 0x2C};
Jerome Coutant 2:123b894b49dd 148 const uint8_t ShortRegData42[] = {OTM8009A_CMD_WRCABC, 0x02};
Jerome Coutant 2:123b894b49dd 149 const uint8_t ShortRegData43[] = {OTM8009A_CMD_WRCABCMB, 0xFF};
Jerome Coutant 2:123b894b49dd 150 const uint8_t ShortRegData44[] = {OTM8009A_CMD_DISPON, 0x00};
Jerome Coutant 2:123b894b49dd 151 const uint8_t ShortRegData45[] = {OTM8009A_CMD_RAMWR, 0x00};
Jerome Coutant 2:123b894b49dd 152 const uint8_t ShortRegData46[] = {0xCF, 0x00};
Jerome Coutant 2:123b894b49dd 153 const uint8_t ShortRegData47[] = {0xC5, 0x66};
Jerome Coutant 2:123b894b49dd 154 const uint8_t ShortRegData48[] = {OTM8009A_CMD_NOP, 0xB6};
Jerome Coutant 2:123b894b49dd 155 const uint8_t ShortRegData49[] = {0xF5, 0x06};
Jerome Coutant 2:123b894b49dd 156 const uint8_t ShortRegData50[] = {OTM8009A_CMD_NOP, 0xB1};
Jerome Coutant 2:123b894b49dd 157 const uint8_t ShortRegData51[] = {0xC6, 0x06};
Jerome Coutant 2:123b894b49dd 158 /**
Jerome Coutant 2:123b894b49dd 159 * @}
Jerome Coutant 2:123b894b49dd 160 */
Jerome Coutant 2:123b894b49dd 161
Jerome Coutant 2:123b894b49dd 162 /* Private macros ------------------------------------------------------------*/
Jerome Coutant 2:123b894b49dd 163 /* Private functions ---------------------------------------------------------*/
Jerome Coutant 2:123b894b49dd 164 /** @defgroup OTM8009A_Exported_Variables
Jerome Coutant 2:123b894b49dd 165 * @{
Jerome Coutant 2:123b894b49dd 166 */
Jerome Coutant 2:123b894b49dd 167
Jerome Coutant 2:123b894b49dd 168 /**
Jerome Coutant 2:123b894b49dd 169 * @}
Jerome Coutant 2:123b894b49dd 170 */
Jerome Coutant 2:123b894b49dd 171
Jerome Coutant 2:123b894b49dd 172 /* Exported functions ---------------------------------------------------------*/
Jerome Coutant 2:123b894b49dd 173 /** @defgroup OTM8009A_Exported_Functions OTM8009A Exported Functions
Jerome Coutant 2:123b894b49dd 174 * @{
Jerome Coutant 2:123b894b49dd 175 */
Jerome Coutant 2:123b894b49dd 176
Jerome Coutant 2:123b894b49dd 177 /**
Jerome Coutant 2:123b894b49dd 178 * @brief DSI IO write short/long command.
Jerome Coutant 2:123b894b49dd 179 * @note : Can be surcharged by application code implementation of the function.
Jerome Coutant 2:123b894b49dd 180 */
Jerome Coutant 2:123b894b49dd 181 __weak void DSI_IO_WriteCmd(uint32_t NbrParams, uint8_t *pParams)
Jerome Coutant 2:123b894b49dd 182 {
Jerome Coutant 2:123b894b49dd 183 /* NOTE : This function Should not be modified, when it is needed,
Jerome Coutant 2:123b894b49dd 184 the DSI_IO_WriteCmd could be implemented in the user file
Jerome Coutant 2:123b894b49dd 185 */
Jerome Coutant 2:123b894b49dd 186 }
Jerome Coutant 2:123b894b49dd 187
Jerome Coutant 2:123b894b49dd 188 /**
Jerome Coutant 2:123b894b49dd 189 * @brief Initializes the LCD KoD display part by communication in DSI mode in Video Mode
Jerome Coutant 2:123b894b49dd 190 * with IC Display Driver OTM8009A (see IC Driver specification for more information).
Jerome Coutant 2:123b894b49dd 191 * @param hdsi_eval : pointer on DSI configuration structure
Jerome Coutant 2:123b894b49dd 192 * @param hdsivideo_handle : pointer on DSI video mode configuration structure
Jerome Coutant 2:123b894b49dd 193 * @retval Status
Jerome Coutant 2:123b894b49dd 194 */
Jerome Coutant 2:123b894b49dd 195 uint8_t OTM8009A_Init(uint32_t ColorCoding, uint32_t orientation)
Jerome Coutant 2:123b894b49dd 196 {
Jerome Coutant 2:123b894b49dd 197 /* Enable CMD2 to access vendor specific commands */
Jerome Coutant 2:123b894b49dd 198 /* Enter in command 2 mode and set EXTC to enable address shift function (0x00) */
Jerome Coutant 2:123b894b49dd 199 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData1);
Jerome Coutant 2:123b894b49dd 200 DSI_IO_WriteCmd( 3, (uint8_t *)lcdRegData1);
Jerome Coutant 2:123b894b49dd 201
Jerome Coutant 2:123b894b49dd 202 /* Enter ORISE Command 2 */
Jerome Coutant 2:123b894b49dd 203 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData2); /* Shift address to 0x80 */
Jerome Coutant 2:123b894b49dd 204 DSI_IO_WriteCmd( 2, (uint8_t *)lcdRegData2);
Jerome Coutant 2:123b894b49dd 205
Jerome Coutant 2:123b894b49dd 206 /////////////////////////////////////////////////////////////////////
Jerome Coutant 2:123b894b49dd 207 /* SD_PCH_CTRL - 0xC480h - 129th parameter - Default 0x00 */
Jerome Coutant 2:123b894b49dd 208 /* Set SD_PT */
Jerome Coutant 2:123b894b49dd 209 /* -> Source output level during porch and non-display area to GND */
Jerome Coutant 2:123b894b49dd 210 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData2);
Jerome Coutant 2:123b894b49dd 211 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData3);
Jerome Coutant 2:123b894b49dd 212 OTM8009A_IO_Delay(10);
Jerome Coutant 2:123b894b49dd 213 /* Not documented */
Jerome Coutant 2:123b894b49dd 214 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData4);
Jerome Coutant 2:123b894b49dd 215 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData5);
Jerome Coutant 2:123b894b49dd 216 OTM8009A_IO_Delay(10);
Jerome Coutant 2:123b894b49dd 217 /////////////////////////////////////////////////////////////////////
Jerome Coutant 2:123b894b49dd 218
Jerome Coutant 2:123b894b49dd 219 /* PWR_CTRL4 - 0xC4B0h - 178th parameter - Default 0xA8 */
Jerome Coutant 2:123b894b49dd 220 /* Set gvdd_en_test */
Jerome Coutant 2:123b894b49dd 221 /* -> enable GVDD test mode !!! */
Jerome Coutant 2:123b894b49dd 222 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData6);
Jerome Coutant 2:123b894b49dd 223 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData7);
Jerome Coutant 2:123b894b49dd 224
Jerome Coutant 2:123b894b49dd 225 /* PWR_CTRL2 - 0xC590h - 146th parameter - Default 0x79 */
Jerome Coutant 2:123b894b49dd 226 /* Set pump 4 vgh voltage */
Jerome Coutant 2:123b894b49dd 227 /* -> from 15.0v down to 13.0v */
Jerome Coutant 2:123b894b49dd 228 /* Set pump 5 vgh voltage */
Jerome Coutant 2:123b894b49dd 229 /* -> from -12.0v downto -9.0v */
Jerome Coutant 2:123b894b49dd 230 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData8);
Jerome Coutant 2:123b894b49dd 231 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData9);
Jerome Coutant 2:123b894b49dd 232
Jerome Coutant 2:123b894b49dd 233 /* P_DRV_M - 0xC0B4h - 181th parameter - Default 0x00 */
Jerome Coutant 2:123b894b49dd 234 /* -> Column inversion */
Jerome Coutant 2:123b894b49dd 235 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData10);
Jerome Coutant 2:123b894b49dd 236 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData11);
Jerome Coutant 2:123b894b49dd 237
Jerome Coutant 2:123b894b49dd 238 /* VCOMDC - 0xD900h - 1st parameter - Default 0x39h */
Jerome Coutant 2:123b894b49dd 239 /* VCOM Voltage settings */
Jerome Coutant 2:123b894b49dd 240 /* -> from -1.0000v downto -1.2625v */
Jerome Coutant 2:123b894b49dd 241 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData1);
Jerome Coutant 2:123b894b49dd 242 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData12);
Jerome Coutant 2:123b894b49dd 243
Jerome Coutant 2:123b894b49dd 244 /* Oscillator adjustment for Idle/Normal mode (LPDT only) set to 65Hz (default is 60Hz) */
Jerome Coutant 2:123b894b49dd 245 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData13);
Jerome Coutant 2:123b894b49dd 246 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData14);
Jerome Coutant 2:123b894b49dd 247
Jerome Coutant 2:123b894b49dd 248 /* Video mode internal */
Jerome Coutant 2:123b894b49dd 249 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData15);
Jerome Coutant 2:123b894b49dd 250 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData16);
Jerome Coutant 2:123b894b49dd 251
Jerome Coutant 2:123b894b49dd 252 /* PWR_CTRL2 - 0xC590h - 147h parameter - Default 0x00 */
Jerome Coutant 2:123b894b49dd 253 /* Set pump 4&5 x6 */
Jerome Coutant 2:123b894b49dd 254 /* -> ONLY VALID when PUMP4_EN_ASDM_HV = "0" */
Jerome Coutant 2:123b894b49dd 255 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData17);
Jerome Coutant 2:123b894b49dd 256 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData18);
Jerome Coutant 2:123b894b49dd 257
Jerome Coutant 2:123b894b49dd 258 /* PWR_CTRL2 - 0xC590h - 150th parameter - Default 0x33h */
Jerome Coutant 2:123b894b49dd 259 /* Change pump4 clock ratio */
Jerome Coutant 2:123b894b49dd 260 /* -> from 1 line to 1/2 line */
Jerome Coutant 2:123b894b49dd 261 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData19);
Jerome Coutant 2:123b894b49dd 262 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData9);
Jerome Coutant 2:123b894b49dd 263
Jerome Coutant 2:123b894b49dd 264 /* GVDD/NGVDD settings */
Jerome Coutant 2:123b894b49dd 265 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData1);
Jerome Coutant 2:123b894b49dd 266 DSI_IO_WriteCmd( 2, (uint8_t *)lcdRegData5);
Jerome Coutant 2:123b894b49dd 267
Jerome Coutant 2:123b894b49dd 268 /* PWR_CTRL2 - 0xC590h - 149th parameter - Default 0x33h */
Jerome Coutant 2:123b894b49dd 269 /* Rewrite the default value ! */
Jerome Coutant 2:123b894b49dd 270 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData20);
Jerome Coutant 2:123b894b49dd 271 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData21);
Jerome Coutant 2:123b894b49dd 272
Jerome Coutant 2:123b894b49dd 273 /* Panel display timing Setting 3 */
Jerome Coutant 2:123b894b49dd 274 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData22);
Jerome Coutant 2:123b894b49dd 275 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData23);
Jerome Coutant 2:123b894b49dd 276
Jerome Coutant 2:123b894b49dd 277 /* Power control 1 */
Jerome Coutant 2:123b894b49dd 278 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData24);
Jerome Coutant 2:123b894b49dd 279 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData25);
Jerome Coutant 2:123b894b49dd 280
Jerome Coutant 2:123b894b49dd 281 /* Source driver precharge */
Jerome Coutant 2:123b894b49dd 282 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData13);
Jerome Coutant 2:123b894b49dd 283 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData26);
Jerome Coutant 2:123b894b49dd 284
Jerome Coutant 2:123b894b49dd 285 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData15);
Jerome Coutant 2:123b894b49dd 286 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData27);
Jerome Coutant 2:123b894b49dd 287
Jerome Coutant 2:123b894b49dd 288 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData28);
Jerome Coutant 2:123b894b49dd 289 DSI_IO_WriteCmd( 2, (uint8_t *)lcdRegData6);
Jerome Coutant 2:123b894b49dd 290
Jerome Coutant 2:123b894b49dd 291 /* GOAVST */
Jerome Coutant 2:123b894b49dd 292 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData2);
Jerome Coutant 2:123b894b49dd 293 DSI_IO_WriteCmd( 6, (uint8_t *)lcdRegData7);
Jerome Coutant 2:123b894b49dd 294
Jerome Coutant 2:123b894b49dd 295 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData29);
Jerome Coutant 2:123b894b49dd 296 DSI_IO_WriteCmd( 14, (uint8_t *)lcdRegData8);
Jerome Coutant 2:123b894b49dd 297
Jerome Coutant 2:123b894b49dd 298 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData30);
Jerome Coutant 2:123b894b49dd 299 DSI_IO_WriteCmd( 14, (uint8_t *)lcdRegData9);
Jerome Coutant 2:123b894b49dd 300
Jerome Coutant 2:123b894b49dd 301 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData31);
Jerome Coutant 2:123b894b49dd 302 DSI_IO_WriteCmd( 10, (uint8_t *)lcdRegData10);
Jerome Coutant 2:123b894b49dd 303
Jerome Coutant 2:123b894b49dd 304 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData32);
Jerome Coutant 2:123b894b49dd 305 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData46);
Jerome Coutant 2:123b894b49dd 306
Jerome Coutant 2:123b894b49dd 307 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData2);
Jerome Coutant 2:123b894b49dd 308 DSI_IO_WriteCmd( 10, (uint8_t *)lcdRegData11);
Jerome Coutant 2:123b894b49dd 309
Jerome Coutant 2:123b894b49dd 310 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData33);
Jerome Coutant 2:123b894b49dd 311 DSI_IO_WriteCmd( 15, (uint8_t *)lcdRegData12);
Jerome Coutant 2:123b894b49dd 312
Jerome Coutant 2:123b894b49dd 313 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData29);
Jerome Coutant 2:123b894b49dd 314 DSI_IO_WriteCmd( 15, (uint8_t *)lcdRegData13);
Jerome Coutant 2:123b894b49dd 315
Jerome Coutant 2:123b894b49dd 316 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData30);
Jerome Coutant 2:123b894b49dd 317 DSI_IO_WriteCmd( 10, (uint8_t *)lcdRegData14);
Jerome Coutant 2:123b894b49dd 318
Jerome Coutant 2:123b894b49dd 319 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData31);
Jerome Coutant 2:123b894b49dd 320 DSI_IO_WriteCmd( 15, (uint8_t *)lcdRegData15);
Jerome Coutant 2:123b894b49dd 321
Jerome Coutant 2:123b894b49dd 322 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData32);
Jerome Coutant 2:123b894b49dd 323 DSI_IO_WriteCmd( 15, (uint8_t *)lcdRegData16);
Jerome Coutant 2:123b894b49dd 324
Jerome Coutant 2:123b894b49dd 325 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData34);
Jerome Coutant 2:123b894b49dd 326 DSI_IO_WriteCmd( 10, (uint8_t *)lcdRegData17);
Jerome Coutant 2:123b894b49dd 327
Jerome Coutant 2:123b894b49dd 328 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData35);
Jerome Coutant 2:123b894b49dd 329 DSI_IO_WriteCmd( 10, (uint8_t *)lcdRegData18);
Jerome Coutant 2:123b894b49dd 330
Jerome Coutant 2:123b894b49dd 331 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData2);
Jerome Coutant 2:123b894b49dd 332 DSI_IO_WriteCmd( 10, (uint8_t *)lcdRegData19);
Jerome Coutant 2:123b894b49dd 333
Jerome Coutant 2:123b894b49dd 334 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData33);
Jerome Coutant 2:123b894b49dd 335 DSI_IO_WriteCmd( 15, (uint8_t *)lcdRegData20);
Jerome Coutant 2:123b894b49dd 336
Jerome Coutant 2:123b894b49dd 337 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData29);
Jerome Coutant 2:123b894b49dd 338 DSI_IO_WriteCmd( 15, (uint8_t *)lcdRegData21);
Jerome Coutant 2:123b894b49dd 339
Jerome Coutant 2:123b894b49dd 340 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData30);
Jerome Coutant 2:123b894b49dd 341 DSI_IO_WriteCmd( 10, (uint8_t *)lcdRegData22);
Jerome Coutant 2:123b894b49dd 342
Jerome Coutant 2:123b894b49dd 343 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData31);
Jerome Coutant 2:123b894b49dd 344 DSI_IO_WriteCmd( 15, (uint8_t *)lcdRegData23);
Jerome Coutant 2:123b894b49dd 345
Jerome Coutant 2:123b894b49dd 346 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData32);
Jerome Coutant 2:123b894b49dd 347 DSI_IO_WriteCmd( 15, (uint8_t *)lcdRegData24);
Jerome Coutant 2:123b894b49dd 348
Jerome Coutant 2:123b894b49dd 349 /////////////////////////////////////////////////////////////////////////////
Jerome Coutant 2:123b894b49dd 350 /* PWR_CTRL1 - 0xc580h - 130th parameter - default 0x00 */
Jerome Coutant 2:123b894b49dd 351 /* Pump 1 min and max DM */
Jerome Coutant 2:123b894b49dd 352 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData13);
Jerome Coutant 2:123b894b49dd 353 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData47);
Jerome Coutant 2:123b894b49dd 354 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData48);
Jerome Coutant 2:123b894b49dd 355 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData49);
Jerome Coutant 2:123b894b49dd 356 /////////////////////////////////////////////////////////////////////////////
Jerome Coutant 2:123b894b49dd 357
Jerome Coutant 2:123b894b49dd 358 /* CABC LEDPWM frequency adjusted to 19,5kHz */
Jerome Coutant 2:123b894b49dd 359 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData50);
Jerome Coutant 2:123b894b49dd 360 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData51);
Jerome Coutant 2:123b894b49dd 361
Jerome Coutant 2:123b894b49dd 362 /* Exit CMD2 mode */
Jerome Coutant 2:123b894b49dd 363 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData1);
Jerome Coutant 2:123b894b49dd 364 DSI_IO_WriteCmd( 3, (uint8_t *)lcdRegData25);
Jerome Coutant 2:123b894b49dd 365
Jerome Coutant 2:123b894b49dd 366 /*************************************************************************** */
Jerome Coutant 2:123b894b49dd 367 /* Standard DCS Initialization TO KEEP CAN BE DONE IN HSDT */
Jerome Coutant 2:123b894b49dd 368 /*************************************************************************** */
Jerome Coutant 2:123b894b49dd 369
Jerome Coutant 2:123b894b49dd 370 /* NOP - goes back to DCS std command ? */
Jerome Coutant 2:123b894b49dd 371 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData1);
Jerome Coutant 2:123b894b49dd 372
Jerome Coutant 2:123b894b49dd 373 /* Gamma correction 2.2+ table (HSDT possible) */
Jerome Coutant 2:123b894b49dd 374 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData1);
Jerome Coutant 2:123b894b49dd 375 DSI_IO_WriteCmd( 16, (uint8_t *)lcdRegData3);
Jerome Coutant 2:123b894b49dd 376
Jerome Coutant 2:123b894b49dd 377 /* Gamma correction 2.2- table (HSDT possible) */
Jerome Coutant 2:123b894b49dd 378 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData1);
Jerome Coutant 2:123b894b49dd 379 DSI_IO_WriteCmd( 16, (uint8_t *)lcdRegData4);
Jerome Coutant 2:123b894b49dd 380
Jerome Coutant 2:123b894b49dd 381 /* Send Sleep Out command to display : no parameter */
Jerome Coutant 2:123b894b49dd 382 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData36);
Jerome Coutant 2:123b894b49dd 383
Jerome Coutant 2:123b894b49dd 384 /* Wait for sleep out exit */
Jerome Coutant 2:123b894b49dd 385 OTM8009A_IO_Delay(120);
Jerome Coutant 2:123b894b49dd 386
Jerome Coutant 2:123b894b49dd 387 switch(ColorCoding)
Jerome Coutant 2:123b894b49dd 388 {
Jerome Coutant 2:123b894b49dd 389 case OTM8009A_FORMAT_RBG565 :
Jerome Coutant 2:123b894b49dd 390 /* Set Pixel color format to RGB565 */
Jerome Coutant 2:123b894b49dd 391 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData37);
Jerome Coutant 2:123b894b49dd 392 break;
Jerome Coutant 2:123b894b49dd 393 case OTM8009A_FORMAT_RGB888 :
Jerome Coutant 2:123b894b49dd 394 /* Set Pixel color format to RGB888 */
Jerome Coutant 2:123b894b49dd 395 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData38);
Jerome Coutant 2:123b894b49dd 396 break;
Jerome Coutant 2:123b894b49dd 397 default :
Jerome Coutant 2:123b894b49dd 398 break;
Jerome Coutant 2:123b894b49dd 399 }
Jerome Coutant 2:123b894b49dd 400
Jerome Coutant 2:123b894b49dd 401 /* Send command to configure display in landscape orientation mode. By default
Jerome Coutant 2:123b894b49dd 402 the orientation mode is portrait */
Jerome Coutant 2:123b894b49dd 403 if(orientation == OTM8009A_ORIENTATION_LANDSCAPE)
Jerome Coutant 2:123b894b49dd 404 {
Jerome Coutant 2:123b894b49dd 405 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData39);
Jerome Coutant 2:123b894b49dd 406 DSI_IO_WriteCmd( 4, (uint8_t *)lcdRegData27);
Jerome Coutant 2:123b894b49dd 407 DSI_IO_WriteCmd( 4, (uint8_t *)lcdRegData28);
Jerome Coutant 2:123b894b49dd 408 }
Jerome Coutant 2:123b894b49dd 409
Jerome Coutant 2:123b894b49dd 410 /** CABC : Content Adaptive Backlight Control section start >> */
Jerome Coutant 2:123b894b49dd 411 /* Note : defaut is 0 (lowest Brightness), 0xFF is highest Brightness, try 0x7F : intermediate value */
Jerome Coutant 2:123b894b49dd 412 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData40);
Jerome Coutant 2:123b894b49dd 413
Jerome Coutant 2:123b894b49dd 414 /* defaut is 0, try 0x2C - Brightness Control Block, Display Dimming & BackLight on */
Jerome Coutant 2:123b894b49dd 415 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData41);
Jerome Coutant 2:123b894b49dd 416
Jerome Coutant 2:123b894b49dd 417 /* defaut is 0, try 0x02 - image Content based Adaptive Brightness [Still Picture] */
Jerome Coutant 2:123b894b49dd 418 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData42);
Jerome Coutant 2:123b894b49dd 419
Jerome Coutant 2:123b894b49dd 420 /* defaut is 0 (lowest Brightness), 0xFF is highest Brightness */
Jerome Coutant 2:123b894b49dd 421 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData43);
Jerome Coutant 2:123b894b49dd 422
Jerome Coutant 2:123b894b49dd 423 /** CABC : Content Adaptive Backlight Control section end << */
Jerome Coutant 2:123b894b49dd 424
Jerome Coutant 2:123b894b49dd 425 /* Send Command Display On */
Jerome Coutant 2:123b894b49dd 426 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData44);
Jerome Coutant 2:123b894b49dd 427
Jerome Coutant 2:123b894b49dd 428 /* NOP command */
Jerome Coutant 2:123b894b49dd 429 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData1);
Jerome Coutant 2:123b894b49dd 430
Jerome Coutant 2:123b894b49dd 431 /* Send Command GRAM memory write (no parameters) : this initiates frame write via other DSI commands sent by */
Jerome Coutant 2:123b894b49dd 432 /* DSI host from LTDC incoming pixels in video mode */
Jerome Coutant 2:123b894b49dd 433 DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData45);
Jerome Coutant 2:123b894b49dd 434
Jerome Coutant 2:123b894b49dd 435 return 0;
Jerome Coutant 2:123b894b49dd 436 }
Jerome Coutant 2:123b894b49dd 437
Jerome Coutant 2:123b894b49dd 438 /**
Jerome Coutant 2:123b894b49dd 439 * @}
Jerome Coutant 2:123b894b49dd 440 */
Jerome Coutant 2:123b894b49dd 441
Jerome Coutant 2:123b894b49dd 442 /**
Jerome Coutant 2:123b894b49dd 443 * @}
Jerome Coutant 2:123b894b49dd 444 */
Jerome Coutant 2:123b894b49dd 445
Jerome Coutant 2:123b894b49dd 446 /**
Jerome Coutant 2:123b894b49dd 447 * @}
Jerome Coutant 2:123b894b49dd 448 */
Jerome Coutant 2:123b894b49dd 449
Jerome Coutant 2:123b894b49dd 450 /**
Jerome Coutant 2:123b894b49dd 451 * @}
Jerome Coutant 2:123b894b49dd 452 */
Jerome Coutant 2:123b894b49dd 453
Jerome Coutant 2:123b894b49dd 454 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/