Modified version of the mbed library for use with the Nucleo boards.

Dependents:   EEPROMWrite Full-Project

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Thu Aug 20 10:45:13 2015 +0100
Revision:
613:bc40b8d2aec4
Parent:
532:fe11edbda85c
Synchronized with git revision 92ca8c7b60a283b6bb60eb65b183dac1599f0ade

Full URL: https://github.com/mbedmicro/mbed/commit/92ca8c7b60a283b6bb60eb65b183dac1599f0ade/

Nordic: update application start address in GCC linker script

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 532:fe11edbda85c 1 /**
mbed_official 532:fe11edbda85c 2 ******************************************************************************
mbed_official 532:fe11edbda85c 3 * @file stm32f4xx_hal_dcmi_ex.c
mbed_official 532:fe11edbda85c 4 * @author MCD Application Team
mbed_official 613:bc40b8d2aec4 5 * @version V1.3.2
mbed_official 613:bc40b8d2aec4 6 * @date 26-June-2015
mbed_official 532:fe11edbda85c 7 * @brief DCMI Extension HAL module driver.
mbed_official 532:fe11edbda85c 8 * This file provides firmware functions to manage the following
mbed_official 532:fe11edbda85c 9 * functionalities of DCMI extension peripheral:
mbed_official 532:fe11edbda85c 10 * + Extension features functions
mbed_official 532:fe11edbda85c 11 *
mbed_official 532:fe11edbda85c 12 @verbatim
mbed_official 532:fe11edbda85c 13 ==============================================================================
mbed_official 532:fe11edbda85c 14 ##### DCMI peripheral extension features #####
mbed_official 532:fe11edbda85c 15 ==============================================================================
mbed_official 532:fe11edbda85c 16
mbed_official 532:fe11edbda85c 17 [..] Comparing to other previous devices, the DCMI interface for STM32F446xx
mbed_official 532:fe11edbda85c 18 devices contains the following additional features :
mbed_official 532:fe11edbda85c 19
mbed_official 532:fe11edbda85c 20 (+) Support of Black and White cameras
mbed_official 532:fe11edbda85c 21
mbed_official 532:fe11edbda85c 22 ##### How to use this driver #####
mbed_official 532:fe11edbda85c 23 ==============================================================================
mbed_official 532:fe11edbda85c 24 [..] This driver provides functions to manage the Black and White feature
mbed_official 532:fe11edbda85c 25
mbed_official 532:fe11edbda85c 26 @endverbatim
mbed_official 532:fe11edbda85c 27 ******************************************************************************
mbed_official 532:fe11edbda85c 28 * @attention
mbed_official 532:fe11edbda85c 29 *
mbed_official 532:fe11edbda85c 30 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
mbed_official 532:fe11edbda85c 31 *
mbed_official 532:fe11edbda85c 32 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 532:fe11edbda85c 33 * are permitted provided that the following conditions are met:
mbed_official 532:fe11edbda85c 34 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 532:fe11edbda85c 35 * this list of conditions and the following disclaimer.
mbed_official 532:fe11edbda85c 36 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 532:fe11edbda85c 37 * this list of conditions and the following disclaimer in the documentation
mbed_official 532:fe11edbda85c 38 * and/or other materials provided with the distribution.
mbed_official 532:fe11edbda85c 39 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mbed_official 532:fe11edbda85c 40 * may be used to endorse or promote products derived from this software
mbed_official 532:fe11edbda85c 41 * without specific prior written permission.
mbed_official 532:fe11edbda85c 42 *
mbed_official 532:fe11edbda85c 43 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 532:fe11edbda85c 44 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 532:fe11edbda85c 45 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 532:fe11edbda85c 46 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 532:fe11edbda85c 47 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 532:fe11edbda85c 48 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 532:fe11edbda85c 49 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 532:fe11edbda85c 50 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 532:fe11edbda85c 51 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 532:fe11edbda85c 52 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 532:fe11edbda85c 53 *
mbed_official 532:fe11edbda85c 54 ******************************************************************************
mbed_official 532:fe11edbda85c 55 */
mbed_official 532:fe11edbda85c 56
mbed_official 532:fe11edbda85c 57 /* Includes ------------------------------------------------------------------*/
mbed_official 532:fe11edbda85c 58 #include "stm32f4xx_hal.h"
mbed_official 532:fe11edbda85c 59
mbed_official 532:fe11edbda85c 60 /** @addtogroup STM32F4xx_HAL_Driver
mbed_official 532:fe11edbda85c 61 * @{
mbed_official 532:fe11edbda85c 62 */
mbed_official 532:fe11edbda85c 63 /** @defgroup DCMI DCMI
mbed_official 532:fe11edbda85c 64 * @brief DCMI HAL module driver
mbed_official 532:fe11edbda85c 65 * @{
mbed_official 532:fe11edbda85c 66 */
mbed_official 532:fe11edbda85c 67
mbed_official 532:fe11edbda85c 68 #ifdef HAL_DCMI_MODULE_ENABLED
mbed_official 532:fe11edbda85c 69
mbed_official 532:fe11edbda85c 70 #if defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F446xx)
mbed_official 532:fe11edbda85c 71 /* Private typedef -----------------------------------------------------------*/
mbed_official 532:fe11edbda85c 72 /* Private define ------------------------------------------------------------*/
mbed_official 532:fe11edbda85c 73 /* Private macro -------------------------------------------------------------*/
mbed_official 532:fe11edbda85c 74 /* Private variables ---------------------------------------------------------*/
mbed_official 532:fe11edbda85c 75 /* Private function prototypes -----------------------------------------------*/
mbed_official 532:fe11edbda85c 76 /* Exported functions --------------------------------------------------------*/
mbed_official 532:fe11edbda85c 77
mbed_official 532:fe11edbda85c 78 /** @defgroup DCMIEx_Exported_Functions DCMI Extended Exported Functions
mbed_official 532:fe11edbda85c 79 * @{
mbed_official 532:fe11edbda85c 80 */
mbed_official 532:fe11edbda85c 81
mbed_official 532:fe11edbda85c 82 /** @defgroup DCMIEx_Exported_Functions_Group1 Initialization and Configuration functions
mbed_official 532:fe11edbda85c 83 * @brief Initialization and Configuration functions
mbed_official 532:fe11edbda85c 84 *
mbed_official 532:fe11edbda85c 85 @verbatim
mbed_official 532:fe11edbda85c 86 ===============================================================================
mbed_official 532:fe11edbda85c 87 ##### Initialization and Configuration functions #####
mbed_official 532:fe11edbda85c 88 ===============================================================================
mbed_official 532:fe11edbda85c 89 [..] This section provides functions allowing to:
mbed_official 532:fe11edbda85c 90 (+) Initialize and configure the DCMI
mbed_official 532:fe11edbda85c 91 (+) De-initialize the DCMI
mbed_official 532:fe11edbda85c 92
mbed_official 532:fe11edbda85c 93 @endverbatim
mbed_official 532:fe11edbda85c 94 * @{
mbed_official 532:fe11edbda85c 95 */
mbed_official 532:fe11edbda85c 96
mbed_official 532:fe11edbda85c 97 /**
mbed_official 532:fe11edbda85c 98 * @brief Initializes the DCMI according to the specified
mbed_official 532:fe11edbda85c 99 * parameters in the DCMI_InitTypeDef and create the associated handle.
mbed_official 532:fe11edbda85c 100 * @param hdcmi: pointer to a DCMI_HandleTypeDef structure that contains
mbed_official 532:fe11edbda85c 101 * the configuration information for DCMI.
mbed_official 532:fe11edbda85c 102 * @retval HAL status
mbed_official 532:fe11edbda85c 103 */
mbed_official 532:fe11edbda85c 104 HAL_StatusTypeDef HAL_DCMI_Init(DCMI_HandleTypeDef *hdcmi)
mbed_official 532:fe11edbda85c 105 {
mbed_official 532:fe11edbda85c 106 /* Check the DCMI peripheral state */
mbed_official 532:fe11edbda85c 107 if(hdcmi == NULL)
mbed_official 532:fe11edbda85c 108 {
mbed_official 532:fe11edbda85c 109 return HAL_ERROR;
mbed_official 532:fe11edbda85c 110 }
mbed_official 532:fe11edbda85c 111
mbed_official 532:fe11edbda85c 112 /* Check function parameters */
mbed_official 532:fe11edbda85c 113 assert_param(IS_DCMI_ALL_INSTANCE(hdcmi->Instance));
mbed_official 532:fe11edbda85c 114 assert_param(IS_DCMI_PCKPOLARITY(hdcmi->Init.PCKPolarity));
mbed_official 532:fe11edbda85c 115 assert_param(IS_DCMI_VSPOLARITY(hdcmi->Init.VSPolarity));
mbed_official 532:fe11edbda85c 116 assert_param(IS_DCMI_HSPOLARITY(hdcmi->Init.HSPolarity));
mbed_official 532:fe11edbda85c 117 assert_param(IS_DCMI_SYNCHRO(hdcmi->Init.SynchroMode));
mbed_official 532:fe11edbda85c 118 assert_param(IS_DCMI_CAPTURE_RATE(hdcmi->Init.CaptureRate));
mbed_official 532:fe11edbda85c 119 assert_param(IS_DCMI_EXTENDED_DATA(hdcmi->Init.ExtendedDataMode));
mbed_official 532:fe11edbda85c 120 assert_param(IS_DCMI_MODE_JPEG(hdcmi->Init.JPEGMode));
mbed_official 532:fe11edbda85c 121 #if defined(STM32F446xx)
mbed_official 532:fe11edbda85c 122 assert_param(IS_DCMI_BYTE_SELECT_MODE(hdcmi->Init.ByteSelectMode));
mbed_official 532:fe11edbda85c 123 assert_param(IS_DCMI_BYTE_SELECT_START(hdcmi->Init.ByteSelectStart));
mbed_official 532:fe11edbda85c 124 assert_param(IS_DCMI_LINE_SELECT_MODE(hdcmi->Init.LineSelectMode));
mbed_official 532:fe11edbda85c 125 assert_param(IS_DCMI_LINE_SELECT_START(hdcmi->Init.LineSelectStart));
mbed_official 532:fe11edbda85c 126 #endif
mbed_official 532:fe11edbda85c 127 if(hdcmi->State == HAL_DCMI_STATE_RESET)
mbed_official 532:fe11edbda85c 128 {
mbed_official 532:fe11edbda85c 129 /* Init the low level hardware */
mbed_official 532:fe11edbda85c 130 HAL_DCMI_MspInit(hdcmi);
mbed_official 532:fe11edbda85c 131 }
mbed_official 532:fe11edbda85c 132
mbed_official 532:fe11edbda85c 133 /* Change the DCMI state */
mbed_official 532:fe11edbda85c 134 hdcmi->State = HAL_DCMI_STATE_BUSY;
mbed_official 532:fe11edbda85c 135 /* Configures the HS, VS, DE and PC polarity */
mbed_official 532:fe11edbda85c 136 hdcmi->Instance->CR &= ~(DCMI_CR_PCKPOL | DCMI_CR_HSPOL | DCMI_CR_VSPOL | DCMI_CR_EDM_0 |\
mbed_official 532:fe11edbda85c 137 DCMI_CR_EDM_1 | DCMI_CR_FCRC_0 | DCMI_CR_FCRC_1 | DCMI_CR_JPEG |\
mbed_official 532:fe11edbda85c 138 DCMI_CR_ESS
mbed_official 532:fe11edbda85c 139 #if defined(STM32F446xx)
mbed_official 532:fe11edbda85c 140 | DCMI_CR_BSM_0 | DCMI_CR_BSM_1 | DCMI_CR_OEBS |\
mbed_official 532:fe11edbda85c 141 DCMI_CR_LSM | DCMI_CR_OELS
mbed_official 532:fe11edbda85c 142 #endif
mbed_official 532:fe11edbda85c 143 );
mbed_official 532:fe11edbda85c 144 hdcmi->Instance->CR |= (uint32_t)(hdcmi->Init.SynchroMode | hdcmi->Init.CaptureRate |\
mbed_official 532:fe11edbda85c 145 hdcmi->Init.VSPolarity | hdcmi->Init.HSPolarity |\
mbed_official 532:fe11edbda85c 146 hdcmi->Init.PCKPolarity | hdcmi->Init.ExtendedDataMode |\
mbed_official 532:fe11edbda85c 147 hdcmi->Init.JPEGMode
mbed_official 532:fe11edbda85c 148 #if defined(STM32F446xx)
mbed_official 532:fe11edbda85c 149 | hdcmi->Init.ByteSelectMode |\
mbed_official 532:fe11edbda85c 150 hdcmi->Init.ByteSelectStart | hdcmi->Init.LineSelectMode |\
mbed_official 532:fe11edbda85c 151 hdcmi->Init.LineSelectStart
mbed_official 532:fe11edbda85c 152 #endif
mbed_official 532:fe11edbda85c 153 );
mbed_official 532:fe11edbda85c 154 if(hdcmi->Init.SynchroMode == DCMI_SYNCHRO_EMBEDDED)
mbed_official 532:fe11edbda85c 155 {
mbed_official 532:fe11edbda85c 156 DCMI->ESCR = (((uint32_t)hdcmi->Init.SyncroCode.FrameStartCode) |
mbed_official 532:fe11edbda85c 157 ((uint32_t)hdcmi->Init.SyncroCode.LineStartCode << 8)|
mbed_official 532:fe11edbda85c 158 ((uint32_t)hdcmi->Init.SyncroCode.LineEndCode << 16) |
mbed_official 532:fe11edbda85c 159 ((uint32_t)hdcmi->Init.SyncroCode.FrameEndCode << 24));
mbed_official 532:fe11edbda85c 160
mbed_official 532:fe11edbda85c 161 }
mbed_official 532:fe11edbda85c 162
mbed_official 532:fe11edbda85c 163 /* Enable the Line interrupt */
mbed_official 532:fe11edbda85c 164 __HAL_DCMI_ENABLE_IT(hdcmi, DCMI_IT_LINE);
mbed_official 532:fe11edbda85c 165
mbed_official 532:fe11edbda85c 166 /* Enable the VSYNC interrupt */
mbed_official 532:fe11edbda85c 167 __HAL_DCMI_ENABLE_IT(hdcmi, DCMI_IT_VSYNC);
mbed_official 532:fe11edbda85c 168
mbed_official 532:fe11edbda85c 169 /* Enable the Frame capture complete interrupt */
mbed_official 532:fe11edbda85c 170 __HAL_DCMI_ENABLE_IT(hdcmi, DCMI_IT_FRAME);
mbed_official 532:fe11edbda85c 171
mbed_official 532:fe11edbda85c 172 /* Enable the Synchronization error interrupt */
mbed_official 532:fe11edbda85c 173 __HAL_DCMI_ENABLE_IT(hdcmi, DCMI_IT_ERR);
mbed_official 532:fe11edbda85c 174
mbed_official 532:fe11edbda85c 175 /* Enable the Overflow interrupt */
mbed_official 532:fe11edbda85c 176 __HAL_DCMI_ENABLE_IT(hdcmi, DCMI_IT_OVF);
mbed_official 532:fe11edbda85c 177
mbed_official 532:fe11edbda85c 178 /* Enable DCMI by setting DCMIEN bit */
mbed_official 532:fe11edbda85c 179 __HAL_DCMI_ENABLE(hdcmi);
mbed_official 532:fe11edbda85c 180
mbed_official 532:fe11edbda85c 181 /* Update error code */
mbed_official 532:fe11edbda85c 182 hdcmi->ErrorCode = HAL_DCMI_ERROR_NONE;
mbed_official 532:fe11edbda85c 183
mbed_official 532:fe11edbda85c 184 /* Initialize the DCMI state*/
mbed_official 532:fe11edbda85c 185 hdcmi->State = HAL_DCMI_STATE_READY;
mbed_official 532:fe11edbda85c 186
mbed_official 532:fe11edbda85c 187 return HAL_OK;
mbed_official 532:fe11edbda85c 188 }
mbed_official 532:fe11edbda85c 189
mbed_official 532:fe11edbda85c 190
mbed_official 532:fe11edbda85c 191 /**
mbed_official 532:fe11edbda85c 192 * @}
mbed_official 532:fe11edbda85c 193 */
mbed_official 532:fe11edbda85c 194
mbed_official 532:fe11edbda85c 195 /**
mbed_official 532:fe11edbda85c 196 * @}
mbed_official 532:fe11edbda85c 197 */
mbed_official 532:fe11edbda85c 198
mbed_official 532:fe11edbda85c 199 /**
mbed_official 532:fe11edbda85c 200 * @}
mbed_official 532:fe11edbda85c 201 */
mbed_official 532:fe11edbda85c 202 #endif /* STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx */
mbed_official 532:fe11edbda85c 203 #endif /* HAL_DCMI_MODULE_ENABLED */
mbed_official 532:fe11edbda85c 204 /**
mbed_official 532:fe11edbda85c 205 * @}
mbed_official 532:fe11edbda85c 206 */
mbed_official 532:fe11edbda85c 207
mbed_official 532:fe11edbda85c 208 /**
mbed_official 532:fe11edbda85c 209 * @}
mbed_official 532:fe11edbda85c 210 */
mbed_official 532:fe11edbda85c 211
mbed_official 532:fe11edbda85c 212 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/