STM32F439xx HAL User Manual
|
00001 /** 00002 ****************************************************************************** 00003 * @file stm32f4xx_hal_ltdc_ex.c 00004 * @author MCD Application Team 00005 * @brief LTDC Extension HAL module driver. 00006 ****************************************************************************** 00007 * @attention 00008 * 00009 * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> 00010 * 00011 * Redistribution and use in source and binary forms, with or without modification, 00012 * are permitted provided that the following conditions are met: 00013 * 1. Redistributions of source code must retain the above copyright notice, 00014 * this list of conditions and the following disclaimer. 00015 * 2. Redistributions in binary form must reproduce the above copyright notice, 00016 * this list of conditions and the following disclaimer in the documentation 00017 * and/or other materials provided with the distribution. 00018 * 3. Neither the name of STMicroelectronics nor the names of its contributors 00019 * may be used to endorse or promote products derived from this software 00020 * without specific prior written permission. 00021 * 00022 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00023 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00024 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00025 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 00026 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00027 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00028 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00029 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00030 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00031 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00032 * 00033 ****************************************************************************** 00034 */ 00035 00036 /* Includes ------------------------------------------------------------------*/ 00037 #include "stm32f4xx_hal.h" 00038 00039 /** @addtogroup STM32F4xx_HAL_Driver 00040 * @{ 00041 */ 00042 /** @defgroup LTDCEx LTDCEx 00043 * @brief LTDC HAL module driver 00044 * @{ 00045 */ 00046 00047 #ifdef HAL_LTDC_MODULE_ENABLED 00048 00049 /* Private typedef -----------------------------------------------------------*/ 00050 /* Private define ------------------------------------------------------------*/ 00051 /* Private macro -------------------------------------------------------------*/ 00052 /* Private variables ---------------------------------------------------------*/ 00053 /* Private function prototypes -----------------------------------------------*/ 00054 /* Exported functions --------------------------------------------------------*/ 00055 00056 /** @defgroup LTDCEx_Exported_Functions LTDC Extended Exported Functions 00057 * @{ 00058 */ 00059 00060 /** @defgroup LTDCEx_Exported_Functions_Group1 Initialization and Configuration functions 00061 * @brief Initialization and Configuration functions 00062 * 00063 @verbatim 00064 =============================================================================== 00065 ##### Initialization and Configuration functions ##### 00066 =============================================================================== 00067 [..] This section provides functions allowing to: 00068 (+) Initialize and configure the LTDC 00069 00070 @endverbatim 00071 * @{ 00072 */ 00073 #if defined(STM32F469xx) || defined(STM32F479xx) 00074 /** 00075 * @brief Retrieve common parameters from DSI Video mode configuration structure 00076 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 00077 * the configuration information for the LTDC. 00078 * @param VidCfg pointer to a DSI_VidCfgTypeDef structure that contains 00079 * the DSI video mode configuration parameters 00080 * @note The implementation of this function is taking into account the LTDC 00081 * polarities inversion as described in the current LTDC specification 00082 * @retval HAL status 00083 */ 00084 HAL_StatusTypeDef HAL_LTDCEx_StructInitFromVideoConfig(LTDC_HandleTypeDef* hltdc, DSI_VidCfgTypeDef *VidCfg) 00085 { 00086 /* Retrieve signal polarities from DSI */ 00087 00088 /* The following polarity is inverted: 00089 LTDC_DEPOLARITY_AL <-> LTDC_DEPOLARITY_AH */ 00090 00091 /* Note 1 : Code in line w/ Current LTDC specification */ 00092 hltdc->Init.DEPolarity = (VidCfg->DEPolarity == DSI_DATA_ENABLE_ACTIVE_HIGH) ? LTDC_DEPOLARITY_AL : LTDC_DEPOLARITY_AH; 00093 hltdc->Init.VSPolarity = (VidCfg->VSPolarity == DSI_VSYNC_ACTIVE_HIGH) ? LTDC_VSPOLARITY_AH : LTDC_VSPOLARITY_AL; 00094 hltdc->Init.HSPolarity = (VidCfg->HSPolarity == DSI_HSYNC_ACTIVE_HIGH) ? LTDC_HSPOLARITY_AH : LTDC_HSPOLARITY_AL; 00095 00096 /* Note 2: Code to be used in case LTDC polarities inversion updated in the specification */ 00097 /* hltdc->Init.DEPolarity = VidCfg->DEPolarity << 29; 00098 hltdc->Init.VSPolarity = VidCfg->VSPolarity << 29; 00099 hltdc->Init.HSPolarity = VidCfg->HSPolarity << 29; */ 00100 00101 /* Retrieve vertical timing parameters from DSI */ 00102 hltdc->Init.VerticalSync = VidCfg->VerticalSyncActive - 1U; 00103 hltdc->Init.AccumulatedVBP = VidCfg->VerticalSyncActive + VidCfg->VerticalBackPorch - 1U; 00104 hltdc->Init.AccumulatedActiveH = VidCfg->VerticalSyncActive + VidCfg->VerticalBackPorch + VidCfg->VerticalActive - 1U; 00105 hltdc->Init.TotalHeigh = VidCfg->VerticalSyncActive + VidCfg->VerticalBackPorch + VidCfg->VerticalActive + VidCfg->VerticalFrontPorch - 1U; 00106 00107 return HAL_OK; 00108 } 00109 00110 /** 00111 * @brief Retrieve common parameters from DSI Adapted command mode configuration structure 00112 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 00113 * the configuration information for the LTDC. 00114 * @param CmdCfg pointer to a DSI_CmdCfgTypeDef structure that contains 00115 * the DSI command mode configuration parameters 00116 * @note The implementation of this function is taking into account the LTDC 00117 * polarities inversion as described in the current LTDC specification 00118 * @retval HAL status 00119 */ 00120 HAL_StatusTypeDef HAL_LTDCEx_StructInitFromAdaptedCommandConfig(LTDC_HandleTypeDef* hltdc, DSI_CmdCfgTypeDef *CmdCfg) 00121 { 00122 /* Retrieve signal polarities from DSI */ 00123 00124 /* The following polarities are inverted: 00125 LTDC_DEPOLARITY_AL <-> LTDC_DEPOLARITY_AH 00126 LTDC_VSPOLARITY_AL <-> LTDC_VSPOLARITY_AH 00127 LTDC_HSPOLARITY_AL <-> LTDC_HSPOLARITY_AH)*/ 00128 00129 /* Note 1 : Code in line w/ Current LTDC specification */ 00130 hltdc->Init.DEPolarity = (CmdCfg->DEPolarity == DSI_DATA_ENABLE_ACTIVE_HIGH) ? LTDC_DEPOLARITY_AL : LTDC_DEPOLARITY_AH; 00131 hltdc->Init.VSPolarity = (CmdCfg->VSPolarity == DSI_VSYNC_ACTIVE_HIGH) ? LTDC_VSPOLARITY_AL : LTDC_VSPOLARITY_AH; 00132 hltdc->Init.HSPolarity = (CmdCfg->HSPolarity == DSI_HSYNC_ACTIVE_HIGH) ? LTDC_HSPOLARITY_AL : LTDC_HSPOLARITY_AH; 00133 00134 /* Note 2: Code to be used in case LTDC polarities inversion updated in the specification */ 00135 /* hltdc->Init.DEPolarity = CmdCfg->DEPolarity << 29; 00136 hltdc->Init.VSPolarity = CmdCfg->VSPolarity << 29; 00137 hltdc->Init.HSPolarity = CmdCfg->HSPolarity << 29; */ 00138 00139 return HAL_OK; 00140 } 00141 #endif /* STM32F469xx || STM32F479xx */ 00142 00143 /** 00144 * @} 00145 */ 00146 00147 /** 00148 * @} 00149 */ 00150 00151 #endif /* HAL_DCMI_MODULE_ENABLED */ 00152 /** 00153 * @} 00154 */ 00155 00156 /** 00157 * @} 00158 */ 00159 00160 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/