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