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