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