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