annotate Common/Drivers/STM32F4xx_HAL_DRIVER_v120/Src/stm32f4xx_hal_ltdc.c @ 42:2d99d9290a22

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