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