1 | /**
|
---|
2 | ******************************************************************************
|
---|
3 | * @file stm32f4xx_hal_ltdc_ex.c
|
---|
4 | * @author MCD Application Team
|
---|
5 | * @version V1.4.1
|
---|
6 | * @date 09-October-2015
|
---|
7 | * @brief LTDC Extension HAL module driver.
|
---|
8 | ******************************************************************************
|
---|
9 | * @attention
|
---|
10 | *
|
---|
11 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
|
---|
12 | *
|
---|
13 | * Redistribution and use in source and binary forms, with or without modification,
|
---|
14 | * are permitted provided that the following conditions are met:
|
---|
15 | * 1. Redistributions of source code must retain the above copyright notice,
|
---|
16 | * this list of conditions and the following disclaimer.
|
---|
17 | * 2. Redistributions in binary form must reproduce the above copyright notice,
|
---|
18 | * this list of conditions and the following disclaimer in the documentation
|
---|
19 | * and/or other materials provided with the distribution.
|
---|
20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
|
---|
21 | * may be used to endorse or promote products derived from this software
|
---|
22 | * without specific prior written permission.
|
---|
23 | *
|
---|
24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
---|
25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
---|
26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
---|
27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
---|
28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
---|
29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
---|
30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
---|
31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
---|
32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
---|
33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
34 | *
|
---|
35 | ******************************************************************************
|
---|
36 | */
|
---|
37 |
|
---|
38 | /* Includes ------------------------------------------------------------------*/
|
---|
39 | #include "stm32f4xx_hal.h"
|
---|
40 |
|
---|
41 | /** @addtogroup STM32F4xx_HAL_Driver
|
---|
42 | * @{
|
---|
43 | */
|
---|
44 | /** @defgroup LTDCEx LTDCEx
|
---|
45 | * @brief LTDC HAL module driver
|
---|
46 | * @{
|
---|
47 | */
|
---|
48 |
|
---|
49 | #ifdef HAL_LTDC_MODULE_ENABLED
|
---|
50 |
|
---|
51 | /* Private typedef -----------------------------------------------------------*/
|
---|
52 | /* Private define ------------------------------------------------------------*/
|
---|
53 | /* Private macro -------------------------------------------------------------*/
|
---|
54 | /* Private variables ---------------------------------------------------------*/
|
---|
55 | /* Private function prototypes -----------------------------------------------*/
|
---|
56 | /* Exported functions --------------------------------------------------------*/
|
---|
57 |
|
---|
58 | /** @defgroup LTDCEx_Exported_Functions LTDC Extended Exported Functions
|
---|
59 | * @{
|
---|
60 | */
|
---|
61 |
|
---|
62 | /** @defgroup LTDCEx_Exported_Functions_Group1 Initialization and Configuration functions
|
---|
63 | * @brief Initialization and Configuration functions
|
---|
64 | *
|
---|
65 | @verbatim
|
---|
66 | ===============================================================================
|
---|
67 | ##### Initialization and Configuration functions #####
|
---|
68 | ===============================================================================
|
---|
69 | [..] This section provides functions allowing to:
|
---|
70 | (+) Initialize and configure the LTDC
|
---|
71 |
|
---|
72 | @endverbatim
|
---|
73 | * @{
|
---|
74 | */
|
---|
75 | #if defined(STM32F469xx) || defined(STM32F479xx)
|
---|
76 | /**
|
---|
77 | * @brief Retrieve common parameters from DSI Video mode configuration structure
|
---|
78 | * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
|
---|
79 | * the configuration information for the LTDC.
|
---|
80 | * @param VidCfg: pointer to a DSI_VidCfgTypeDef structure that contains
|
---|
81 | * the DSI video mode configuration parameters
|
---|
82 | * @note The implementation of this function is taking into account the LTDC
|
---|
83 | * polarities inversion as described in the current LTDC specification
|
---|
84 | * @retval HAL status
|
---|
85 | */
|
---|
86 | HAL_StatusTypeDef HAL_LTDC_StructInitFromVideoConfig(LTDC_HandleTypeDef* hltdc, DSI_VidCfgTypeDef *VidCfg)
|
---|
87 | {
|
---|
88 | /* Retrieve signal polarities from DSI */
|
---|
89 |
|
---|
90 | /* The following polarities are inverted:
|
---|
91 | LTDC_DEPOLARITY_AL <-> LTDC_DEPOLARITY_AH
|
---|
92 | LTDC_VSPOLARITY_AL <-> LTDC_VSPOLARITY_AH
|
---|
93 | LTDC_HSPOLARITY_AL <-> LTDC_HSPOLARITY_AH)*/
|
---|
94 |
|
---|
95 | /* Note 1 : Code in line w/ Current LTDC specification */
|
---|
96 | hltdc->Init.DEPolarity = (VidCfg->DEPolarity == DSI_DATA_ENABLE_ACTIVE_HIGH) ? LTDC_DEPOLARITY_AL : LTDC_DEPOLARITY_AH;
|
---|
97 | hltdc->Init.VSPolarity = (VidCfg->VSPolarity == DSI_VSYNC_ACTIVE_HIGH) ? LTDC_VSPOLARITY_AL : LTDC_VSPOLARITY_AH;
|
---|
98 | hltdc->Init.HSPolarity = (VidCfg->HSPolarity == DSI_HSYNC_ACTIVE_HIGH) ? LTDC_HSPOLARITY_AL : LTDC_HSPOLARITY_AH;
|
---|
99 |
|
---|
100 | /* Note 2: Code to be used in case LTDC polarities inversion updated in the specification */
|
---|
101 | /* hltdc->Init.DEPolarity = VidCfg->DEPolarity << 29;
|
---|
102 | hltdc->Init.VSPolarity = VidCfg->VSPolarity << 29;
|
---|
103 | hltdc->Init.HSPolarity = VidCfg->HSPolarity << 29; */
|
---|
104 |
|
---|
105 | /* Retrieve vertical timing parameters from DSI */
|
---|
106 | hltdc->Init.VerticalSync = VidCfg->VerticalSyncActive - 1;
|
---|
107 | hltdc->Init.AccumulatedVBP = VidCfg->VerticalSyncActive + VidCfg->VerticalBackPorch - 1;
|
---|
108 | hltdc->Init.AccumulatedActiveH = VidCfg->VerticalSyncActive + VidCfg->VerticalBackPorch + VidCfg->VerticalActive - 1;
|
---|
109 | hltdc->Init.TotalHeigh = VidCfg->VerticalSyncActive + VidCfg->VerticalBackPorch + VidCfg->VerticalActive + VidCfg->VerticalFrontPorch - 1;
|
---|
110 |
|
---|
111 | return HAL_OK;
|
---|
112 | }
|
---|
113 |
|
---|
114 | /**
|
---|
115 | * @brief Retrieve common parameters from DSI Adapted command mode configuration structure
|
---|
116 | * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains
|
---|
117 | * the configuration information for the LTDC.
|
---|
118 | * @param CmdCfg: pointer to a DSI_CmdCfgTypeDef structure that contains
|
---|
119 | * the DSI command mode configuration parameters
|
---|
120 | * @note The implementation of this function is taking into account the LTDC
|
---|
121 | * polarities inversion as described in the current LTDC specification
|
---|
122 | * @retval HAL status
|
---|
123 | */
|
---|
124 | HAL_StatusTypeDef HAL_LTDC_StructInitFromAdaptedCommandConfig(LTDC_HandleTypeDef* hltdc, DSI_CmdCfgTypeDef *CmdCfg)
|
---|
125 | {
|
---|
126 | /* Retrieve signal polarities from DSI */
|
---|
127 |
|
---|
128 | /* The following polarities are inverted:
|
---|
129 | LTDC_DEPOLARITY_AL <-> LTDC_DEPOLARITY_AH
|
---|
130 | LTDC_VSPOLARITY_AL <-> LTDC_VSPOLARITY_AH
|
---|
131 | LTDC_HSPOLARITY_AL <-> LTDC_HSPOLARITY_AH)*/
|
---|
132 |
|
---|
133 | /* Note 1 : Code in line w/ Current LTDC specification */
|
---|
134 | hltdc->Init.DEPolarity = (CmdCfg->DEPolarity == DSI_DATA_ENABLE_ACTIVE_HIGH) ? LTDC_DEPOLARITY_AL : LTDC_DEPOLARITY_AH;
|
---|
135 | hltdc->Init.VSPolarity = (CmdCfg->VSPolarity == DSI_VSYNC_ACTIVE_HIGH) ? LTDC_VSPOLARITY_AL : LTDC_VSPOLARITY_AH;
|
---|
136 | hltdc->Init.HSPolarity = (CmdCfg->HSPolarity == DSI_HSYNC_ACTIVE_HIGH) ? LTDC_HSPOLARITY_AL : LTDC_HSPOLARITY_AH;
|
---|
137 |
|
---|
138 | /* Note 2: Code to be used in case LTDC polarities inversion updated in the specification */
|
---|
139 | /* hltdc->Init.DEPolarity = CmdCfg->DEPolarity << 29;
|
---|
140 | hltdc->Init.VSPolarity = CmdCfg->VSPolarity << 29;
|
---|
141 | hltdc->Init.HSPolarity = CmdCfg->HSPolarity << 29; */
|
---|
142 |
|
---|
143 | return HAL_OK;
|
---|
144 | }
|
---|
145 | #endif /* STM32F469xx || STM32F479xx */
|
---|
146 |
|
---|
147 | /**
|
---|
148 | * @}
|
---|
149 | */
|
---|
150 |
|
---|
151 | /**
|
---|
152 | * @}
|
---|
153 | */
|
---|
154 |
|
---|
155 | #endif /* HAL_DCMI_MODULE_ENABLED */
|
---|
156 | /**
|
---|
157 | * @}
|
---|
158 | */
|
---|
159 |
|
---|
160 | /**
|
---|
161 | * @}
|
---|
162 | */
|
---|
163 |
|
---|
164 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
---|