Initial commit

Dependencies:   FastPWM

Committer:
lypinator
Date:
Wed Sep 16 01:11:49 2020 +0000
Revision:
0:bb348c97df44
Added PWM

Who changed what in which revision?

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