mbed library sources
Dependents: frdm_kl05z_gpio_test
Fork of mbed-src by
targets/cmsis/TARGET_STM/TARGET_STM32F407VG/stm32f4xx_hal_ltdc.c@323:9e901b0a5aa1, 2014-09-13 (annotated)
- Committer:
- shaoziyang
- Date:
- Sat Sep 13 14:25:46 2014 +0000
- Revision:
- 323:9e901b0a5aa1
- Parent:
- 296:ec1b66a3d094
test with CLOCK_SETUP = 0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 133:d4dda5c437f0 | 1 | /** |
mbed_official | 133:d4dda5c437f0 | 2 | ****************************************************************************** |
mbed_official | 133:d4dda5c437f0 | 3 | * @file stm32f4xx_hal_ltdc.c |
mbed_official | 133:d4dda5c437f0 | 4 | * @author MCD Application Team |
mbed_official | 242:7074e42da0b2 | 5 | * @version V1.1.0RC2 |
mbed_official | 242:7074e42da0b2 | 6 | * @date 14-May-2014 |
mbed_official | 133:d4dda5c437f0 | 7 | * @brief LTDC HAL module driver. |
mbed_official | 133:d4dda5c437f0 | 8 | * This file provides firmware functions to manage the following |
mbed_official | 133:d4dda5c437f0 | 9 | * functionalities of the LTDC peripheral: |
mbed_official | 133:d4dda5c437f0 | 10 | * + Initialization and de-initialization functions |
mbed_official | 133:d4dda5c437f0 | 11 | * + IO operation functions |
mbed_official | 133:d4dda5c437f0 | 12 | * + Peripheral Control functions |
mbed_official | 133:d4dda5c437f0 | 13 | * + Peripheral State and Errors functions |
mbed_official | 133:d4dda5c437f0 | 14 | * |
mbed_official | 133:d4dda5c437f0 | 15 | @verbatim |
mbed_official | 133:d4dda5c437f0 | 16 | ============================================================================== |
mbed_official | 133:d4dda5c437f0 | 17 | ##### How to use this driver ##### |
mbed_official | 133:d4dda5c437f0 | 18 | ============================================================================== |
mbed_official | 133:d4dda5c437f0 | 19 | [..] |
mbed_official | 242:7074e42da0b2 | 20 | (#) Program the required configuration through the following parameters: |
mbed_official | 133:d4dda5c437f0 | 21 | the LTDC timing, the horizontal and vertical polarity, |
mbed_official | 133:d4dda5c437f0 | 22 | the pixel clock polarity, Data Enable polarity and the LTDC background color value |
mbed_official | 133:d4dda5c437f0 | 23 | using HAL_LTDC_Init() function |
mbed_official | 133:d4dda5c437f0 | 24 | |
mbed_official | 242:7074e42da0b2 | 25 | (#) Program the required configuration through the following parameters: |
mbed_official | 133:d4dda5c437f0 | 26 | the pixel format, the blending factors, input alpha value, the window size |
mbed_official | 133:d4dda5c437f0 | 27 | and the image size using HAL_LTDC_ConfigLayer() function for foreground |
mbed_official | 133:d4dda5c437f0 | 28 | or/and background layer. |
mbed_official | 133:d4dda5c437f0 | 29 | |
mbed_official | 133:d4dda5c437f0 | 30 | (#) Optionally, configure and enable the CLUT using HAL_LTDC_ConfigCLUT() and |
mbed_official | 133:d4dda5c437f0 | 31 | HAL_LTDC_EnableCLUT functions. |
mbed_official | 133:d4dda5c437f0 | 32 | |
mbed_official | 133:d4dda5c437f0 | 33 | (#) Optionally, enable the Dither using HAL_LTDC_EnableDither(). |
mbed_official | 133:d4dda5c437f0 | 34 | |
mbed_official | 133:d4dda5c437f0 | 35 | (#) Optionally, configure and enable the Color keying using HAL_LTDC_ConfigColorKeying() |
mbed_official | 133:d4dda5c437f0 | 36 | and HAL_LTDC_EnableColorKeying functions. |
mbed_official | 133:d4dda5c437f0 | 37 | |
mbed_official | 133:d4dda5c437f0 | 38 | (#) Optionally, configure LineInterrupt using HAL_LTDC_ProgramLineInterrupt() |
mbed_official | 133:d4dda5c437f0 | 39 | function |
mbed_official | 133:d4dda5c437f0 | 40 | |
mbed_official | 242:7074e42da0b2 | 41 | (#) If needed, reconfigure and change the pixel format value, the alpha value |
mbed_official | 133:d4dda5c437f0 | 42 | value, the window size, the window position and the layer start address |
mbed_official | 133:d4dda5c437f0 | 43 | for foreground or/and background layer using respectively the following |
mbed_official | 133:d4dda5c437f0 | 44 | functions: HAL_LTDC_SetPixelFormat(), HAL_LTDC_SetAlpha(), HAL_LTDC_SetWindowSize(), |
mbed_official | 133:d4dda5c437f0 | 45 | HAL_LTDC_SetWindowPosition(), HAL_LTDC_SetAddress. |
mbed_official | 133:d4dda5c437f0 | 46 | |
mbed_official | 133:d4dda5c437f0 | 47 | (#) To control LTDC state you can use the following function: HAL_LTDC_GetState() |
mbed_official | 133:d4dda5c437f0 | 48 | |
mbed_official | 133:d4dda5c437f0 | 49 | *** LTDC HAL driver macros list *** |
mbed_official | 133:d4dda5c437f0 | 50 | ============================================= |
mbed_official | 133:d4dda5c437f0 | 51 | [..] |
mbed_official | 133:d4dda5c437f0 | 52 | Below the list of most used macros in LTDC HAL driver. |
mbed_official | 133:d4dda5c437f0 | 53 | |
mbed_official | 133:d4dda5c437f0 | 54 | (+) __HAL_LTDC_ENABLE: Enable the LTDC. |
mbed_official | 133:d4dda5c437f0 | 55 | (+) __HAL_LTDC_DISABLE: Disable the LTDC. |
mbed_official | 133:d4dda5c437f0 | 56 | (+) __HAL_LTDC_LAYER_ENABLE: Enable the LTDC Layer. |
mbed_official | 133:d4dda5c437f0 | 57 | (+) __HAL_LTDC_LAYER_DISABLE: Disable the LTDC Layer. |
mbed_official | 133:d4dda5c437f0 | 58 | (+) __HAL_LTDC_RELOAD_CONFIG: Reload Layer Configuration. |
mbed_official | 133:d4dda5c437f0 | 59 | (+) __HAL_LTDC_GET_FLAG: Get the LTDC pending flags. |
mbed_official | 242:7074e42da0b2 | 60 | (+) __HAL_LTDC_CLEAR_FLAG: Clear the LTDC pending flags. |
mbed_official | 242:7074e42da0b2 | 61 | (+) __HAL_LTDC_ENABLE_IT: Enable the specified LTDC interrupts. |
mbed_official | 242:7074e42da0b2 | 62 | (+) __HAL_LTDC_DISABLE_IT: Disable the specified LTDC interrupts. |
mbed_official | 242:7074e42da0b2 | 63 | (+) __HAL_LTDC_GET_IT_SOURCE: Check whether the specified LTDC interrupt has occurred or not. |
mbed_official | 133:d4dda5c437f0 | 64 | |
mbed_official | 133:d4dda5c437f0 | 65 | [..] |
mbed_official | 133:d4dda5c437f0 | 66 | (@) You can refer to the LTDC HAL driver header file for more useful macros |
mbed_official | 133:d4dda5c437f0 | 67 | |
mbed_official | 133:d4dda5c437f0 | 68 | @endverbatim |
mbed_official | 133:d4dda5c437f0 | 69 | ****************************************************************************** |
mbed_official | 133:d4dda5c437f0 | 70 | * @attention |
mbed_official | 133:d4dda5c437f0 | 71 | * |
mbed_official | 133:d4dda5c437f0 | 72 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
mbed_official | 133:d4dda5c437f0 | 73 | * |
mbed_official | 133:d4dda5c437f0 | 74 | * Redistribution and use in source and binary forms, with or without modification, |
mbed_official | 133:d4dda5c437f0 | 75 | * are permitted provided that the following conditions are met: |
mbed_official | 133:d4dda5c437f0 | 76 | * 1. Redistributions of source code must retain the above copyright notice, |
mbed_official | 133:d4dda5c437f0 | 77 | * this list of conditions and the following disclaimer. |
mbed_official | 133:d4dda5c437f0 | 78 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
mbed_official | 133:d4dda5c437f0 | 79 | * this list of conditions and the following disclaimer in the documentation |
mbed_official | 133:d4dda5c437f0 | 80 | * and/or other materials provided with the distribution. |
mbed_official | 133:d4dda5c437f0 | 81 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
mbed_official | 133:d4dda5c437f0 | 82 | * may be used to endorse or promote products derived from this software |
mbed_official | 133:d4dda5c437f0 | 83 | * without specific prior written permission. |
mbed_official | 133:d4dda5c437f0 | 84 | * |
mbed_official | 133:d4dda5c437f0 | 85 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
mbed_official | 133:d4dda5c437f0 | 86 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
mbed_official | 133:d4dda5c437f0 | 87 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
mbed_official | 133:d4dda5c437f0 | 88 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
mbed_official | 133:d4dda5c437f0 | 89 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
mbed_official | 133:d4dda5c437f0 | 90 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
mbed_official | 133:d4dda5c437f0 | 91 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
mbed_official | 133:d4dda5c437f0 | 92 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
mbed_official | 133:d4dda5c437f0 | 93 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
mbed_official | 133:d4dda5c437f0 | 94 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
mbed_official | 133:d4dda5c437f0 | 95 | * |
mbed_official | 133:d4dda5c437f0 | 96 | ****************************************************************************** |
mbed_official | 133:d4dda5c437f0 | 97 | */ |
mbed_official | 133:d4dda5c437f0 | 98 | |
mbed_official | 133:d4dda5c437f0 | 99 | /* Includes ------------------------------------------------------------------*/ |
mbed_official | 133:d4dda5c437f0 | 100 | #include "stm32f4xx_hal.h" |
mbed_official | 133:d4dda5c437f0 | 101 | |
mbed_official | 133:d4dda5c437f0 | 102 | /** @addtogroup STM32F4xx_HAL_Driver |
mbed_official | 133:d4dda5c437f0 | 103 | * @{ |
mbed_official | 133:d4dda5c437f0 | 104 | */ |
mbed_official | 133:d4dda5c437f0 | 105 | /** @defgroup LTDC |
mbed_official | 133:d4dda5c437f0 | 106 | * @brief LTDC HAL module driver |
mbed_official | 133:d4dda5c437f0 | 107 | * @{ |
mbed_official | 133:d4dda5c437f0 | 108 | */ |
mbed_official | 133:d4dda5c437f0 | 109 | |
mbed_official | 133:d4dda5c437f0 | 110 | #ifdef HAL_LTDC_MODULE_ENABLED |
mbed_official | 133:d4dda5c437f0 | 111 | |
mbed_official | 133:d4dda5c437f0 | 112 | #if defined(STM32F429xx) || defined(STM32F439xx) |
mbed_official | 133:d4dda5c437f0 | 113 | |
mbed_official | 133:d4dda5c437f0 | 114 | /* Private typedef -----------------------------------------------------------*/ |
mbed_official | 133:d4dda5c437f0 | 115 | /* Private define ------------------------------------------------------------*/ |
mbed_official | 133:d4dda5c437f0 | 116 | /* Private macro -------------------------------------------------------------*/ |
mbed_official | 133:d4dda5c437f0 | 117 | /* Private variables ---------------------------------------------------------*/ |
mbed_official | 133:d4dda5c437f0 | 118 | /* Private function prototypes -----------------------------------------------*/ |
mbed_official | 133:d4dda5c437f0 | 119 | static void LTDC_SetConfig(LTDC_HandleTypeDef *hltdc, LTDC_LayerCfgTypeDef *pLayerCfg, uint32_t LayerIdx); |
mbed_official | 133:d4dda5c437f0 | 120 | /* Private functions ---------------------------------------------------------*/ |
mbed_official | 133:d4dda5c437f0 | 121 | |
mbed_official | 133:d4dda5c437f0 | 122 | /** @defgroup LTDC_Private_Functions |
mbed_official | 133:d4dda5c437f0 | 123 | * @{ |
mbed_official | 133:d4dda5c437f0 | 124 | */ |
mbed_official | 133:d4dda5c437f0 | 125 | |
mbed_official | 133:d4dda5c437f0 | 126 | /** @defgroup LTDC_Group1 Initialization and Configuration functions |
mbed_official | 133:d4dda5c437f0 | 127 | * @brief Initialization and Configuration functions |
mbed_official | 133:d4dda5c437f0 | 128 | * |
mbed_official | 133:d4dda5c437f0 | 129 | @verbatim |
mbed_official | 133:d4dda5c437f0 | 130 | =============================================================================== |
mbed_official | 133:d4dda5c437f0 | 131 | ##### Initialization and Configuration functions ##### |
mbed_official | 133:d4dda5c437f0 | 132 | =============================================================================== |
mbed_official | 133:d4dda5c437f0 | 133 | [..] This section provides functions allowing to: |
mbed_official | 133:d4dda5c437f0 | 134 | (+) Initialize and configure the LTDC |
mbed_official | 133:d4dda5c437f0 | 135 | (+) De-initialize the LTDC |
mbed_official | 133:d4dda5c437f0 | 136 | |
mbed_official | 133:d4dda5c437f0 | 137 | @endverbatim |
mbed_official | 133:d4dda5c437f0 | 138 | * @{ |
mbed_official | 133:d4dda5c437f0 | 139 | */ |
mbed_official | 133:d4dda5c437f0 | 140 | |
mbed_official | 133:d4dda5c437f0 | 141 | /** |
mbed_official | 133:d4dda5c437f0 | 142 | * @brief Initializes the LTDC according to the specified |
mbed_official | 133:d4dda5c437f0 | 143 | * parameters in the LTDC_InitTypeDef and create the associated handle. |
mbed_official | 133:d4dda5c437f0 | 144 | * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains |
mbed_official | 133:d4dda5c437f0 | 145 | * the configuration information for the LTDC. |
mbed_official | 133:d4dda5c437f0 | 146 | * @retval HAL status |
mbed_official | 133:d4dda5c437f0 | 147 | */ |
mbed_official | 133:d4dda5c437f0 | 148 | HAL_StatusTypeDef HAL_LTDC_Init(LTDC_HandleTypeDef *hltdc) |
mbed_official | 133:d4dda5c437f0 | 149 | { |
mbed_official | 133:d4dda5c437f0 | 150 | uint32_t tmp = 0, tmp1 = 0; |
mbed_official | 133:d4dda5c437f0 | 151 | |
mbed_official | 133:d4dda5c437f0 | 152 | /* Check the LTDC peripheral state */ |
mbed_official | 133:d4dda5c437f0 | 153 | if(hltdc == NULL) |
mbed_official | 133:d4dda5c437f0 | 154 | { |
mbed_official | 133:d4dda5c437f0 | 155 | return HAL_ERROR; |
mbed_official | 133:d4dda5c437f0 | 156 | } |
mbed_official | 133:d4dda5c437f0 | 157 | |
mbed_official | 133:d4dda5c437f0 | 158 | /* Check function parameters */ |
mbed_official | 133:d4dda5c437f0 | 159 | assert_param(IS_LTDC_ALL_INSTANCE(hltdc->Instance)); |
mbed_official | 133:d4dda5c437f0 | 160 | assert_param(IS_LTDC_HSYNC(hltdc->Init.HorizontalSync)); |
mbed_official | 133:d4dda5c437f0 | 161 | assert_param(IS_LTDC_VSYNC(hltdc->Init.VerticalSync)); |
mbed_official | 133:d4dda5c437f0 | 162 | assert_param(IS_LTDC_AHBP(hltdc->Init.AccumulatedHBP)); |
mbed_official | 133:d4dda5c437f0 | 163 | assert_param(IS_LTDC_AVBP(hltdc->Init.AccumulatedVBP)); |
mbed_official | 133:d4dda5c437f0 | 164 | assert_param(IS_LTDC_AAH(hltdc->Init.AccumulatedActiveH)); |
mbed_official | 133:d4dda5c437f0 | 165 | assert_param(IS_LTDC_AAW(hltdc->Init.AccumulatedActiveW)); |
mbed_official | 133:d4dda5c437f0 | 166 | assert_param(IS_LTDC_TOTALH(hltdc->Init.TotalHeigh)); |
mbed_official | 133:d4dda5c437f0 | 167 | assert_param(IS_LTDC_TOTALW(hltdc->Init.TotalWidth)); |
mbed_official | 133:d4dda5c437f0 | 168 | assert_param(IS_LTDC_HSPOL(hltdc->Init.HSPolarity)); |
mbed_official | 133:d4dda5c437f0 | 169 | assert_param(IS_LTDC_VSPOL(hltdc->Init.VSPolarity)); |
mbed_official | 133:d4dda5c437f0 | 170 | assert_param(IS_LTDC_DEPOL(hltdc->Init.DEPolarity)); |
mbed_official | 133:d4dda5c437f0 | 171 | assert_param(IS_LTDC_PCPOL(hltdc->Init.PCPolarity)); |
mbed_official | 133:d4dda5c437f0 | 172 | |
mbed_official | 133:d4dda5c437f0 | 173 | if(hltdc->State == HAL_LTDC_STATE_RESET) |
mbed_official | 133:d4dda5c437f0 | 174 | { |
mbed_official | 133:d4dda5c437f0 | 175 | /* Init the low level hardware */ |
mbed_official | 133:d4dda5c437f0 | 176 | HAL_LTDC_MspInit(hltdc); |
mbed_official | 133:d4dda5c437f0 | 177 | } |
mbed_official | 133:d4dda5c437f0 | 178 | |
mbed_official | 133:d4dda5c437f0 | 179 | /* Change LTDC peripheral state */ |
mbed_official | 133:d4dda5c437f0 | 180 | hltdc->State = HAL_LTDC_STATE_BUSY; |
mbed_official | 133:d4dda5c437f0 | 181 | |
mbed_official | 133:d4dda5c437f0 | 182 | /* Configures the HS, VS, DE and PC polarity */ |
mbed_official | 133:d4dda5c437f0 | 183 | hltdc->Instance->GCR &= ~(LTDC_GCR_HSPOL | LTDC_GCR_VSPOL | LTDC_GCR_DEPOL | LTDC_GCR_PCPOL); |
mbed_official | 133:d4dda5c437f0 | 184 | hltdc->Instance->GCR |= (uint32_t)(hltdc->Init.HSPolarity | hltdc->Init.VSPolarity | \ |
mbed_official | 133:d4dda5c437f0 | 185 | hltdc->Init.DEPolarity | hltdc->Init.PCPolarity); |
mbed_official | 133:d4dda5c437f0 | 186 | |
mbed_official | 133:d4dda5c437f0 | 187 | /* Sets Synchronization size */ |
mbed_official | 133:d4dda5c437f0 | 188 | hltdc->Instance->SSCR &= ~(LTDC_SSCR_VSH | LTDC_SSCR_HSW); |
mbed_official | 133:d4dda5c437f0 | 189 | tmp = (hltdc->Init.HorizontalSync << 16); |
mbed_official | 133:d4dda5c437f0 | 190 | hltdc->Instance->SSCR |= (tmp | hltdc->Init.VerticalSync); |
mbed_official | 133:d4dda5c437f0 | 191 | |
mbed_official | 133:d4dda5c437f0 | 192 | /* Sets Accumulated Back porch */ |
mbed_official | 133:d4dda5c437f0 | 193 | hltdc->Instance->BPCR &= ~(LTDC_BPCR_AVBP | LTDC_BPCR_AHBP); |
mbed_official | 133:d4dda5c437f0 | 194 | tmp = (hltdc->Init.AccumulatedHBP << 16); |
mbed_official | 133:d4dda5c437f0 | 195 | hltdc->Instance->BPCR |= (tmp | hltdc->Init.AccumulatedVBP); |
mbed_official | 133:d4dda5c437f0 | 196 | |
mbed_official | 133:d4dda5c437f0 | 197 | /* Sets Accumulated Active Width */ |
mbed_official | 133:d4dda5c437f0 | 198 | hltdc->Instance->AWCR &= ~(LTDC_AWCR_AAH | LTDC_AWCR_AAW); |
mbed_official | 133:d4dda5c437f0 | 199 | tmp = (hltdc->Init.AccumulatedActiveW << 16); |
mbed_official | 133:d4dda5c437f0 | 200 | hltdc->Instance->AWCR |= (tmp | hltdc->Init.AccumulatedActiveH); |
mbed_official | 133:d4dda5c437f0 | 201 | |
mbed_official | 133:d4dda5c437f0 | 202 | /* Sets Total Width */ |
mbed_official | 133:d4dda5c437f0 | 203 | hltdc->Instance->TWCR &= ~(LTDC_TWCR_TOTALH | LTDC_TWCR_TOTALW); |
mbed_official | 133:d4dda5c437f0 | 204 | tmp = (hltdc->Init.TotalWidth << 16); |
mbed_official | 133:d4dda5c437f0 | 205 | hltdc->Instance->TWCR |= (tmp | hltdc->Init.TotalHeigh); |
mbed_official | 133:d4dda5c437f0 | 206 | |
mbed_official | 133:d4dda5c437f0 | 207 | /* Sets the background color value */ |
mbed_official | 133:d4dda5c437f0 | 208 | tmp = ((uint32_t)(hltdc->Init.Backcolor.Green) << 8); |
mbed_official | 133:d4dda5c437f0 | 209 | tmp1 = ((uint32_t)(hltdc->Init.Backcolor.Red) << 16); |
mbed_official | 133:d4dda5c437f0 | 210 | hltdc->Instance->BCCR &= ~(LTDC_BCCR_BCBLUE | LTDC_BCCR_BCGREEN | LTDC_BCCR_BCRED); |
mbed_official | 133:d4dda5c437f0 | 211 | hltdc->Instance->BCCR |= (tmp1 | tmp | hltdc->Init.Backcolor.Blue); |
mbed_official | 133:d4dda5c437f0 | 212 | |
mbed_official | 133:d4dda5c437f0 | 213 | /* Enable the transfer Error interrupt */ |
mbed_official | 133:d4dda5c437f0 | 214 | __HAL_LTDC_ENABLE_IT(hltdc, LTDC_IT_TE); |
mbed_official | 133:d4dda5c437f0 | 215 | |
mbed_official | 133:d4dda5c437f0 | 216 | /* Enable the FIFO underrun interrupt */ |
mbed_official | 133:d4dda5c437f0 | 217 | __HAL_LTDC_ENABLE_IT(hltdc, LTDC_IT_FU); |
mbed_official | 133:d4dda5c437f0 | 218 | |
mbed_official | 133:d4dda5c437f0 | 219 | /* Enable LTDC by setting LTDCEN bit */ |
mbed_official | 133:d4dda5c437f0 | 220 | __HAL_LTDC_ENABLE(hltdc); |
mbed_official | 133:d4dda5c437f0 | 221 | |
mbed_official | 133:d4dda5c437f0 | 222 | /* Initialise the error code */ |
mbed_official | 133:d4dda5c437f0 | 223 | hltdc->ErrorCode = HAL_LTDC_ERROR_NONE; |
mbed_official | 133:d4dda5c437f0 | 224 | |
mbed_official | 133:d4dda5c437f0 | 225 | /* Initialize the LTDC state*/ |
mbed_official | 133:d4dda5c437f0 | 226 | hltdc->State = HAL_LTDC_STATE_READY; |
mbed_official | 133:d4dda5c437f0 | 227 | |
mbed_official | 133:d4dda5c437f0 | 228 | return HAL_OK; |
mbed_official | 133:d4dda5c437f0 | 229 | } |
mbed_official | 133:d4dda5c437f0 | 230 | |
mbed_official | 133:d4dda5c437f0 | 231 | /** |
mbed_official | 133:d4dda5c437f0 | 232 | * @brief Deinitializes the LTDC peripheral registers to their default reset |
mbed_official | 133:d4dda5c437f0 | 233 | * values. |
mbed_official | 133:d4dda5c437f0 | 234 | * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains |
mbed_official | 133:d4dda5c437f0 | 235 | * the configuration information for the LTDC. |
mbed_official | 133:d4dda5c437f0 | 236 | * @retval None |
mbed_official | 133:d4dda5c437f0 | 237 | */ |
mbed_official | 133:d4dda5c437f0 | 238 | |
mbed_official | 133:d4dda5c437f0 | 239 | HAL_StatusTypeDef HAL_LTDC_DeInit(LTDC_HandleTypeDef *hltdc) |
mbed_official | 133:d4dda5c437f0 | 240 | { |
mbed_official | 133:d4dda5c437f0 | 241 | /* DeInit the low level hardware */ |
mbed_official | 133:d4dda5c437f0 | 242 | HAL_LTDC_MspDeInit(hltdc); |
mbed_official | 133:d4dda5c437f0 | 243 | |
mbed_official | 133:d4dda5c437f0 | 244 | /* Initialise the error code */ |
mbed_official | 133:d4dda5c437f0 | 245 | hltdc->ErrorCode = HAL_LTDC_ERROR_NONE; |
mbed_official | 133:d4dda5c437f0 | 246 | |
mbed_official | 133:d4dda5c437f0 | 247 | /* Initialize the LTDC state*/ |
mbed_official | 133:d4dda5c437f0 | 248 | hltdc->State = HAL_LTDC_STATE_RESET; |
mbed_official | 133:d4dda5c437f0 | 249 | |
mbed_official | 133:d4dda5c437f0 | 250 | /* Release Lock */ |
mbed_official | 133:d4dda5c437f0 | 251 | __HAL_UNLOCK(hltdc); |
mbed_official | 133:d4dda5c437f0 | 252 | |
mbed_official | 133:d4dda5c437f0 | 253 | return HAL_OK; |
mbed_official | 133:d4dda5c437f0 | 254 | } |
mbed_official | 133:d4dda5c437f0 | 255 | |
mbed_official | 133:d4dda5c437f0 | 256 | /** |
mbed_official | 133:d4dda5c437f0 | 257 | * @brief Initializes the LTDC MSP. |
mbed_official | 133:d4dda5c437f0 | 258 | * @param hltdc : pointer to a LTDC_HandleTypeDef structure that contains |
mbed_official | 133:d4dda5c437f0 | 259 | * the configuration information for the LTDC. |
mbed_official | 133:d4dda5c437f0 | 260 | * @retval None |
mbed_official | 133:d4dda5c437f0 | 261 | */ |
mbed_official | 133:d4dda5c437f0 | 262 | __weak void HAL_LTDC_MspInit(LTDC_HandleTypeDef* hltdc) |
mbed_official | 133:d4dda5c437f0 | 263 | { |
mbed_official | 133:d4dda5c437f0 | 264 | /* NOTE : This function Should not be modified, when the callback is needed, |
mbed_official | 133:d4dda5c437f0 | 265 | the HAL_LTDC_MspInit could be implemented in the user file |
mbed_official | 133:d4dda5c437f0 | 266 | */ |
mbed_official | 133:d4dda5c437f0 | 267 | } |
mbed_official | 133:d4dda5c437f0 | 268 | |
mbed_official | 133:d4dda5c437f0 | 269 | /** |
mbed_official | 133:d4dda5c437f0 | 270 | * @brief DeInitializes the LTDC MSP. |
mbed_official | 133:d4dda5c437f0 | 271 | * @param hltdc : pointer to a LTDC_HandleTypeDef structure that contains |
mbed_official | 133:d4dda5c437f0 | 272 | * the configuration information for the LTDC. |
mbed_official | 133:d4dda5c437f0 | 273 | * @retval None |
mbed_official | 133:d4dda5c437f0 | 274 | */ |
mbed_official | 133:d4dda5c437f0 | 275 | __weak void HAL_LTDC_MspDeInit(LTDC_HandleTypeDef* hltdc) |
mbed_official | 133:d4dda5c437f0 | 276 | { |
mbed_official | 133:d4dda5c437f0 | 277 | /* NOTE : This function Should not be modified, when the callback is needed, |
mbed_official | 133:d4dda5c437f0 | 278 | the HAL_LTDC_MspDeInit could be implemented in the user file |
mbed_official | 133:d4dda5c437f0 | 279 | */ |
mbed_official | 133:d4dda5c437f0 | 280 | } |
mbed_official | 133:d4dda5c437f0 | 281 | |
mbed_official | 133:d4dda5c437f0 | 282 | /** |
mbed_official | 133:d4dda5c437f0 | 283 | * @} |
mbed_official | 133:d4dda5c437f0 | 284 | */ |
mbed_official | 133:d4dda5c437f0 | 285 | |
mbed_official | 133:d4dda5c437f0 | 286 | /** @defgroup LTDC_Group2 IO operation functions |
mbed_official | 133:d4dda5c437f0 | 287 | * @brief IO operation functions |
mbed_official | 133:d4dda5c437f0 | 288 | * |
mbed_official | 133:d4dda5c437f0 | 289 | @verbatim |
mbed_official | 133:d4dda5c437f0 | 290 | =============================================================================== |
mbed_official | 133:d4dda5c437f0 | 291 | ##### IO operation functions ##### |
mbed_official | 133:d4dda5c437f0 | 292 | =============================================================================== |
mbed_official | 133:d4dda5c437f0 | 293 | [..] This section provides function allowing to: |
mbed_official | 133:d4dda5c437f0 | 294 | (+) Handle LTDC interrupt request |
mbed_official | 133:d4dda5c437f0 | 295 | |
mbed_official | 133:d4dda5c437f0 | 296 | @endverbatim |
mbed_official | 133:d4dda5c437f0 | 297 | * @{ |
mbed_official | 133:d4dda5c437f0 | 298 | */ |
mbed_official | 133:d4dda5c437f0 | 299 | /** |
mbed_official | 133:d4dda5c437f0 | 300 | * @brief Handles LTDC interrupt request. |
mbed_official | 133:d4dda5c437f0 | 301 | * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains |
mbed_official | 133:d4dda5c437f0 | 302 | * the configuration information for the LTDC. |
mbed_official | 133:d4dda5c437f0 | 303 | * @retval HAL status |
mbed_official | 133:d4dda5c437f0 | 304 | */ |
mbed_official | 133:d4dda5c437f0 | 305 | void HAL_LTDC_IRQHandler(LTDC_HandleTypeDef *hltdc) |
mbed_official | 133:d4dda5c437f0 | 306 | { |
mbed_official | 133:d4dda5c437f0 | 307 | /* Transfer Error Interrupt management ***************************************/ |
mbed_official | 133:d4dda5c437f0 | 308 | if(__HAL_LTDC_GET_FLAG(hltdc, LTDC_FLAG_TE) != RESET) |
mbed_official | 133:d4dda5c437f0 | 309 | { |
mbed_official | 133:d4dda5c437f0 | 310 | if(__HAL_LTDC_GET_IT_SOURCE(hltdc, LTDC_IT_TE) != RESET) |
mbed_official | 133:d4dda5c437f0 | 311 | { |
mbed_official | 133:d4dda5c437f0 | 312 | /* Disable the transfer Error interrupt */ |
mbed_official | 133:d4dda5c437f0 | 313 | __HAL_LTDC_DISABLE_IT(hltdc, LTDC_IT_TE); |
mbed_official | 133:d4dda5c437f0 | 314 | |
mbed_official | 133:d4dda5c437f0 | 315 | /* Clear the transfer error flag */ |
mbed_official | 133:d4dda5c437f0 | 316 | __HAL_LTDC_CLEAR_FLAG(hltdc, LTDC_FLAG_TE); |
mbed_official | 133:d4dda5c437f0 | 317 | |
mbed_official | 133:d4dda5c437f0 | 318 | /* Update error code */ |
mbed_official | 133:d4dda5c437f0 | 319 | hltdc->ErrorCode |= HAL_LTDC_ERROR_TE; |
mbed_official | 133:d4dda5c437f0 | 320 | |
mbed_official | 133:d4dda5c437f0 | 321 | /* Change LTDC state */ |
mbed_official | 133:d4dda5c437f0 | 322 | hltdc->State = HAL_LTDC_STATE_ERROR; |
mbed_official | 133:d4dda5c437f0 | 323 | |
mbed_official | 133:d4dda5c437f0 | 324 | /* Process unlocked */ |
mbed_official | 133:d4dda5c437f0 | 325 | __HAL_UNLOCK(hltdc); |
mbed_official | 133:d4dda5c437f0 | 326 | |
mbed_official | 133:d4dda5c437f0 | 327 | /* Transfer error Callback */ |
mbed_official | 133:d4dda5c437f0 | 328 | HAL_LTDC_ErrorCallback(hltdc); |
mbed_official | 133:d4dda5c437f0 | 329 | } |
mbed_official | 133:d4dda5c437f0 | 330 | } |
mbed_official | 133:d4dda5c437f0 | 331 | /* FIFO underrun Interrupt management ***************************************/ |
mbed_official | 133:d4dda5c437f0 | 332 | if(__HAL_LTDC_GET_FLAG(hltdc, LTDC_FLAG_FU) != RESET) |
mbed_official | 133:d4dda5c437f0 | 333 | { |
mbed_official | 133:d4dda5c437f0 | 334 | if(__HAL_LTDC_GET_IT_SOURCE(hltdc, LTDC_IT_FU) != RESET) |
mbed_official | 133:d4dda5c437f0 | 335 | { |
mbed_official | 133:d4dda5c437f0 | 336 | /* Disable the FIFO underrun interrupt */ |
mbed_official | 133:d4dda5c437f0 | 337 | __HAL_LTDC_DISABLE_IT(hltdc, LTDC_IT_FU); |
mbed_official | 133:d4dda5c437f0 | 338 | |
mbed_official | 133:d4dda5c437f0 | 339 | /* Clear the FIFO underrun flag */ |
mbed_official | 133:d4dda5c437f0 | 340 | __HAL_LTDC_CLEAR_FLAG(hltdc, LTDC_FLAG_FU); |
mbed_official | 133:d4dda5c437f0 | 341 | |
mbed_official | 133:d4dda5c437f0 | 342 | /* Update error code */ |
mbed_official | 133:d4dda5c437f0 | 343 | hltdc->ErrorCode |= HAL_LTDC_ERROR_FU; |
mbed_official | 133:d4dda5c437f0 | 344 | |
mbed_official | 133:d4dda5c437f0 | 345 | /* Change LTDC state */ |
mbed_official | 133:d4dda5c437f0 | 346 | hltdc->State = HAL_LTDC_STATE_ERROR; |
mbed_official | 133:d4dda5c437f0 | 347 | |
mbed_official | 133:d4dda5c437f0 | 348 | /* Process unlocked */ |
mbed_official | 133:d4dda5c437f0 | 349 | __HAL_UNLOCK(hltdc); |
mbed_official | 133:d4dda5c437f0 | 350 | |
mbed_official | 133:d4dda5c437f0 | 351 | /* Transfer error Callback */ |
mbed_official | 133:d4dda5c437f0 | 352 | HAL_LTDC_ErrorCallback(hltdc); |
mbed_official | 133:d4dda5c437f0 | 353 | } |
mbed_official | 133:d4dda5c437f0 | 354 | } |
mbed_official | 133:d4dda5c437f0 | 355 | /* Line Interrupt management ************************************************/ |
mbed_official | 133:d4dda5c437f0 | 356 | if(__HAL_LTDC_GET_FLAG(hltdc, LTDC_FLAG_LI) != RESET) |
mbed_official | 133:d4dda5c437f0 | 357 | { |
mbed_official | 133:d4dda5c437f0 | 358 | if(__HAL_LTDC_GET_IT_SOURCE(hltdc, LTDC_IT_LI) != RESET) |
mbed_official | 133:d4dda5c437f0 | 359 | { |
mbed_official | 133:d4dda5c437f0 | 360 | /* Disable the Line interrupt */ |
mbed_official | 133:d4dda5c437f0 | 361 | __HAL_LTDC_DISABLE_IT(hltdc, LTDC_IT_LI); |
mbed_official | 133:d4dda5c437f0 | 362 | |
mbed_official | 133:d4dda5c437f0 | 363 | /* Clear the Line interrupt flag */ |
mbed_official | 133:d4dda5c437f0 | 364 | __HAL_LTDC_CLEAR_FLAG(hltdc, LTDC_FLAG_LI); |
mbed_official | 133:d4dda5c437f0 | 365 | |
mbed_official | 133:d4dda5c437f0 | 366 | /* Change LTDC state */ |
mbed_official | 133:d4dda5c437f0 | 367 | hltdc->State = HAL_LTDC_STATE_READY; |
mbed_official | 133:d4dda5c437f0 | 368 | |
mbed_official | 133:d4dda5c437f0 | 369 | /* Process unlocked */ |
mbed_official | 133:d4dda5c437f0 | 370 | __HAL_UNLOCK(hltdc); |
mbed_official | 133:d4dda5c437f0 | 371 | |
mbed_official | 133:d4dda5c437f0 | 372 | /* Line interrupt Callback */ |
mbed_official | 133:d4dda5c437f0 | 373 | HAL_LTDC_LineEvenCallback(hltdc); |
mbed_official | 133:d4dda5c437f0 | 374 | } |
mbed_official | 133:d4dda5c437f0 | 375 | } |
mbed_official | 133:d4dda5c437f0 | 376 | } |
mbed_official | 133:d4dda5c437f0 | 377 | |
mbed_official | 133:d4dda5c437f0 | 378 | /** |
mbed_official | 133:d4dda5c437f0 | 379 | * @brief Error LTDC callback. |
mbed_official | 133:d4dda5c437f0 | 380 | * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains |
mbed_official | 133:d4dda5c437f0 | 381 | * the configuration information for the LTDC. |
mbed_official | 133:d4dda5c437f0 | 382 | * @retval None |
mbed_official | 133:d4dda5c437f0 | 383 | */ |
mbed_official | 133:d4dda5c437f0 | 384 | __weak void HAL_LTDC_ErrorCallback(LTDC_HandleTypeDef *hltdc) |
mbed_official | 133:d4dda5c437f0 | 385 | { |
mbed_official | 133:d4dda5c437f0 | 386 | /* NOTE : This function Should not be modified, when the callback is needed, |
mbed_official | 133:d4dda5c437f0 | 387 | the HAL_LTDC_ErrorCallback could be implemented in the user file |
mbed_official | 133:d4dda5c437f0 | 388 | */ |
mbed_official | 133:d4dda5c437f0 | 389 | } |
mbed_official | 133:d4dda5c437f0 | 390 | |
mbed_official | 133:d4dda5c437f0 | 391 | /** |
mbed_official | 133:d4dda5c437f0 | 392 | * @brief Line Event callback. |
mbed_official | 133:d4dda5c437f0 | 393 | * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains |
mbed_official | 133:d4dda5c437f0 | 394 | * the configuration information for the LTDC. |
mbed_official | 133:d4dda5c437f0 | 395 | * @retval None |
mbed_official | 133:d4dda5c437f0 | 396 | */ |
mbed_official | 133:d4dda5c437f0 | 397 | __weak void HAL_LTDC_LineEvenCallback(LTDC_HandleTypeDef *hltdc) |
mbed_official | 133:d4dda5c437f0 | 398 | { |
mbed_official | 133:d4dda5c437f0 | 399 | /* NOTE : This function Should not be modified, when the callback is needed, |
mbed_official | 133:d4dda5c437f0 | 400 | the HAL_LTDC_LineEvenCallback could be implemented in the user file |
mbed_official | 133:d4dda5c437f0 | 401 | */ |
mbed_official | 133:d4dda5c437f0 | 402 | } |
mbed_official | 133:d4dda5c437f0 | 403 | |
mbed_official | 133:d4dda5c437f0 | 404 | /** |
mbed_official | 133:d4dda5c437f0 | 405 | * @} |
mbed_official | 133:d4dda5c437f0 | 406 | */ |
mbed_official | 133:d4dda5c437f0 | 407 | |
mbed_official | 133:d4dda5c437f0 | 408 | /** @defgroup LTDC_Group3 Peripheral Control functions |
mbed_official | 133:d4dda5c437f0 | 409 | * @brief Peripheral Control functions |
mbed_official | 133:d4dda5c437f0 | 410 | * |
mbed_official | 133:d4dda5c437f0 | 411 | @verbatim |
mbed_official | 133:d4dda5c437f0 | 412 | =============================================================================== |
mbed_official | 133:d4dda5c437f0 | 413 | ##### Peripheral Control functions ##### |
mbed_official | 133:d4dda5c437f0 | 414 | =============================================================================== |
mbed_official | 133:d4dda5c437f0 | 415 | [..] This section provides functions allowing to: |
mbed_official | 133:d4dda5c437f0 | 416 | (+) Configure the LTDC foreground or/and background parameters. |
mbed_official | 133:d4dda5c437f0 | 417 | (+) Set the active layer. |
mbed_official | 133:d4dda5c437f0 | 418 | (+) Configure the color keying. |
mbed_official | 133:d4dda5c437f0 | 419 | (+) Configure the C-LUT. |
mbed_official | 133:d4dda5c437f0 | 420 | (+) Enable / Disable the color keying. |
mbed_official | 133:d4dda5c437f0 | 421 | (+) Enable / Disable the C-LUT. |
mbed_official | 133:d4dda5c437f0 | 422 | (+) Update the layer position. |
mbed_official | 133:d4dda5c437f0 | 423 | (+) Update the layer size. |
mbed_official | 242:7074e42da0b2 | 424 | (+) Update pixel format on the fly. |
mbed_official | 242:7074e42da0b2 | 425 | (+) Update transparency on the fly. |
mbed_official | 242:7074e42da0b2 | 426 | (+) Update address on the fly. |
mbed_official | 133:d4dda5c437f0 | 427 | |
mbed_official | 133:d4dda5c437f0 | 428 | @endverbatim |
mbed_official | 133:d4dda5c437f0 | 429 | * @{ |
mbed_official | 133:d4dda5c437f0 | 430 | */ |
mbed_official | 133:d4dda5c437f0 | 431 | |
mbed_official | 133:d4dda5c437f0 | 432 | /** |
mbed_official | 133:d4dda5c437f0 | 433 | * @brief Configure the LTDC Layer according to the specified |
mbed_official | 133:d4dda5c437f0 | 434 | * parameters in the LTDC_InitTypeDef and create the associated handle. |
mbed_official | 133:d4dda5c437f0 | 435 | * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains |
mbed_official | 133:d4dda5c437f0 | 436 | * the configuration information for the LTDC. |
mbed_official | 133:d4dda5c437f0 | 437 | * @param pLayerCfg: pointer to a LTDC_LayerCfgTypeDef structure that contains |
mbed_official | 133:d4dda5c437f0 | 438 | * the configuration information for the Layer. |
mbed_official | 242:7074e42da0b2 | 439 | * @param LayerIdx: LTDC Layer index. |
mbed_official | 133:d4dda5c437f0 | 440 | * This parameter can be one of the following values: |
mbed_official | 133:d4dda5c437f0 | 441 | * 0 or 1 |
mbed_official | 133:d4dda5c437f0 | 442 | * @retval HAL status |
mbed_official | 133:d4dda5c437f0 | 443 | */ |
mbed_official | 133:d4dda5c437f0 | 444 | HAL_StatusTypeDef HAL_LTDC_ConfigLayer(LTDC_HandleTypeDef *hltdc, LTDC_LayerCfgTypeDef *pLayerCfg, uint32_t LayerIdx) |
mbed_official | 133:d4dda5c437f0 | 445 | { |
mbed_official | 133:d4dda5c437f0 | 446 | /* Process locked */ |
mbed_official | 133:d4dda5c437f0 | 447 | __HAL_LOCK(hltdc); |
mbed_official | 133:d4dda5c437f0 | 448 | |
mbed_official | 133:d4dda5c437f0 | 449 | /* Change LTDC peripheral state */ |
mbed_official | 133:d4dda5c437f0 | 450 | hltdc->State = HAL_LTDC_STATE_BUSY; |
mbed_official | 133:d4dda5c437f0 | 451 | |
mbed_official | 133:d4dda5c437f0 | 452 | /* Check the parameters */ |
mbed_official | 133:d4dda5c437f0 | 453 | assert_param(IS_LTDC_LAYER(LayerIdx)); |
mbed_official | 133:d4dda5c437f0 | 454 | assert_param(IS_LTDC_PIXEL_FORMAT(pLayerCfg->PixelFormat)); |
mbed_official | 133:d4dda5c437f0 | 455 | assert_param(IS_LTDC_BLENDING_FACTOR1(pLayerCfg->BlendingFactor1)); |
mbed_official | 133:d4dda5c437f0 | 456 | assert_param(IS_LTDC_BLENDING_FACTOR2(pLayerCfg->BlendingFactor2)); |
mbed_official | 133:d4dda5c437f0 | 457 | assert_param(IS_LTDC_HCONFIGST(pLayerCfg->WindowX0)); |
mbed_official | 133:d4dda5c437f0 | 458 | assert_param(IS_LTDC_HCONFIGSP(pLayerCfg->WindowX1)); |
mbed_official | 133:d4dda5c437f0 | 459 | assert_param(IS_LTDC_VCONFIGST(pLayerCfg->WindowY0)); |
mbed_official | 133:d4dda5c437f0 | 460 | assert_param(IS_LTDC_VCONFIGSP(pLayerCfg->WindowY1)); |
mbed_official | 133:d4dda5c437f0 | 461 | assert_param(IS_LTDC_ALPHA(pLayerCfg->Alpha0)); |
mbed_official | 133:d4dda5c437f0 | 462 | assert_param(IS_LTDC_CFBLL(pLayerCfg->ImageWidth)); |
mbed_official | 133:d4dda5c437f0 | 463 | assert_param(IS_LTDC_CFBLNBR(pLayerCfg->ImageHeight)); |
mbed_official | 133:d4dda5c437f0 | 464 | |
mbed_official | 133:d4dda5c437f0 | 465 | /* Copy new layer configuration into handle structure */ |
mbed_official | 133:d4dda5c437f0 | 466 | hltdc->LayerCfg[LayerIdx] = *pLayerCfg; |
mbed_official | 133:d4dda5c437f0 | 467 | |
mbed_official | 133:d4dda5c437f0 | 468 | /* Configure the LTDC Layer */ |
mbed_official | 133:d4dda5c437f0 | 469 | LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx); |
mbed_official | 133:d4dda5c437f0 | 470 | |
mbed_official | 133:d4dda5c437f0 | 471 | /* Sets the Reload type */ |
mbed_official | 133:d4dda5c437f0 | 472 | hltdc->Instance->SRCR = LTDC_SRCR_IMR; |
mbed_official | 133:d4dda5c437f0 | 473 | |
mbed_official | 133:d4dda5c437f0 | 474 | /* Initialize the LTDC state*/ |
mbed_official | 133:d4dda5c437f0 | 475 | hltdc->State = HAL_LTDC_STATE_READY; |
mbed_official | 133:d4dda5c437f0 | 476 | |
mbed_official | 133:d4dda5c437f0 | 477 | /* Process unlocked */ |
mbed_official | 133:d4dda5c437f0 | 478 | __HAL_UNLOCK(hltdc); |
mbed_official | 133:d4dda5c437f0 | 479 | |
mbed_official | 133:d4dda5c437f0 | 480 | return HAL_OK; |
mbed_official | 133:d4dda5c437f0 | 481 | } |
mbed_official | 133:d4dda5c437f0 | 482 | |
mbed_official | 133:d4dda5c437f0 | 483 | /** |
mbed_official | 133:d4dda5c437f0 | 484 | * @brief Configure the color keying. |
mbed_official | 133:d4dda5c437f0 | 485 | * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains |
mbed_official | 133:d4dda5c437f0 | 486 | * the configuration information for the LTDC. |
mbed_official | 133:d4dda5c437f0 | 487 | * @param RGBValue: the color key value |
mbed_official | 242:7074e42da0b2 | 488 | * @param LayerIdx: LTDC Layer index. |
mbed_official | 133:d4dda5c437f0 | 489 | * This parameter can be one of the following values: |
mbed_official | 133:d4dda5c437f0 | 490 | * 0 or 1 |
mbed_official | 242:7074e42da0b2 | 491 | * @retval HAL status |
mbed_official | 133:d4dda5c437f0 | 492 | */ |
mbed_official | 133:d4dda5c437f0 | 493 | HAL_StatusTypeDef HAL_LTDC_ConfigColorKeying(LTDC_HandleTypeDef *hltdc, uint32_t RGBValue, uint32_t LayerIdx) |
mbed_official | 133:d4dda5c437f0 | 494 | { |
mbed_official | 133:d4dda5c437f0 | 495 | /* Process locked */ |
mbed_official | 133:d4dda5c437f0 | 496 | __HAL_LOCK(hltdc); |
mbed_official | 133:d4dda5c437f0 | 497 | |
mbed_official | 133:d4dda5c437f0 | 498 | /* Change LTDC peripheral state */ |
mbed_official | 133:d4dda5c437f0 | 499 | hltdc->State = HAL_LTDC_STATE_BUSY; |
mbed_official | 133:d4dda5c437f0 | 500 | |
mbed_official | 133:d4dda5c437f0 | 501 | /* Check the parameters */ |
mbed_official | 133:d4dda5c437f0 | 502 | assert_param(IS_LTDC_LAYER(LayerIdx)); |
mbed_official | 133:d4dda5c437f0 | 503 | |
mbed_official | 133:d4dda5c437f0 | 504 | /* Configures the default color values */ |
mbed_official | 133:d4dda5c437f0 | 505 | __HAL_LTDC_LAYER(hltdc, LayerIdx)->CKCR &= ~(LTDC_LxCKCR_CKBLUE | LTDC_LxCKCR_CKGREEN | LTDC_LxCKCR_CKRED); |
mbed_official | 133:d4dda5c437f0 | 506 | __HAL_LTDC_LAYER(hltdc, LayerIdx)->CKCR = RGBValue; |
mbed_official | 133:d4dda5c437f0 | 507 | |
mbed_official | 133:d4dda5c437f0 | 508 | /* Sets the Reload type */ |
mbed_official | 133:d4dda5c437f0 | 509 | hltdc->Instance->SRCR = LTDC_SRCR_IMR; |
mbed_official | 133:d4dda5c437f0 | 510 | |
mbed_official | 133:d4dda5c437f0 | 511 | /* Change the LTDC state*/ |
mbed_official | 133:d4dda5c437f0 | 512 | hltdc->State = HAL_LTDC_STATE_READY; |
mbed_official | 133:d4dda5c437f0 | 513 | |
mbed_official | 133:d4dda5c437f0 | 514 | /* Process unlocked */ |
mbed_official | 133:d4dda5c437f0 | 515 | __HAL_UNLOCK(hltdc); |
mbed_official | 133:d4dda5c437f0 | 516 | |
mbed_official | 133:d4dda5c437f0 | 517 | return HAL_OK; |
mbed_official | 133:d4dda5c437f0 | 518 | } |
mbed_official | 133:d4dda5c437f0 | 519 | |
mbed_official | 133:d4dda5c437f0 | 520 | /** |
mbed_official | 133:d4dda5c437f0 | 521 | * @brief Load the color lookup table. |
mbed_official | 133:d4dda5c437f0 | 522 | * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains |
mbed_official | 133:d4dda5c437f0 | 523 | * the configuration information for the LTDC. |
mbed_official | 133:d4dda5c437f0 | 524 | * @param pCLUT: pointer to the color lookup table address. |
mbed_official | 133:d4dda5c437f0 | 525 | * @param CLUTSize: the color lookup table size. |
mbed_official | 242:7074e42da0b2 | 526 | * @param LayerIdx: LTDC Layer index. |
mbed_official | 133:d4dda5c437f0 | 527 | * This parameter can be one of the following values: |
mbed_official | 133:d4dda5c437f0 | 528 | * 0 or 1 |
mbed_official | 242:7074e42da0b2 | 529 | * @retval HAL status |
mbed_official | 133:d4dda5c437f0 | 530 | */ |
mbed_official | 133:d4dda5c437f0 | 531 | HAL_StatusTypeDef HAL_LTDC_ConfigCLUT(LTDC_HandleTypeDef *hltdc, uint32_t *pCLUT, uint32_t CLUTSize, uint32_t LayerIdx) |
mbed_official | 133:d4dda5c437f0 | 532 | { |
mbed_official | 133:d4dda5c437f0 | 533 | uint32_t tmp = 0; |
mbed_official | 133:d4dda5c437f0 | 534 | uint32_t counter = 0; |
mbed_official | 133:d4dda5c437f0 | 535 | uint32_t pcounter = 0; |
mbed_official | 133:d4dda5c437f0 | 536 | |
mbed_official | 133:d4dda5c437f0 | 537 | /* Process locked */ |
mbed_official | 133:d4dda5c437f0 | 538 | __HAL_LOCK(hltdc); |
mbed_official | 133:d4dda5c437f0 | 539 | |
mbed_official | 133:d4dda5c437f0 | 540 | /* Change LTDC peripheral state */ |
mbed_official | 133:d4dda5c437f0 | 541 | hltdc->State = HAL_LTDC_STATE_BUSY; |
mbed_official | 133:d4dda5c437f0 | 542 | |
mbed_official | 133:d4dda5c437f0 | 543 | /* Check the parameters */ |
mbed_official | 133:d4dda5c437f0 | 544 | assert_param(IS_LTDC_LAYER(LayerIdx)); |
mbed_official | 133:d4dda5c437f0 | 545 | |
mbed_official | 133:d4dda5c437f0 | 546 | for(counter = 0; (counter < CLUTSize); counter++) |
mbed_official | 133:d4dda5c437f0 | 547 | { |
mbed_official | 133:d4dda5c437f0 | 548 | tmp = ((counter << 24) | ((uint32_t)(*pCLUT) & 0xFF) | ((uint32_t)(*pCLUT) & 0xFF00) | ((uint32_t)(*pCLUT) & 0xFF0000)); |
mbed_official | 133:d4dda5c437f0 | 549 | pcounter = (uint32_t)pCLUT + sizeof(*pCLUT); |
mbed_official | 133:d4dda5c437f0 | 550 | pCLUT = (uint32_t *)pcounter; |
mbed_official | 133:d4dda5c437f0 | 551 | |
mbed_official | 133:d4dda5c437f0 | 552 | /* Specifies the C-LUT address and RGB value */ |
mbed_official | 133:d4dda5c437f0 | 553 | __HAL_LTDC_LAYER(hltdc, LayerIdx)->CLUTWR = tmp; |
mbed_official | 133:d4dda5c437f0 | 554 | } |
mbed_official | 133:d4dda5c437f0 | 555 | |
mbed_official | 133:d4dda5c437f0 | 556 | /* Change the LTDC state*/ |
mbed_official | 133:d4dda5c437f0 | 557 | hltdc->State = HAL_LTDC_STATE_READY; |
mbed_official | 133:d4dda5c437f0 | 558 | |
mbed_official | 133:d4dda5c437f0 | 559 | /* Process unlocked */ |
mbed_official | 133:d4dda5c437f0 | 560 | __HAL_UNLOCK(hltdc); |
mbed_official | 133:d4dda5c437f0 | 561 | |
mbed_official | 133:d4dda5c437f0 | 562 | return HAL_OK; |
mbed_official | 133:d4dda5c437f0 | 563 | } |
mbed_official | 133:d4dda5c437f0 | 564 | |
mbed_official | 133:d4dda5c437f0 | 565 | /** |
mbed_official | 133:d4dda5c437f0 | 566 | * @brief Enable the color keying. |
mbed_official | 133:d4dda5c437f0 | 567 | * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains |
mbed_official | 133:d4dda5c437f0 | 568 | * the configuration information for the LTDC. |
mbed_official | 242:7074e42da0b2 | 569 | * @param LayerIdx: LTDC Layer index. |
mbed_official | 133:d4dda5c437f0 | 570 | * This parameter can be one of the following values: |
mbed_official | 133:d4dda5c437f0 | 571 | * 0 or 1 |
mbed_official | 242:7074e42da0b2 | 572 | * @retval HAL status |
mbed_official | 133:d4dda5c437f0 | 573 | */ |
mbed_official | 133:d4dda5c437f0 | 574 | HAL_StatusTypeDef HAL_LTDC_EnableColorKeying(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx) |
mbed_official | 133:d4dda5c437f0 | 575 | { |
mbed_official | 133:d4dda5c437f0 | 576 | /* Process locked */ |
mbed_official | 133:d4dda5c437f0 | 577 | __HAL_LOCK(hltdc); |
mbed_official | 133:d4dda5c437f0 | 578 | |
mbed_official | 133:d4dda5c437f0 | 579 | /* Change LTDC peripheral state */ |
mbed_official | 133:d4dda5c437f0 | 580 | hltdc->State = HAL_LTDC_STATE_BUSY; |
mbed_official | 133:d4dda5c437f0 | 581 | |
mbed_official | 133:d4dda5c437f0 | 582 | /* Check the parameters */ |
mbed_official | 133:d4dda5c437f0 | 583 | assert_param(IS_LTDC_LAYER(LayerIdx)); |
mbed_official | 133:d4dda5c437f0 | 584 | |
mbed_official | 133:d4dda5c437f0 | 585 | /* Enable LTDC color keying by setting COLKEN bit */ |
mbed_official | 133:d4dda5c437f0 | 586 | __HAL_LTDC_LAYER(hltdc, LayerIdx)->CR |= (uint32_t)LTDC_LxCR_COLKEN; |
mbed_official | 133:d4dda5c437f0 | 587 | |
mbed_official | 133:d4dda5c437f0 | 588 | /* Sets the Reload type */ |
mbed_official | 133:d4dda5c437f0 | 589 | hltdc->Instance->SRCR = LTDC_SRCR_IMR; |
mbed_official | 133:d4dda5c437f0 | 590 | |
mbed_official | 133:d4dda5c437f0 | 591 | /* Change the LTDC state*/ |
mbed_official | 133:d4dda5c437f0 | 592 | hltdc->State = HAL_LTDC_STATE_READY; |
mbed_official | 133:d4dda5c437f0 | 593 | |
mbed_official | 133:d4dda5c437f0 | 594 | /* Process unlocked */ |
mbed_official | 133:d4dda5c437f0 | 595 | __HAL_UNLOCK(hltdc); |
mbed_official | 133:d4dda5c437f0 | 596 | |
mbed_official | 133:d4dda5c437f0 | 597 | return HAL_OK; |
mbed_official | 133:d4dda5c437f0 | 598 | } |
mbed_official | 133:d4dda5c437f0 | 599 | |
mbed_official | 133:d4dda5c437f0 | 600 | /** |
mbed_official | 133:d4dda5c437f0 | 601 | * @brief Disable the color keying. |
mbed_official | 133:d4dda5c437f0 | 602 | * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains |
mbed_official | 133:d4dda5c437f0 | 603 | * the configuration information for the LTDC. |
mbed_official | 242:7074e42da0b2 | 604 | * @param LayerIdx: LTDC Layer index. |
mbed_official | 133:d4dda5c437f0 | 605 | * This parameter can be one of the following values: |
mbed_official | 133:d4dda5c437f0 | 606 | * 0 or 1 |
mbed_official | 242:7074e42da0b2 | 607 | * @retval HAL status |
mbed_official | 133:d4dda5c437f0 | 608 | */ |
mbed_official | 133:d4dda5c437f0 | 609 | HAL_StatusTypeDef HAL_LTDC_DisableColorKeying(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx) |
mbed_official | 133:d4dda5c437f0 | 610 | { |
mbed_official | 133:d4dda5c437f0 | 611 | /* Process locked */ |
mbed_official | 133:d4dda5c437f0 | 612 | __HAL_LOCK(hltdc); |
mbed_official | 133:d4dda5c437f0 | 613 | |
mbed_official | 133:d4dda5c437f0 | 614 | /* Change LTDC peripheral state */ |
mbed_official | 133:d4dda5c437f0 | 615 | hltdc->State = HAL_LTDC_STATE_BUSY; |
mbed_official | 133:d4dda5c437f0 | 616 | |
mbed_official | 133:d4dda5c437f0 | 617 | /* Check the parameters */ |
mbed_official | 133:d4dda5c437f0 | 618 | assert_param(IS_LTDC_LAYER(LayerIdx)); |
mbed_official | 133:d4dda5c437f0 | 619 | |
mbed_official | 133:d4dda5c437f0 | 620 | /* Disable LTDC color keying by setting COLKEN bit */ |
mbed_official | 133:d4dda5c437f0 | 621 | __HAL_LTDC_LAYER(hltdc, LayerIdx)->CR &= ~(uint32_t)LTDC_LxCR_COLKEN; |
mbed_official | 133:d4dda5c437f0 | 622 | |
mbed_official | 133:d4dda5c437f0 | 623 | /* Sets the Reload type */ |
mbed_official | 133:d4dda5c437f0 | 624 | hltdc->Instance->SRCR = LTDC_SRCR_IMR; |
mbed_official | 133:d4dda5c437f0 | 625 | |
mbed_official | 133:d4dda5c437f0 | 626 | /* Change the LTDC state*/ |
mbed_official | 133:d4dda5c437f0 | 627 | hltdc->State = HAL_LTDC_STATE_READY; |
mbed_official | 133:d4dda5c437f0 | 628 | |
mbed_official | 133:d4dda5c437f0 | 629 | /* Process unlocked */ |
mbed_official | 133:d4dda5c437f0 | 630 | __HAL_UNLOCK(hltdc); |
mbed_official | 133:d4dda5c437f0 | 631 | |
mbed_official | 133:d4dda5c437f0 | 632 | return HAL_OK; |
mbed_official | 133:d4dda5c437f0 | 633 | } |
mbed_official | 133:d4dda5c437f0 | 634 | |
mbed_official | 133:d4dda5c437f0 | 635 | /** |
mbed_official | 133:d4dda5c437f0 | 636 | * @brief Enable the color lookup table. |
mbed_official | 133:d4dda5c437f0 | 637 | * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains |
mbed_official | 133:d4dda5c437f0 | 638 | * the configuration information for the LTDC. |
mbed_official | 242:7074e42da0b2 | 639 | * @param LayerIdx: LTDC Layer index. |
mbed_official | 133:d4dda5c437f0 | 640 | * This parameter can be one of the following values: |
mbed_official | 133:d4dda5c437f0 | 641 | * 0 or 1 |
mbed_official | 242:7074e42da0b2 | 642 | * @retval HAL status |
mbed_official | 133:d4dda5c437f0 | 643 | */ |
mbed_official | 133:d4dda5c437f0 | 644 | HAL_StatusTypeDef HAL_LTDC_EnableCLUT(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx) |
mbed_official | 133:d4dda5c437f0 | 645 | { |
mbed_official | 133:d4dda5c437f0 | 646 | |
mbed_official | 133:d4dda5c437f0 | 647 | /* Process locked */ |
mbed_official | 133:d4dda5c437f0 | 648 | __HAL_LOCK(hltdc); |
mbed_official | 133:d4dda5c437f0 | 649 | |
mbed_official | 133:d4dda5c437f0 | 650 | /* Change LTDC peripheral state */ |
mbed_official | 133:d4dda5c437f0 | 651 | hltdc->State = HAL_LTDC_STATE_BUSY; |
mbed_official | 133:d4dda5c437f0 | 652 | |
mbed_official | 133:d4dda5c437f0 | 653 | /* Check the parameters */ |
mbed_official | 133:d4dda5c437f0 | 654 | assert_param(IS_LTDC_LAYER(LayerIdx)); |
mbed_official | 133:d4dda5c437f0 | 655 | |
mbed_official | 133:d4dda5c437f0 | 656 | /* Disable LTDC color lookup table by setting CLUTEN bit */ |
mbed_official | 133:d4dda5c437f0 | 657 | __HAL_LTDC_LAYER(hltdc, LayerIdx)->CR |= (uint32_t)LTDC_LxCR_CLUTEN; |
mbed_official | 133:d4dda5c437f0 | 658 | |
mbed_official | 133:d4dda5c437f0 | 659 | /* Sets the Reload type */ |
mbed_official | 133:d4dda5c437f0 | 660 | hltdc->Instance->SRCR = LTDC_SRCR_IMR; |
mbed_official | 133:d4dda5c437f0 | 661 | |
mbed_official | 133:d4dda5c437f0 | 662 | /* Change the LTDC state*/ |
mbed_official | 133:d4dda5c437f0 | 663 | hltdc->State = HAL_LTDC_STATE_READY; |
mbed_official | 133:d4dda5c437f0 | 664 | |
mbed_official | 133:d4dda5c437f0 | 665 | /* Process unlocked */ |
mbed_official | 133:d4dda5c437f0 | 666 | __HAL_UNLOCK(hltdc); |
mbed_official | 133:d4dda5c437f0 | 667 | |
mbed_official | 133:d4dda5c437f0 | 668 | return HAL_OK; |
mbed_official | 133:d4dda5c437f0 | 669 | } |
mbed_official | 133:d4dda5c437f0 | 670 | |
mbed_official | 133:d4dda5c437f0 | 671 | /** |
mbed_official | 133:d4dda5c437f0 | 672 | * @brief Disable the color lookup table. |
mbed_official | 133:d4dda5c437f0 | 673 | * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains |
mbed_official | 133:d4dda5c437f0 | 674 | * the configuration information for the LTDC. |
mbed_official | 242:7074e42da0b2 | 675 | * @param LayerIdx: LTDC Layer index. |
mbed_official | 133:d4dda5c437f0 | 676 | * This parameter can be one of the following values: |
mbed_official | 133:d4dda5c437f0 | 677 | * 0 or 1 |
mbed_official | 242:7074e42da0b2 | 678 | * @retval HAL status |
mbed_official | 133:d4dda5c437f0 | 679 | */ |
mbed_official | 133:d4dda5c437f0 | 680 | HAL_StatusTypeDef HAL_LTDC_DisableCLUT(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx) |
mbed_official | 133:d4dda5c437f0 | 681 | { |
mbed_official | 133:d4dda5c437f0 | 682 | |
mbed_official | 133:d4dda5c437f0 | 683 | /* Process locked */ |
mbed_official | 133:d4dda5c437f0 | 684 | __HAL_LOCK(hltdc); |
mbed_official | 133:d4dda5c437f0 | 685 | |
mbed_official | 133:d4dda5c437f0 | 686 | /* Change LTDC peripheral state */ |
mbed_official | 133:d4dda5c437f0 | 687 | hltdc->State = HAL_LTDC_STATE_BUSY; |
mbed_official | 133:d4dda5c437f0 | 688 | |
mbed_official | 133:d4dda5c437f0 | 689 | /* Check the parameters */ |
mbed_official | 133:d4dda5c437f0 | 690 | assert_param(IS_LTDC_LAYER(LayerIdx)); |
mbed_official | 133:d4dda5c437f0 | 691 | |
mbed_official | 133:d4dda5c437f0 | 692 | /* Disable LTDC color lookup table by setting CLUTEN bit */ |
mbed_official | 133:d4dda5c437f0 | 693 | __HAL_LTDC_LAYER(hltdc, LayerIdx)->CR &= ~(uint32_t)LTDC_LxCR_CLUTEN; |
mbed_official | 133:d4dda5c437f0 | 694 | |
mbed_official | 133:d4dda5c437f0 | 695 | /* Sets the Reload type */ |
mbed_official | 133:d4dda5c437f0 | 696 | hltdc->Instance->SRCR = LTDC_SRCR_IMR; |
mbed_official | 133:d4dda5c437f0 | 697 | |
mbed_official | 133:d4dda5c437f0 | 698 | /* Change the LTDC state*/ |
mbed_official | 133:d4dda5c437f0 | 699 | hltdc->State = HAL_LTDC_STATE_READY; |
mbed_official | 133:d4dda5c437f0 | 700 | |
mbed_official | 133:d4dda5c437f0 | 701 | /* Process unlocked */ |
mbed_official | 133:d4dda5c437f0 | 702 | __HAL_UNLOCK(hltdc); |
mbed_official | 133:d4dda5c437f0 | 703 | |
mbed_official | 133:d4dda5c437f0 | 704 | return HAL_OK; |
mbed_official | 133:d4dda5c437f0 | 705 | } |
mbed_official | 133:d4dda5c437f0 | 706 | |
mbed_official | 133:d4dda5c437f0 | 707 | /** |
mbed_official | 133:d4dda5c437f0 | 708 | * @brief Enables Dither. |
mbed_official | 133:d4dda5c437f0 | 709 | * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains |
mbed_official | 133:d4dda5c437f0 | 710 | * the configuration information for the LTDC. |
mbed_official | 242:7074e42da0b2 | 711 | * @retval HAL status |
mbed_official | 133:d4dda5c437f0 | 712 | */ |
mbed_official | 133:d4dda5c437f0 | 713 | |
mbed_official | 133:d4dda5c437f0 | 714 | HAL_StatusTypeDef HAL_LTDC_EnableDither(LTDC_HandleTypeDef *hltdc) |
mbed_official | 133:d4dda5c437f0 | 715 | { |
mbed_official | 133:d4dda5c437f0 | 716 | /* Process locked */ |
mbed_official | 133:d4dda5c437f0 | 717 | __HAL_LOCK(hltdc); |
mbed_official | 133:d4dda5c437f0 | 718 | |
mbed_official | 133:d4dda5c437f0 | 719 | /* Change LTDC peripheral state */ |
mbed_official | 133:d4dda5c437f0 | 720 | hltdc->State = HAL_LTDC_STATE_BUSY; |
mbed_official | 133:d4dda5c437f0 | 721 | |
mbed_official | 133:d4dda5c437f0 | 722 | /* Enable Dither by setting DTEN bit */ |
mbed_official | 133:d4dda5c437f0 | 723 | LTDC->GCR |= (uint32_t)LTDC_GCR_DTEN; |
mbed_official | 133:d4dda5c437f0 | 724 | |
mbed_official | 133:d4dda5c437f0 | 725 | /* Change the LTDC state*/ |
mbed_official | 133:d4dda5c437f0 | 726 | hltdc->State = HAL_LTDC_STATE_READY; |
mbed_official | 133:d4dda5c437f0 | 727 | |
mbed_official | 133:d4dda5c437f0 | 728 | /* Process unlocked */ |
mbed_official | 133:d4dda5c437f0 | 729 | __HAL_UNLOCK(hltdc); |
mbed_official | 133:d4dda5c437f0 | 730 | |
mbed_official | 133:d4dda5c437f0 | 731 | return HAL_OK; |
mbed_official | 133:d4dda5c437f0 | 732 | } |
mbed_official | 133:d4dda5c437f0 | 733 | |
mbed_official | 133:d4dda5c437f0 | 734 | /** |
mbed_official | 133:d4dda5c437f0 | 735 | * @brief Disables Dither. |
mbed_official | 133:d4dda5c437f0 | 736 | * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains |
mbed_official | 133:d4dda5c437f0 | 737 | * the configuration information for the LTDC. |
mbed_official | 242:7074e42da0b2 | 738 | * @retval HAL status |
mbed_official | 133:d4dda5c437f0 | 739 | */ |
mbed_official | 133:d4dda5c437f0 | 740 | |
mbed_official | 133:d4dda5c437f0 | 741 | HAL_StatusTypeDef HAL_LTDC_DisableDither(LTDC_HandleTypeDef *hltdc) |
mbed_official | 133:d4dda5c437f0 | 742 | { |
mbed_official | 133:d4dda5c437f0 | 743 | /* Process locked */ |
mbed_official | 133:d4dda5c437f0 | 744 | __HAL_LOCK(hltdc); |
mbed_official | 133:d4dda5c437f0 | 745 | |
mbed_official | 133:d4dda5c437f0 | 746 | /* Change LTDC peripheral state */ |
mbed_official | 133:d4dda5c437f0 | 747 | hltdc->State = HAL_LTDC_STATE_BUSY; |
mbed_official | 133:d4dda5c437f0 | 748 | |
mbed_official | 133:d4dda5c437f0 | 749 | /* Disable Dither by setting DTEN bit */ |
mbed_official | 133:d4dda5c437f0 | 750 | LTDC->GCR &= ~(uint32_t)LTDC_GCR_DTEN; |
mbed_official | 133:d4dda5c437f0 | 751 | |
mbed_official | 133:d4dda5c437f0 | 752 | /* Change the LTDC state*/ |
mbed_official | 133:d4dda5c437f0 | 753 | hltdc->State = HAL_LTDC_STATE_READY; |
mbed_official | 133:d4dda5c437f0 | 754 | |
mbed_official | 133:d4dda5c437f0 | 755 | /* Process unlocked */ |
mbed_official | 133:d4dda5c437f0 | 756 | __HAL_UNLOCK(hltdc); |
mbed_official | 133:d4dda5c437f0 | 757 | |
mbed_official | 133:d4dda5c437f0 | 758 | return HAL_OK; |
mbed_official | 133:d4dda5c437f0 | 759 | } |
mbed_official | 133:d4dda5c437f0 | 760 | |
mbed_official | 133:d4dda5c437f0 | 761 | /** |
mbed_official | 133:d4dda5c437f0 | 762 | * @brief Set the LTDC window size. |
mbed_official | 133:d4dda5c437f0 | 763 | * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains |
mbed_official | 133:d4dda5c437f0 | 764 | * the configuration information for the LTDC. |
mbed_official | 133:d4dda5c437f0 | 765 | * @param XSize: LTDC Pixel per line |
mbed_official | 133:d4dda5c437f0 | 766 | * @param YSize: LTDC Line number |
mbed_official | 242:7074e42da0b2 | 767 | * @param LayerIdx: LTDC Layer index. |
mbed_official | 133:d4dda5c437f0 | 768 | * This parameter can be one of the following values: |
mbed_official | 133:d4dda5c437f0 | 769 | * 0 or 1 |
mbed_official | 242:7074e42da0b2 | 770 | * @retval HAL status |
mbed_official | 133:d4dda5c437f0 | 771 | */ |
mbed_official | 133:d4dda5c437f0 | 772 | HAL_StatusTypeDef HAL_LTDC_SetWindowSize(LTDC_HandleTypeDef *hltdc, uint32_t XSize, uint32_t YSize, uint32_t LayerIdx) |
mbed_official | 133:d4dda5c437f0 | 773 | { |
mbed_official | 133:d4dda5c437f0 | 774 | LTDC_LayerCfgTypeDef *pLayerCfg; |
mbed_official | 133:d4dda5c437f0 | 775 | |
mbed_official | 133:d4dda5c437f0 | 776 | /* Process locked */ |
mbed_official | 133:d4dda5c437f0 | 777 | __HAL_LOCK(hltdc); |
mbed_official | 133:d4dda5c437f0 | 778 | |
mbed_official | 133:d4dda5c437f0 | 779 | /* Change LTDC peripheral state */ |
mbed_official | 133:d4dda5c437f0 | 780 | hltdc->State = HAL_LTDC_STATE_BUSY; |
mbed_official | 133:d4dda5c437f0 | 781 | |
mbed_official | 133:d4dda5c437f0 | 782 | /* Get layer configuration from handle structure */ |
mbed_official | 133:d4dda5c437f0 | 783 | pLayerCfg = &hltdc->LayerCfg[LayerIdx]; |
mbed_official | 133:d4dda5c437f0 | 784 | |
mbed_official | 133:d4dda5c437f0 | 785 | /* Check the parameters (Layers parameters)*/ |
mbed_official | 133:d4dda5c437f0 | 786 | assert_param(IS_LTDC_LAYER(LayerIdx)); |
mbed_official | 133:d4dda5c437f0 | 787 | assert_param(IS_LTDC_HCONFIGST(pLayerCfg->WindowX0)); |
mbed_official | 133:d4dda5c437f0 | 788 | assert_param(IS_LTDC_HCONFIGSP(pLayerCfg->WindowX1)); |
mbed_official | 133:d4dda5c437f0 | 789 | assert_param(IS_LTDC_VCONFIGST(pLayerCfg->WindowY0)); |
mbed_official | 133:d4dda5c437f0 | 790 | assert_param(IS_LTDC_VCONFIGSP(pLayerCfg->WindowY1)); |
mbed_official | 133:d4dda5c437f0 | 791 | assert_param(IS_LTDC_CFBLL(XSize)); |
mbed_official | 133:d4dda5c437f0 | 792 | assert_param(IS_LTDC_CFBLNBR(YSize)); |
mbed_official | 133:d4dda5c437f0 | 793 | |
mbed_official | 133:d4dda5c437f0 | 794 | /* update horizontal start/stop */ |
mbed_official | 133:d4dda5c437f0 | 795 | pLayerCfg->WindowX0 = 0; |
mbed_official | 133:d4dda5c437f0 | 796 | pLayerCfg->WindowX1 = XSize + pLayerCfg->WindowX0; |
mbed_official | 133:d4dda5c437f0 | 797 | |
mbed_official | 133:d4dda5c437f0 | 798 | /* update vertical start/stop */ |
mbed_official | 133:d4dda5c437f0 | 799 | pLayerCfg->WindowY0 = 0; |
mbed_official | 133:d4dda5c437f0 | 800 | pLayerCfg->WindowY1 = YSize + pLayerCfg->WindowY0; |
mbed_official | 133:d4dda5c437f0 | 801 | |
mbed_official | 133:d4dda5c437f0 | 802 | /* Reconfigures the color frame buffer pitch in byte */ |
mbed_official | 133:d4dda5c437f0 | 803 | pLayerCfg->ImageWidth = XSize; |
mbed_official | 133:d4dda5c437f0 | 804 | |
mbed_official | 133:d4dda5c437f0 | 805 | /* Reconfigures the frame buffer line number */ |
mbed_official | 133:d4dda5c437f0 | 806 | pLayerCfg->ImageHeight = YSize; |
mbed_official | 133:d4dda5c437f0 | 807 | |
mbed_official | 133:d4dda5c437f0 | 808 | /* Set LTDC parameters */ |
mbed_official | 133:d4dda5c437f0 | 809 | LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx); |
mbed_official | 133:d4dda5c437f0 | 810 | |
mbed_official | 133:d4dda5c437f0 | 811 | /* Sets the Reload type */ |
mbed_official | 133:d4dda5c437f0 | 812 | hltdc->Instance->SRCR = LTDC_SRCR_IMR; |
mbed_official | 133:d4dda5c437f0 | 813 | |
mbed_official | 133:d4dda5c437f0 | 814 | /* Change the LTDC state*/ |
mbed_official | 133:d4dda5c437f0 | 815 | hltdc->State = HAL_LTDC_STATE_READY; |
mbed_official | 133:d4dda5c437f0 | 816 | |
mbed_official | 133:d4dda5c437f0 | 817 | /* Process unlocked */ |
mbed_official | 133:d4dda5c437f0 | 818 | __HAL_UNLOCK(hltdc); |
mbed_official | 133:d4dda5c437f0 | 819 | |
mbed_official | 133:d4dda5c437f0 | 820 | return HAL_OK; |
mbed_official | 133:d4dda5c437f0 | 821 | } |
mbed_official | 133:d4dda5c437f0 | 822 | |
mbed_official | 133:d4dda5c437f0 | 823 | /** |
mbed_official | 133:d4dda5c437f0 | 824 | * @brief Set the LTDC window position. |
mbed_official | 133:d4dda5c437f0 | 825 | * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains |
mbed_official | 133:d4dda5c437f0 | 826 | * the configuration information for the LTDC. |
mbed_official | 133:d4dda5c437f0 | 827 | * @param X0: LTDC window X offset |
mbed_official | 133:d4dda5c437f0 | 828 | * @param Y0: LTDC window Y offset |
mbed_official | 242:7074e42da0b2 | 829 | * @param LayerIdx: LTDC Layer index. |
mbed_official | 133:d4dda5c437f0 | 830 | * This parameter can be one of the following values: |
mbed_official | 133:d4dda5c437f0 | 831 | * 0 or 1 |
mbed_official | 242:7074e42da0b2 | 832 | * @retval HAL status |
mbed_official | 133:d4dda5c437f0 | 833 | */ |
mbed_official | 133:d4dda5c437f0 | 834 | HAL_StatusTypeDef HAL_LTDC_SetWindowPosition(LTDC_HandleTypeDef *hltdc, uint32_t X0, uint32_t Y0, uint32_t LayerIdx) |
mbed_official | 133:d4dda5c437f0 | 835 | { |
mbed_official | 133:d4dda5c437f0 | 836 | LTDC_LayerCfgTypeDef *pLayerCfg; |
mbed_official | 133:d4dda5c437f0 | 837 | |
mbed_official | 133:d4dda5c437f0 | 838 | /* Process locked */ |
mbed_official | 133:d4dda5c437f0 | 839 | __HAL_LOCK(hltdc); |
mbed_official | 133:d4dda5c437f0 | 840 | |
mbed_official | 133:d4dda5c437f0 | 841 | /* Change LTDC peripheral state */ |
mbed_official | 133:d4dda5c437f0 | 842 | hltdc->State = HAL_LTDC_STATE_BUSY; |
mbed_official | 133:d4dda5c437f0 | 843 | |
mbed_official | 133:d4dda5c437f0 | 844 | /* Get layer configuration from handle structure */ |
mbed_official | 133:d4dda5c437f0 | 845 | pLayerCfg = &hltdc->LayerCfg[LayerIdx]; |
mbed_official | 133:d4dda5c437f0 | 846 | |
mbed_official | 133:d4dda5c437f0 | 847 | /* Check the parameters */ |
mbed_official | 133:d4dda5c437f0 | 848 | assert_param(IS_LTDC_LAYER(LayerIdx)); |
mbed_official | 133:d4dda5c437f0 | 849 | assert_param(IS_LTDC_HCONFIGST(pLayerCfg->WindowX0)); |
mbed_official | 133:d4dda5c437f0 | 850 | assert_param(IS_LTDC_HCONFIGSP(pLayerCfg->WindowX1)); |
mbed_official | 133:d4dda5c437f0 | 851 | assert_param(IS_LTDC_VCONFIGST(pLayerCfg->WindowY0)); |
mbed_official | 133:d4dda5c437f0 | 852 | assert_param(IS_LTDC_VCONFIGSP(pLayerCfg->WindowY1)); |
mbed_official | 133:d4dda5c437f0 | 853 | |
mbed_official | 133:d4dda5c437f0 | 854 | /* update horizontal start/stop */ |
mbed_official | 133:d4dda5c437f0 | 855 | pLayerCfg->WindowX0 = X0; |
mbed_official | 133:d4dda5c437f0 | 856 | pLayerCfg->WindowX1 = X0 + pLayerCfg->ImageWidth; |
mbed_official | 133:d4dda5c437f0 | 857 | |
mbed_official | 133:d4dda5c437f0 | 858 | /* update vertical start/stop */ |
mbed_official | 133:d4dda5c437f0 | 859 | pLayerCfg->WindowY0 = Y0; |
mbed_official | 133:d4dda5c437f0 | 860 | pLayerCfg->WindowY1 = Y0 + pLayerCfg->ImageHeight; |
mbed_official | 133:d4dda5c437f0 | 861 | |
mbed_official | 133:d4dda5c437f0 | 862 | /* Set LTDC parameters */ |
mbed_official | 133:d4dda5c437f0 | 863 | LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx); |
mbed_official | 133:d4dda5c437f0 | 864 | |
mbed_official | 133:d4dda5c437f0 | 865 | /* Sets the Reload type */ |
mbed_official | 133:d4dda5c437f0 | 866 | hltdc->Instance->SRCR = LTDC_SRCR_IMR; |
mbed_official | 133:d4dda5c437f0 | 867 | |
mbed_official | 133:d4dda5c437f0 | 868 | /* Change the LTDC state*/ |
mbed_official | 133:d4dda5c437f0 | 869 | hltdc->State = HAL_LTDC_STATE_READY; |
mbed_official | 133:d4dda5c437f0 | 870 | |
mbed_official | 133:d4dda5c437f0 | 871 | /* Process unlocked */ |
mbed_official | 133:d4dda5c437f0 | 872 | __HAL_UNLOCK(hltdc); |
mbed_official | 133:d4dda5c437f0 | 873 | |
mbed_official | 133:d4dda5c437f0 | 874 | return HAL_OK; |
mbed_official | 133:d4dda5c437f0 | 875 | } |
mbed_official | 133:d4dda5c437f0 | 876 | |
mbed_official | 133:d4dda5c437f0 | 877 | /** |
mbed_official | 133:d4dda5c437f0 | 878 | * @brief Reconfigure the pixel format. |
mbed_official | 133:d4dda5c437f0 | 879 | * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains |
mbed_official | 133:d4dda5c437f0 | 880 | * the configuration information for the LTDC. |
mbed_official | 133:d4dda5c437f0 | 881 | * @param Pixelformat: new pixel format value. |
mbed_official | 133:d4dda5c437f0 | 882 | * @param LayerIdx: LTDC Layer index. |
mbed_official | 133:d4dda5c437f0 | 883 | * This parameter can be one of the following values: |
mbed_official | 133:d4dda5c437f0 | 884 | * 0 or 1. |
mbed_official | 242:7074e42da0b2 | 885 | * @retval HAL status |
mbed_official | 133:d4dda5c437f0 | 886 | */ |
mbed_official | 133:d4dda5c437f0 | 887 | HAL_StatusTypeDef HAL_LTDC_SetPixelFormat(LTDC_HandleTypeDef *hltdc, uint32_t Pixelformat, uint32_t LayerIdx) |
mbed_official | 133:d4dda5c437f0 | 888 | { |
mbed_official | 133:d4dda5c437f0 | 889 | LTDC_LayerCfgTypeDef *pLayerCfg; |
mbed_official | 133:d4dda5c437f0 | 890 | |
mbed_official | 133:d4dda5c437f0 | 891 | /* Process locked */ |
mbed_official | 133:d4dda5c437f0 | 892 | __HAL_LOCK(hltdc); |
mbed_official | 133:d4dda5c437f0 | 893 | |
mbed_official | 133:d4dda5c437f0 | 894 | /* Change LTDC peripheral state */ |
mbed_official | 133:d4dda5c437f0 | 895 | hltdc->State = HAL_LTDC_STATE_BUSY; |
mbed_official | 133:d4dda5c437f0 | 896 | |
mbed_official | 133:d4dda5c437f0 | 897 | /* Check the parameters */ |
mbed_official | 133:d4dda5c437f0 | 898 | assert_param(IS_LTDC_LAYER(LayerIdx)); |
mbed_official | 133:d4dda5c437f0 | 899 | assert_param(IS_LTDC_PIXEL_FORMAT(Pixelformat)); |
mbed_official | 133:d4dda5c437f0 | 900 | |
mbed_official | 133:d4dda5c437f0 | 901 | /* Get layer configuration from handle structure */ |
mbed_official | 133:d4dda5c437f0 | 902 | pLayerCfg = &hltdc->LayerCfg[LayerIdx]; |
mbed_official | 133:d4dda5c437f0 | 903 | |
mbed_official | 133:d4dda5c437f0 | 904 | /* Reconfigure the pixel format */ |
mbed_official | 133:d4dda5c437f0 | 905 | pLayerCfg->PixelFormat = Pixelformat; |
mbed_official | 133:d4dda5c437f0 | 906 | |
mbed_official | 133:d4dda5c437f0 | 907 | /* Set LTDC parameters */ |
mbed_official | 133:d4dda5c437f0 | 908 | LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx); |
mbed_official | 133:d4dda5c437f0 | 909 | |
mbed_official | 133:d4dda5c437f0 | 910 | /* Sets the Reload type */ |
mbed_official | 133:d4dda5c437f0 | 911 | hltdc->Instance->SRCR = LTDC_SRCR_IMR; |
mbed_official | 133:d4dda5c437f0 | 912 | |
mbed_official | 133:d4dda5c437f0 | 913 | /* Change the LTDC state*/ |
mbed_official | 133:d4dda5c437f0 | 914 | hltdc->State = HAL_LTDC_STATE_READY; |
mbed_official | 133:d4dda5c437f0 | 915 | |
mbed_official | 133:d4dda5c437f0 | 916 | /* Process unlocked */ |
mbed_official | 133:d4dda5c437f0 | 917 | __HAL_UNLOCK(hltdc); |
mbed_official | 133:d4dda5c437f0 | 918 | |
mbed_official | 133:d4dda5c437f0 | 919 | return HAL_OK; |
mbed_official | 133:d4dda5c437f0 | 920 | } |
mbed_official | 133:d4dda5c437f0 | 921 | |
mbed_official | 133:d4dda5c437f0 | 922 | /** |
mbed_official | 133:d4dda5c437f0 | 923 | * @brief Reconfigure the layer alpha value. |
mbed_official | 133:d4dda5c437f0 | 924 | * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains |
mbed_official | 133:d4dda5c437f0 | 925 | * the configuration information for the LTDC. |
mbed_official | 133:d4dda5c437f0 | 926 | * @param Alpha: new alpha value. |
mbed_official | 242:7074e42da0b2 | 927 | * @param LayerIdx: LTDC Layer index. |
mbed_official | 133:d4dda5c437f0 | 928 | * This parameter can be one of the following values: |
mbed_official | 133:d4dda5c437f0 | 929 | * 0 or 1 |
mbed_official | 242:7074e42da0b2 | 930 | * @retval HAL status |
mbed_official | 133:d4dda5c437f0 | 931 | */ |
mbed_official | 133:d4dda5c437f0 | 932 | HAL_StatusTypeDef HAL_LTDC_SetAlpha(LTDC_HandleTypeDef *hltdc, uint32_t Alpha, uint32_t LayerIdx) |
mbed_official | 133:d4dda5c437f0 | 933 | { |
mbed_official | 133:d4dda5c437f0 | 934 | LTDC_LayerCfgTypeDef *pLayerCfg; |
mbed_official | 133:d4dda5c437f0 | 935 | |
mbed_official | 133:d4dda5c437f0 | 936 | /* Process locked */ |
mbed_official | 133:d4dda5c437f0 | 937 | __HAL_LOCK(hltdc); |
mbed_official | 133:d4dda5c437f0 | 938 | |
mbed_official | 133:d4dda5c437f0 | 939 | /* Change LTDC peripheral state */ |
mbed_official | 133:d4dda5c437f0 | 940 | hltdc->State = HAL_LTDC_STATE_BUSY; |
mbed_official | 133:d4dda5c437f0 | 941 | |
mbed_official | 133:d4dda5c437f0 | 942 | /* Check the parameters */ |
mbed_official | 133:d4dda5c437f0 | 943 | assert_param(IS_LTDC_ALPHA(Alpha)); |
mbed_official | 133:d4dda5c437f0 | 944 | assert_param(IS_LTDC_LAYER(LayerIdx)); |
mbed_official | 133:d4dda5c437f0 | 945 | |
mbed_official | 133:d4dda5c437f0 | 946 | /* Get layer configuration from handle structure */ |
mbed_official | 133:d4dda5c437f0 | 947 | pLayerCfg = &hltdc->LayerCfg[LayerIdx]; |
mbed_official | 133:d4dda5c437f0 | 948 | |
mbed_official | 133:d4dda5c437f0 | 949 | /* Reconfigure the Alpha value */ |
mbed_official | 133:d4dda5c437f0 | 950 | pLayerCfg->Alpha = Alpha; |
mbed_official | 133:d4dda5c437f0 | 951 | |
mbed_official | 133:d4dda5c437f0 | 952 | /* Set LTDC parameters */ |
mbed_official | 133:d4dda5c437f0 | 953 | LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx); |
mbed_official | 133:d4dda5c437f0 | 954 | |
mbed_official | 133:d4dda5c437f0 | 955 | /* Sets the Reload type */ |
mbed_official | 133:d4dda5c437f0 | 956 | hltdc->Instance->SRCR = LTDC_SRCR_IMR; |
mbed_official | 133:d4dda5c437f0 | 957 | |
mbed_official | 133:d4dda5c437f0 | 958 | /* Change the LTDC state*/ |
mbed_official | 133:d4dda5c437f0 | 959 | hltdc->State = HAL_LTDC_STATE_READY; |
mbed_official | 133:d4dda5c437f0 | 960 | |
mbed_official | 133:d4dda5c437f0 | 961 | /* Process unlocked */ |
mbed_official | 133:d4dda5c437f0 | 962 | __HAL_UNLOCK(hltdc); |
mbed_official | 133:d4dda5c437f0 | 963 | |
mbed_official | 133:d4dda5c437f0 | 964 | return HAL_OK; |
mbed_official | 133:d4dda5c437f0 | 965 | } |
mbed_official | 133:d4dda5c437f0 | 966 | /** |
mbed_official | 133:d4dda5c437f0 | 967 | * @brief Reconfigure the frame buffer Address. |
mbed_official | 133:d4dda5c437f0 | 968 | * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains |
mbed_official | 133:d4dda5c437f0 | 969 | * the configuration information for the LTDC. |
mbed_official | 133:d4dda5c437f0 | 970 | * @param Address: new address value. |
mbed_official | 133:d4dda5c437f0 | 971 | * @param LayerIdx: LTDC Layer index. |
mbed_official | 133:d4dda5c437f0 | 972 | * This parameter can be one of the following values: |
mbed_official | 133:d4dda5c437f0 | 973 | * 0 or 1. |
mbed_official | 242:7074e42da0b2 | 974 | * @retval HAL status |
mbed_official | 133:d4dda5c437f0 | 975 | */ |
mbed_official | 133:d4dda5c437f0 | 976 | HAL_StatusTypeDef HAL_LTDC_SetAddress(LTDC_HandleTypeDef *hltdc, uint32_t Address, uint32_t LayerIdx) |
mbed_official | 133:d4dda5c437f0 | 977 | { |
mbed_official | 133:d4dda5c437f0 | 978 | LTDC_LayerCfgTypeDef *pLayerCfg; |
mbed_official | 133:d4dda5c437f0 | 979 | |
mbed_official | 133:d4dda5c437f0 | 980 | /* Process locked */ |
mbed_official | 133:d4dda5c437f0 | 981 | __HAL_LOCK(hltdc); |
mbed_official | 133:d4dda5c437f0 | 982 | |
mbed_official | 133:d4dda5c437f0 | 983 | /* Change LTDC peripheral state */ |
mbed_official | 133:d4dda5c437f0 | 984 | hltdc->State = HAL_LTDC_STATE_BUSY; |
mbed_official | 133:d4dda5c437f0 | 985 | |
mbed_official | 133:d4dda5c437f0 | 986 | /* Check the parameters */ |
mbed_official | 133:d4dda5c437f0 | 987 | assert_param(IS_LTDC_LAYER(LayerIdx)); |
mbed_official | 133:d4dda5c437f0 | 988 | |
mbed_official | 133:d4dda5c437f0 | 989 | /* Get layer configuration from handle structure */ |
mbed_official | 133:d4dda5c437f0 | 990 | pLayerCfg = &hltdc->LayerCfg[LayerIdx]; |
mbed_official | 133:d4dda5c437f0 | 991 | |
mbed_official | 133:d4dda5c437f0 | 992 | /* Reconfigure the Address */ |
mbed_official | 133:d4dda5c437f0 | 993 | pLayerCfg->FBStartAdress = Address; |
mbed_official | 133:d4dda5c437f0 | 994 | |
mbed_official | 133:d4dda5c437f0 | 995 | /* Set LTDC parameters */ |
mbed_official | 133:d4dda5c437f0 | 996 | LTDC_SetConfig(hltdc, pLayerCfg, LayerIdx); |
mbed_official | 133:d4dda5c437f0 | 997 | |
mbed_official | 133:d4dda5c437f0 | 998 | /* Sets the Reload type */ |
mbed_official | 133:d4dda5c437f0 | 999 | hltdc->Instance->SRCR = LTDC_SRCR_IMR; |
mbed_official | 133:d4dda5c437f0 | 1000 | |
mbed_official | 133:d4dda5c437f0 | 1001 | /* Change the LTDC state*/ |
mbed_official | 133:d4dda5c437f0 | 1002 | hltdc->State = HAL_LTDC_STATE_READY; |
mbed_official | 133:d4dda5c437f0 | 1003 | |
mbed_official | 133:d4dda5c437f0 | 1004 | /* Process unlocked */ |
mbed_official | 133:d4dda5c437f0 | 1005 | __HAL_UNLOCK(hltdc); |
mbed_official | 133:d4dda5c437f0 | 1006 | |
mbed_official | 133:d4dda5c437f0 | 1007 | return HAL_OK; |
mbed_official | 133:d4dda5c437f0 | 1008 | } |
mbed_official | 133:d4dda5c437f0 | 1009 | |
mbed_official | 133:d4dda5c437f0 | 1010 | /** |
mbed_official | 133:d4dda5c437f0 | 1011 | * @brief Define the position of the line interrupt . |
mbed_official | 133:d4dda5c437f0 | 1012 | * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains |
mbed_official | 133:d4dda5c437f0 | 1013 | * the configuration information for the LTDC. |
mbed_official | 133:d4dda5c437f0 | 1014 | * @param Line: Line Interrupt Position. |
mbed_official | 242:7074e42da0b2 | 1015 | * @retval HAL status |
mbed_official | 133:d4dda5c437f0 | 1016 | */ |
mbed_official | 133:d4dda5c437f0 | 1017 | HAL_StatusTypeDef HAL_LTDC_ProgramLineEvent(LTDC_HandleTypeDef *hltdc, uint32_t Line) |
mbed_official | 133:d4dda5c437f0 | 1018 | { |
mbed_official | 133:d4dda5c437f0 | 1019 | /* Process locked */ |
mbed_official | 133:d4dda5c437f0 | 1020 | __HAL_LOCK(hltdc); |
mbed_official | 133:d4dda5c437f0 | 1021 | |
mbed_official | 133:d4dda5c437f0 | 1022 | /* Change LTDC peripheral state */ |
mbed_official | 133:d4dda5c437f0 | 1023 | hltdc->State = HAL_LTDC_STATE_BUSY; |
mbed_official | 133:d4dda5c437f0 | 1024 | |
mbed_official | 133:d4dda5c437f0 | 1025 | /* Check the parameters */ |
mbed_official | 133:d4dda5c437f0 | 1026 | assert_param(IS_LTDC_LIPOS(Line)); |
mbed_official | 133:d4dda5c437f0 | 1027 | |
mbed_official | 133:d4dda5c437f0 | 1028 | /* Enable the Line interrupt */ |
mbed_official | 133:d4dda5c437f0 | 1029 | __HAL_LTDC_ENABLE_IT(hltdc, LTDC_IT_LI); |
mbed_official | 133:d4dda5c437f0 | 1030 | |
mbed_official | 133:d4dda5c437f0 | 1031 | /* Sets the Line Interrupt position */ |
mbed_official | 133:d4dda5c437f0 | 1032 | LTDC->LIPCR = (uint32_t)Line; |
mbed_official | 133:d4dda5c437f0 | 1033 | |
mbed_official | 133:d4dda5c437f0 | 1034 | /* Change the LTDC state*/ |
mbed_official | 133:d4dda5c437f0 | 1035 | hltdc->State = HAL_LTDC_STATE_READY; |
mbed_official | 133:d4dda5c437f0 | 1036 | |
mbed_official | 133:d4dda5c437f0 | 1037 | /* Process unlocked */ |
mbed_official | 133:d4dda5c437f0 | 1038 | __HAL_UNLOCK(hltdc); |
mbed_official | 133:d4dda5c437f0 | 1039 | |
mbed_official | 133:d4dda5c437f0 | 1040 | return HAL_OK; |
mbed_official | 133:d4dda5c437f0 | 1041 | } |
mbed_official | 133:d4dda5c437f0 | 1042 | |
mbed_official | 133:d4dda5c437f0 | 1043 | /** |
mbed_official | 133:d4dda5c437f0 | 1044 | * @} |
mbed_official | 133:d4dda5c437f0 | 1045 | */ |
mbed_official | 133:d4dda5c437f0 | 1046 | |
mbed_official | 133:d4dda5c437f0 | 1047 | /** @defgroup LTDC_Group4 Peripheral State and Errors functions |
mbed_official | 133:d4dda5c437f0 | 1048 | * @brief Peripheral State and Errors functions |
mbed_official | 133:d4dda5c437f0 | 1049 | * |
mbed_official | 133:d4dda5c437f0 | 1050 | @verbatim |
mbed_official | 133:d4dda5c437f0 | 1051 | =============================================================================== |
mbed_official | 133:d4dda5c437f0 | 1052 | ##### Peripheral State and Errors functions ##### |
mbed_official | 133:d4dda5c437f0 | 1053 | =============================================================================== |
mbed_official | 133:d4dda5c437f0 | 1054 | [..] |
mbed_official | 133:d4dda5c437f0 | 1055 | This subsection provides functions allowing to |
mbed_official | 133:d4dda5c437f0 | 1056 | (+) Check the LTDC state. |
mbed_official | 133:d4dda5c437f0 | 1057 | (+) Get error code. |
mbed_official | 133:d4dda5c437f0 | 1058 | |
mbed_official | 133:d4dda5c437f0 | 1059 | @endverbatim |
mbed_official | 133:d4dda5c437f0 | 1060 | * @{ |
mbed_official | 133:d4dda5c437f0 | 1061 | */ |
mbed_official | 133:d4dda5c437f0 | 1062 | |
mbed_official | 133:d4dda5c437f0 | 1063 | /** |
mbed_official | 133:d4dda5c437f0 | 1064 | * @brief Return the LTDC state |
mbed_official | 133:d4dda5c437f0 | 1065 | * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains |
mbed_official | 133:d4dda5c437f0 | 1066 | * the configuration information for the LTDC. |
mbed_official | 133:d4dda5c437f0 | 1067 | * @retval HAL state |
mbed_official | 133:d4dda5c437f0 | 1068 | */ |
mbed_official | 133:d4dda5c437f0 | 1069 | HAL_LTDC_StateTypeDef HAL_LTDC_GetState(LTDC_HandleTypeDef *hltdc) |
mbed_official | 133:d4dda5c437f0 | 1070 | { |
mbed_official | 133:d4dda5c437f0 | 1071 | return hltdc->State; |
mbed_official | 133:d4dda5c437f0 | 1072 | } |
mbed_official | 133:d4dda5c437f0 | 1073 | |
mbed_official | 133:d4dda5c437f0 | 1074 | /** |
mbed_official | 133:d4dda5c437f0 | 1075 | * @brief Return the LTDC error code |
mbed_official | 133:d4dda5c437f0 | 1076 | * @param hltdc : pointer to a LTDC_HandleTypeDef structure that contains |
mbed_official | 133:d4dda5c437f0 | 1077 | * the configuration information for the LTDC. |
mbed_official | 133:d4dda5c437f0 | 1078 | * @retval LTDC Error Code |
mbed_official | 133:d4dda5c437f0 | 1079 | */ |
mbed_official | 133:d4dda5c437f0 | 1080 | uint32_t HAL_LTDC_GetError(LTDC_HandleTypeDef *hltdc) |
mbed_official | 133:d4dda5c437f0 | 1081 | { |
mbed_official | 133:d4dda5c437f0 | 1082 | return hltdc->ErrorCode; |
mbed_official | 133:d4dda5c437f0 | 1083 | } |
mbed_official | 133:d4dda5c437f0 | 1084 | |
mbed_official | 133:d4dda5c437f0 | 1085 | /** |
mbed_official | 133:d4dda5c437f0 | 1086 | * @} |
mbed_official | 133:d4dda5c437f0 | 1087 | */ |
mbed_official | 133:d4dda5c437f0 | 1088 | |
mbed_official | 133:d4dda5c437f0 | 1089 | /** |
mbed_official | 133:d4dda5c437f0 | 1090 | * @brief Configures the LTDC peripheral |
mbed_official | 133:d4dda5c437f0 | 1091 | * @param hltdc : Pointer to a LTDC_HandleTypeDef structure that contains |
mbed_official | 133:d4dda5c437f0 | 1092 | * the configuration information for the LTDC. |
mbed_official | 133:d4dda5c437f0 | 1093 | * @param pLayerCfg: Pointer LTDC Layer Configuration strusture |
mbed_official | 242:7074e42da0b2 | 1094 | * @param LayerIdx: LTDC Layer index. |
mbed_official | 133:d4dda5c437f0 | 1095 | * This parameter can be one of the following values: 0 or 1 |
mbed_official | 133:d4dda5c437f0 | 1096 | * @retval None |
mbed_official | 133:d4dda5c437f0 | 1097 | */ |
mbed_official | 133:d4dda5c437f0 | 1098 | static void LTDC_SetConfig(LTDC_HandleTypeDef *hltdc, LTDC_LayerCfgTypeDef *pLayerCfg, uint32_t LayerIdx) |
mbed_official | 133:d4dda5c437f0 | 1099 | { |
mbed_official | 133:d4dda5c437f0 | 1100 | uint32_t tmp = 0; |
mbed_official | 133:d4dda5c437f0 | 1101 | uint32_t tmp1 = 0; |
mbed_official | 133:d4dda5c437f0 | 1102 | uint32_t tmp2 = 0; |
mbed_official | 133:d4dda5c437f0 | 1103 | |
mbed_official | 133:d4dda5c437f0 | 1104 | /* Configures the horizontal start and stop position */ |
mbed_official | 133:d4dda5c437f0 | 1105 | tmp = ((pLayerCfg->WindowX1 + ((hltdc->Instance->BPCR & LTDC_BPCR_AHBP) >> 16)) << 16); |
mbed_official | 133:d4dda5c437f0 | 1106 | __HAL_LTDC_LAYER(hltdc, LayerIdx)->WHPCR &= ~(LTDC_LxWHPCR_WHSTPOS | LTDC_LxWHPCR_WHSPPOS); |
mbed_official | 133:d4dda5c437f0 | 1107 | __HAL_LTDC_LAYER(hltdc, LayerIdx)->WHPCR = ((pLayerCfg->WindowX0 + ((hltdc->Instance->BPCR & LTDC_BPCR_AHBP) >> 16) + 1) | tmp); |
mbed_official | 133:d4dda5c437f0 | 1108 | |
mbed_official | 133:d4dda5c437f0 | 1109 | /* Configures the vertical start and stop position */ |
mbed_official | 133:d4dda5c437f0 | 1110 | tmp = ((pLayerCfg->WindowY1 + (hltdc->Instance->BPCR & LTDC_BPCR_AVBP)) << 16); |
mbed_official | 133:d4dda5c437f0 | 1111 | __HAL_LTDC_LAYER(hltdc, LayerIdx)->WVPCR &= ~(LTDC_LxWVPCR_WVSTPOS | LTDC_LxWVPCR_WVSPPOS); |
mbed_official | 133:d4dda5c437f0 | 1112 | __HAL_LTDC_LAYER(hltdc, LayerIdx)->WVPCR = ((pLayerCfg->WindowY0 + (hltdc->Instance->BPCR & LTDC_BPCR_AVBP) + 1) | tmp); |
mbed_official | 133:d4dda5c437f0 | 1113 | |
mbed_official | 133:d4dda5c437f0 | 1114 | /* Specifies the pixel format */ |
mbed_official | 133:d4dda5c437f0 | 1115 | __HAL_LTDC_LAYER(hltdc, LayerIdx)->PFCR &= ~(LTDC_LxPFCR_PF); |
mbed_official | 133:d4dda5c437f0 | 1116 | __HAL_LTDC_LAYER(hltdc, LayerIdx)->PFCR = (pLayerCfg->PixelFormat); |
mbed_official | 133:d4dda5c437f0 | 1117 | |
mbed_official | 133:d4dda5c437f0 | 1118 | /* Configures the default color values */ |
mbed_official | 133:d4dda5c437f0 | 1119 | tmp = ((uint32_t)(pLayerCfg->Backcolor.Green) << 8); |
mbed_official | 133:d4dda5c437f0 | 1120 | tmp1 = ((uint32_t)(pLayerCfg->Backcolor.Red) << 16); |
mbed_official | 133:d4dda5c437f0 | 1121 | tmp2 = (pLayerCfg->Alpha0 << 24); |
mbed_official | 133:d4dda5c437f0 | 1122 | __HAL_LTDC_LAYER(hltdc, LayerIdx)->DCCR &= ~(LTDC_LxDCCR_DCBLUE | LTDC_LxDCCR_DCGREEN | LTDC_LxDCCR_DCRED | LTDC_LxDCCR_DCALPHA); |
mbed_official | 133:d4dda5c437f0 | 1123 | __HAL_LTDC_LAYER(hltdc, LayerIdx)->DCCR = (pLayerCfg->Backcolor.Blue | tmp | tmp1 | tmp2); |
mbed_official | 133:d4dda5c437f0 | 1124 | |
mbed_official | 133:d4dda5c437f0 | 1125 | /* Specifies the constant alpha value */ |
mbed_official | 133:d4dda5c437f0 | 1126 | __HAL_LTDC_LAYER(hltdc, LayerIdx)->CACR &= ~(LTDC_LxCACR_CONSTA); |
mbed_official | 133:d4dda5c437f0 | 1127 | __HAL_LTDC_LAYER(hltdc, LayerIdx)->CACR = (pLayerCfg->Alpha); |
mbed_official | 133:d4dda5c437f0 | 1128 | |
mbed_official | 133:d4dda5c437f0 | 1129 | /* Specifies the blending factors */ |
mbed_official | 133:d4dda5c437f0 | 1130 | __HAL_LTDC_LAYER(hltdc, LayerIdx)->BFCR &= ~(LTDC_LxBFCR_BF2 | LTDC_LxBFCR_BF1); |
mbed_official | 133:d4dda5c437f0 | 1131 | __HAL_LTDC_LAYER(hltdc, LayerIdx)->BFCR = (pLayerCfg->BlendingFactor1 | pLayerCfg->BlendingFactor2); |
mbed_official | 133:d4dda5c437f0 | 1132 | |
mbed_official | 133:d4dda5c437f0 | 1133 | /* Configures the color frame buffer start address */ |
mbed_official | 133:d4dda5c437f0 | 1134 | __HAL_LTDC_LAYER(hltdc, LayerIdx)->CFBAR &= ~(LTDC_LxCFBAR_CFBADD); |
mbed_official | 133:d4dda5c437f0 | 1135 | __HAL_LTDC_LAYER(hltdc, LayerIdx)->CFBAR = (pLayerCfg->FBStartAdress); |
mbed_official | 133:d4dda5c437f0 | 1136 | |
mbed_official | 133:d4dda5c437f0 | 1137 | if(pLayerCfg->PixelFormat == LTDC_PIXEL_FORMAT_ARGB8888) |
mbed_official | 133:d4dda5c437f0 | 1138 | { |
mbed_official | 133:d4dda5c437f0 | 1139 | tmp = 4; |
mbed_official | 133:d4dda5c437f0 | 1140 | } |
mbed_official | 133:d4dda5c437f0 | 1141 | else if (pLayerCfg->PixelFormat == LTDC_PIXEL_FORMAT_RGB888) |
mbed_official | 133:d4dda5c437f0 | 1142 | { |
mbed_official | 133:d4dda5c437f0 | 1143 | tmp = 3; |
mbed_official | 133:d4dda5c437f0 | 1144 | } |
mbed_official | 133:d4dda5c437f0 | 1145 | else if((pLayerCfg->PixelFormat == LTDC_PIXEL_FORMAT_ARGB4444) || \ |
mbed_official | 133:d4dda5c437f0 | 1146 | (pLayerCfg->PixelFormat == LTDC_PIXEL_FORMAT_RGB565) || \ |
mbed_official | 133:d4dda5c437f0 | 1147 | (pLayerCfg->PixelFormat == LTDC_PIXEL_FORMAT_ARGB1555) || \ |
mbed_official | 133:d4dda5c437f0 | 1148 | (pLayerCfg->PixelFormat == LTDC_PIXEL_FORMAT_AL88)) |
mbed_official | 133:d4dda5c437f0 | 1149 | { |
mbed_official | 133:d4dda5c437f0 | 1150 | tmp = 2; |
mbed_official | 133:d4dda5c437f0 | 1151 | } |
mbed_official | 133:d4dda5c437f0 | 1152 | else |
mbed_official | 133:d4dda5c437f0 | 1153 | { |
mbed_official | 133:d4dda5c437f0 | 1154 | tmp = 1; |
mbed_official | 133:d4dda5c437f0 | 1155 | } |
mbed_official | 133:d4dda5c437f0 | 1156 | |
mbed_official | 133:d4dda5c437f0 | 1157 | /* Configures the color frame buffer pitch in byte */ |
mbed_official | 133:d4dda5c437f0 | 1158 | __HAL_LTDC_LAYER(hltdc, LayerIdx)->CFBLR &= ~(LTDC_LxCFBLR_CFBLL | LTDC_LxCFBLR_CFBP); |
mbed_official | 133:d4dda5c437f0 | 1159 | __HAL_LTDC_LAYER(hltdc, LayerIdx)->CFBLR = (((pLayerCfg->ImageWidth * tmp) << 16) | ((pLayerCfg->ImageWidth * tmp) + 3)); |
mbed_official | 133:d4dda5c437f0 | 1160 | |
mbed_official | 133:d4dda5c437f0 | 1161 | /* Configures the frame buffer line number */ |
mbed_official | 133:d4dda5c437f0 | 1162 | __HAL_LTDC_LAYER(hltdc, LayerIdx)->CFBLNR &= ~(LTDC_LxCFBLNR_CFBLNBR); |
mbed_official | 133:d4dda5c437f0 | 1163 | __HAL_LTDC_LAYER(hltdc, LayerIdx)->CFBLNR = (pLayerCfg->ImageHeight); |
mbed_official | 133:d4dda5c437f0 | 1164 | |
mbed_official | 133:d4dda5c437f0 | 1165 | /* Enable LTDC_Layer by setting LEN bit */ |
mbed_official | 133:d4dda5c437f0 | 1166 | __HAL_LTDC_LAYER(hltdc, LayerIdx)->CR |= (uint32_t)LTDC_LxCR_LEN; |
mbed_official | 133:d4dda5c437f0 | 1167 | } |
mbed_official | 133:d4dda5c437f0 | 1168 | |
mbed_official | 133:d4dda5c437f0 | 1169 | /** |
mbed_official | 133:d4dda5c437f0 | 1170 | * @} |
mbed_official | 133:d4dda5c437f0 | 1171 | */ |
mbed_official | 133:d4dda5c437f0 | 1172 | #endif /* STM32F429xx || STM32F439xx */ |
mbed_official | 133:d4dda5c437f0 | 1173 | #endif /* HAL_LTDC_MODULE_ENABLED */ |
mbed_official | 133:d4dda5c437f0 | 1174 | /** |
mbed_official | 133:d4dda5c437f0 | 1175 | * @} |
mbed_official | 133:d4dda5c437f0 | 1176 | */ |
mbed_official | 133:d4dda5c437f0 | 1177 | |
mbed_official | 133:d4dda5c437f0 | 1178 | /** |
mbed_official | 133:d4dda5c437f0 | 1179 | * @} |
mbed_official | 133:d4dda5c437f0 | 1180 | */ |
mbed_official | 133:d4dda5c437f0 | 1181 | |
mbed_official | 133:d4dda5c437f0 | 1182 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |