Mouse code for the MacroRat

Dependencies:   ITG3200 QEI

Committer:
sahilmgandhi
Date:
Sat Jun 03 00:22:44 2017 +0000
Revision:
46:b156ef445742
Parent:
18:6a4db94011d3
Final code for internal battlebot competition.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sahilmgandhi 18:6a4db94011d3 1 /**
sahilmgandhi 18:6a4db94011d3 2 ******************************************************************************
sahilmgandhi 18:6a4db94011d3 3 * @file stm32f4xx_hal_ltdc.c
sahilmgandhi 18:6a4db94011d3 4 * @author MCD Application Team
sahilmgandhi 18:6a4db94011d3 5 * @version V1.5.0
sahilmgandhi 18:6a4db94011d3 6 * @date 06-May-2016
sahilmgandhi 18:6a4db94011d3 7 * @brief LTDC HAL module driver.
sahilmgandhi 18:6a4db94011d3 8 * This file provides firmware functions to manage the following
sahilmgandhi 18:6a4db94011d3 9 * functionalities of the LTDC peripheral:
sahilmgandhi 18:6a4db94011d3 10 * + Initialization and de-initialization functions
sahilmgandhi 18:6a4db94011d3 11 * + IO operation functions
sahilmgandhi 18:6a4db94011d3 12 * + Peripheral Control functions
sahilmgandhi 18:6a4db94011d3 13 * + Peripheral State and Errors functions
sahilmgandhi 18:6a4db94011d3 14 *
sahilmgandhi 18:6a4db94011d3 15 @verbatim
sahilmgandhi 18:6a4db94011d3 16 ==============================================================================
sahilmgandhi 18:6a4db94011d3 17 ##### How to use this driver #####
sahilmgandhi 18:6a4db94011d3 18 ==============================================================================
sahilmgandhi 18:6a4db94011d3 19 [..]
sahilmgandhi 18:6a4db94011d3 20 (#) Program the required configuration through the following parameters:
sahilmgandhi 18:6a4db94011d3 21 the LTDC timing, the horizontal and vertical polarity,
sahilmgandhi 18:6a4db94011d3 22 the pixel clock polarity, Data Enable polarity and the LTDC background color value
sahilmgandhi 18:6a4db94011d3 23 using HAL_LTDC_Init() function
sahilmgandhi 18:6a4db94011d3 24
sahilmgandhi 18:6a4db94011d3 25 (#) Program the required configuration through the following parameters:
sahilmgandhi 18:6a4db94011d3 26 the pixel format, the blending factors, input alpha value, the window size
sahilmgandhi 18:6a4db94011d3 27 and the image size using HAL_LTDC_ConfigLayer() function for foreground
sahilmgandhi 18:6a4db94011d3 28 or/and background layer.
sahilmgandhi 18:6a4db94011d3 29
sahilmgandhi 18:6a4db94011d3 30 (#) Optionally, configure and enable the CLUT using HAL_LTDC_ConfigCLUT() and
sahilmgandhi 18:6a4db94011d3 31 HAL_LTDC_EnableCLUT functions.
sahilmgandhi 18:6a4db94011d3 32
sahilmgandhi 18:6a4db94011d3 33 (#) Optionally, enable the Dither using HAL_LTDC_EnableDither().
sahilmgandhi 18:6a4db94011d3 34
sahilmgandhi 18:6a4db94011d3 35 (#) Optionally, configure and enable the Color keying using HAL_LTDC_ConfigColorKeying()
sahilmgandhi 18:6a4db94011d3 36 and HAL_LTDC_EnableColorKeying functions.
sahilmgandhi 18:6a4db94011d3 37
sahilmgandhi 18:6a4db94011d3 38 (#) Optionally, configure LineInterrupt using HAL_LTDC_ProgramLineEvent()
sahilmgandhi 18:6a4db94011d3 39 function
sahilmgandhi 18:6a4db94011d3 40
sahilmgandhi 18:6a4db94011d3 41 (#) If needed, reconfigure and change the pixel format value, the alpha value
sahilmgandhi 18:6a4db94011d3 42 value, the window size, the window position and the layer start address
sahilmgandhi 18:6a4db94011d3 43 for foreground or/and background layer using respectively the following
sahilmgandhi 18:6a4db94011d3 44 functions: HAL_LTDC_SetPixelFormat(), HAL_LTDC_SetAlpha(), HAL_LTDC_SetWindowSize(),
sahilmgandhi 18:6a4db94011d3 45 HAL_LTDC_SetWindowPosition(), HAL_LTDC_SetAddress.
sahilmgandhi 18:6a4db94011d3 46
sahilmgandhi 18:6a4db94011d3 47 (#) Variant functions with “_NoReload” post fix allows to set the LTDC configuration/settings without immediate reload.
sahilmgandhi 18:6a4db94011d3 48 This is useful in case when the program requires to modify serval LTDC settings (on one or both layers)
sahilmgandhi 18:6a4db94011d3 49 then applying(reload) these settings in one shot by calling the function “HAL_LTDC_Relaod”
sahilmgandhi 18:6a4db94011d3 50
sahilmgandhi 18:6a4db94011d3 51 After calling the “_NoReload” functions to set different color/format/layer settings,
sahilmgandhi 18:6a4db94011d3 52 the program can call the function “HAL_LTDC_Relaod” To apply(Reload) these settings.
sahilmgandhi 18:6a4db94011d3 53 Function “HAL_LTDC_Relaod” can be called with the parameter “ReloadType”
sahilmgandhi 18:6a4db94011d3 54 set to LTDC_RELOAD_IMMEDIATE if an immediate reload is required.
sahilmgandhi 18:6a4db94011d3 55 Function “HAL_LTDC_Relaod” can be called with the parameter “ReloadType”
sahilmgandhi 18:6a4db94011d3 56 set to LTDC_RELOAD_VERTICAL_BLANKING if the reload should be done in the next vertical blanking period,
sahilmgandhi 18:6a4db94011d3 57 this option allows to avoid display flicker by applying the new settings during the vertical blanking period.
sahilmgandhi 18:6a4db94011d3 58
sahilmgandhi 18:6a4db94011d3 59
sahilmgandhi 18:6a4db94011d3 60 (#) To control LTDC state you can use the following function: HAL_LTDC_GetState()
sahilmgandhi 18:6a4db94011d3 61
sahilmgandhi 18:6a4db94011d3 62 *** LTDC HAL driver macros list ***
sahilmgandhi 18:6a4db94011d3 63 =============================================
sahilmgandhi 18:6a4db94011d3 64 [..]
sahilmgandhi 18:6a4db94011d3 65 Below the list of most used macros in LTDC HAL driver.
sahilmgandhi 18:6a4db94011d3 66
sahilmgandhi 18:6a4db94011d3 67 (+) __HAL_LTDC_ENABLE: Enable the LTDC.
sahilmgandhi 18:6a4db94011d3 68 (+) __HAL_LTDC_DISABLE: Disable the LTDC.
sahilmgandhi 18:6a4db94011d3 69 (+) __HAL_LTDC_LAYER_ENABLE: Enable the LTDC Layer.
sahilmgandhi 18:6a4db94011d3 70 (+) __HAL_LTDC_LAYER_DISABLE: Disable the LTDC Layer.
sahilmgandhi 18:6a4db94011d3 71 (+) __HAL_LTDC_RELOAD_CONFIG: Reload Layer Configuration.
sahilmgandhi 18:6a4db94011d3 72 (+) __HAL_LTDC_GET_FLAG: Get the LTDC pending flags.
sahilmgandhi 18:6a4db94011d3 73 (+) __HAL_LTDC_CLEAR_FLAG: Clear the LTDC pending flags.
sahilmgandhi 18:6a4db94011d3 74 (+) __HAL_LTDC_ENABLE_IT: Enable the specified LTDC interrupts.
sahilmgandhi 18:6a4db94011d3 75 (+) __HAL_LTDC_DISABLE_IT: Disable the specified LTDC interrupts.
sahilmgandhi 18:6a4db94011d3 76 (+) __HAL_LTDC_GET_IT_SOURCE: Check whether the specified LTDC interrupt has occurred or not.
sahilmgandhi 18:6a4db94011d3 77
sahilmgandhi 18:6a4db94011d3 78 [..]
sahilmgandhi 18:6a4db94011d3 79 (@) You can refer to the LTDC HAL driver header file for more useful macros
sahilmgandhi 18:6a4db94011d3 80
sahilmgandhi 18:6a4db94011d3 81 @endverbatim
sahilmgandhi 18:6a4db94011d3 82 ******************************************************************************
sahilmgandhi 18:6a4db94011d3 83 * @attention
sahilmgandhi 18:6a4db94011d3 84 *
sahilmgandhi 18:6a4db94011d3 85 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
sahilmgandhi 18:6a4db94011d3 86 *
sahilmgandhi 18:6a4db94011d3 87 * Redistribution and use in source and binary forms, with or without modification,
sahilmgandhi 18:6a4db94011d3 88 * are permitted provided that the following conditions are met:
sahilmgandhi 18:6a4db94011d3 89 * 1. Redistributions of source code must retain the above copyright notice,
sahilmgandhi 18:6a4db94011d3 90 * this list of conditions and the following disclaimer.
sahilmgandhi 18:6a4db94011d3 91 * 2. Redistributions in binary form must reproduce the above copyright notice,
sahilmgandhi 18:6a4db94011d3 92 * this list of conditions and the following disclaimer in the documentation
sahilmgandhi 18:6a4db94011d3 93 * and/or other materials provided with the distribution.
sahilmgandhi 18:6a4db94011d3 94 * 3. Neither the name of STMicroelectronics nor the names of its contributors
sahilmgandhi 18:6a4db94011d3 95 * may be used to endorse or promote products derived from this software
sahilmgandhi 18:6a4db94011d3 96 * without specific prior written permission.
sahilmgandhi 18:6a4db94011d3 97 *
sahilmgandhi 18:6a4db94011d3 98 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
sahilmgandhi 18:6a4db94011d3 99 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
sahilmgandhi 18:6a4db94011d3 100 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
sahilmgandhi 18:6a4db94011d3 101 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
sahilmgandhi 18:6a4db94011d3 102 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
sahilmgandhi 18:6a4db94011d3 103 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
sahilmgandhi 18:6a4db94011d3 104 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
sahilmgandhi 18:6a4db94011d3 105 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
sahilmgandhi 18:6a4db94011d3 106 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
sahilmgandhi 18:6a4db94011d3 107 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
sahilmgandhi 18:6a4db94011d3 108 *
sahilmgandhi 18:6a4db94011d3 109 ******************************************************************************
sahilmgandhi 18:6a4db94011d3 110 */
sahilmgandhi 18:6a4db94011d3 111
sahilmgandhi 18:6a4db94011d3 112 /* Includes ------------------------------------------------------------------*/
sahilmgandhi 18:6a4db94011d3 113 #include "stm32f4xx_hal.h"
sahilmgandhi 18:6a4db94011d3 114
sahilmgandhi 18:6a4db94011d3 115 /** @addtogroup STM32F4xx_HAL_Driver
sahilmgandhi 18:6a4db94011d3 116 * @{
sahilmgandhi 18:6a4db94011d3 117 */
sahilmgandhi 18:6a4db94011d3 118 /** @defgroup LTDC LTDC
sahilmgandhi 18:6a4db94011d3 119 * @brief LTDC HAL module driver
sahilmgandhi 18:6a4db94011d3 120 * @{
sahilmgandhi 18:6a4db94011d3 121 */
sahilmgandhi 18:6a4db94011d3 122
sahilmgandhi 18:6a4db94011d3 123 #ifdef HAL_LTDC_MODULE_ENABLED
sahilmgandhi 18:6a4db94011d3 124
sahilmgandhi 18:6a4db94011d3 125 #if defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx)
sahilmgandhi 18:6a4db94011d3 126
sahilmgandhi 18:6a4db94011d3 127 /* Private typedef -----------------------------------------------------------*/
sahilmgandhi 18:6a4db94011d3 128 /* Private define ------------------------------------------------------------*/
sahilmgandhi 18:6a4db94011d3 129 /* Private macro -------------------------------------------------------------*/
sahilmgandhi 18:6a4db94011d3 130 /* Private variables ---------------------------------------------------------*/
sahilmgandhi 18:6a4db94011d3 131 /* Private function prototypes -----------------------------------------------*/
sahilmgandhi 18:6a4db94011d3 132 static void LTDC_SetConfig(LTDC_HandleTypeDef *hltdc, LTDC_LayerCfgTypeDef *pLayerCfg, uint32_t LayerIdx);
sahilmgandhi 18:6a4db94011d3 133 /* Private functions ---------------------------------------------------------*/
sahilmgandhi 18:6a4db94011d3 134
sahilmgandhi 18:6a4db94011d3 135 /** @defgroup LTDC_Exported_Functions LTDC Exported Functions
sahilmgandhi 18:6a4db94011d3 136 * @{
sahilmgandhi 18:6a4db94011d3 137 */
sahilmgandhi 18:6a4db94011d3 138
sahilmgandhi 18:6a4db94011d3 139 /** @defgroup LTDC_Exported_Functions_Group1 Initialization and Configuration functions
sahilmgandhi 18:6a4db94011d3 140 * @brief Initialization and Configuration functions
sahilmgandhi 18:6a4db94011d3 141 *
sahilmgandhi 18:6a4db94011d3 142 @verbatim
sahilmgandhi 18:6a4db94011d3 143 ===============================================================================
sahilmgandhi 18:6a4db94011d3 144 ##### Initialization and Configuration functions #####
sahilmgandhi 18:6a4db94011d3 145 ===============================================================================
sahilmgandhi 18:6a4db94011d3 146 [..] This section provides functions allowing to:
sahilmgandhi 18:6a4db94011d3 147 (+) Initialize and configure the LTDC
sahilmgandhi 18:6a4db94011d3 148 (+) De-initialize the LTDC
sahilmgandhi 18:6a4db94011d3 149
sahilmgandhi 18:6a4db94011d3 150 @endverbatim
sahilmgandhi 18:6a4db94011d3 151 * @{
sahilmgandhi 18:6a4db94011d3 152 */
sahilmgandhi 18:6a4db94011d3 153
sahilmgandhi 18:6a4db94011d3 154 /**
sahilmgandhi 18:6a4db94011d3 155 * @brief Initializes the LTDC according to the specified
sahilmgandhi 18:6a4db94011d3 156 * parameters in the LTDC_InitTypeDef and create the associated handle.
sahilmgandhi 18:6a4db94011d3 157 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 158 * the configuration information for the LTDC.
sahilmgandhi 18:6a4db94011d3 159 * @retval HAL status
sahilmgandhi 18:6a4db94011d3 160 */
sahilmgandhi 18:6a4db94011d3 161 HAL_StatusTypeDef HAL_LTDC_Init(LTDC_HandleTypeDef *hltdc)
sahilmgandhi 18:6a4db94011d3 162 {
sahilmgandhi 18:6a4db94011d3 163 uint32_t tmp = 0U, tmp1 = 0U;
sahilmgandhi 18:6a4db94011d3 164
sahilmgandhi 18:6a4db94011d3 165 /* Check the LTDC peripheral state */
sahilmgandhi 18:6a4db94011d3 166 if(hltdc == NULL)
sahilmgandhi 18:6a4db94011d3 167 {
sahilmgandhi 18:6a4db94011d3 168 return HAL_ERROR;
sahilmgandhi 18:6a4db94011d3 169 }
sahilmgandhi 18:6a4db94011d3 170
sahilmgandhi 18:6a4db94011d3 171 /* Check function parameters */
sahilmgandhi 18:6a4db94011d3 172 assert_param(IS_LTDC_ALL_INSTANCE(hltdc->Instance));
sahilmgandhi 18:6a4db94011d3 173 assert_param(IS_LTDC_HSYNC(hltdc->Init.HorizontalSync));
sahilmgandhi 18:6a4db94011d3 174 assert_param(IS_LTDC_VSYNC(hltdc->Init.VerticalSync));
sahilmgandhi 18:6a4db94011d3 175 assert_param(IS_LTDC_AHBP(hltdc->Init.AccumulatedHBP));
sahilmgandhi 18:6a4db94011d3 176 assert_param(IS_LTDC_AVBP(hltdc->Init.AccumulatedVBP));
sahilmgandhi 18:6a4db94011d3 177 assert_param(IS_LTDC_AAH(hltdc->Init.AccumulatedActiveH));
sahilmgandhi 18:6a4db94011d3 178 assert_param(IS_LTDC_AAW(hltdc->Init.AccumulatedActiveW));
sahilmgandhi 18:6a4db94011d3 179 assert_param(IS_LTDC_TOTALH(hltdc->Init.TotalHeigh));
sahilmgandhi 18:6a4db94011d3 180 assert_param(IS_LTDC_TOTALW(hltdc->Init.TotalWidth));
sahilmgandhi 18:6a4db94011d3 181 assert_param(IS_LTDC_HSPOL(hltdc->Init.HSPolarity));
sahilmgandhi 18:6a4db94011d3 182 assert_param(IS_LTDC_VSPOL(hltdc->Init.VSPolarity));
sahilmgandhi 18:6a4db94011d3 183 assert_param(IS_LTDC_DEPOL(hltdc->Init.DEPolarity));
sahilmgandhi 18:6a4db94011d3 184 assert_param(IS_LTDC_PCPOL(hltdc->Init.PCPolarity));
sahilmgandhi 18:6a4db94011d3 185
sahilmgandhi 18:6a4db94011d3 186 if(hltdc->State == HAL_LTDC_STATE_RESET)
sahilmgandhi 18:6a4db94011d3 187 {
sahilmgandhi 18:6a4db94011d3 188 /* Allocate lock resource and initialize it */
sahilmgandhi 18:6a4db94011d3 189 hltdc->Lock = HAL_UNLOCKED;
sahilmgandhi 18:6a4db94011d3 190 /* Init the low level hardware */
sahilmgandhi 18:6a4db94011d3 191 HAL_LTDC_MspInit(hltdc);
sahilmgandhi 18:6a4db94011d3 192 }
sahilmgandhi 18:6a4db94011d3 193
sahilmgandhi 18:6a4db94011d3 194 /* Change LTDC peripheral state */
sahilmgandhi 18:6a4db94011d3 195 hltdc->State = HAL_LTDC_STATE_BUSY;
sahilmgandhi 18:6a4db94011d3 196
sahilmgandhi 18:6a4db94011d3 197 /* Configures the HS, VS, DE and PC polarity */
sahilmgandhi 18:6a4db94011d3 198 hltdc->Instance->GCR &= ~(LTDC_GCR_HSPOL | LTDC_GCR_VSPOL | LTDC_GCR_DEPOL | LTDC_GCR_PCPOL);
sahilmgandhi 18:6a4db94011d3 199 hltdc->Instance->GCR |= (uint32_t)(hltdc->Init.HSPolarity | hltdc->Init.VSPolarity | \
sahilmgandhi 18:6a4db94011d3 200 hltdc->Init.DEPolarity | hltdc->Init.PCPolarity);
sahilmgandhi 18:6a4db94011d3 201
sahilmgandhi 18:6a4db94011d3 202 /* Sets Synchronization size */
sahilmgandhi 18:6a4db94011d3 203 hltdc->Instance->SSCR &= ~(LTDC_SSCR_VSH | LTDC_SSCR_HSW);
sahilmgandhi 18:6a4db94011d3 204 tmp = (hltdc->Init.HorizontalSync << 16U);
sahilmgandhi 18:6a4db94011d3 205 hltdc->Instance->SSCR |= (tmp | hltdc->Init.VerticalSync);
sahilmgandhi 18:6a4db94011d3 206
sahilmgandhi 18:6a4db94011d3 207 /* Sets Accumulated Back porch */
sahilmgandhi 18:6a4db94011d3 208 hltdc->Instance->BPCR &= ~(LTDC_BPCR_AVBP | LTDC_BPCR_AHBP);
sahilmgandhi 18:6a4db94011d3 209 tmp = (hltdc->Init.AccumulatedHBP << 16U);
sahilmgandhi 18:6a4db94011d3 210 hltdc->Instance->BPCR |= (tmp | hltdc->Init.AccumulatedVBP);
sahilmgandhi 18:6a4db94011d3 211
sahilmgandhi 18:6a4db94011d3 212 /* Sets Accumulated Active Width */
sahilmgandhi 18:6a4db94011d3 213 hltdc->Instance->AWCR &= ~(LTDC_AWCR_AAH | LTDC_AWCR_AAW);
sahilmgandhi 18:6a4db94011d3 214 tmp = (hltdc->Init.AccumulatedActiveW << 16U);
sahilmgandhi 18:6a4db94011d3 215 hltdc->Instance->AWCR |= (tmp | hltdc->Init.AccumulatedActiveH);
sahilmgandhi 18:6a4db94011d3 216
sahilmgandhi 18:6a4db94011d3 217 /* Sets Total Width */
sahilmgandhi 18:6a4db94011d3 218 hltdc->Instance->TWCR &= ~(LTDC_TWCR_TOTALH | LTDC_TWCR_TOTALW);
sahilmgandhi 18:6a4db94011d3 219 tmp = (hltdc->Init.TotalWidth << 16U);
sahilmgandhi 18:6a4db94011d3 220 hltdc->Instance->TWCR |= (tmp | hltdc->Init.TotalHeigh);
sahilmgandhi 18:6a4db94011d3 221
sahilmgandhi 18:6a4db94011d3 222 /* Sets the background color value */
sahilmgandhi 18:6a4db94011d3 223 tmp = ((uint32_t)(hltdc->Init.Backcolor.Green) << 8U);
sahilmgandhi 18:6a4db94011d3 224 tmp1 = ((uint32_t)(hltdc->Init.Backcolor.Red) << 16U);
sahilmgandhi 18:6a4db94011d3 225 hltdc->Instance->BCCR &= ~(LTDC_BCCR_BCBLUE | LTDC_BCCR_BCGREEN | LTDC_BCCR_BCRED);
sahilmgandhi 18:6a4db94011d3 226 hltdc->Instance->BCCR |= (tmp1 | tmp | hltdc->Init.Backcolor.Blue);
sahilmgandhi 18:6a4db94011d3 227
sahilmgandhi 18:6a4db94011d3 228 /* Enable the transfer Error interrupt */
sahilmgandhi 18:6a4db94011d3 229 __HAL_LTDC_ENABLE_IT(hltdc, LTDC_IT_TE);
sahilmgandhi 18:6a4db94011d3 230
sahilmgandhi 18:6a4db94011d3 231 /* Enable the FIFO underrun interrupt */
sahilmgandhi 18:6a4db94011d3 232 __HAL_LTDC_ENABLE_IT(hltdc, LTDC_IT_FU);
sahilmgandhi 18:6a4db94011d3 233
sahilmgandhi 18:6a4db94011d3 234 /* Enable LTDC by setting LTDCEN bit */
sahilmgandhi 18:6a4db94011d3 235 __HAL_LTDC_ENABLE(hltdc);
sahilmgandhi 18:6a4db94011d3 236
sahilmgandhi 18:6a4db94011d3 237 /* Initialize the error code */
sahilmgandhi 18:6a4db94011d3 238 hltdc->ErrorCode = HAL_LTDC_ERROR_NONE;
sahilmgandhi 18:6a4db94011d3 239
sahilmgandhi 18:6a4db94011d3 240 /* Initialize the LTDC state*/
sahilmgandhi 18:6a4db94011d3 241 hltdc->State = HAL_LTDC_STATE_READY;
sahilmgandhi 18:6a4db94011d3 242
sahilmgandhi 18:6a4db94011d3 243 return HAL_OK;
sahilmgandhi 18:6a4db94011d3 244 }
sahilmgandhi 18:6a4db94011d3 245
sahilmgandhi 18:6a4db94011d3 246 /**
sahilmgandhi 18:6a4db94011d3 247 * @brief Deinitializes the LTDC peripheral registers to their default reset
sahilmgandhi 18:6a4db94011d3 248 * values.
sahilmgandhi 18:6a4db94011d3 249 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 250 * the configuration information for the LTDC.
sahilmgandhi 18:6a4db94011d3 251 * @retval None
sahilmgandhi 18:6a4db94011d3 252 */
sahilmgandhi 18:6a4db94011d3 253
sahilmgandhi 18:6a4db94011d3 254 HAL_StatusTypeDef HAL_LTDC_DeInit(LTDC_HandleTypeDef *hltdc)
sahilmgandhi 18:6a4db94011d3 255 {
sahilmgandhi 18:6a4db94011d3 256 /* DeInit the low level hardware */
sahilmgandhi 18:6a4db94011d3 257 HAL_LTDC_MspDeInit(hltdc);
sahilmgandhi 18:6a4db94011d3 258
sahilmgandhi 18:6a4db94011d3 259 /* Initialize the error code */
sahilmgandhi 18:6a4db94011d3 260 hltdc->ErrorCode = HAL_LTDC_ERROR_NONE;
sahilmgandhi 18:6a4db94011d3 261
sahilmgandhi 18:6a4db94011d3 262 /* Initialize the LTDC state*/
sahilmgandhi 18:6a4db94011d3 263 hltdc->State = HAL_LTDC_STATE_RESET;
sahilmgandhi 18:6a4db94011d3 264
sahilmgandhi 18:6a4db94011d3 265 /* Release Lock */
sahilmgandhi 18:6a4db94011d3 266 __HAL_UNLOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 267
sahilmgandhi 18:6a4db94011d3 268 return HAL_OK;
sahilmgandhi 18:6a4db94011d3 269 }
sahilmgandhi 18:6a4db94011d3 270
sahilmgandhi 18:6a4db94011d3 271 /**
sahilmgandhi 18:6a4db94011d3 272 * @brief Initializes the LTDC MSP.
sahilmgandhi 18:6a4db94011d3 273 * @param hltdc : pointer to a LTDC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 274 * the configuration information for the LTDC.
sahilmgandhi 18:6a4db94011d3 275 * @retval None
sahilmgandhi 18:6a4db94011d3 276 */
sahilmgandhi 18:6a4db94011d3 277 __weak void HAL_LTDC_MspInit(LTDC_HandleTypeDef* hltdc)
sahilmgandhi 18:6a4db94011d3 278 {
sahilmgandhi 18:6a4db94011d3 279 /* Prevent unused argument(s) compilation warning */
sahilmgandhi 18:6a4db94011d3 280 UNUSED(hltdc);
sahilmgandhi 18:6a4db94011d3 281 /* NOTE : This function Should not be modified, when the callback is needed,
sahilmgandhi 18:6a4db94011d3 282 the HAL_LTDC_MspInit could be implemented in the user file
sahilmgandhi 18:6a4db94011d3 283 */
sahilmgandhi 18:6a4db94011d3 284 }
sahilmgandhi 18:6a4db94011d3 285
sahilmgandhi 18:6a4db94011d3 286 /**
sahilmgandhi 18:6a4db94011d3 287 * @brief DeInitializes the LTDC MSP.
sahilmgandhi 18:6a4db94011d3 288 * @param hltdc : pointer to a LTDC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 289 * the configuration information for the LTDC.
sahilmgandhi 18:6a4db94011d3 290 * @retval None
sahilmgandhi 18:6a4db94011d3 291 */
sahilmgandhi 18:6a4db94011d3 292 __weak void HAL_LTDC_MspDeInit(LTDC_HandleTypeDef* hltdc)
sahilmgandhi 18:6a4db94011d3 293 {
sahilmgandhi 18:6a4db94011d3 294 /* Prevent unused argument(s) compilation warning */
sahilmgandhi 18:6a4db94011d3 295 UNUSED(hltdc);
sahilmgandhi 18:6a4db94011d3 296 /* NOTE : This function Should not be modified, when the callback is needed,
sahilmgandhi 18:6a4db94011d3 297 the HAL_LTDC_MspDeInit could be implemented in the user file
sahilmgandhi 18:6a4db94011d3 298 */
sahilmgandhi 18:6a4db94011d3 299 }
sahilmgandhi 18:6a4db94011d3 300
sahilmgandhi 18:6a4db94011d3 301 /**
sahilmgandhi 18:6a4db94011d3 302 * @}
sahilmgandhi 18:6a4db94011d3 303 */
sahilmgandhi 18:6a4db94011d3 304
sahilmgandhi 18:6a4db94011d3 305 /** @defgroup LTDC_Exported_Functions_Group2 IO operation functions
sahilmgandhi 18:6a4db94011d3 306 * @brief IO operation functions
sahilmgandhi 18:6a4db94011d3 307 *
sahilmgandhi 18:6a4db94011d3 308 @verbatim
sahilmgandhi 18:6a4db94011d3 309 ===============================================================================
sahilmgandhi 18:6a4db94011d3 310 ##### IO operation functions #####
sahilmgandhi 18:6a4db94011d3 311 ===============================================================================
sahilmgandhi 18:6a4db94011d3 312 [..] This section provides function allowing to:
sahilmgandhi 18:6a4db94011d3 313 (+) Handle LTDC interrupt request
sahilmgandhi 18:6a4db94011d3 314
sahilmgandhi 18:6a4db94011d3 315 @endverbatim
sahilmgandhi 18:6a4db94011d3 316 * @{
sahilmgandhi 18:6a4db94011d3 317 */
sahilmgandhi 18:6a4db94011d3 318 /**
sahilmgandhi 18:6a4db94011d3 319 * @brief Handles LTDC interrupt request.
sahilmgandhi 18:6a4db94011d3 320 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 321 * the configuration information for the LTDC.
sahilmgandhi 18:6a4db94011d3 322 * @retval HAL status
sahilmgandhi 18:6a4db94011d3 323 */
sahilmgandhi 18:6a4db94011d3 324 void HAL_LTDC_IRQHandler(LTDC_HandleTypeDef *hltdc)
sahilmgandhi 18:6a4db94011d3 325 {
sahilmgandhi 18:6a4db94011d3 326 /* Transfer Error Interrupt management ***************************************/
sahilmgandhi 18:6a4db94011d3 327 if(__HAL_LTDC_GET_FLAG(hltdc, LTDC_FLAG_TE) != RESET)
sahilmgandhi 18:6a4db94011d3 328 {
sahilmgandhi 18:6a4db94011d3 329 if(__HAL_LTDC_GET_IT_SOURCE(hltdc, LTDC_IT_TE) != RESET)
sahilmgandhi 18:6a4db94011d3 330 {
sahilmgandhi 18:6a4db94011d3 331 /* Disable the transfer Error interrupt */
sahilmgandhi 18:6a4db94011d3 332 __HAL_LTDC_DISABLE_IT(hltdc, LTDC_IT_TE);
sahilmgandhi 18:6a4db94011d3 333
sahilmgandhi 18:6a4db94011d3 334 /* Clear the transfer error flag */
sahilmgandhi 18:6a4db94011d3 335 __HAL_LTDC_CLEAR_FLAG(hltdc, LTDC_FLAG_TE);
sahilmgandhi 18:6a4db94011d3 336
sahilmgandhi 18:6a4db94011d3 337 /* Update error code */
sahilmgandhi 18:6a4db94011d3 338 hltdc->ErrorCode |= HAL_LTDC_ERROR_TE;
sahilmgandhi 18:6a4db94011d3 339
sahilmgandhi 18:6a4db94011d3 340 /* Change LTDC state */
sahilmgandhi 18:6a4db94011d3 341 hltdc->State = HAL_LTDC_STATE_ERROR;
sahilmgandhi 18:6a4db94011d3 342
sahilmgandhi 18:6a4db94011d3 343 /* Process unlocked */
sahilmgandhi 18:6a4db94011d3 344 __HAL_UNLOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 345
sahilmgandhi 18:6a4db94011d3 346 /* Transfer error Callback */
sahilmgandhi 18:6a4db94011d3 347 HAL_LTDC_ErrorCallback(hltdc);
sahilmgandhi 18:6a4db94011d3 348 }
sahilmgandhi 18:6a4db94011d3 349 }
sahilmgandhi 18:6a4db94011d3 350 /* FIFO underrun Interrupt management ***************************************/
sahilmgandhi 18:6a4db94011d3 351 if(__HAL_LTDC_GET_FLAG(hltdc, LTDC_FLAG_FU) != RESET)
sahilmgandhi 18:6a4db94011d3 352 {
sahilmgandhi 18:6a4db94011d3 353 if(__HAL_LTDC_GET_IT_SOURCE(hltdc, LTDC_IT_FU) != RESET)
sahilmgandhi 18:6a4db94011d3 354 {
sahilmgandhi 18:6a4db94011d3 355 /* Disable the FIFO underrun interrupt */
sahilmgandhi 18:6a4db94011d3 356 __HAL_LTDC_DISABLE_IT(hltdc, LTDC_IT_FU);
sahilmgandhi 18:6a4db94011d3 357
sahilmgandhi 18:6a4db94011d3 358 /* Clear the FIFO underrun flag */
sahilmgandhi 18:6a4db94011d3 359 __HAL_LTDC_CLEAR_FLAG(hltdc, LTDC_FLAG_FU);
sahilmgandhi 18:6a4db94011d3 360
sahilmgandhi 18:6a4db94011d3 361 /* Update error code */
sahilmgandhi 18:6a4db94011d3 362 hltdc->ErrorCode |= HAL_LTDC_ERROR_FU;
sahilmgandhi 18:6a4db94011d3 363
sahilmgandhi 18:6a4db94011d3 364 /* Change LTDC state */
sahilmgandhi 18:6a4db94011d3 365 hltdc->State = HAL_LTDC_STATE_ERROR;
sahilmgandhi 18:6a4db94011d3 366
sahilmgandhi 18:6a4db94011d3 367 /* Process unlocked */
sahilmgandhi 18:6a4db94011d3 368 __HAL_UNLOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 369
sahilmgandhi 18:6a4db94011d3 370 /* Transfer error Callback */
sahilmgandhi 18:6a4db94011d3 371 HAL_LTDC_ErrorCallback(hltdc);
sahilmgandhi 18:6a4db94011d3 372 }
sahilmgandhi 18:6a4db94011d3 373 }
sahilmgandhi 18:6a4db94011d3 374 /* Line Interrupt management ************************************************/
sahilmgandhi 18:6a4db94011d3 375 if(__HAL_LTDC_GET_FLAG(hltdc, LTDC_FLAG_LI) != RESET)
sahilmgandhi 18:6a4db94011d3 376 {
sahilmgandhi 18:6a4db94011d3 377 if(__HAL_LTDC_GET_IT_SOURCE(hltdc, LTDC_IT_LI) != RESET)
sahilmgandhi 18:6a4db94011d3 378 {
sahilmgandhi 18:6a4db94011d3 379 /* Disable the Line interrupt */
sahilmgandhi 18:6a4db94011d3 380 __HAL_LTDC_DISABLE_IT(hltdc, LTDC_IT_LI);
sahilmgandhi 18:6a4db94011d3 381
sahilmgandhi 18:6a4db94011d3 382 /* Clear the Line interrupt flag */
sahilmgandhi 18:6a4db94011d3 383 __HAL_LTDC_CLEAR_FLAG(hltdc, LTDC_FLAG_LI);
sahilmgandhi 18:6a4db94011d3 384
sahilmgandhi 18:6a4db94011d3 385 /* Change LTDC state */
sahilmgandhi 18:6a4db94011d3 386 hltdc->State = HAL_LTDC_STATE_READY;
sahilmgandhi 18:6a4db94011d3 387
sahilmgandhi 18:6a4db94011d3 388 /* Process unlocked */
sahilmgandhi 18:6a4db94011d3 389 __HAL_UNLOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 390
sahilmgandhi 18:6a4db94011d3 391 /* Line interrupt Callback */
sahilmgandhi 18:6a4db94011d3 392 HAL_LTDC_LineEventCallback(hltdc);
sahilmgandhi 18:6a4db94011d3 393 }
sahilmgandhi 18:6a4db94011d3 394 }
sahilmgandhi 18:6a4db94011d3 395 /* Register reload Interrupt management ***************************************/
sahilmgandhi 18:6a4db94011d3 396 if(__HAL_LTDC_GET_FLAG(hltdc, LTDC_FLAG_RR) != RESET)
sahilmgandhi 18:6a4db94011d3 397 {
sahilmgandhi 18:6a4db94011d3 398 if(__HAL_LTDC_GET_IT_SOURCE(hltdc, LTDC_IT_RR) != RESET)
sahilmgandhi 18:6a4db94011d3 399 {
sahilmgandhi 18:6a4db94011d3 400 /* Disable the register reload interrupt */
sahilmgandhi 18:6a4db94011d3 401 __HAL_LTDC_DISABLE_IT(hltdc, LTDC_IT_RR);
sahilmgandhi 18:6a4db94011d3 402
sahilmgandhi 18:6a4db94011d3 403 /* Clear the register reload flag */
sahilmgandhi 18:6a4db94011d3 404 __HAL_LTDC_CLEAR_FLAG(hltdc, LTDC_FLAG_RR);
sahilmgandhi 18:6a4db94011d3 405
sahilmgandhi 18:6a4db94011d3 406 /* Change LTDC state */
sahilmgandhi 18:6a4db94011d3 407 hltdc->State = HAL_LTDC_STATE_READY;
sahilmgandhi 18:6a4db94011d3 408
sahilmgandhi 18:6a4db94011d3 409 /* Process unlocked */
sahilmgandhi 18:6a4db94011d3 410 __HAL_UNLOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 411
sahilmgandhi 18:6a4db94011d3 412 /* Register reload interrupt Callback */
sahilmgandhi 18:6a4db94011d3 413 HAL_LTDC_ReloadEventCallback(hltdc);
sahilmgandhi 18:6a4db94011d3 414 }
sahilmgandhi 18:6a4db94011d3 415 }
sahilmgandhi 18:6a4db94011d3 416 }
sahilmgandhi 18:6a4db94011d3 417
sahilmgandhi 18:6a4db94011d3 418 /**
sahilmgandhi 18:6a4db94011d3 419 * @brief Error LTDC callback.
sahilmgandhi 18:6a4db94011d3 420 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 421 * the configuration information for the LTDC.
sahilmgandhi 18:6a4db94011d3 422 * @retval None
sahilmgandhi 18:6a4db94011d3 423 */
sahilmgandhi 18:6a4db94011d3 424 __weak void HAL_LTDC_ErrorCallback(LTDC_HandleTypeDef *hltdc)
sahilmgandhi 18:6a4db94011d3 425 {
sahilmgandhi 18:6a4db94011d3 426 /* Prevent unused argument(s) compilation warning */
sahilmgandhi 18:6a4db94011d3 427 UNUSED(hltdc);
sahilmgandhi 18:6a4db94011d3 428 /* NOTE : This function Should not be modified, when the callback is needed,
sahilmgandhi 18:6a4db94011d3 429 the HAL_LTDC_ErrorCallback could be implemented in the user file
sahilmgandhi 18:6a4db94011d3 430 */
sahilmgandhi 18:6a4db94011d3 431 }
sahilmgandhi 18:6a4db94011d3 432
sahilmgandhi 18:6a4db94011d3 433 /**
sahilmgandhi 18:6a4db94011d3 434 * @brief Line Event callback.
sahilmgandhi 18:6a4db94011d3 435 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 436 * the configuration information for the LTDC.
sahilmgandhi 18:6a4db94011d3 437 * @retval None
sahilmgandhi 18:6a4db94011d3 438 */
sahilmgandhi 18:6a4db94011d3 439 __weak void HAL_LTDC_LineEventCallback(LTDC_HandleTypeDef *hltdc)
sahilmgandhi 18:6a4db94011d3 440 {
sahilmgandhi 18:6a4db94011d3 441 /* Prevent unused argument(s) compilation warning */
sahilmgandhi 18:6a4db94011d3 442 UNUSED(hltdc);
sahilmgandhi 18:6a4db94011d3 443
sahilmgandhi 18:6a4db94011d3 444 /* NOTE : This function Should not be modified, when the callback is needed,
sahilmgandhi 18:6a4db94011d3 445 the HAL_LTDC_LineEventCallback could be implemented in the user file
sahilmgandhi 18:6a4db94011d3 446 */
sahilmgandhi 18:6a4db94011d3 447 }
sahilmgandhi 18:6a4db94011d3 448
sahilmgandhi 18:6a4db94011d3 449 /**
sahilmgandhi 18:6a4db94011d3 450 * @brief Reload Event callback.
sahilmgandhi 18:6a4db94011d3 451 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 452 * the configuration information for the LTDC.
sahilmgandhi 18:6a4db94011d3 453 * @retval None
sahilmgandhi 18:6a4db94011d3 454 */
sahilmgandhi 18:6a4db94011d3 455 __weak void HAL_LTDC_ReloadEventCallback(LTDC_HandleTypeDef *hltdc)
sahilmgandhi 18:6a4db94011d3 456 {
sahilmgandhi 18:6a4db94011d3 457 /* Prevent unused argument(s) compilation warning */
sahilmgandhi 18:6a4db94011d3 458 UNUSED(hltdc);
sahilmgandhi 18:6a4db94011d3 459
sahilmgandhi 18:6a4db94011d3 460 /* NOTE : This function Should not be modified, when the callback is needed,
sahilmgandhi 18:6a4db94011d3 461 the HAL_LTDC_ReloadEvenCallback could be implemented in the user file
sahilmgandhi 18:6a4db94011d3 462 */
sahilmgandhi 18:6a4db94011d3 463 }
sahilmgandhi 18:6a4db94011d3 464
sahilmgandhi 18:6a4db94011d3 465 /**
sahilmgandhi 18:6a4db94011d3 466 * @}
sahilmgandhi 18:6a4db94011d3 467 */
sahilmgandhi 18:6a4db94011d3 468
sahilmgandhi 18:6a4db94011d3 469 /** @defgroup LTDC_Exported_Functions_Group3 Peripheral Control functions
sahilmgandhi 18:6a4db94011d3 470 * @brief Peripheral Control functions
sahilmgandhi 18:6a4db94011d3 471 *
sahilmgandhi 18:6a4db94011d3 472 @verbatim
sahilmgandhi 18:6a4db94011d3 473 ===============================================================================
sahilmgandhi 18:6a4db94011d3 474 ##### Peripheral Control functions #####
sahilmgandhi 18:6a4db94011d3 475 ===============================================================================
sahilmgandhi 18:6a4db94011d3 476 [..] This section provides functions allowing to:
sahilmgandhi 18:6a4db94011d3 477 (+) Configure the LTDC foreground or/and background parameters.
sahilmgandhi 18:6a4db94011d3 478 (+) Set the active layer.
sahilmgandhi 18:6a4db94011d3 479 (+) Configure the color keying.
sahilmgandhi 18:6a4db94011d3 480 (+) Configure the C-LUT.
sahilmgandhi 18:6a4db94011d3 481 (+) Enable / Disable the color keying.
sahilmgandhi 18:6a4db94011d3 482 (+) Enable / Disable the C-LUT.
sahilmgandhi 18:6a4db94011d3 483 (+) Update the layer position.
sahilmgandhi 18:6a4db94011d3 484 (+) Update the layer size.
sahilmgandhi 18:6a4db94011d3 485 (+) Update pixel format on the fly.
sahilmgandhi 18:6a4db94011d3 486 (+) Update transparency on the fly.
sahilmgandhi 18:6a4db94011d3 487 (+) Update address on the fly.
sahilmgandhi 18:6a4db94011d3 488
sahilmgandhi 18:6a4db94011d3 489 @endverbatim
sahilmgandhi 18:6a4db94011d3 490 * @{
sahilmgandhi 18:6a4db94011d3 491 */
sahilmgandhi 18:6a4db94011d3 492
sahilmgandhi 18:6a4db94011d3 493 /**
sahilmgandhi 18:6a4db94011d3 494 * @brief Configure the LTDC Layer according to the specified
sahilmgandhi 18:6a4db94011d3 495 * parameters in the LTDC_InitTypeDef and create the associated handle.
sahilmgandhi 18:6a4db94011d3 496 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 497 * the configuration information for the LTDC.
sahilmgandhi 18:6a4db94011d3 498 * @param pLayerCfg: pointer to a LTDC_LayerCfgTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 499 * the configuration information for the Layer.
sahilmgandhi 18:6a4db94011d3 500 * @param LayerIdx: LTDC Layer index.
sahilmgandhi 18:6a4db94011d3 501 * This parameter can be one of the following values:
sahilmgandhi 18:6a4db94011d3 502 * 0 or 1
sahilmgandhi 18:6a4db94011d3 503 * @retval HAL status
sahilmgandhi 18:6a4db94011d3 504 */
sahilmgandhi 18:6a4db94011d3 505 HAL_StatusTypeDef HAL_LTDC_ConfigLayer(LTDC_HandleTypeDef *hltdc, LTDC_LayerCfgTypeDef *pLayerCfg, uint32_t LayerIdx)
sahilmgandhi 18:6a4db94011d3 506 {
sahilmgandhi 18:6a4db94011d3 507 /* Process locked */
sahilmgandhi 18:6a4db94011d3 508 __HAL_LOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 509
sahilmgandhi 18:6a4db94011d3 510 /* Change LTDC peripheral state */
sahilmgandhi 18:6a4db94011d3 511 hltdc->State = HAL_LTDC_STATE_BUSY;
sahilmgandhi 18:6a4db94011d3 512
sahilmgandhi 18:6a4db94011d3 513 /* Check the parameters */
sahilmgandhi 18:6a4db94011d3 514 assert_param(IS_LTDC_LAYER(LayerIdx));
sahilmgandhi 18:6a4db94011d3 515 assert_param(IS_LTDC_PIXEL_FORMAT(pLayerCfg->PixelFormat));
sahilmgandhi 18:6a4db94011d3 516 assert_param(IS_LTDC_BLENDING_FACTOR1(pLayerCfg->BlendingFactor1));
sahilmgandhi 18:6a4db94011d3 517 assert_param(IS_LTDC_BLENDING_FACTOR2(pLayerCfg->BlendingFactor2));
sahilmgandhi 18:6a4db94011d3 518 assert_param(IS_LTDC_HCONFIGST(pLayerCfg->WindowX0));
sahilmgandhi 18:6a4db94011d3 519 assert_param(IS_LTDC_HCONFIGSP(pLayerCfg->WindowX1));
sahilmgandhi 18:6a4db94011d3 520 assert_param(IS_LTDC_VCONFIGST(pLayerCfg->WindowY0));
sahilmgandhi 18:6a4db94011d3 521 assert_param(IS_LTDC_VCONFIGSP(pLayerCfg->WindowY1));
sahilmgandhi 18:6a4db94011d3 522 assert_param(IS_LTDC_ALPHA(pLayerCfg->Alpha0));
sahilmgandhi 18:6a4db94011d3 523 assert_param(IS_LTDC_CFBLL(pLayerCfg->ImageWidth));
sahilmgandhi 18:6a4db94011d3 524 assert_param(IS_LTDC_CFBLNBR(pLayerCfg->ImageHeight));
sahilmgandhi 18:6a4db94011d3 525
sahilmgandhi 18:6a4db94011d3 526 /* Copy new layer configuration into handle structure */
sahilmgandhi 18:6a4db94011d3 527 hltdc->LayerCfg[LayerIdx] = *pLayerCfg;
sahilmgandhi 18:6a4db94011d3 528
sahilmgandhi 18:6a4db94011d3 529 /* Configure the LTDC Layer */
sahilmgandhi 18:6a4db94011d3 530 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx);
sahilmgandhi 18:6a4db94011d3 531
sahilmgandhi 18:6a4db94011d3 532 /* Sets the Reload type */
sahilmgandhi 18:6a4db94011d3 533 hltdc->Instance->SRCR = LTDC_SRCR_IMR;
sahilmgandhi 18:6a4db94011d3 534
sahilmgandhi 18:6a4db94011d3 535 /* Initialize the LTDC state*/
sahilmgandhi 18:6a4db94011d3 536 hltdc->State = HAL_LTDC_STATE_READY;
sahilmgandhi 18:6a4db94011d3 537
sahilmgandhi 18:6a4db94011d3 538 /* Process unlocked */
sahilmgandhi 18:6a4db94011d3 539 __HAL_UNLOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 540
sahilmgandhi 18:6a4db94011d3 541 return HAL_OK;
sahilmgandhi 18:6a4db94011d3 542 }
sahilmgandhi 18:6a4db94011d3 543
sahilmgandhi 18:6a4db94011d3 544 /**
sahilmgandhi 18:6a4db94011d3 545 * @brief Configure the color keying.
sahilmgandhi 18:6a4db94011d3 546 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 547 * the configuration information for the LTDC.
sahilmgandhi 18:6a4db94011d3 548 * @param RGBValue: the color key value
sahilmgandhi 18:6a4db94011d3 549 * @param LayerIdx: LTDC Layer index.
sahilmgandhi 18:6a4db94011d3 550 * This parameter can be one of the following values:
sahilmgandhi 18:6a4db94011d3 551 * 0 or 1
sahilmgandhi 18:6a4db94011d3 552 * @retval HAL status
sahilmgandhi 18:6a4db94011d3 553 */
sahilmgandhi 18:6a4db94011d3 554 HAL_StatusTypeDef HAL_LTDC_ConfigColorKeying(LTDC_HandleTypeDef *hltdc, uint32_t RGBValue, uint32_t LayerIdx)
sahilmgandhi 18:6a4db94011d3 555 {
sahilmgandhi 18:6a4db94011d3 556 /* Process locked */
sahilmgandhi 18:6a4db94011d3 557 __HAL_LOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 558
sahilmgandhi 18:6a4db94011d3 559 /* Change LTDC peripheral state */
sahilmgandhi 18:6a4db94011d3 560 hltdc->State = HAL_LTDC_STATE_BUSY;
sahilmgandhi 18:6a4db94011d3 561
sahilmgandhi 18:6a4db94011d3 562 /* Check the parameters */
sahilmgandhi 18:6a4db94011d3 563 assert_param(IS_LTDC_LAYER(LayerIdx));
sahilmgandhi 18:6a4db94011d3 564
sahilmgandhi 18:6a4db94011d3 565 /* Configures the default color values */
sahilmgandhi 18:6a4db94011d3 566 LTDC_LAYER(hltdc, LayerIdx)->CKCR &= ~(LTDC_LxCKCR_CKBLUE | LTDC_LxCKCR_CKGREEN | LTDC_LxCKCR_CKRED);
sahilmgandhi 18:6a4db94011d3 567 LTDC_LAYER(hltdc, LayerIdx)->CKCR = RGBValue;
sahilmgandhi 18:6a4db94011d3 568
sahilmgandhi 18:6a4db94011d3 569 /* Sets the Reload type */
sahilmgandhi 18:6a4db94011d3 570 hltdc->Instance->SRCR = LTDC_SRCR_IMR;
sahilmgandhi 18:6a4db94011d3 571
sahilmgandhi 18:6a4db94011d3 572 /* Change the LTDC state*/
sahilmgandhi 18:6a4db94011d3 573 hltdc->State = HAL_LTDC_STATE_READY;
sahilmgandhi 18:6a4db94011d3 574
sahilmgandhi 18:6a4db94011d3 575 /* Process unlocked */
sahilmgandhi 18:6a4db94011d3 576 __HAL_UNLOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 577
sahilmgandhi 18:6a4db94011d3 578 return HAL_OK;
sahilmgandhi 18:6a4db94011d3 579 }
sahilmgandhi 18:6a4db94011d3 580
sahilmgandhi 18:6a4db94011d3 581 /**
sahilmgandhi 18:6a4db94011d3 582 * @brief Load the color lookup table.
sahilmgandhi 18:6a4db94011d3 583 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 584 * the configuration information for the LTDC.
sahilmgandhi 18:6a4db94011d3 585 * @param pCLUT: pointer to the color lookup table address.
sahilmgandhi 18:6a4db94011d3 586 * @param CLUTSize: the color lookup table size.
sahilmgandhi 18:6a4db94011d3 587 * @param LayerIdx: LTDC Layer index.
sahilmgandhi 18:6a4db94011d3 588 * This parameter can be one of the following values:
sahilmgandhi 18:6a4db94011d3 589 * 0 or 1
sahilmgandhi 18:6a4db94011d3 590 * @retval HAL status
sahilmgandhi 18:6a4db94011d3 591 */
sahilmgandhi 18:6a4db94011d3 592 HAL_StatusTypeDef HAL_LTDC_ConfigCLUT(LTDC_HandleTypeDef *hltdc, uint32_t *pCLUT, uint32_t CLUTSize, uint32_t LayerIdx)
sahilmgandhi 18:6a4db94011d3 593 {
sahilmgandhi 18:6a4db94011d3 594 uint32_t tmp = 0U;
sahilmgandhi 18:6a4db94011d3 595 uint32_t counter = 0U;
sahilmgandhi 18:6a4db94011d3 596 uint32_t pcounter = 0U;
sahilmgandhi 18:6a4db94011d3 597
sahilmgandhi 18:6a4db94011d3 598 /* Process locked */
sahilmgandhi 18:6a4db94011d3 599 __HAL_LOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 600
sahilmgandhi 18:6a4db94011d3 601 /* Change LTDC peripheral state */
sahilmgandhi 18:6a4db94011d3 602 hltdc->State = HAL_LTDC_STATE_BUSY;
sahilmgandhi 18:6a4db94011d3 603
sahilmgandhi 18:6a4db94011d3 604 /* Check the parameters */
sahilmgandhi 18:6a4db94011d3 605 assert_param(IS_LTDC_LAYER(LayerIdx));
sahilmgandhi 18:6a4db94011d3 606
sahilmgandhi 18:6a4db94011d3 607 for(counter = 0U; (counter < CLUTSize); counter++)
sahilmgandhi 18:6a4db94011d3 608 {
sahilmgandhi 18:6a4db94011d3 609 if(hltdc->LayerCfg[LayerIdx].PixelFormat == LTDC_PIXEL_FORMAT_AL44)
sahilmgandhi 18:6a4db94011d3 610 {
sahilmgandhi 18:6a4db94011d3 611 tmp = (((counter + 16U*counter) << 24U) | ((uint32_t)(*pCLUT) & 0xFFU) | ((uint32_t)(*pCLUT) & 0xFF00U) | ((uint32_t)(*pCLUT) & 0xFF0000U));
sahilmgandhi 18:6a4db94011d3 612 }
sahilmgandhi 18:6a4db94011d3 613 else
sahilmgandhi 18:6a4db94011d3 614 {
sahilmgandhi 18:6a4db94011d3 615 tmp = ((counter << 24U) | ((uint32_t)(*pCLUT) & 0xFFU) | ((uint32_t)(*pCLUT) & 0xFF00U) | ((uint32_t)(*pCLUT) & 0xFF0000U));
sahilmgandhi 18:6a4db94011d3 616 }
sahilmgandhi 18:6a4db94011d3 617 pcounter = (uint32_t)pCLUT + sizeof(*pCLUT);
sahilmgandhi 18:6a4db94011d3 618 pCLUT = (uint32_t *)pcounter;
sahilmgandhi 18:6a4db94011d3 619
sahilmgandhi 18:6a4db94011d3 620 /* Specifies the C-LUT address and RGB value */
sahilmgandhi 18:6a4db94011d3 621 LTDC_LAYER(hltdc, LayerIdx)->CLUTWR = tmp;
sahilmgandhi 18:6a4db94011d3 622 }
sahilmgandhi 18:6a4db94011d3 623
sahilmgandhi 18:6a4db94011d3 624 /* Change the LTDC state*/
sahilmgandhi 18:6a4db94011d3 625 hltdc->State = HAL_LTDC_STATE_READY;
sahilmgandhi 18:6a4db94011d3 626
sahilmgandhi 18:6a4db94011d3 627 /* Process unlocked */
sahilmgandhi 18:6a4db94011d3 628 __HAL_UNLOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 629
sahilmgandhi 18:6a4db94011d3 630 return HAL_OK;
sahilmgandhi 18:6a4db94011d3 631 }
sahilmgandhi 18:6a4db94011d3 632
sahilmgandhi 18:6a4db94011d3 633 /**
sahilmgandhi 18:6a4db94011d3 634 * @brief Enable the color keying.
sahilmgandhi 18:6a4db94011d3 635 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 636 * the configuration information for the LTDC.
sahilmgandhi 18:6a4db94011d3 637 * @param LayerIdx: LTDC Layer index.
sahilmgandhi 18:6a4db94011d3 638 * This parameter can be one of the following values:
sahilmgandhi 18:6a4db94011d3 639 * 0 or 1
sahilmgandhi 18:6a4db94011d3 640 * @retval HAL status
sahilmgandhi 18:6a4db94011d3 641 */
sahilmgandhi 18:6a4db94011d3 642 HAL_StatusTypeDef HAL_LTDC_EnableColorKeying(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx)
sahilmgandhi 18:6a4db94011d3 643 {
sahilmgandhi 18:6a4db94011d3 644 /* Process locked */
sahilmgandhi 18:6a4db94011d3 645 __HAL_LOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 646
sahilmgandhi 18:6a4db94011d3 647 /* Change LTDC peripheral state */
sahilmgandhi 18:6a4db94011d3 648 hltdc->State = HAL_LTDC_STATE_BUSY;
sahilmgandhi 18:6a4db94011d3 649
sahilmgandhi 18:6a4db94011d3 650 /* Check the parameters */
sahilmgandhi 18:6a4db94011d3 651 assert_param(IS_LTDC_LAYER(LayerIdx));
sahilmgandhi 18:6a4db94011d3 652
sahilmgandhi 18:6a4db94011d3 653 /* Enable LTDC color keying by setting COLKEN bit */
sahilmgandhi 18:6a4db94011d3 654 LTDC_LAYER(hltdc, LayerIdx)->CR |= (uint32_t)LTDC_LxCR_COLKEN;
sahilmgandhi 18:6a4db94011d3 655
sahilmgandhi 18:6a4db94011d3 656 /* Sets the Reload type */
sahilmgandhi 18:6a4db94011d3 657 hltdc->Instance->SRCR = LTDC_SRCR_IMR;
sahilmgandhi 18:6a4db94011d3 658
sahilmgandhi 18:6a4db94011d3 659 /* Change the LTDC state*/
sahilmgandhi 18:6a4db94011d3 660 hltdc->State = HAL_LTDC_STATE_READY;
sahilmgandhi 18:6a4db94011d3 661
sahilmgandhi 18:6a4db94011d3 662 /* Process unlocked */
sahilmgandhi 18:6a4db94011d3 663 __HAL_UNLOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 664
sahilmgandhi 18:6a4db94011d3 665 return HAL_OK;
sahilmgandhi 18:6a4db94011d3 666 }
sahilmgandhi 18:6a4db94011d3 667
sahilmgandhi 18:6a4db94011d3 668 /**
sahilmgandhi 18:6a4db94011d3 669 * @brief Disable the color keying.
sahilmgandhi 18:6a4db94011d3 670 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 671 * the configuration information for the LTDC.
sahilmgandhi 18:6a4db94011d3 672 * @param LayerIdx: LTDC Layer index.
sahilmgandhi 18:6a4db94011d3 673 * This parameter can be one of the following values:
sahilmgandhi 18:6a4db94011d3 674 * 0 or 1
sahilmgandhi 18:6a4db94011d3 675 * @retval HAL status
sahilmgandhi 18:6a4db94011d3 676 */
sahilmgandhi 18:6a4db94011d3 677 HAL_StatusTypeDef HAL_LTDC_DisableColorKeying(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx)
sahilmgandhi 18:6a4db94011d3 678 {
sahilmgandhi 18:6a4db94011d3 679 /* Process locked */
sahilmgandhi 18:6a4db94011d3 680 __HAL_LOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 681
sahilmgandhi 18:6a4db94011d3 682 /* Change LTDC peripheral state */
sahilmgandhi 18:6a4db94011d3 683 hltdc->State = HAL_LTDC_STATE_BUSY;
sahilmgandhi 18:6a4db94011d3 684
sahilmgandhi 18:6a4db94011d3 685 /* Check the parameters */
sahilmgandhi 18:6a4db94011d3 686 assert_param(IS_LTDC_LAYER(LayerIdx));
sahilmgandhi 18:6a4db94011d3 687
sahilmgandhi 18:6a4db94011d3 688 /* Disable LTDC color keying by setting COLKEN bit */
sahilmgandhi 18:6a4db94011d3 689 LTDC_LAYER(hltdc, LayerIdx)->CR &= ~(uint32_t)LTDC_LxCR_COLKEN;
sahilmgandhi 18:6a4db94011d3 690
sahilmgandhi 18:6a4db94011d3 691 /* Sets the Reload type */
sahilmgandhi 18:6a4db94011d3 692 hltdc->Instance->SRCR = LTDC_SRCR_IMR;
sahilmgandhi 18:6a4db94011d3 693
sahilmgandhi 18:6a4db94011d3 694 /* Change the LTDC state*/
sahilmgandhi 18:6a4db94011d3 695 hltdc->State = HAL_LTDC_STATE_READY;
sahilmgandhi 18:6a4db94011d3 696
sahilmgandhi 18:6a4db94011d3 697 /* Process unlocked */
sahilmgandhi 18:6a4db94011d3 698 __HAL_UNLOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 699
sahilmgandhi 18:6a4db94011d3 700 return HAL_OK;
sahilmgandhi 18:6a4db94011d3 701 }
sahilmgandhi 18:6a4db94011d3 702
sahilmgandhi 18:6a4db94011d3 703 /**
sahilmgandhi 18:6a4db94011d3 704 * @brief Enable the color lookup table.
sahilmgandhi 18:6a4db94011d3 705 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 706 * the configuration information for the LTDC.
sahilmgandhi 18:6a4db94011d3 707 * @param LayerIdx: LTDC Layer index.
sahilmgandhi 18:6a4db94011d3 708 * This parameter can be one of the following values:
sahilmgandhi 18:6a4db94011d3 709 * 0 or 1
sahilmgandhi 18:6a4db94011d3 710 * @retval HAL status
sahilmgandhi 18:6a4db94011d3 711 */
sahilmgandhi 18:6a4db94011d3 712 HAL_StatusTypeDef HAL_LTDC_EnableCLUT(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx)
sahilmgandhi 18:6a4db94011d3 713 {
sahilmgandhi 18:6a4db94011d3 714
sahilmgandhi 18:6a4db94011d3 715 /* Process locked */
sahilmgandhi 18:6a4db94011d3 716 __HAL_LOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 717
sahilmgandhi 18:6a4db94011d3 718 /* Change LTDC peripheral state */
sahilmgandhi 18:6a4db94011d3 719 hltdc->State = HAL_LTDC_STATE_BUSY;
sahilmgandhi 18:6a4db94011d3 720
sahilmgandhi 18:6a4db94011d3 721 /* Check the parameters */
sahilmgandhi 18:6a4db94011d3 722 assert_param(IS_LTDC_LAYER(LayerIdx));
sahilmgandhi 18:6a4db94011d3 723
sahilmgandhi 18:6a4db94011d3 724 /* Disable LTDC color lookup table by setting CLUTEN bit */
sahilmgandhi 18:6a4db94011d3 725 LTDC_LAYER(hltdc, LayerIdx)->CR |= (uint32_t)LTDC_LxCR_CLUTEN;
sahilmgandhi 18:6a4db94011d3 726
sahilmgandhi 18:6a4db94011d3 727 /* Sets the Reload type */
sahilmgandhi 18:6a4db94011d3 728 hltdc->Instance->SRCR = LTDC_SRCR_IMR;
sahilmgandhi 18:6a4db94011d3 729
sahilmgandhi 18:6a4db94011d3 730 /* Change the LTDC state*/
sahilmgandhi 18:6a4db94011d3 731 hltdc->State = HAL_LTDC_STATE_READY;
sahilmgandhi 18:6a4db94011d3 732
sahilmgandhi 18:6a4db94011d3 733 /* Process unlocked */
sahilmgandhi 18:6a4db94011d3 734 __HAL_UNLOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 735
sahilmgandhi 18:6a4db94011d3 736 return HAL_OK;
sahilmgandhi 18:6a4db94011d3 737 }
sahilmgandhi 18:6a4db94011d3 738
sahilmgandhi 18:6a4db94011d3 739 /**
sahilmgandhi 18:6a4db94011d3 740 * @brief Disable the color lookup table.
sahilmgandhi 18:6a4db94011d3 741 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 742 * the configuration information for the LTDC.
sahilmgandhi 18:6a4db94011d3 743 * @param LayerIdx: LTDC Layer index.
sahilmgandhi 18:6a4db94011d3 744 * This parameter can be one of the following values:
sahilmgandhi 18:6a4db94011d3 745 * 0 or 1
sahilmgandhi 18:6a4db94011d3 746 * @retval HAL status
sahilmgandhi 18:6a4db94011d3 747 */
sahilmgandhi 18:6a4db94011d3 748 HAL_StatusTypeDef HAL_LTDC_DisableCLUT(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx)
sahilmgandhi 18:6a4db94011d3 749 {
sahilmgandhi 18:6a4db94011d3 750
sahilmgandhi 18:6a4db94011d3 751 /* Process locked */
sahilmgandhi 18:6a4db94011d3 752 __HAL_LOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 753
sahilmgandhi 18:6a4db94011d3 754 /* Change LTDC peripheral state */
sahilmgandhi 18:6a4db94011d3 755 hltdc->State = HAL_LTDC_STATE_BUSY;
sahilmgandhi 18:6a4db94011d3 756
sahilmgandhi 18:6a4db94011d3 757 /* Check the parameters */
sahilmgandhi 18:6a4db94011d3 758 assert_param(IS_LTDC_LAYER(LayerIdx));
sahilmgandhi 18:6a4db94011d3 759
sahilmgandhi 18:6a4db94011d3 760 /* Disable LTDC color lookup table by setting CLUTEN bit */
sahilmgandhi 18:6a4db94011d3 761 LTDC_LAYER(hltdc, LayerIdx)->CR &= ~(uint32_t)LTDC_LxCR_CLUTEN;
sahilmgandhi 18:6a4db94011d3 762
sahilmgandhi 18:6a4db94011d3 763 /* Sets the Reload type */
sahilmgandhi 18:6a4db94011d3 764 hltdc->Instance->SRCR = LTDC_SRCR_IMR;
sahilmgandhi 18:6a4db94011d3 765
sahilmgandhi 18:6a4db94011d3 766 /* Change the LTDC state*/
sahilmgandhi 18:6a4db94011d3 767 hltdc->State = HAL_LTDC_STATE_READY;
sahilmgandhi 18:6a4db94011d3 768
sahilmgandhi 18:6a4db94011d3 769 /* Process unlocked */
sahilmgandhi 18:6a4db94011d3 770 __HAL_UNLOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 771
sahilmgandhi 18:6a4db94011d3 772 return HAL_OK;
sahilmgandhi 18:6a4db94011d3 773 }
sahilmgandhi 18:6a4db94011d3 774
sahilmgandhi 18:6a4db94011d3 775 /**
sahilmgandhi 18:6a4db94011d3 776 * @brief Enables Dither.
sahilmgandhi 18:6a4db94011d3 777 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 778 * the configuration information for the LTDC.
sahilmgandhi 18:6a4db94011d3 779 * @retval HAL status
sahilmgandhi 18:6a4db94011d3 780 */
sahilmgandhi 18:6a4db94011d3 781
sahilmgandhi 18:6a4db94011d3 782 HAL_StatusTypeDef HAL_LTDC_EnableDither(LTDC_HandleTypeDef *hltdc)
sahilmgandhi 18:6a4db94011d3 783 {
sahilmgandhi 18:6a4db94011d3 784 /* Process locked */
sahilmgandhi 18:6a4db94011d3 785 __HAL_LOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 786
sahilmgandhi 18:6a4db94011d3 787 /* Change LTDC peripheral state */
sahilmgandhi 18:6a4db94011d3 788 hltdc->State = HAL_LTDC_STATE_BUSY;
sahilmgandhi 18:6a4db94011d3 789
sahilmgandhi 18:6a4db94011d3 790 /* Enable Dither by setting DTEN bit */
sahilmgandhi 18:6a4db94011d3 791 LTDC->GCR |= (uint32_t)LTDC_GCR_DTEN;
sahilmgandhi 18:6a4db94011d3 792
sahilmgandhi 18:6a4db94011d3 793 /* Change the LTDC state*/
sahilmgandhi 18:6a4db94011d3 794 hltdc->State = HAL_LTDC_STATE_READY;
sahilmgandhi 18:6a4db94011d3 795
sahilmgandhi 18:6a4db94011d3 796 /* Process unlocked */
sahilmgandhi 18:6a4db94011d3 797 __HAL_UNLOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 798
sahilmgandhi 18:6a4db94011d3 799 return HAL_OK;
sahilmgandhi 18:6a4db94011d3 800 }
sahilmgandhi 18:6a4db94011d3 801
sahilmgandhi 18:6a4db94011d3 802 /**
sahilmgandhi 18:6a4db94011d3 803 * @brief Disables Dither.
sahilmgandhi 18:6a4db94011d3 804 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 805 * the configuration information for the LTDC.
sahilmgandhi 18:6a4db94011d3 806 * @retval HAL status
sahilmgandhi 18:6a4db94011d3 807 */
sahilmgandhi 18:6a4db94011d3 808
sahilmgandhi 18:6a4db94011d3 809 HAL_StatusTypeDef HAL_LTDC_DisableDither(LTDC_HandleTypeDef *hltdc)
sahilmgandhi 18:6a4db94011d3 810 {
sahilmgandhi 18:6a4db94011d3 811 /* Process locked */
sahilmgandhi 18:6a4db94011d3 812 __HAL_LOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 813
sahilmgandhi 18:6a4db94011d3 814 /* Change LTDC peripheral state */
sahilmgandhi 18:6a4db94011d3 815 hltdc->State = HAL_LTDC_STATE_BUSY;
sahilmgandhi 18:6a4db94011d3 816
sahilmgandhi 18:6a4db94011d3 817 /* Disable Dither by setting DTEN bit */
sahilmgandhi 18:6a4db94011d3 818 LTDC->GCR &= ~(uint32_t)LTDC_GCR_DTEN;
sahilmgandhi 18:6a4db94011d3 819
sahilmgandhi 18:6a4db94011d3 820 /* Change the LTDC state*/
sahilmgandhi 18:6a4db94011d3 821 hltdc->State = HAL_LTDC_STATE_READY;
sahilmgandhi 18:6a4db94011d3 822
sahilmgandhi 18:6a4db94011d3 823 /* Process unlocked */
sahilmgandhi 18:6a4db94011d3 824 __HAL_UNLOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 825
sahilmgandhi 18:6a4db94011d3 826 return HAL_OK;
sahilmgandhi 18:6a4db94011d3 827 }
sahilmgandhi 18:6a4db94011d3 828
sahilmgandhi 18:6a4db94011d3 829 /**
sahilmgandhi 18:6a4db94011d3 830 * @brief Set the LTDC window size.
sahilmgandhi 18:6a4db94011d3 831 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 832 * the configuration information for the LTDC.
sahilmgandhi 18:6a4db94011d3 833 * @param XSize: LTDC Pixel per line
sahilmgandhi 18:6a4db94011d3 834 * @param YSize: LTDC Line number
sahilmgandhi 18:6a4db94011d3 835 * @param LayerIdx: LTDC Layer index.
sahilmgandhi 18:6a4db94011d3 836 * This parameter can be one of the following values:
sahilmgandhi 18:6a4db94011d3 837 * 0 or 1
sahilmgandhi 18:6a4db94011d3 838 * @retval HAL status
sahilmgandhi 18:6a4db94011d3 839 */
sahilmgandhi 18:6a4db94011d3 840 HAL_StatusTypeDef HAL_LTDC_SetWindowSize(LTDC_HandleTypeDef *hltdc, uint32_t XSize, uint32_t YSize, uint32_t LayerIdx)
sahilmgandhi 18:6a4db94011d3 841 {
sahilmgandhi 18:6a4db94011d3 842 LTDC_LayerCfgTypeDef *pLayerCfg;
sahilmgandhi 18:6a4db94011d3 843
sahilmgandhi 18:6a4db94011d3 844 /* Process locked */
sahilmgandhi 18:6a4db94011d3 845 __HAL_LOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 846
sahilmgandhi 18:6a4db94011d3 847 /* Change LTDC peripheral state */
sahilmgandhi 18:6a4db94011d3 848 hltdc->State = HAL_LTDC_STATE_BUSY;
sahilmgandhi 18:6a4db94011d3 849
sahilmgandhi 18:6a4db94011d3 850 /* Get layer configuration from handle structure */
sahilmgandhi 18:6a4db94011d3 851 pLayerCfg = &hltdc->LayerCfg[LayerIdx];
sahilmgandhi 18:6a4db94011d3 852
sahilmgandhi 18:6a4db94011d3 853 /* Check the parameters (Layers parameters)*/
sahilmgandhi 18:6a4db94011d3 854 assert_param(IS_LTDC_LAYER(LayerIdx));
sahilmgandhi 18:6a4db94011d3 855 assert_param(IS_LTDC_HCONFIGST(pLayerCfg->WindowX0));
sahilmgandhi 18:6a4db94011d3 856 assert_param(IS_LTDC_HCONFIGSP(pLayerCfg->WindowX1));
sahilmgandhi 18:6a4db94011d3 857 assert_param(IS_LTDC_VCONFIGST(pLayerCfg->WindowY0));
sahilmgandhi 18:6a4db94011d3 858 assert_param(IS_LTDC_VCONFIGSP(pLayerCfg->WindowY1));
sahilmgandhi 18:6a4db94011d3 859 assert_param(IS_LTDC_CFBLL(XSize));
sahilmgandhi 18:6a4db94011d3 860 assert_param(IS_LTDC_CFBLNBR(YSize));
sahilmgandhi 18:6a4db94011d3 861
sahilmgandhi 18:6a4db94011d3 862 /* update horizontal start/stop */
sahilmgandhi 18:6a4db94011d3 863 pLayerCfg->WindowX0 = 0U;
sahilmgandhi 18:6a4db94011d3 864 pLayerCfg->WindowX1 = XSize + pLayerCfg->WindowX0;
sahilmgandhi 18:6a4db94011d3 865
sahilmgandhi 18:6a4db94011d3 866 /* update vertical start/stop */
sahilmgandhi 18:6a4db94011d3 867 pLayerCfg->WindowY0 = 0U;
sahilmgandhi 18:6a4db94011d3 868 pLayerCfg->WindowY1 = YSize + pLayerCfg->WindowY0;
sahilmgandhi 18:6a4db94011d3 869
sahilmgandhi 18:6a4db94011d3 870 /* Reconfigures the color frame buffer pitch in byte */
sahilmgandhi 18:6a4db94011d3 871 pLayerCfg->ImageWidth = XSize;
sahilmgandhi 18:6a4db94011d3 872
sahilmgandhi 18:6a4db94011d3 873 /* Reconfigures the frame buffer line number */
sahilmgandhi 18:6a4db94011d3 874 pLayerCfg->ImageHeight = YSize;
sahilmgandhi 18:6a4db94011d3 875
sahilmgandhi 18:6a4db94011d3 876 /* Set LTDC parameters */
sahilmgandhi 18:6a4db94011d3 877 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx);
sahilmgandhi 18:6a4db94011d3 878
sahilmgandhi 18:6a4db94011d3 879 /* Sets the Reload type */
sahilmgandhi 18:6a4db94011d3 880 hltdc->Instance->SRCR = LTDC_SRCR_IMR;
sahilmgandhi 18:6a4db94011d3 881
sahilmgandhi 18:6a4db94011d3 882 /* Change the LTDC state*/
sahilmgandhi 18:6a4db94011d3 883 hltdc->State = HAL_LTDC_STATE_READY;
sahilmgandhi 18:6a4db94011d3 884
sahilmgandhi 18:6a4db94011d3 885 /* Process unlocked */
sahilmgandhi 18:6a4db94011d3 886 __HAL_UNLOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 887
sahilmgandhi 18:6a4db94011d3 888 return HAL_OK;
sahilmgandhi 18:6a4db94011d3 889 }
sahilmgandhi 18:6a4db94011d3 890
sahilmgandhi 18:6a4db94011d3 891 /**
sahilmgandhi 18:6a4db94011d3 892 * @brief Set the LTDC window position.
sahilmgandhi 18:6a4db94011d3 893 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 894 * the configuration information for the LTDC.
sahilmgandhi 18:6a4db94011d3 895 * @param X0: LTDC window X offset
sahilmgandhi 18:6a4db94011d3 896 * @param Y0: LTDC window Y offset
sahilmgandhi 18:6a4db94011d3 897 * @param LayerIdx: LTDC Layer index.
sahilmgandhi 18:6a4db94011d3 898 * This parameter can be one of the following values:
sahilmgandhi 18:6a4db94011d3 899 * 0 or 1
sahilmgandhi 18:6a4db94011d3 900 * @retval HAL status
sahilmgandhi 18:6a4db94011d3 901 */
sahilmgandhi 18:6a4db94011d3 902 HAL_StatusTypeDef HAL_LTDC_SetWindowPosition(LTDC_HandleTypeDef *hltdc, uint32_t X0, uint32_t Y0, uint32_t LayerIdx)
sahilmgandhi 18:6a4db94011d3 903 {
sahilmgandhi 18:6a4db94011d3 904 LTDC_LayerCfgTypeDef *pLayerCfg;
sahilmgandhi 18:6a4db94011d3 905
sahilmgandhi 18:6a4db94011d3 906 /* Process locked */
sahilmgandhi 18:6a4db94011d3 907 __HAL_LOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 908
sahilmgandhi 18:6a4db94011d3 909 /* Change LTDC peripheral state */
sahilmgandhi 18:6a4db94011d3 910 hltdc->State = HAL_LTDC_STATE_BUSY;
sahilmgandhi 18:6a4db94011d3 911
sahilmgandhi 18:6a4db94011d3 912 /* Get layer configuration from handle structure */
sahilmgandhi 18:6a4db94011d3 913 pLayerCfg = &hltdc->LayerCfg[LayerIdx];
sahilmgandhi 18:6a4db94011d3 914
sahilmgandhi 18:6a4db94011d3 915 /* Check the parameters */
sahilmgandhi 18:6a4db94011d3 916 assert_param(IS_LTDC_LAYER(LayerIdx));
sahilmgandhi 18:6a4db94011d3 917 assert_param(IS_LTDC_HCONFIGST(pLayerCfg->WindowX0));
sahilmgandhi 18:6a4db94011d3 918 assert_param(IS_LTDC_HCONFIGSP(pLayerCfg->WindowX1));
sahilmgandhi 18:6a4db94011d3 919 assert_param(IS_LTDC_VCONFIGST(pLayerCfg->WindowY0));
sahilmgandhi 18:6a4db94011d3 920 assert_param(IS_LTDC_VCONFIGSP(pLayerCfg->WindowY1));
sahilmgandhi 18:6a4db94011d3 921
sahilmgandhi 18:6a4db94011d3 922 /* update horizontal start/stop */
sahilmgandhi 18:6a4db94011d3 923 pLayerCfg->WindowX0 = X0;
sahilmgandhi 18:6a4db94011d3 924 pLayerCfg->WindowX1 = X0 + pLayerCfg->ImageWidth;
sahilmgandhi 18:6a4db94011d3 925
sahilmgandhi 18:6a4db94011d3 926 /* update vertical start/stop */
sahilmgandhi 18:6a4db94011d3 927 pLayerCfg->WindowY0 = Y0;
sahilmgandhi 18:6a4db94011d3 928 pLayerCfg->WindowY1 = Y0 + pLayerCfg->ImageHeight;
sahilmgandhi 18:6a4db94011d3 929
sahilmgandhi 18:6a4db94011d3 930 /* Set LTDC parameters */
sahilmgandhi 18:6a4db94011d3 931 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx);
sahilmgandhi 18:6a4db94011d3 932
sahilmgandhi 18:6a4db94011d3 933 /* Sets the Reload type */
sahilmgandhi 18:6a4db94011d3 934 hltdc->Instance->SRCR = LTDC_SRCR_IMR;
sahilmgandhi 18:6a4db94011d3 935
sahilmgandhi 18:6a4db94011d3 936 /* Change the LTDC state*/
sahilmgandhi 18:6a4db94011d3 937 hltdc->State = HAL_LTDC_STATE_READY;
sahilmgandhi 18:6a4db94011d3 938
sahilmgandhi 18:6a4db94011d3 939 /* Process unlocked */
sahilmgandhi 18:6a4db94011d3 940 __HAL_UNLOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 941
sahilmgandhi 18:6a4db94011d3 942 return HAL_OK;
sahilmgandhi 18:6a4db94011d3 943 }
sahilmgandhi 18:6a4db94011d3 944
sahilmgandhi 18:6a4db94011d3 945 /**
sahilmgandhi 18:6a4db94011d3 946 * @brief Reconfigure the pixel format.
sahilmgandhi 18:6a4db94011d3 947 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 948 * the configuration information for the LTDC.
sahilmgandhi 18:6a4db94011d3 949 * @param Pixelformat: new pixel format value.
sahilmgandhi 18:6a4db94011d3 950 * @param LayerIdx: LTDC Layer index.
sahilmgandhi 18:6a4db94011d3 951 * This parameter can be one of the following values:
sahilmgandhi 18:6a4db94011d3 952 * 0 or 1.
sahilmgandhi 18:6a4db94011d3 953 * @retval HAL status
sahilmgandhi 18:6a4db94011d3 954 */
sahilmgandhi 18:6a4db94011d3 955 HAL_StatusTypeDef HAL_LTDC_SetPixelFormat(LTDC_HandleTypeDef *hltdc, uint32_t Pixelformat, uint32_t LayerIdx)
sahilmgandhi 18:6a4db94011d3 956 {
sahilmgandhi 18:6a4db94011d3 957 LTDC_LayerCfgTypeDef *pLayerCfg;
sahilmgandhi 18:6a4db94011d3 958
sahilmgandhi 18:6a4db94011d3 959 /* Process locked */
sahilmgandhi 18:6a4db94011d3 960 __HAL_LOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 961
sahilmgandhi 18:6a4db94011d3 962 /* Change LTDC peripheral state */
sahilmgandhi 18:6a4db94011d3 963 hltdc->State = HAL_LTDC_STATE_BUSY;
sahilmgandhi 18:6a4db94011d3 964
sahilmgandhi 18:6a4db94011d3 965 /* Check the parameters */
sahilmgandhi 18:6a4db94011d3 966 assert_param(IS_LTDC_LAYER(LayerIdx));
sahilmgandhi 18:6a4db94011d3 967 assert_param(IS_LTDC_PIXEL_FORMAT(Pixelformat));
sahilmgandhi 18:6a4db94011d3 968
sahilmgandhi 18:6a4db94011d3 969 /* Get layer configuration from handle structure */
sahilmgandhi 18:6a4db94011d3 970 pLayerCfg = &hltdc->LayerCfg[LayerIdx];
sahilmgandhi 18:6a4db94011d3 971
sahilmgandhi 18:6a4db94011d3 972 /* Reconfigure the pixel format */
sahilmgandhi 18:6a4db94011d3 973 pLayerCfg->PixelFormat = Pixelformat;
sahilmgandhi 18:6a4db94011d3 974
sahilmgandhi 18:6a4db94011d3 975 /* Set LTDC parameters */
sahilmgandhi 18:6a4db94011d3 976 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx);
sahilmgandhi 18:6a4db94011d3 977
sahilmgandhi 18:6a4db94011d3 978 /* Sets the Reload type */
sahilmgandhi 18:6a4db94011d3 979 hltdc->Instance->SRCR = LTDC_SRCR_IMR;
sahilmgandhi 18:6a4db94011d3 980
sahilmgandhi 18:6a4db94011d3 981 /* Change the LTDC state*/
sahilmgandhi 18:6a4db94011d3 982 hltdc->State = HAL_LTDC_STATE_READY;
sahilmgandhi 18:6a4db94011d3 983
sahilmgandhi 18:6a4db94011d3 984 /* Process unlocked */
sahilmgandhi 18:6a4db94011d3 985 __HAL_UNLOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 986
sahilmgandhi 18:6a4db94011d3 987 return HAL_OK;
sahilmgandhi 18:6a4db94011d3 988 }
sahilmgandhi 18:6a4db94011d3 989
sahilmgandhi 18:6a4db94011d3 990 /**
sahilmgandhi 18:6a4db94011d3 991 * @brief Reconfigure the layer alpha value.
sahilmgandhi 18:6a4db94011d3 992 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 993 * the configuration information for the LTDC.
sahilmgandhi 18:6a4db94011d3 994 * @param Alpha: new alpha value.
sahilmgandhi 18:6a4db94011d3 995 * @param LayerIdx: LTDC Layer index.
sahilmgandhi 18:6a4db94011d3 996 * This parameter can be one of the following values:
sahilmgandhi 18:6a4db94011d3 997 * 0 or 1
sahilmgandhi 18:6a4db94011d3 998 * @retval HAL status
sahilmgandhi 18:6a4db94011d3 999 */
sahilmgandhi 18:6a4db94011d3 1000 HAL_StatusTypeDef HAL_LTDC_SetAlpha(LTDC_HandleTypeDef *hltdc, uint32_t Alpha, uint32_t LayerIdx)
sahilmgandhi 18:6a4db94011d3 1001 {
sahilmgandhi 18:6a4db94011d3 1002 LTDC_LayerCfgTypeDef *pLayerCfg;
sahilmgandhi 18:6a4db94011d3 1003
sahilmgandhi 18:6a4db94011d3 1004 /* Process locked */
sahilmgandhi 18:6a4db94011d3 1005 __HAL_LOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 1006
sahilmgandhi 18:6a4db94011d3 1007 /* Change LTDC peripheral state */
sahilmgandhi 18:6a4db94011d3 1008 hltdc->State = HAL_LTDC_STATE_BUSY;
sahilmgandhi 18:6a4db94011d3 1009
sahilmgandhi 18:6a4db94011d3 1010 /* Check the parameters */
sahilmgandhi 18:6a4db94011d3 1011 assert_param(IS_LTDC_ALPHA(Alpha));
sahilmgandhi 18:6a4db94011d3 1012 assert_param(IS_LTDC_LAYER(LayerIdx));
sahilmgandhi 18:6a4db94011d3 1013
sahilmgandhi 18:6a4db94011d3 1014 /* Get layer configuration from handle structure */
sahilmgandhi 18:6a4db94011d3 1015 pLayerCfg = &hltdc->LayerCfg[LayerIdx];
sahilmgandhi 18:6a4db94011d3 1016
sahilmgandhi 18:6a4db94011d3 1017 /* Reconfigure the Alpha value */
sahilmgandhi 18:6a4db94011d3 1018 pLayerCfg->Alpha = Alpha;
sahilmgandhi 18:6a4db94011d3 1019
sahilmgandhi 18:6a4db94011d3 1020 /* Set LTDC parameters */
sahilmgandhi 18:6a4db94011d3 1021 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx);
sahilmgandhi 18:6a4db94011d3 1022
sahilmgandhi 18:6a4db94011d3 1023 /* Sets the Reload type */
sahilmgandhi 18:6a4db94011d3 1024 hltdc->Instance->SRCR = LTDC_SRCR_IMR;
sahilmgandhi 18:6a4db94011d3 1025
sahilmgandhi 18:6a4db94011d3 1026 /* Change the LTDC state*/
sahilmgandhi 18:6a4db94011d3 1027 hltdc->State = HAL_LTDC_STATE_READY;
sahilmgandhi 18:6a4db94011d3 1028
sahilmgandhi 18:6a4db94011d3 1029 /* Process unlocked */
sahilmgandhi 18:6a4db94011d3 1030 __HAL_UNLOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 1031
sahilmgandhi 18:6a4db94011d3 1032 return HAL_OK;
sahilmgandhi 18:6a4db94011d3 1033 }
sahilmgandhi 18:6a4db94011d3 1034 /**
sahilmgandhi 18:6a4db94011d3 1035 * @brief Reconfigure the frame buffer Address.
sahilmgandhi 18:6a4db94011d3 1036 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 1037 * the configuration information for the LTDC.
sahilmgandhi 18:6a4db94011d3 1038 * @param Address: new address value.
sahilmgandhi 18:6a4db94011d3 1039 * @param LayerIdx: LTDC Layer index.
sahilmgandhi 18:6a4db94011d3 1040 * This parameter can be one of the following values:
sahilmgandhi 18:6a4db94011d3 1041 * 0 or 1.
sahilmgandhi 18:6a4db94011d3 1042 * @retval HAL status
sahilmgandhi 18:6a4db94011d3 1043 */
sahilmgandhi 18:6a4db94011d3 1044 HAL_StatusTypeDef HAL_LTDC_SetAddress(LTDC_HandleTypeDef *hltdc, uint32_t Address, uint32_t LayerIdx)
sahilmgandhi 18:6a4db94011d3 1045 {
sahilmgandhi 18:6a4db94011d3 1046 LTDC_LayerCfgTypeDef *pLayerCfg;
sahilmgandhi 18:6a4db94011d3 1047
sahilmgandhi 18:6a4db94011d3 1048 /* Process locked */
sahilmgandhi 18:6a4db94011d3 1049 __HAL_LOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 1050
sahilmgandhi 18:6a4db94011d3 1051 /* Change LTDC peripheral state */
sahilmgandhi 18:6a4db94011d3 1052 hltdc->State = HAL_LTDC_STATE_BUSY;
sahilmgandhi 18:6a4db94011d3 1053
sahilmgandhi 18:6a4db94011d3 1054 /* Check the parameters */
sahilmgandhi 18:6a4db94011d3 1055 assert_param(IS_LTDC_LAYER(LayerIdx));
sahilmgandhi 18:6a4db94011d3 1056
sahilmgandhi 18:6a4db94011d3 1057 /* Get layer configuration from handle structure */
sahilmgandhi 18:6a4db94011d3 1058 pLayerCfg = &hltdc->LayerCfg[LayerIdx];
sahilmgandhi 18:6a4db94011d3 1059
sahilmgandhi 18:6a4db94011d3 1060 /* Reconfigure the Address */
sahilmgandhi 18:6a4db94011d3 1061 pLayerCfg->FBStartAdress = Address;
sahilmgandhi 18:6a4db94011d3 1062
sahilmgandhi 18:6a4db94011d3 1063 /* Set LTDC parameters */
sahilmgandhi 18:6a4db94011d3 1064 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx);
sahilmgandhi 18:6a4db94011d3 1065
sahilmgandhi 18:6a4db94011d3 1066 /* Sets the Reload type */
sahilmgandhi 18:6a4db94011d3 1067 hltdc->Instance->SRCR = LTDC_SRCR_IMR;
sahilmgandhi 18:6a4db94011d3 1068
sahilmgandhi 18:6a4db94011d3 1069 /* Change the LTDC state*/
sahilmgandhi 18:6a4db94011d3 1070 hltdc->State = HAL_LTDC_STATE_READY;
sahilmgandhi 18:6a4db94011d3 1071
sahilmgandhi 18:6a4db94011d3 1072 /* Process unlocked */
sahilmgandhi 18:6a4db94011d3 1073 __HAL_UNLOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 1074
sahilmgandhi 18:6a4db94011d3 1075 return HAL_OK;
sahilmgandhi 18:6a4db94011d3 1076 }
sahilmgandhi 18:6a4db94011d3 1077
sahilmgandhi 18:6a4db94011d3 1078 /**
sahilmgandhi 18:6a4db94011d3 1079 * @brief Function used to reconfigure the pitch for specific cases where the attached LayerIdx buffer have a width that is
sahilmgandhi 18:6a4db94011d3 1080 * larger than the one intended to be displayed on screen. Example of a buffer 800x480 attached to layer for which we
sahilmgandhi 18:6a4db94011d3 1081 * want to read and display on screen only a portion 320x240 taken in the center of the buffer. The pitch in pixels
sahilmgandhi 18:6a4db94011d3 1082 * will be in that case 800 pixels and not 320 pixels as initially configured by previous call to HAL_LTDC_ConfigLayer().
sahilmgandhi 18:6a4db94011d3 1083 * Note : this function should be called only after a previous call to HAL_LTDC_ConfigLayer() to modify the default pitch
sahilmgandhi 18:6a4db94011d3 1084 * configured by HAL_LTDC_ConfigLayer() when required (refer to example described just above).
sahilmgandhi 18:6a4db94011d3 1085 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 1086 * the configuration information for the LTDC.
sahilmgandhi 18:6a4db94011d3 1087 * @param LinePitchInPixels: New line pitch in pixels to configure for LTDC layer 'LayerIdx'.
sahilmgandhi 18:6a4db94011d3 1088 * @param LayerIdx: LTDC layer index concerned by the modification of line pitch.
sahilmgandhi 18:6a4db94011d3 1089 * @retval HAL status
sahilmgandhi 18:6a4db94011d3 1090 */
sahilmgandhi 18:6a4db94011d3 1091 HAL_StatusTypeDef HAL_LTDC_SetPitch(LTDC_HandleTypeDef *hltdc, uint32_t LinePitchInPixels, uint32_t LayerIdx)
sahilmgandhi 18:6a4db94011d3 1092 {
sahilmgandhi 18:6a4db94011d3 1093 uint32_t tmp = 0U;
sahilmgandhi 18:6a4db94011d3 1094 uint32_t pitchUpdate = 0U;
sahilmgandhi 18:6a4db94011d3 1095 uint32_t pixelFormat = 0U;
sahilmgandhi 18:6a4db94011d3 1096
sahilmgandhi 18:6a4db94011d3 1097 /* Process locked */
sahilmgandhi 18:6a4db94011d3 1098 __HAL_LOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 1099
sahilmgandhi 18:6a4db94011d3 1100 /* Change LTDC peripheral state */
sahilmgandhi 18:6a4db94011d3 1101 hltdc->State = HAL_LTDC_STATE_BUSY;
sahilmgandhi 18:6a4db94011d3 1102
sahilmgandhi 18:6a4db94011d3 1103 /* Check the parameters */
sahilmgandhi 18:6a4db94011d3 1104 assert_param(IS_LTDC_LAYER(LayerIdx));
sahilmgandhi 18:6a4db94011d3 1105
sahilmgandhi 18:6a4db94011d3 1106 /* get LayerIdx used pixel format */
sahilmgandhi 18:6a4db94011d3 1107 pixelFormat = hltdc->LayerCfg[LayerIdx].PixelFormat;
sahilmgandhi 18:6a4db94011d3 1108
sahilmgandhi 18:6a4db94011d3 1109 if(pixelFormat == LTDC_PIXEL_FORMAT_ARGB8888)
sahilmgandhi 18:6a4db94011d3 1110 {
sahilmgandhi 18:6a4db94011d3 1111 tmp = 4U;
sahilmgandhi 18:6a4db94011d3 1112 }
sahilmgandhi 18:6a4db94011d3 1113 else if (pixelFormat == LTDC_PIXEL_FORMAT_RGB888)
sahilmgandhi 18:6a4db94011d3 1114 {
sahilmgandhi 18:6a4db94011d3 1115 tmp = 3U;
sahilmgandhi 18:6a4db94011d3 1116 }
sahilmgandhi 18:6a4db94011d3 1117 else if((pixelFormat == LTDC_PIXEL_FORMAT_ARGB4444) || \
sahilmgandhi 18:6a4db94011d3 1118 (pixelFormat == LTDC_PIXEL_FORMAT_RGB565) || \
sahilmgandhi 18:6a4db94011d3 1119 (pixelFormat == LTDC_PIXEL_FORMAT_ARGB1555) || \
sahilmgandhi 18:6a4db94011d3 1120 (pixelFormat == LTDC_PIXEL_FORMAT_AL88))
sahilmgandhi 18:6a4db94011d3 1121 {
sahilmgandhi 18:6a4db94011d3 1122 tmp = 2U;
sahilmgandhi 18:6a4db94011d3 1123 }
sahilmgandhi 18:6a4db94011d3 1124 else
sahilmgandhi 18:6a4db94011d3 1125 {
sahilmgandhi 18:6a4db94011d3 1126 tmp = 1U;
sahilmgandhi 18:6a4db94011d3 1127 }
sahilmgandhi 18:6a4db94011d3 1128
sahilmgandhi 18:6a4db94011d3 1129 pitchUpdate = ((LinePitchInPixels * tmp) << 16U);
sahilmgandhi 18:6a4db94011d3 1130
sahilmgandhi 18:6a4db94011d3 1131 /* Clear previously set standard pitch */
sahilmgandhi 18:6a4db94011d3 1132 LTDC_LAYER(hltdc, LayerIdx)->CFBLR &= ~LTDC_LxCFBLR_CFBP;
sahilmgandhi 18:6a4db94011d3 1133
sahilmgandhi 18:6a4db94011d3 1134 /* Sets the Reload type as immediate update of LTDC pitch configured above */
sahilmgandhi 18:6a4db94011d3 1135 LTDC->SRCR |= LTDC_SRCR_IMR;
sahilmgandhi 18:6a4db94011d3 1136
sahilmgandhi 18:6a4db94011d3 1137 /* Set new line pitch value */
sahilmgandhi 18:6a4db94011d3 1138 LTDC_LAYER(hltdc, LayerIdx)->CFBLR |= pitchUpdate;
sahilmgandhi 18:6a4db94011d3 1139
sahilmgandhi 18:6a4db94011d3 1140 /* Sets the Reload type as immediate update of LTDC pitch configured above */
sahilmgandhi 18:6a4db94011d3 1141 LTDC->SRCR |= LTDC_SRCR_IMR;
sahilmgandhi 18:6a4db94011d3 1142
sahilmgandhi 18:6a4db94011d3 1143 /* Change the LTDC state*/
sahilmgandhi 18:6a4db94011d3 1144 hltdc->State = HAL_LTDC_STATE_READY;
sahilmgandhi 18:6a4db94011d3 1145
sahilmgandhi 18:6a4db94011d3 1146 /* Process unlocked */
sahilmgandhi 18:6a4db94011d3 1147 __HAL_UNLOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 1148
sahilmgandhi 18:6a4db94011d3 1149 return HAL_OK;
sahilmgandhi 18:6a4db94011d3 1150 }
sahilmgandhi 18:6a4db94011d3 1151
sahilmgandhi 18:6a4db94011d3 1152 /**
sahilmgandhi 18:6a4db94011d3 1153 * @brief Define the position of the line interrupt .
sahilmgandhi 18:6a4db94011d3 1154 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 1155 * the configuration information for the LTDC.
sahilmgandhi 18:6a4db94011d3 1156 * @param Line: Line Interrupt Position.
sahilmgandhi 18:6a4db94011d3 1157 * @retval HAL status
sahilmgandhi 18:6a4db94011d3 1158 */
sahilmgandhi 18:6a4db94011d3 1159 HAL_StatusTypeDef HAL_LTDC_ProgramLineEvent(LTDC_HandleTypeDef *hltdc, uint32_t Line)
sahilmgandhi 18:6a4db94011d3 1160 {
sahilmgandhi 18:6a4db94011d3 1161 /* Process locked */
sahilmgandhi 18:6a4db94011d3 1162 __HAL_LOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 1163
sahilmgandhi 18:6a4db94011d3 1164 /* Change LTDC peripheral state */
sahilmgandhi 18:6a4db94011d3 1165 hltdc->State = HAL_LTDC_STATE_BUSY;
sahilmgandhi 18:6a4db94011d3 1166
sahilmgandhi 18:6a4db94011d3 1167 /* Check the parameters */
sahilmgandhi 18:6a4db94011d3 1168 assert_param(IS_LTDC_LIPOS(Line));
sahilmgandhi 18:6a4db94011d3 1169
sahilmgandhi 18:6a4db94011d3 1170 /* Enable the Line interrupt */
sahilmgandhi 18:6a4db94011d3 1171 __HAL_LTDC_ENABLE_IT(hltdc, LTDC_IT_LI);
sahilmgandhi 18:6a4db94011d3 1172
sahilmgandhi 18:6a4db94011d3 1173 /* Sets the Line Interrupt position */
sahilmgandhi 18:6a4db94011d3 1174 LTDC->LIPCR = (uint32_t)Line;
sahilmgandhi 18:6a4db94011d3 1175
sahilmgandhi 18:6a4db94011d3 1176 /* Change the LTDC state*/
sahilmgandhi 18:6a4db94011d3 1177 hltdc->State = HAL_LTDC_STATE_READY;
sahilmgandhi 18:6a4db94011d3 1178
sahilmgandhi 18:6a4db94011d3 1179 /* Process unlocked */
sahilmgandhi 18:6a4db94011d3 1180 __HAL_UNLOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 1181
sahilmgandhi 18:6a4db94011d3 1182 return HAL_OK;
sahilmgandhi 18:6a4db94011d3 1183 }
sahilmgandhi 18:6a4db94011d3 1184
sahilmgandhi 18:6a4db94011d3 1185 /**
sahilmgandhi 18:6a4db94011d3 1186 * @brief LTDC configuration relaod .
sahilmgandhi 18:6a4db94011d3 1187 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 1188 * the configuration information for the LTDC.
sahilmgandhi 18:6a4db94011d3 1189 * @param ReloadType: This parameter can be one of the following values :
sahilmgandhi 18:6a4db94011d3 1190 * LTDC_RELOAD_IMMEDIATE : Immediate Reload
sahilmgandhi 18:6a4db94011d3 1191 * LTDC_SRCR_VBR : Reload in the next Vertical Blanking
sahilmgandhi 18:6a4db94011d3 1192 * @retval HAL status
sahilmgandhi 18:6a4db94011d3 1193 */
sahilmgandhi 18:6a4db94011d3 1194 HAL_StatusTypeDef HAL_LTDC_Relaod(LTDC_HandleTypeDef *hltdc, uint32_t ReloadType)
sahilmgandhi 18:6a4db94011d3 1195 {
sahilmgandhi 18:6a4db94011d3 1196 assert_param(IS_LTDC_RELAOD(ReloadType));
sahilmgandhi 18:6a4db94011d3 1197
sahilmgandhi 18:6a4db94011d3 1198 /* Process locked */
sahilmgandhi 18:6a4db94011d3 1199 __HAL_LOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 1200
sahilmgandhi 18:6a4db94011d3 1201 /* Change LTDC peripheral state */
sahilmgandhi 18:6a4db94011d3 1202 hltdc->State = HAL_LTDC_STATE_BUSY;
sahilmgandhi 18:6a4db94011d3 1203
sahilmgandhi 18:6a4db94011d3 1204 /* Enable the Reload interrupt */
sahilmgandhi 18:6a4db94011d3 1205 __HAL_LTDC_ENABLE_IT(hltdc, LTDC_IT_RR);
sahilmgandhi 18:6a4db94011d3 1206
sahilmgandhi 18:6a4db94011d3 1207 /* Apply Reload type */
sahilmgandhi 18:6a4db94011d3 1208 hltdc->Instance->SRCR = ReloadType;
sahilmgandhi 18:6a4db94011d3 1209
sahilmgandhi 18:6a4db94011d3 1210 /* Change the LTDC state*/
sahilmgandhi 18:6a4db94011d3 1211 hltdc->State = HAL_LTDC_STATE_READY;
sahilmgandhi 18:6a4db94011d3 1212
sahilmgandhi 18:6a4db94011d3 1213 /* Process unlocked */
sahilmgandhi 18:6a4db94011d3 1214 __HAL_UNLOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 1215
sahilmgandhi 18:6a4db94011d3 1216 return HAL_OK;
sahilmgandhi 18:6a4db94011d3 1217 }
sahilmgandhi 18:6a4db94011d3 1218
sahilmgandhi 18:6a4db94011d3 1219 /**
sahilmgandhi 18:6a4db94011d3 1220 * @brief Configure the LTDC Layer according to the specified without reloading
sahilmgandhi 18:6a4db94011d3 1221 * parameters in the LTDC_InitTypeDef and create the associated handle.
sahilmgandhi 18:6a4db94011d3 1222 * Variant of the function HAL_LTDC_ConfigLayer without immediate reload
sahilmgandhi 18:6a4db94011d3 1223 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 1224 * the configuration information for the LTDC.
sahilmgandhi 18:6a4db94011d3 1225 * @param pLayerCfg: pointer to a LTDC_LayerCfgTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 1226 * the configuration information for the Layer.
sahilmgandhi 18:6a4db94011d3 1227 * @param LayerIdx: LTDC Layer index.
sahilmgandhi 18:6a4db94011d3 1228 * This parameter can be one of the following values:
sahilmgandhi 18:6a4db94011d3 1229 * 0 or 1
sahilmgandhi 18:6a4db94011d3 1230 * @retval HAL status
sahilmgandhi 18:6a4db94011d3 1231 */
sahilmgandhi 18:6a4db94011d3 1232 HAL_StatusTypeDef HAL_LTDC_ConfigLayer_NoReload(LTDC_HandleTypeDef *hltdc, LTDC_LayerCfgTypeDef *pLayerCfg, uint32_t LayerIdx)
sahilmgandhi 18:6a4db94011d3 1233 {
sahilmgandhi 18:6a4db94011d3 1234 /* Process locked */
sahilmgandhi 18:6a4db94011d3 1235 __HAL_LOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 1236
sahilmgandhi 18:6a4db94011d3 1237 /* Change LTDC peripheral state */
sahilmgandhi 18:6a4db94011d3 1238 hltdc->State = HAL_LTDC_STATE_BUSY;
sahilmgandhi 18:6a4db94011d3 1239
sahilmgandhi 18:6a4db94011d3 1240 /* Check the parameters */
sahilmgandhi 18:6a4db94011d3 1241 assert_param(IS_LTDC_LAYER(LayerIdx));
sahilmgandhi 18:6a4db94011d3 1242 assert_param(IS_LTDC_PIXEL_FORMAT(pLayerCfg->PixelFormat));
sahilmgandhi 18:6a4db94011d3 1243 assert_param(IS_LTDC_BLENDING_FACTOR1(pLayerCfg->BlendingFactor1));
sahilmgandhi 18:6a4db94011d3 1244 assert_param(IS_LTDC_BLENDING_FACTOR2(pLayerCfg->BlendingFactor2));
sahilmgandhi 18:6a4db94011d3 1245 assert_param(IS_LTDC_HCONFIGST(pLayerCfg->WindowX0));
sahilmgandhi 18:6a4db94011d3 1246 assert_param(IS_LTDC_HCONFIGSP(pLayerCfg->WindowX1));
sahilmgandhi 18:6a4db94011d3 1247 assert_param(IS_LTDC_VCONFIGST(pLayerCfg->WindowY0));
sahilmgandhi 18:6a4db94011d3 1248 assert_param(IS_LTDC_VCONFIGSP(pLayerCfg->WindowY1));
sahilmgandhi 18:6a4db94011d3 1249 assert_param(IS_LTDC_ALPHA(pLayerCfg->Alpha0));
sahilmgandhi 18:6a4db94011d3 1250 assert_param(IS_LTDC_CFBLL(pLayerCfg->ImageWidth));
sahilmgandhi 18:6a4db94011d3 1251 assert_param(IS_LTDC_CFBLNBR(pLayerCfg->ImageHeight));
sahilmgandhi 18:6a4db94011d3 1252
sahilmgandhi 18:6a4db94011d3 1253 /* Copy new layer configuration into handle structure */
sahilmgandhi 18:6a4db94011d3 1254 hltdc->LayerCfg[LayerIdx] = *pLayerCfg;
sahilmgandhi 18:6a4db94011d3 1255
sahilmgandhi 18:6a4db94011d3 1256 /* Configure the LTDC Layer */
sahilmgandhi 18:6a4db94011d3 1257 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx);
sahilmgandhi 18:6a4db94011d3 1258
sahilmgandhi 18:6a4db94011d3 1259 /* Do not Sets the Reload */
sahilmgandhi 18:6a4db94011d3 1260
sahilmgandhi 18:6a4db94011d3 1261 /* Initialize the LTDC state*/
sahilmgandhi 18:6a4db94011d3 1262 hltdc->State = HAL_LTDC_STATE_READY;
sahilmgandhi 18:6a4db94011d3 1263
sahilmgandhi 18:6a4db94011d3 1264 /* Process unlocked */
sahilmgandhi 18:6a4db94011d3 1265 __HAL_UNLOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 1266
sahilmgandhi 18:6a4db94011d3 1267 return HAL_OK;
sahilmgandhi 18:6a4db94011d3 1268 }
sahilmgandhi 18:6a4db94011d3 1269
sahilmgandhi 18:6a4db94011d3 1270 /**
sahilmgandhi 18:6a4db94011d3 1271 * @brief Set the LTDC window size without reloading.
sahilmgandhi 18:6a4db94011d3 1272 * Variant of the function HAL_LTDC_SetWindowSize without immediate reload
sahilmgandhi 18:6a4db94011d3 1273 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 1274 * the configuration information for the LTDC.
sahilmgandhi 18:6a4db94011d3 1275 * @param XSize: LTDC Pixel per line
sahilmgandhi 18:6a4db94011d3 1276 * @param YSize: LTDC Line number
sahilmgandhi 18:6a4db94011d3 1277 * @param LayerIdx: LTDC Layer index.
sahilmgandhi 18:6a4db94011d3 1278 * This parameter can be one of the following values:
sahilmgandhi 18:6a4db94011d3 1279 * 0 or 1
sahilmgandhi 18:6a4db94011d3 1280 * @retval HAL status
sahilmgandhi 18:6a4db94011d3 1281 */
sahilmgandhi 18:6a4db94011d3 1282 HAL_StatusTypeDef HAL_LTDC_SetWindowSize_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t XSize, uint32_t YSize, uint32_t LayerIdx)
sahilmgandhi 18:6a4db94011d3 1283 {
sahilmgandhi 18:6a4db94011d3 1284 LTDC_LayerCfgTypeDef *pLayerCfg;
sahilmgandhi 18:6a4db94011d3 1285
sahilmgandhi 18:6a4db94011d3 1286 /* Process locked */
sahilmgandhi 18:6a4db94011d3 1287 __HAL_LOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 1288
sahilmgandhi 18:6a4db94011d3 1289 /* Change LTDC peripheral state */
sahilmgandhi 18:6a4db94011d3 1290 hltdc->State = HAL_LTDC_STATE_BUSY;
sahilmgandhi 18:6a4db94011d3 1291
sahilmgandhi 18:6a4db94011d3 1292 /* Get layer configuration from handle structure */
sahilmgandhi 18:6a4db94011d3 1293 pLayerCfg = &hltdc->LayerCfg[LayerIdx];
sahilmgandhi 18:6a4db94011d3 1294
sahilmgandhi 18:6a4db94011d3 1295 /* Check the parameters (Layers parameters)*/
sahilmgandhi 18:6a4db94011d3 1296 assert_param(IS_LTDC_LAYER(LayerIdx));
sahilmgandhi 18:6a4db94011d3 1297 assert_param(IS_LTDC_HCONFIGST(pLayerCfg->WindowX0));
sahilmgandhi 18:6a4db94011d3 1298 assert_param(IS_LTDC_HCONFIGSP(pLayerCfg->WindowX1));
sahilmgandhi 18:6a4db94011d3 1299 assert_param(IS_LTDC_VCONFIGST(pLayerCfg->WindowY0));
sahilmgandhi 18:6a4db94011d3 1300 assert_param(IS_LTDC_VCONFIGSP(pLayerCfg->WindowY1));
sahilmgandhi 18:6a4db94011d3 1301 assert_param(IS_LTDC_CFBLL(XSize));
sahilmgandhi 18:6a4db94011d3 1302 assert_param(IS_LTDC_CFBLNBR(YSize));
sahilmgandhi 18:6a4db94011d3 1303
sahilmgandhi 18:6a4db94011d3 1304 /* update horizontal start/stop */
sahilmgandhi 18:6a4db94011d3 1305 pLayerCfg->WindowX0 = 0;
sahilmgandhi 18:6a4db94011d3 1306 pLayerCfg->WindowX1 = XSize + pLayerCfg->WindowX0;
sahilmgandhi 18:6a4db94011d3 1307
sahilmgandhi 18:6a4db94011d3 1308 /* update vertical start/stop */
sahilmgandhi 18:6a4db94011d3 1309 pLayerCfg->WindowY0 = 0;
sahilmgandhi 18:6a4db94011d3 1310 pLayerCfg->WindowY1 = YSize + pLayerCfg->WindowY0;
sahilmgandhi 18:6a4db94011d3 1311
sahilmgandhi 18:6a4db94011d3 1312 /* Reconfigures the color frame buffer pitch in byte */
sahilmgandhi 18:6a4db94011d3 1313 pLayerCfg->ImageWidth = XSize;
sahilmgandhi 18:6a4db94011d3 1314
sahilmgandhi 18:6a4db94011d3 1315 /* Reconfigures the frame buffer line number */
sahilmgandhi 18:6a4db94011d3 1316 pLayerCfg->ImageHeight = YSize;
sahilmgandhi 18:6a4db94011d3 1317
sahilmgandhi 18:6a4db94011d3 1318 /* Set LTDC parameters */
sahilmgandhi 18:6a4db94011d3 1319 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx);
sahilmgandhi 18:6a4db94011d3 1320
sahilmgandhi 18:6a4db94011d3 1321 /* Do not Sets the Reload */
sahilmgandhi 18:6a4db94011d3 1322
sahilmgandhi 18:6a4db94011d3 1323 /* Change the LTDC state*/
sahilmgandhi 18:6a4db94011d3 1324 hltdc->State = HAL_LTDC_STATE_READY;
sahilmgandhi 18:6a4db94011d3 1325
sahilmgandhi 18:6a4db94011d3 1326 /* Process unlocked */
sahilmgandhi 18:6a4db94011d3 1327 __HAL_UNLOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 1328
sahilmgandhi 18:6a4db94011d3 1329 return HAL_OK;
sahilmgandhi 18:6a4db94011d3 1330 }
sahilmgandhi 18:6a4db94011d3 1331
sahilmgandhi 18:6a4db94011d3 1332 /**
sahilmgandhi 18:6a4db94011d3 1333 * @brief Set the LTDC window position without reloading.
sahilmgandhi 18:6a4db94011d3 1334 * Variant of the function HAL_LTDC_SetWindowPosition without immediate reload
sahilmgandhi 18:6a4db94011d3 1335 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 1336 * the configuration information for the LTDC.
sahilmgandhi 18:6a4db94011d3 1337 * @param X0: LTDC window X offset
sahilmgandhi 18:6a4db94011d3 1338 * @param Y0: LTDC window Y offset
sahilmgandhi 18:6a4db94011d3 1339 * @param LayerIdx: LTDC Layer index.
sahilmgandhi 18:6a4db94011d3 1340 * This parameter can be one of the following values:
sahilmgandhi 18:6a4db94011d3 1341 * 0 or 1
sahilmgandhi 18:6a4db94011d3 1342 * @retval HAL status
sahilmgandhi 18:6a4db94011d3 1343 */
sahilmgandhi 18:6a4db94011d3 1344 HAL_StatusTypeDef HAL_LTDC_SetWindowPosition_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t X0, uint32_t Y0, uint32_t LayerIdx)
sahilmgandhi 18:6a4db94011d3 1345 {
sahilmgandhi 18:6a4db94011d3 1346 LTDC_LayerCfgTypeDef *pLayerCfg;
sahilmgandhi 18:6a4db94011d3 1347
sahilmgandhi 18:6a4db94011d3 1348 /* Process locked */
sahilmgandhi 18:6a4db94011d3 1349 __HAL_LOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 1350
sahilmgandhi 18:6a4db94011d3 1351 /* Change LTDC peripheral state */
sahilmgandhi 18:6a4db94011d3 1352 hltdc->State = HAL_LTDC_STATE_BUSY;
sahilmgandhi 18:6a4db94011d3 1353
sahilmgandhi 18:6a4db94011d3 1354 /* Get layer configuration from handle structure */
sahilmgandhi 18:6a4db94011d3 1355 pLayerCfg = &hltdc->LayerCfg[LayerIdx];
sahilmgandhi 18:6a4db94011d3 1356
sahilmgandhi 18:6a4db94011d3 1357 /* Check the parameters */
sahilmgandhi 18:6a4db94011d3 1358 assert_param(IS_LTDC_LAYER(LayerIdx));
sahilmgandhi 18:6a4db94011d3 1359 assert_param(IS_LTDC_HCONFIGST(pLayerCfg->WindowX0));
sahilmgandhi 18:6a4db94011d3 1360 assert_param(IS_LTDC_HCONFIGSP(pLayerCfg->WindowX1));
sahilmgandhi 18:6a4db94011d3 1361 assert_param(IS_LTDC_VCONFIGST(pLayerCfg->WindowY0));
sahilmgandhi 18:6a4db94011d3 1362 assert_param(IS_LTDC_VCONFIGSP(pLayerCfg->WindowY1));
sahilmgandhi 18:6a4db94011d3 1363
sahilmgandhi 18:6a4db94011d3 1364 /* update horizontal start/stop */
sahilmgandhi 18:6a4db94011d3 1365 pLayerCfg->WindowX0 = X0;
sahilmgandhi 18:6a4db94011d3 1366 pLayerCfg->WindowX1 = X0 + pLayerCfg->ImageWidth;
sahilmgandhi 18:6a4db94011d3 1367
sahilmgandhi 18:6a4db94011d3 1368 /* update vertical start/stop */
sahilmgandhi 18:6a4db94011d3 1369 pLayerCfg->WindowY0 = Y0;
sahilmgandhi 18:6a4db94011d3 1370 pLayerCfg->WindowY1 = Y0 + pLayerCfg->ImageHeight;
sahilmgandhi 18:6a4db94011d3 1371
sahilmgandhi 18:6a4db94011d3 1372 /* Set LTDC parameters */
sahilmgandhi 18:6a4db94011d3 1373 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx);
sahilmgandhi 18:6a4db94011d3 1374
sahilmgandhi 18:6a4db94011d3 1375 /* Do not Sets the Reload */
sahilmgandhi 18:6a4db94011d3 1376
sahilmgandhi 18:6a4db94011d3 1377 /* Change the LTDC state*/
sahilmgandhi 18:6a4db94011d3 1378 hltdc->State = HAL_LTDC_STATE_READY;
sahilmgandhi 18:6a4db94011d3 1379
sahilmgandhi 18:6a4db94011d3 1380 /* Process unlocked */
sahilmgandhi 18:6a4db94011d3 1381 __HAL_UNLOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 1382
sahilmgandhi 18:6a4db94011d3 1383 return HAL_OK;
sahilmgandhi 18:6a4db94011d3 1384 }
sahilmgandhi 18:6a4db94011d3 1385
sahilmgandhi 18:6a4db94011d3 1386 /**
sahilmgandhi 18:6a4db94011d3 1387 * @brief Reconfigure the pixel format without reloading.
sahilmgandhi 18:6a4db94011d3 1388 * Variant of the function HAL_LTDC_SetPixelFormat without immediate reload
sahilmgandhi 18:6a4db94011d3 1389 * @param hltdc: pointer to a LTDC_HandleTypeDfef structure that contains
sahilmgandhi 18:6a4db94011d3 1390 * the configuration information for the LTDC.
sahilmgandhi 18:6a4db94011d3 1391 * @param Pixelformat: new pixel format value.
sahilmgandhi 18:6a4db94011d3 1392 * @param LayerIdx: LTDC Layer index.
sahilmgandhi 18:6a4db94011d3 1393 * This parameter can be one of the following values:
sahilmgandhi 18:6a4db94011d3 1394 * 0 or 1.
sahilmgandhi 18:6a4db94011d3 1395 * @retval HAL status
sahilmgandhi 18:6a4db94011d3 1396 */
sahilmgandhi 18:6a4db94011d3 1397 HAL_StatusTypeDef HAL_LTDC_SetPixelFormat_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t Pixelformat, uint32_t LayerIdx)
sahilmgandhi 18:6a4db94011d3 1398 {
sahilmgandhi 18:6a4db94011d3 1399 LTDC_LayerCfgTypeDef *pLayerCfg;
sahilmgandhi 18:6a4db94011d3 1400
sahilmgandhi 18:6a4db94011d3 1401 /* Process locked */
sahilmgandhi 18:6a4db94011d3 1402 __HAL_LOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 1403
sahilmgandhi 18:6a4db94011d3 1404 /* Change LTDC peripheral state */
sahilmgandhi 18:6a4db94011d3 1405 hltdc->State = HAL_LTDC_STATE_BUSY;
sahilmgandhi 18:6a4db94011d3 1406
sahilmgandhi 18:6a4db94011d3 1407 /* Check the parameters */
sahilmgandhi 18:6a4db94011d3 1408 assert_param(IS_LTDC_LAYER(LayerIdx));
sahilmgandhi 18:6a4db94011d3 1409 assert_param(IS_LTDC_PIXEL_FORMAT(Pixelformat));
sahilmgandhi 18:6a4db94011d3 1410
sahilmgandhi 18:6a4db94011d3 1411 /* Get layer configuration from handle structure */
sahilmgandhi 18:6a4db94011d3 1412 pLayerCfg = &hltdc->LayerCfg[LayerIdx];
sahilmgandhi 18:6a4db94011d3 1413
sahilmgandhi 18:6a4db94011d3 1414 /* Reconfigure the pixel format */
sahilmgandhi 18:6a4db94011d3 1415 pLayerCfg->PixelFormat = Pixelformat;
sahilmgandhi 18:6a4db94011d3 1416
sahilmgandhi 18:6a4db94011d3 1417 /* Set LTDC parameters */
sahilmgandhi 18:6a4db94011d3 1418 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx);
sahilmgandhi 18:6a4db94011d3 1419
sahilmgandhi 18:6a4db94011d3 1420 /* Do not Sets the Reload */
sahilmgandhi 18:6a4db94011d3 1421
sahilmgandhi 18:6a4db94011d3 1422 /* Change the LTDC state*/
sahilmgandhi 18:6a4db94011d3 1423 hltdc->State = HAL_LTDC_STATE_READY;
sahilmgandhi 18:6a4db94011d3 1424
sahilmgandhi 18:6a4db94011d3 1425 /* Process unlocked */
sahilmgandhi 18:6a4db94011d3 1426 __HAL_UNLOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 1427
sahilmgandhi 18:6a4db94011d3 1428 return HAL_OK;
sahilmgandhi 18:6a4db94011d3 1429 }
sahilmgandhi 18:6a4db94011d3 1430
sahilmgandhi 18:6a4db94011d3 1431 /**
sahilmgandhi 18:6a4db94011d3 1432 * @brief Reconfigure the layer alpha value without reloading.
sahilmgandhi 18:6a4db94011d3 1433 * Variant of the function HAL_LTDC_SetAlpha without immediate reload
sahilmgandhi 18:6a4db94011d3 1434 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 1435 * the configuration information for the LTDC.
sahilmgandhi 18:6a4db94011d3 1436 * @param Alpha: new alpha value.
sahilmgandhi 18:6a4db94011d3 1437 * @param LayerIdx: LTDC Layer index.
sahilmgandhi 18:6a4db94011d3 1438 * This parameter can be one of the following values:
sahilmgandhi 18:6a4db94011d3 1439 * 0 or 1
sahilmgandhi 18:6a4db94011d3 1440 * @retval HAL status
sahilmgandhi 18:6a4db94011d3 1441 */
sahilmgandhi 18:6a4db94011d3 1442 HAL_StatusTypeDef HAL_LTDC_SetAlpha_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t Alpha, uint32_t LayerIdx)
sahilmgandhi 18:6a4db94011d3 1443 {
sahilmgandhi 18:6a4db94011d3 1444 LTDC_LayerCfgTypeDef *pLayerCfg;
sahilmgandhi 18:6a4db94011d3 1445
sahilmgandhi 18:6a4db94011d3 1446 /* Process locked */
sahilmgandhi 18:6a4db94011d3 1447 __HAL_LOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 1448
sahilmgandhi 18:6a4db94011d3 1449 /* Change LTDC peripheral state */
sahilmgandhi 18:6a4db94011d3 1450 hltdc->State = HAL_LTDC_STATE_BUSY;
sahilmgandhi 18:6a4db94011d3 1451
sahilmgandhi 18:6a4db94011d3 1452 /* Check the parameters */
sahilmgandhi 18:6a4db94011d3 1453 assert_param(IS_LTDC_ALPHA(Alpha));
sahilmgandhi 18:6a4db94011d3 1454 assert_param(IS_LTDC_LAYER(LayerIdx));
sahilmgandhi 18:6a4db94011d3 1455
sahilmgandhi 18:6a4db94011d3 1456 /* Get layer configuration from handle structure */
sahilmgandhi 18:6a4db94011d3 1457 pLayerCfg = &hltdc->LayerCfg[LayerIdx];
sahilmgandhi 18:6a4db94011d3 1458
sahilmgandhi 18:6a4db94011d3 1459 /* Reconfigure the Alpha value */
sahilmgandhi 18:6a4db94011d3 1460 pLayerCfg->Alpha = Alpha;
sahilmgandhi 18:6a4db94011d3 1461
sahilmgandhi 18:6a4db94011d3 1462 /* Set LTDC parameters */
sahilmgandhi 18:6a4db94011d3 1463 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx);
sahilmgandhi 18:6a4db94011d3 1464
sahilmgandhi 18:6a4db94011d3 1465 /* Do not Sets the Reload */
sahilmgandhi 18:6a4db94011d3 1466
sahilmgandhi 18:6a4db94011d3 1467 /* Change the LTDC state*/
sahilmgandhi 18:6a4db94011d3 1468 hltdc->State = HAL_LTDC_STATE_READY;
sahilmgandhi 18:6a4db94011d3 1469
sahilmgandhi 18:6a4db94011d3 1470 /* Process unlocked */
sahilmgandhi 18:6a4db94011d3 1471 __HAL_UNLOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 1472
sahilmgandhi 18:6a4db94011d3 1473 return HAL_OK;
sahilmgandhi 18:6a4db94011d3 1474 }
sahilmgandhi 18:6a4db94011d3 1475
sahilmgandhi 18:6a4db94011d3 1476 /**
sahilmgandhi 18:6a4db94011d3 1477 * @brief Reconfigure the frame buffer Address without reloading.
sahilmgandhi 18:6a4db94011d3 1478 * Variant of the function HAL_LTDC_SetAddress without immediate reload
sahilmgandhi 18:6a4db94011d3 1479 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 1480 * the configuration information for the LTDC.
sahilmgandhi 18:6a4db94011d3 1481 * @param Address: new address value.
sahilmgandhi 18:6a4db94011d3 1482 * @param LayerIdx: LTDC Layer index.
sahilmgandhi 18:6a4db94011d3 1483 * This parameter can be one of the following values:
sahilmgandhi 18:6a4db94011d3 1484 * 0 or 1.
sahilmgandhi 18:6a4db94011d3 1485 * @retval HAL status
sahilmgandhi 18:6a4db94011d3 1486 */
sahilmgandhi 18:6a4db94011d3 1487 HAL_StatusTypeDef HAL_LTDC_SetAddress_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t Address, uint32_t LayerIdx)
sahilmgandhi 18:6a4db94011d3 1488 {
sahilmgandhi 18:6a4db94011d3 1489 LTDC_LayerCfgTypeDef *pLayerCfg;
sahilmgandhi 18:6a4db94011d3 1490
sahilmgandhi 18:6a4db94011d3 1491 /* Process locked */
sahilmgandhi 18:6a4db94011d3 1492 __HAL_LOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 1493
sahilmgandhi 18:6a4db94011d3 1494 /* Change LTDC peripheral state */
sahilmgandhi 18:6a4db94011d3 1495 hltdc->State = HAL_LTDC_STATE_BUSY;
sahilmgandhi 18:6a4db94011d3 1496
sahilmgandhi 18:6a4db94011d3 1497 /* Check the parameters */
sahilmgandhi 18:6a4db94011d3 1498 assert_param(IS_LTDC_LAYER(LayerIdx));
sahilmgandhi 18:6a4db94011d3 1499
sahilmgandhi 18:6a4db94011d3 1500 /* Get layer configuration from handle structure */
sahilmgandhi 18:6a4db94011d3 1501 pLayerCfg = &hltdc->LayerCfg[LayerIdx];
sahilmgandhi 18:6a4db94011d3 1502
sahilmgandhi 18:6a4db94011d3 1503 /* Reconfigure the Address */
sahilmgandhi 18:6a4db94011d3 1504 pLayerCfg->FBStartAdress = Address;
sahilmgandhi 18:6a4db94011d3 1505
sahilmgandhi 18:6a4db94011d3 1506 /* Set LTDC parameters */
sahilmgandhi 18:6a4db94011d3 1507 LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx);
sahilmgandhi 18:6a4db94011d3 1508
sahilmgandhi 18:6a4db94011d3 1509 /* Do not Sets the Reload */
sahilmgandhi 18:6a4db94011d3 1510
sahilmgandhi 18:6a4db94011d3 1511 /* Change the LTDC state*/
sahilmgandhi 18:6a4db94011d3 1512 hltdc->State = HAL_LTDC_STATE_READY;
sahilmgandhi 18:6a4db94011d3 1513
sahilmgandhi 18:6a4db94011d3 1514 /* Process unlocked */
sahilmgandhi 18:6a4db94011d3 1515 __HAL_UNLOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 1516
sahilmgandhi 18:6a4db94011d3 1517 return HAL_OK;
sahilmgandhi 18:6a4db94011d3 1518 }
sahilmgandhi 18:6a4db94011d3 1519
sahilmgandhi 18:6a4db94011d3 1520 /**
sahilmgandhi 18:6a4db94011d3 1521 * @brief Function used to reconfigure the pitch for specific cases where the attached LayerIdx buffer have a width that is
sahilmgandhi 18:6a4db94011d3 1522 * larger than the one intended to be displayed on screen. Example of a buffer 800x480 attached to layer for which we
sahilmgandhi 18:6a4db94011d3 1523 * want to read and display on screen only a portion 320x240 taken in the center of the buffer. The pitch in pixels
sahilmgandhi 18:6a4db94011d3 1524 * will be in that case 800 pixels and not 320 pixels as initially configured by previous call to HAL_LTDC_ConfigLayer().
sahilmgandhi 18:6a4db94011d3 1525 * Note : this function should be called only after a previous call to HAL_LTDC_ConfigLayer() to modify the default pitch
sahilmgandhi 18:6a4db94011d3 1526 * configured by HAL_LTDC_ConfigLayer() when required (refer to example described just above).
sahilmgandhi 18:6a4db94011d3 1527 * Variant of the function HAL_LTDC_SetPitch without immediate reload
sahilmgandhi 18:6a4db94011d3 1528 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 1529 * the configuration information for the LTDC.
sahilmgandhi 18:6a4db94011d3 1530 * @param LinePitchInPixels: New line pitch in pixels to configure for LTDC layer 'LayerIdx'.
sahilmgandhi 18:6a4db94011d3 1531 * @param LayerIdx: LTDC layer index concerned by the modification of line pitch.
sahilmgandhi 18:6a4db94011d3 1532 * @retval HAL status
sahilmgandhi 18:6a4db94011d3 1533 */
sahilmgandhi 18:6a4db94011d3 1534 HAL_StatusTypeDef HAL_LTDC_SetPitch_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t LinePitchInPixels, uint32_t LayerIdx)
sahilmgandhi 18:6a4db94011d3 1535 {
sahilmgandhi 18:6a4db94011d3 1536 uint32_t tmp = 0;
sahilmgandhi 18:6a4db94011d3 1537 uint32_t pitchUpdate = 0;
sahilmgandhi 18:6a4db94011d3 1538 uint32_t pixelFormat = 0;
sahilmgandhi 18:6a4db94011d3 1539
sahilmgandhi 18:6a4db94011d3 1540 /* Process locked */
sahilmgandhi 18:6a4db94011d3 1541 __HAL_LOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 1542
sahilmgandhi 18:6a4db94011d3 1543 /* Change LTDC peripheral state */
sahilmgandhi 18:6a4db94011d3 1544 hltdc->State = HAL_LTDC_STATE_BUSY;
sahilmgandhi 18:6a4db94011d3 1545
sahilmgandhi 18:6a4db94011d3 1546 /* Check the parameters */
sahilmgandhi 18:6a4db94011d3 1547 assert_param(IS_LTDC_LAYER(LayerIdx));
sahilmgandhi 18:6a4db94011d3 1548
sahilmgandhi 18:6a4db94011d3 1549 /* get LayerIdx used pixel format */
sahilmgandhi 18:6a4db94011d3 1550 pixelFormat = hltdc->LayerCfg[LayerIdx].PixelFormat;
sahilmgandhi 18:6a4db94011d3 1551
sahilmgandhi 18:6a4db94011d3 1552 if(pixelFormat == LTDC_PIXEL_FORMAT_ARGB8888)
sahilmgandhi 18:6a4db94011d3 1553 {
sahilmgandhi 18:6a4db94011d3 1554 tmp = 4;
sahilmgandhi 18:6a4db94011d3 1555 }
sahilmgandhi 18:6a4db94011d3 1556 else if (pixelFormat == LTDC_PIXEL_FORMAT_RGB888)
sahilmgandhi 18:6a4db94011d3 1557 {
sahilmgandhi 18:6a4db94011d3 1558 tmp = 3;
sahilmgandhi 18:6a4db94011d3 1559 }
sahilmgandhi 18:6a4db94011d3 1560 else if((pixelFormat == LTDC_PIXEL_FORMAT_ARGB4444) || \
sahilmgandhi 18:6a4db94011d3 1561 (pixelFormat == LTDC_PIXEL_FORMAT_RGB565) || \
sahilmgandhi 18:6a4db94011d3 1562 (pixelFormat == LTDC_PIXEL_FORMAT_ARGB1555) || \
sahilmgandhi 18:6a4db94011d3 1563 (pixelFormat == LTDC_PIXEL_FORMAT_AL88))
sahilmgandhi 18:6a4db94011d3 1564 {
sahilmgandhi 18:6a4db94011d3 1565 tmp = 2;
sahilmgandhi 18:6a4db94011d3 1566 }
sahilmgandhi 18:6a4db94011d3 1567 else
sahilmgandhi 18:6a4db94011d3 1568 {
sahilmgandhi 18:6a4db94011d3 1569 tmp = 1;
sahilmgandhi 18:6a4db94011d3 1570 }
sahilmgandhi 18:6a4db94011d3 1571
sahilmgandhi 18:6a4db94011d3 1572 pitchUpdate = ((LinePitchInPixels * tmp) << 16);
sahilmgandhi 18:6a4db94011d3 1573
sahilmgandhi 18:6a4db94011d3 1574 /* Clear previously set standard pitch */
sahilmgandhi 18:6a4db94011d3 1575 LTDC_LAYER(hltdc, LayerIdx)->CFBLR &= ~LTDC_LxCFBLR_CFBP;
sahilmgandhi 18:6a4db94011d3 1576
sahilmgandhi 18:6a4db94011d3 1577 /* Set new line pitch value */
sahilmgandhi 18:6a4db94011d3 1578 LTDC_LAYER(hltdc, LayerIdx)->CFBLR |= pitchUpdate;
sahilmgandhi 18:6a4db94011d3 1579
sahilmgandhi 18:6a4db94011d3 1580 /* Do not Sets the Reload */
sahilmgandhi 18:6a4db94011d3 1581
sahilmgandhi 18:6a4db94011d3 1582 /* Change the LTDC state*/
sahilmgandhi 18:6a4db94011d3 1583 hltdc->State = HAL_LTDC_STATE_READY;
sahilmgandhi 18:6a4db94011d3 1584
sahilmgandhi 18:6a4db94011d3 1585 /* Process unlocked */
sahilmgandhi 18:6a4db94011d3 1586 __HAL_UNLOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 1587
sahilmgandhi 18:6a4db94011d3 1588 return HAL_OK;
sahilmgandhi 18:6a4db94011d3 1589 }
sahilmgandhi 18:6a4db94011d3 1590
sahilmgandhi 18:6a4db94011d3 1591
sahilmgandhi 18:6a4db94011d3 1592 /**
sahilmgandhi 18:6a4db94011d3 1593 * @brief Configure the color keying without reloading.
sahilmgandhi 18:6a4db94011d3 1594 * Variant of the function HAL_LTDC_ConfigColorKeying without immediate reload
sahilmgandhi 18:6a4db94011d3 1595 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 1596 * the configuration information for the LTDC.
sahilmgandhi 18:6a4db94011d3 1597 * @param RGBValue: the color key value
sahilmgandhi 18:6a4db94011d3 1598 * @param LayerIdx: LTDC Layer index.
sahilmgandhi 18:6a4db94011d3 1599 * This parameter can be one of the following values:
sahilmgandhi 18:6a4db94011d3 1600 * 0 or 1
sahilmgandhi 18:6a4db94011d3 1601 * @retval HAL status
sahilmgandhi 18:6a4db94011d3 1602 */
sahilmgandhi 18:6a4db94011d3 1603 HAL_StatusTypeDef HAL_LTDC_ConfigColorKeying_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t RGBValue, uint32_t LayerIdx)
sahilmgandhi 18:6a4db94011d3 1604 {
sahilmgandhi 18:6a4db94011d3 1605 /* Process locked */
sahilmgandhi 18:6a4db94011d3 1606 __HAL_LOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 1607
sahilmgandhi 18:6a4db94011d3 1608 /* Change LTDC peripheral state */
sahilmgandhi 18:6a4db94011d3 1609 hltdc->State = HAL_LTDC_STATE_BUSY;
sahilmgandhi 18:6a4db94011d3 1610
sahilmgandhi 18:6a4db94011d3 1611 /* Check the parameters */
sahilmgandhi 18:6a4db94011d3 1612 assert_param(IS_LTDC_LAYER(LayerIdx));
sahilmgandhi 18:6a4db94011d3 1613
sahilmgandhi 18:6a4db94011d3 1614 /* Configures the default color values */
sahilmgandhi 18:6a4db94011d3 1615 LTDC_LAYER(hltdc, LayerIdx)->CKCR &= ~(LTDC_LxCKCR_CKBLUE | LTDC_LxCKCR_CKGREEN | LTDC_LxCKCR_CKRED);
sahilmgandhi 18:6a4db94011d3 1616 LTDC_LAYER(hltdc, LayerIdx)->CKCR = RGBValue;
sahilmgandhi 18:6a4db94011d3 1617
sahilmgandhi 18:6a4db94011d3 1618 /* Do not Sets the Reload */
sahilmgandhi 18:6a4db94011d3 1619
sahilmgandhi 18:6a4db94011d3 1620 /* Change the LTDC state*/
sahilmgandhi 18:6a4db94011d3 1621 hltdc->State = HAL_LTDC_STATE_READY;
sahilmgandhi 18:6a4db94011d3 1622
sahilmgandhi 18:6a4db94011d3 1623 /* Process unlocked */
sahilmgandhi 18:6a4db94011d3 1624 __HAL_UNLOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 1625
sahilmgandhi 18:6a4db94011d3 1626 return HAL_OK;
sahilmgandhi 18:6a4db94011d3 1627 }
sahilmgandhi 18:6a4db94011d3 1628
sahilmgandhi 18:6a4db94011d3 1629 /**
sahilmgandhi 18:6a4db94011d3 1630 * @brief Enable the color keying without reloading.
sahilmgandhi 18:6a4db94011d3 1631 * Variant of the function HAL_LTDC_EnableColorKeying without immediate reload
sahilmgandhi 18:6a4db94011d3 1632 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 1633 * the configuration information for the LTDC.
sahilmgandhi 18:6a4db94011d3 1634 * @param LayerIdx: LTDC Layer index.
sahilmgandhi 18:6a4db94011d3 1635 * This parameter can be one of the following values:
sahilmgandhi 18:6a4db94011d3 1636 * 0 or 1
sahilmgandhi 18:6a4db94011d3 1637 * @retval HAL status
sahilmgandhi 18:6a4db94011d3 1638 */
sahilmgandhi 18:6a4db94011d3 1639 HAL_StatusTypeDef HAL_LTDC_EnableColorKeying_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx)
sahilmgandhi 18:6a4db94011d3 1640 {
sahilmgandhi 18:6a4db94011d3 1641 /* Process locked */
sahilmgandhi 18:6a4db94011d3 1642 __HAL_LOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 1643
sahilmgandhi 18:6a4db94011d3 1644 /* Change LTDC peripheral state */
sahilmgandhi 18:6a4db94011d3 1645 hltdc->State = HAL_LTDC_STATE_BUSY;
sahilmgandhi 18:6a4db94011d3 1646
sahilmgandhi 18:6a4db94011d3 1647 /* Check the parameters */
sahilmgandhi 18:6a4db94011d3 1648 assert_param(IS_LTDC_LAYER(LayerIdx));
sahilmgandhi 18:6a4db94011d3 1649
sahilmgandhi 18:6a4db94011d3 1650 /* Enable LTDC color keying by setting COLKEN bit */
sahilmgandhi 18:6a4db94011d3 1651 LTDC_LAYER(hltdc, LayerIdx)->CR |= (uint32_t)LTDC_LxCR_COLKEN;
sahilmgandhi 18:6a4db94011d3 1652
sahilmgandhi 18:6a4db94011d3 1653 /* Do not Sets the Reload */
sahilmgandhi 18:6a4db94011d3 1654
sahilmgandhi 18:6a4db94011d3 1655 /* Change the LTDC state*/
sahilmgandhi 18:6a4db94011d3 1656 hltdc->State = HAL_LTDC_STATE_READY;
sahilmgandhi 18:6a4db94011d3 1657
sahilmgandhi 18:6a4db94011d3 1658 /* Process unlocked */
sahilmgandhi 18:6a4db94011d3 1659 __HAL_UNLOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 1660
sahilmgandhi 18:6a4db94011d3 1661 return HAL_OK;
sahilmgandhi 18:6a4db94011d3 1662 }
sahilmgandhi 18:6a4db94011d3 1663
sahilmgandhi 18:6a4db94011d3 1664 /**
sahilmgandhi 18:6a4db94011d3 1665 * @brief Disable the color keying without reloading.
sahilmgandhi 18:6a4db94011d3 1666 * Variant of the function HAL_LTDC_DisableColorKeying without immediate reload
sahilmgandhi 18:6a4db94011d3 1667 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 1668 * the configuration information for the LTDC.
sahilmgandhi 18:6a4db94011d3 1669 * @param LayerIdx: LTDC Layer index.
sahilmgandhi 18:6a4db94011d3 1670 * This parameter can be one of the following values:
sahilmgandhi 18:6a4db94011d3 1671 * 0 or 1
sahilmgandhi 18:6a4db94011d3 1672 * @retval HAL status
sahilmgandhi 18:6a4db94011d3 1673 */
sahilmgandhi 18:6a4db94011d3 1674 HAL_StatusTypeDef HAL_LTDC_DisableColorKeying_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx)
sahilmgandhi 18:6a4db94011d3 1675 {
sahilmgandhi 18:6a4db94011d3 1676 /* Process locked */
sahilmgandhi 18:6a4db94011d3 1677 __HAL_LOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 1678
sahilmgandhi 18:6a4db94011d3 1679 /* Change LTDC peripheral state */
sahilmgandhi 18:6a4db94011d3 1680 hltdc->State = HAL_LTDC_STATE_BUSY;
sahilmgandhi 18:6a4db94011d3 1681
sahilmgandhi 18:6a4db94011d3 1682 /* Check the parameters */
sahilmgandhi 18:6a4db94011d3 1683 assert_param(IS_LTDC_LAYER(LayerIdx));
sahilmgandhi 18:6a4db94011d3 1684
sahilmgandhi 18:6a4db94011d3 1685 /* Disable LTDC color keying by setting COLKEN bit */
sahilmgandhi 18:6a4db94011d3 1686 LTDC_LAYER(hltdc, LayerIdx)->CR &= ~(uint32_t)LTDC_LxCR_COLKEN;
sahilmgandhi 18:6a4db94011d3 1687
sahilmgandhi 18:6a4db94011d3 1688 /* Do not Sets the Reload */
sahilmgandhi 18:6a4db94011d3 1689
sahilmgandhi 18:6a4db94011d3 1690 /* Change the LTDC state*/
sahilmgandhi 18:6a4db94011d3 1691 hltdc->State = HAL_LTDC_STATE_READY;
sahilmgandhi 18:6a4db94011d3 1692
sahilmgandhi 18:6a4db94011d3 1693 /* Process unlocked */
sahilmgandhi 18:6a4db94011d3 1694 __HAL_UNLOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 1695
sahilmgandhi 18:6a4db94011d3 1696 return HAL_OK;
sahilmgandhi 18:6a4db94011d3 1697 }
sahilmgandhi 18:6a4db94011d3 1698
sahilmgandhi 18:6a4db94011d3 1699 /**
sahilmgandhi 18:6a4db94011d3 1700 * @brief Enable the color lookup table without reloading.
sahilmgandhi 18:6a4db94011d3 1701 * Variant of the function HAL_LTDC_EnableCLUT without immediate reload
sahilmgandhi 18:6a4db94011d3 1702 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 1703 * the configuration information for the LTDC.
sahilmgandhi 18:6a4db94011d3 1704 * @param LayerIdx: LTDC Layer index.
sahilmgandhi 18:6a4db94011d3 1705 * This parameter can be one of the following values:
sahilmgandhi 18:6a4db94011d3 1706 * 0 or 1
sahilmgandhi 18:6a4db94011d3 1707 * @retval HAL status
sahilmgandhi 18:6a4db94011d3 1708 */
sahilmgandhi 18:6a4db94011d3 1709 HAL_StatusTypeDef HAL_LTDC_EnableCLUT_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx)
sahilmgandhi 18:6a4db94011d3 1710 {
sahilmgandhi 18:6a4db94011d3 1711
sahilmgandhi 18:6a4db94011d3 1712 /* Process locked */
sahilmgandhi 18:6a4db94011d3 1713 __HAL_LOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 1714
sahilmgandhi 18:6a4db94011d3 1715 /* Change LTDC peripheral state */
sahilmgandhi 18:6a4db94011d3 1716 hltdc->State = HAL_LTDC_STATE_BUSY;
sahilmgandhi 18:6a4db94011d3 1717
sahilmgandhi 18:6a4db94011d3 1718 /* Check the parameters */
sahilmgandhi 18:6a4db94011d3 1719 assert_param(IS_LTDC_LAYER(LayerIdx));
sahilmgandhi 18:6a4db94011d3 1720
sahilmgandhi 18:6a4db94011d3 1721 /* Disable LTDC color lookup table by setting CLUTEN bit */
sahilmgandhi 18:6a4db94011d3 1722 LTDC_LAYER(hltdc, LayerIdx)->CR |= (uint32_t)LTDC_LxCR_CLUTEN;
sahilmgandhi 18:6a4db94011d3 1723
sahilmgandhi 18:6a4db94011d3 1724 /* Do not Sets the Reload */
sahilmgandhi 18:6a4db94011d3 1725
sahilmgandhi 18:6a4db94011d3 1726 /* Change the LTDC state*/
sahilmgandhi 18:6a4db94011d3 1727 hltdc->State = HAL_LTDC_STATE_READY;
sahilmgandhi 18:6a4db94011d3 1728
sahilmgandhi 18:6a4db94011d3 1729 /* Process unlocked */
sahilmgandhi 18:6a4db94011d3 1730 __HAL_UNLOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 1731
sahilmgandhi 18:6a4db94011d3 1732 return HAL_OK;
sahilmgandhi 18:6a4db94011d3 1733 }
sahilmgandhi 18:6a4db94011d3 1734
sahilmgandhi 18:6a4db94011d3 1735 /**
sahilmgandhi 18:6a4db94011d3 1736 * @brief Disable the color lookup table without reloading.
sahilmgandhi 18:6a4db94011d3 1737 * Variant of the function HAL_LTDC_DisableCLUT without immediate reload
sahilmgandhi 18:6a4db94011d3 1738 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 1739 * the configuration information for the LTDC.
sahilmgandhi 18:6a4db94011d3 1740 * @param LayerIdx: LTDC Layer index.
sahilmgandhi 18:6a4db94011d3 1741 * This parameter can be one of the following values:
sahilmgandhi 18:6a4db94011d3 1742 * 0 or 1
sahilmgandhi 18:6a4db94011d3 1743 * @retval HAL status
sahilmgandhi 18:6a4db94011d3 1744 */
sahilmgandhi 18:6a4db94011d3 1745 HAL_StatusTypeDef HAL_LTDC_DisableCLUT_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx)
sahilmgandhi 18:6a4db94011d3 1746 {
sahilmgandhi 18:6a4db94011d3 1747
sahilmgandhi 18:6a4db94011d3 1748 /* Process locked */
sahilmgandhi 18:6a4db94011d3 1749 __HAL_LOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 1750
sahilmgandhi 18:6a4db94011d3 1751 /* Change LTDC peripheral state */
sahilmgandhi 18:6a4db94011d3 1752 hltdc->State = HAL_LTDC_STATE_BUSY;
sahilmgandhi 18:6a4db94011d3 1753
sahilmgandhi 18:6a4db94011d3 1754 /* Check the parameters */
sahilmgandhi 18:6a4db94011d3 1755 assert_param(IS_LTDC_LAYER(LayerIdx));
sahilmgandhi 18:6a4db94011d3 1756
sahilmgandhi 18:6a4db94011d3 1757 /* Disable LTDC color lookup table by setting CLUTEN bit */
sahilmgandhi 18:6a4db94011d3 1758 LTDC_LAYER(hltdc, LayerIdx)->CR &= ~(uint32_t)LTDC_LxCR_CLUTEN;
sahilmgandhi 18:6a4db94011d3 1759
sahilmgandhi 18:6a4db94011d3 1760 /* Do not Sets the Reload */
sahilmgandhi 18:6a4db94011d3 1761
sahilmgandhi 18:6a4db94011d3 1762 /* Change the LTDC state*/
sahilmgandhi 18:6a4db94011d3 1763 hltdc->State = HAL_LTDC_STATE_READY;
sahilmgandhi 18:6a4db94011d3 1764
sahilmgandhi 18:6a4db94011d3 1765 /* Process unlocked */
sahilmgandhi 18:6a4db94011d3 1766 __HAL_UNLOCK(hltdc);
sahilmgandhi 18:6a4db94011d3 1767
sahilmgandhi 18:6a4db94011d3 1768 return HAL_OK;
sahilmgandhi 18:6a4db94011d3 1769 }
sahilmgandhi 18:6a4db94011d3 1770
sahilmgandhi 18:6a4db94011d3 1771 /**
sahilmgandhi 18:6a4db94011d3 1772 * @}
sahilmgandhi 18:6a4db94011d3 1773 */
sahilmgandhi 18:6a4db94011d3 1774
sahilmgandhi 18:6a4db94011d3 1775 /** @defgroup LTDC_Exported_Functions_Group4 Peripheral State and Errors functions
sahilmgandhi 18:6a4db94011d3 1776 * @brief Peripheral State and Errors functions
sahilmgandhi 18:6a4db94011d3 1777 *
sahilmgandhi 18:6a4db94011d3 1778 @verbatim
sahilmgandhi 18:6a4db94011d3 1779 ===============================================================================
sahilmgandhi 18:6a4db94011d3 1780 ##### Peripheral State and Errors functions #####
sahilmgandhi 18:6a4db94011d3 1781 ===============================================================================
sahilmgandhi 18:6a4db94011d3 1782 [..]
sahilmgandhi 18:6a4db94011d3 1783 This subsection provides functions allowing to
sahilmgandhi 18:6a4db94011d3 1784 (+) Check the LTDC state.
sahilmgandhi 18:6a4db94011d3 1785 (+) Get error code.
sahilmgandhi 18:6a4db94011d3 1786
sahilmgandhi 18:6a4db94011d3 1787 @endverbatim
sahilmgandhi 18:6a4db94011d3 1788 * @{
sahilmgandhi 18:6a4db94011d3 1789 */
sahilmgandhi 18:6a4db94011d3 1790
sahilmgandhi 18:6a4db94011d3 1791 /**
sahilmgandhi 18:6a4db94011d3 1792 * @brief Return the LTDC state
sahilmgandhi 18:6a4db94011d3 1793 * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 1794 * the configuration information for the LTDC.
sahilmgandhi 18:6a4db94011d3 1795 * @retval HAL state
sahilmgandhi 18:6a4db94011d3 1796 */
sahilmgandhi 18:6a4db94011d3 1797 HAL_LTDC_StateTypeDef HAL_LTDC_GetState(LTDC_HandleTypeDef *hltdc)
sahilmgandhi 18:6a4db94011d3 1798 {
sahilmgandhi 18:6a4db94011d3 1799 return hltdc->State;
sahilmgandhi 18:6a4db94011d3 1800 }
sahilmgandhi 18:6a4db94011d3 1801
sahilmgandhi 18:6a4db94011d3 1802 /**
sahilmgandhi 18:6a4db94011d3 1803 * @brief Return the LTDC error code
sahilmgandhi 18:6a4db94011d3 1804 * @param hltdc : pointer to a LTDC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 1805 * the configuration information for the LTDC.
sahilmgandhi 18:6a4db94011d3 1806 * @retval LTDC Error Code
sahilmgandhi 18:6a4db94011d3 1807 */
sahilmgandhi 18:6a4db94011d3 1808 uint32_t HAL_LTDC_GetError(LTDC_HandleTypeDef *hltdc)
sahilmgandhi 18:6a4db94011d3 1809 {
sahilmgandhi 18:6a4db94011d3 1810 return hltdc->ErrorCode;
sahilmgandhi 18:6a4db94011d3 1811 }
sahilmgandhi 18:6a4db94011d3 1812
sahilmgandhi 18:6a4db94011d3 1813 /**
sahilmgandhi 18:6a4db94011d3 1814 * @}
sahilmgandhi 18:6a4db94011d3 1815 */
sahilmgandhi 18:6a4db94011d3 1816
sahilmgandhi 18:6a4db94011d3 1817 /**
sahilmgandhi 18:6a4db94011d3 1818 * @brief Configures the LTDC peripheral
sahilmgandhi 18:6a4db94011d3 1819 * @param hltdc : Pointer to a LTDC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 1820 * the configuration information for the LTDC.
sahilmgandhi 18:6a4db94011d3 1821 * @param pLayerCfg: Pointer LTDC Layer Configuration structure
sahilmgandhi 18:6a4db94011d3 1822 * @param LayerIdx: LTDC Layer index.
sahilmgandhi 18:6a4db94011d3 1823 * This parameter can be one of the following values: 0 or 1
sahilmgandhi 18:6a4db94011d3 1824 * @retval None
sahilmgandhi 18:6a4db94011d3 1825 */
sahilmgandhi 18:6a4db94011d3 1826 static void LTDC_SetConfig(LTDC_HandleTypeDef *hltdc, LTDC_LayerCfgTypeDef *pLayerCfg, uint32_t LayerIdx)
sahilmgandhi 18:6a4db94011d3 1827 {
sahilmgandhi 18:6a4db94011d3 1828 uint32_t tmp = 0U;
sahilmgandhi 18:6a4db94011d3 1829 uint32_t tmp1 = 0U;
sahilmgandhi 18:6a4db94011d3 1830 uint32_t tmp2 = 0U;
sahilmgandhi 18:6a4db94011d3 1831
sahilmgandhi 18:6a4db94011d3 1832 /* Configures the horizontal start and stop position */
sahilmgandhi 18:6a4db94011d3 1833 tmp = ((pLayerCfg->WindowX1 + ((hltdc->Instance->BPCR & LTDC_BPCR_AHBP) >> 16U)) << 16U);
sahilmgandhi 18:6a4db94011d3 1834 LTDC_LAYER(hltdc, LayerIdx)->WHPCR &= ~(LTDC_LxWHPCR_WHSTPOS | LTDC_LxWHPCR_WHSPPOS);
sahilmgandhi 18:6a4db94011d3 1835 LTDC_LAYER(hltdc, LayerIdx)->WHPCR = ((pLayerCfg->WindowX0 + ((hltdc->Instance->BPCR & LTDC_BPCR_AHBP) >> 16U) + 1U) | tmp);
sahilmgandhi 18:6a4db94011d3 1836
sahilmgandhi 18:6a4db94011d3 1837 /* Configures the vertical start and stop position */
sahilmgandhi 18:6a4db94011d3 1838 tmp = ((pLayerCfg->WindowY1 + (hltdc->Instance->BPCR & LTDC_BPCR_AVBP)) << 16U);
sahilmgandhi 18:6a4db94011d3 1839 LTDC_LAYER(hltdc, LayerIdx)->WVPCR &= ~(LTDC_LxWVPCR_WVSTPOS | LTDC_LxWVPCR_WVSPPOS);
sahilmgandhi 18:6a4db94011d3 1840 LTDC_LAYER(hltdc, LayerIdx)->WVPCR = ((pLayerCfg->WindowY0 + (hltdc->Instance->BPCR & LTDC_BPCR_AVBP) + 1U) | tmp);
sahilmgandhi 18:6a4db94011d3 1841
sahilmgandhi 18:6a4db94011d3 1842 /* Specifies the pixel format */
sahilmgandhi 18:6a4db94011d3 1843 LTDC_LAYER(hltdc, LayerIdx)->PFCR &= ~(LTDC_LxPFCR_PF);
sahilmgandhi 18:6a4db94011d3 1844 LTDC_LAYER(hltdc, LayerIdx)->PFCR = (pLayerCfg->PixelFormat);
sahilmgandhi 18:6a4db94011d3 1845
sahilmgandhi 18:6a4db94011d3 1846 /* Configures the default color values */
sahilmgandhi 18:6a4db94011d3 1847 tmp = ((uint32_t)(pLayerCfg->Backcolor.Green) << 8U);
sahilmgandhi 18:6a4db94011d3 1848 tmp1 = ((uint32_t)(pLayerCfg->Backcolor.Red) << 16U);
sahilmgandhi 18:6a4db94011d3 1849 tmp2 = (pLayerCfg->Alpha0 << 24U);
sahilmgandhi 18:6a4db94011d3 1850 LTDC_LAYER(hltdc, LayerIdx)->DCCR &= ~(LTDC_LxDCCR_DCBLUE | LTDC_LxDCCR_DCGREEN | LTDC_LxDCCR_DCRED | LTDC_LxDCCR_DCALPHA);
sahilmgandhi 18:6a4db94011d3 1851 LTDC_LAYER(hltdc, LayerIdx)->DCCR = (pLayerCfg->Backcolor.Blue | tmp | tmp1 | tmp2);
sahilmgandhi 18:6a4db94011d3 1852
sahilmgandhi 18:6a4db94011d3 1853 /* Specifies the constant alpha value */
sahilmgandhi 18:6a4db94011d3 1854 LTDC_LAYER(hltdc, LayerIdx)->CACR &= ~(LTDC_LxCACR_CONSTA);
sahilmgandhi 18:6a4db94011d3 1855 LTDC_LAYER(hltdc, LayerIdx)->CACR = (pLayerCfg->Alpha);
sahilmgandhi 18:6a4db94011d3 1856
sahilmgandhi 18:6a4db94011d3 1857 /* Specifies the blending factors */
sahilmgandhi 18:6a4db94011d3 1858 LTDC_LAYER(hltdc, LayerIdx)->BFCR &= ~(LTDC_LxBFCR_BF2 | LTDC_LxBFCR_BF1);
sahilmgandhi 18:6a4db94011d3 1859 LTDC_LAYER(hltdc, LayerIdx)->BFCR = (pLayerCfg->BlendingFactor1 | pLayerCfg->BlendingFactor2);
sahilmgandhi 18:6a4db94011d3 1860
sahilmgandhi 18:6a4db94011d3 1861 /* Configures the color frame buffer start address */
sahilmgandhi 18:6a4db94011d3 1862 LTDC_LAYER(hltdc, LayerIdx)->CFBAR &= ~(LTDC_LxCFBAR_CFBADD);
sahilmgandhi 18:6a4db94011d3 1863 LTDC_LAYER(hltdc, LayerIdx)->CFBAR = (pLayerCfg->FBStartAdress);
sahilmgandhi 18:6a4db94011d3 1864
sahilmgandhi 18:6a4db94011d3 1865 if(pLayerCfg->PixelFormat == LTDC_PIXEL_FORMAT_ARGB8888)
sahilmgandhi 18:6a4db94011d3 1866 {
sahilmgandhi 18:6a4db94011d3 1867 tmp = 4U;
sahilmgandhi 18:6a4db94011d3 1868 }
sahilmgandhi 18:6a4db94011d3 1869 else if (pLayerCfg->PixelFormat == LTDC_PIXEL_FORMAT_RGB888)
sahilmgandhi 18:6a4db94011d3 1870 {
sahilmgandhi 18:6a4db94011d3 1871 tmp = 3U;
sahilmgandhi 18:6a4db94011d3 1872 }
sahilmgandhi 18:6a4db94011d3 1873 else if((pLayerCfg->PixelFormat == LTDC_PIXEL_FORMAT_ARGB4444) || \
sahilmgandhi 18:6a4db94011d3 1874 (pLayerCfg->PixelFormat == LTDC_PIXEL_FORMAT_RGB565) || \
sahilmgandhi 18:6a4db94011d3 1875 (pLayerCfg->PixelFormat == LTDC_PIXEL_FORMAT_ARGB1555) || \
sahilmgandhi 18:6a4db94011d3 1876 (pLayerCfg->PixelFormat == LTDC_PIXEL_FORMAT_AL88))
sahilmgandhi 18:6a4db94011d3 1877 {
sahilmgandhi 18:6a4db94011d3 1878 tmp = 2U;
sahilmgandhi 18:6a4db94011d3 1879 }
sahilmgandhi 18:6a4db94011d3 1880 else
sahilmgandhi 18:6a4db94011d3 1881 {
sahilmgandhi 18:6a4db94011d3 1882 tmp = 1U;
sahilmgandhi 18:6a4db94011d3 1883 }
sahilmgandhi 18:6a4db94011d3 1884
sahilmgandhi 18:6a4db94011d3 1885 /* Configures the color frame buffer pitch in byte */
sahilmgandhi 18:6a4db94011d3 1886 LTDC_LAYER(hltdc, LayerIdx)->CFBLR &= ~(LTDC_LxCFBLR_CFBLL | LTDC_LxCFBLR_CFBP);
sahilmgandhi 18:6a4db94011d3 1887 LTDC_LAYER(hltdc, LayerIdx)->CFBLR = (((pLayerCfg->ImageWidth * tmp) << 16U) | (((pLayerCfg->WindowX1 - pLayerCfg->WindowX0) * tmp) + 3U));
sahilmgandhi 18:6a4db94011d3 1888
sahilmgandhi 18:6a4db94011d3 1889 /* Configures the frame buffer line number */
sahilmgandhi 18:6a4db94011d3 1890 LTDC_LAYER(hltdc, LayerIdx)->CFBLNR &= ~(LTDC_LxCFBLNR_CFBLNBR);
sahilmgandhi 18:6a4db94011d3 1891 LTDC_LAYER(hltdc, LayerIdx)->CFBLNR = (pLayerCfg->ImageHeight);
sahilmgandhi 18:6a4db94011d3 1892
sahilmgandhi 18:6a4db94011d3 1893 /* Enable LTDC_Layer by setting LEN bit */
sahilmgandhi 18:6a4db94011d3 1894 LTDC_LAYER(hltdc, LayerIdx)->CR |= (uint32_t)LTDC_LxCR_LEN;
sahilmgandhi 18:6a4db94011d3 1895 }
sahilmgandhi 18:6a4db94011d3 1896
sahilmgandhi 18:6a4db94011d3 1897 /**
sahilmgandhi 18:6a4db94011d3 1898 * @}
sahilmgandhi 18:6a4db94011d3 1899 */
sahilmgandhi 18:6a4db94011d3 1900 #endif /* STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */
sahilmgandhi 18:6a4db94011d3 1901 #endif /* HAL_LTDC_MODULE_ENABLED */
sahilmgandhi 18:6a4db94011d3 1902 /**
sahilmgandhi 18:6a4db94011d3 1903 * @}
sahilmgandhi 18:6a4db94011d3 1904 */
sahilmgandhi 18:6a4db94011d3 1905
sahilmgandhi 18:6a4db94011d3 1906 /**
sahilmgandhi 18:6a4db94011d3 1907 * @}
sahilmgandhi 18:6a4db94011d3 1908 */
sahilmgandhi 18:6a4db94011d3 1909
sahilmgandhi 18:6a4db94011d3 1910 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/