STM32F469NI Discovery board drivers

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

Committer:
bcostm
Date:
Fri Dec 18 07:32:01 2015 +0000
Revision:
0:0002c86c2220
Initial version

Who changed what in which revision?

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