STM32F479xx 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) 2016 STMicroelectronics. 00010 * All rights reserved.</center></h2> 00011 * 00012 * This software component is licensed by ST under BSD 3-Clause license, 00013 * the "License"; You may not use this file except in compliance with the 00014 * License. You may obtain a copy of the License at: 00015 * opensource.org/licenses/BSD-3-Clause 00016 * 00017 ****************************************************************************** 00018 */ 00019 00020 /* Includes ------------------------------------------------------------------*/ 00021 #include "stm32f4xx_hal.h" 00022 00023 /** @addtogroup STM32F4xx_HAL_Driver 00024 * @{ 00025 */ 00026 00027 #if defined(HAL_LTDC_MODULE_ENABLED) && defined(HAL_DSI_MODULE_ENABLED) 00028 00029 #if defined (LTDC) && defined (DSI) 00030 00031 /** @defgroup LTDCEx LTDCEx 00032 * @brief LTDC HAL module driver 00033 * @{ 00034 */ 00035 00036 /* Private typedef -----------------------------------------------------------*/ 00037 /* Private define ------------------------------------------------------------*/ 00038 /* Private macro -------------------------------------------------------------*/ 00039 /* Private variables ---------------------------------------------------------*/ 00040 /* Private function prototypes -----------------------------------------------*/ 00041 /* Exported functions --------------------------------------------------------*/ 00042 00043 /** @defgroup LTDCEx_Exported_Functions LTDC Extended Exported Functions 00044 * @{ 00045 */ 00046 00047 /** @defgroup LTDCEx_Exported_Functions_Group1 Initialization and Configuration functions 00048 * @brief Initialization and Configuration functions 00049 * 00050 @verbatim 00051 =============================================================================== 00052 ##### Initialization and Configuration functions ##### 00053 =============================================================================== 00054 [..] This section provides functions allowing to: 00055 (+) Initialize and configure the LTDC 00056 00057 @endverbatim 00058 * @{ 00059 */ 00060 00061 /** 00062 * @brief Retrieve common parameters from DSI Video mode configuration structure 00063 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 00064 * the configuration information for the LTDC. 00065 * @param VidCfg pointer to a DSI_VidCfgTypeDef structure that contains 00066 * the DSI video mode configuration parameters 00067 * @note The implementation of this function is taking into account the LTDC 00068 * polarities inversion as described in the current LTDC specification 00069 * @retval HAL status 00070 */ 00071 HAL_StatusTypeDef HAL_LTDCEx_StructInitFromVideoConfig(LTDC_HandleTypeDef *hltdc, DSI_VidCfgTypeDef *VidCfg) 00072 { 00073 /* Retrieve signal polarities from DSI */ 00074 00075 /* The following polarity is inverted: 00076 LTDC_DEPOLARITY_AL <-> LTDC_DEPOLARITY_AH */ 00077 00078 /* Note 1 : Code in line w/ Current LTDC specification */ 00079 hltdc->Init.DEPolarity = (VidCfg->DEPolarity == DSI_DATA_ENABLE_ACTIVE_HIGH) ? LTDC_DEPOLARITY_AL : LTDC_DEPOLARITY_AH; 00080 hltdc->Init.VSPolarity = (VidCfg->VSPolarity == DSI_VSYNC_ACTIVE_HIGH) ? LTDC_VSPOLARITY_AH : LTDC_VSPOLARITY_AL; 00081 hltdc->Init.HSPolarity = (VidCfg->HSPolarity == DSI_HSYNC_ACTIVE_HIGH) ? LTDC_HSPOLARITY_AH : LTDC_HSPOLARITY_AL; 00082 00083 /* Note 2: Code to be used in case LTDC polarities inversion updated in the specification */ 00084 /* hltdc->Init.DEPolarity = VidCfg->DEPolarity << 29; 00085 hltdc->Init.VSPolarity = VidCfg->VSPolarity << 29; 00086 hltdc->Init.HSPolarity = VidCfg->HSPolarity << 29; */ 00087 00088 /* Retrieve vertical timing parameters from DSI */ 00089 hltdc->Init.VerticalSync = VidCfg->VerticalSyncActive - 1U; 00090 hltdc->Init.AccumulatedVBP = VidCfg->VerticalSyncActive + VidCfg->VerticalBackPorch - 1U; 00091 hltdc->Init.AccumulatedActiveH = VidCfg->VerticalSyncActive + VidCfg->VerticalBackPorch + VidCfg->VerticalActive - 1U; 00092 hltdc->Init.TotalHeigh = VidCfg->VerticalSyncActive + VidCfg->VerticalBackPorch + VidCfg->VerticalActive + VidCfg->VerticalFrontPorch - 1U; 00093 00094 return HAL_OK; 00095 } 00096 00097 /** 00098 * @brief Retrieve common parameters from DSI Adapted command mode configuration structure 00099 * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 00100 * the configuration information for the LTDC. 00101 * @param CmdCfg pointer to a DSI_CmdCfgTypeDef structure that contains 00102 * the DSI command mode configuration parameters 00103 * @note The implementation of this function is taking into account the LTDC 00104 * polarities inversion as described in the current LTDC specification 00105 * @retval HAL status 00106 */ 00107 HAL_StatusTypeDef HAL_LTDCEx_StructInitFromAdaptedCommandConfig(LTDC_HandleTypeDef *hltdc, DSI_CmdCfgTypeDef *CmdCfg) 00108 { 00109 /* Retrieve signal polarities from DSI */ 00110 00111 /* The following polarities are inverted: 00112 LTDC_DEPOLARITY_AL <-> LTDC_DEPOLARITY_AH 00113 LTDC_VSPOLARITY_AL <-> LTDC_VSPOLARITY_AH 00114 LTDC_HSPOLARITY_AL <-> LTDC_HSPOLARITY_AH)*/ 00115 00116 /* Note 1 : Code in line w/ Current LTDC specification */ 00117 hltdc->Init.DEPolarity = (CmdCfg->DEPolarity == DSI_DATA_ENABLE_ACTIVE_HIGH) ? LTDC_DEPOLARITY_AL : LTDC_DEPOLARITY_AH; 00118 hltdc->Init.VSPolarity = (CmdCfg->VSPolarity == DSI_VSYNC_ACTIVE_HIGH) ? LTDC_VSPOLARITY_AL : LTDC_VSPOLARITY_AH; 00119 hltdc->Init.HSPolarity = (CmdCfg->HSPolarity == DSI_HSYNC_ACTIVE_HIGH) ? LTDC_HSPOLARITY_AL : LTDC_HSPOLARITY_AH; 00120 00121 /* Note 2: Code to be used in case LTDC polarities inversion updated in the specification */ 00122 /* hltdc->Init.DEPolarity = CmdCfg->DEPolarity << 29; 00123 hltdc->Init.VSPolarity = CmdCfg->VSPolarity << 29; 00124 hltdc->Init.HSPolarity = CmdCfg->HSPolarity << 29; */ 00125 00126 return HAL_OK; 00127 } 00128 00129 /** 00130 * @} 00131 */ 00132 00133 /** 00134 * @} 00135 */ 00136 00137 /** 00138 * @} 00139 */ 00140 00141 #endif /* LTDC && DSI */ 00142 00143 #endif /* HAL_LTCD_MODULE_ENABLED && HAL_DSI_MODULE_ENABLED */ 00144 00145 /** 00146 * @} 00147 */ 00148 00149 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/