IOTON Technology / mbed-ton

Fork of mbed-dev by mbed official

Committer:
mbed_official
Date:
Tue Nov 10 09:30:11 2015 +0000
Revision:
19:112740acecfa
Child:
144:ef7eb2e8f9f7
Synchronized with git revision 7218418919aeaf775fb8d386ea7ee0dfc0c80ff9

Full URL: https://github.com/mbedmicro/mbed/commit/7218418919aeaf775fb8d386ea7ee0dfc0c80ff9/

DISCO_F469NI - add disco F469NI support

Who changed what in which revision?

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