SilentSensors / mbed-dev

Fork of mbed-dev by mbed official

Committer:
WaleedElmughrabi
Date:
Thu Sep 20 16:11:23 2018 +0000
Revision:
188:60408c49b6d4
Parent:
182:a56a73fd2a6f
Fork modified for BG96 error

Who changed what in which revision?

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