mbed library sources
Fork of mbed-src by
targets/cmsis/TARGET_STM/TARGET_NUCLEO_F030R8/stm32f0xx_syscfg.c@106:ced8cbb51063, 2014-02-26 (annotated)
- Committer:
- mbed_official
- Date:
- Wed Feb 26 09:45:12 2014 +0000
- Revision:
- 106:ced8cbb51063
- Parent:
- 76:aeb1df146756
Synchronized with git revision 4222735eff5868389433f0e9271976b39c8115cd
Full URL: https://github.com/mbedmicro/mbed/commit/4222735eff5868389433f0e9271976b39c8115cd/
[NUCLEO_xxx] Update STM32CubeF4 driver V1.0.0 + update license
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 76:aeb1df146756 | 1 | /** |
mbed_official | 76:aeb1df146756 | 2 | ****************************************************************************** |
mbed_official | 76:aeb1df146756 | 3 | * @file stm32f0xx_syscfg.c |
mbed_official | 76:aeb1df146756 | 4 | * @author MCD Application Team |
mbed_official | 76:aeb1df146756 | 5 | * @version V1.3.0 |
mbed_official | 76:aeb1df146756 | 6 | * @date 16-January-2014 |
mbed_official | 76:aeb1df146756 | 7 | * @brief This file provides firmware functions to manage the following |
mbed_official | 76:aeb1df146756 | 8 | * functionalities of the SYSCFG peripheral: |
mbed_official | 76:aeb1df146756 | 9 | * + Remapping the memory mapped at 0x00000000 |
mbed_official | 76:aeb1df146756 | 10 | * + Remapping the DMA channels |
mbed_official | 76:aeb1df146756 | 11 | * + Enabling I2C fast mode plus driving capability for I2C pins |
mbed_official | 76:aeb1df146756 | 12 | * + Configuring the EXTI lines connection to the GPIO port |
mbed_official | 76:aeb1df146756 | 13 | * + Configuring the CFGR2 features (Connecting some internal signal |
mbed_official | 76:aeb1df146756 | 14 | * to the break input of TIM1) |
mbed_official | 76:aeb1df146756 | 15 | * |
mbed_official | 76:aeb1df146756 | 16 | * @verbatim |
mbed_official | 76:aeb1df146756 | 17 | =============================================================================== |
mbed_official | 76:aeb1df146756 | 18 | ##### How to use this driver ##### |
mbed_official | 76:aeb1df146756 | 19 | =============================================================================== |
mbed_official | 76:aeb1df146756 | 20 | [..] |
mbed_official | 76:aeb1df146756 | 21 | The SYSCFG registers can be accessed only when the SYSCFG |
mbed_official | 76:aeb1df146756 | 22 | interface APB clock is enabled. |
mbed_official | 76:aeb1df146756 | 23 | To enable SYSCFG APB clock use: |
mbed_official | 76:aeb1df146756 | 24 | RCC_APBPeriphClockCmd(RCC_APBPeriph_SYSCFG, ENABLE). |
mbed_official | 76:aeb1df146756 | 25 | * @endverbatim |
mbed_official | 76:aeb1df146756 | 26 | * |
mbed_official | 76:aeb1df146756 | 27 | ****************************************************************************** |
mbed_official | 76:aeb1df146756 | 28 | * @attention |
mbed_official | 76:aeb1df146756 | 29 | * |
mbed_official | 106:ced8cbb51063 | 30 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
mbed_official | 76:aeb1df146756 | 31 | * |
mbed_official | 106:ced8cbb51063 | 32 | * Redistribution and use in source and binary forms, with or without modification, |
mbed_official | 106:ced8cbb51063 | 33 | * are permitted provided that the following conditions are met: |
mbed_official | 106:ced8cbb51063 | 34 | * 1. Redistributions of source code must retain the above copyright notice, |
mbed_official | 106:ced8cbb51063 | 35 | * this list of conditions and the following disclaimer. |
mbed_official | 106:ced8cbb51063 | 36 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
mbed_official | 106:ced8cbb51063 | 37 | * this list of conditions and the following disclaimer in the documentation |
mbed_official | 106:ced8cbb51063 | 38 | * and/or other materials provided with the distribution. |
mbed_official | 106:ced8cbb51063 | 39 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
mbed_official | 106:ced8cbb51063 | 40 | * may be used to endorse or promote products derived from this software |
mbed_official | 106:ced8cbb51063 | 41 | * without specific prior written permission. |
mbed_official | 76:aeb1df146756 | 42 | * |
mbed_official | 106:ced8cbb51063 | 43 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
mbed_official | 106:ced8cbb51063 | 44 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
mbed_official | 106:ced8cbb51063 | 45 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
mbed_official | 106:ced8cbb51063 | 46 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
mbed_official | 106:ced8cbb51063 | 47 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
mbed_official | 106:ced8cbb51063 | 48 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
mbed_official | 106:ced8cbb51063 | 49 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
mbed_official | 106:ced8cbb51063 | 50 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
mbed_official | 106:ced8cbb51063 | 51 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
mbed_official | 106:ced8cbb51063 | 52 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
mbed_official | 76:aeb1df146756 | 53 | * |
mbed_official | 76:aeb1df146756 | 54 | ****************************************************************************** |
mbed_official | 76:aeb1df146756 | 55 | */ |
mbed_official | 76:aeb1df146756 | 56 | |
mbed_official | 76:aeb1df146756 | 57 | /* Includes ------------------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 58 | #include "stm32f0xx_syscfg.h" |
mbed_official | 76:aeb1df146756 | 59 | |
mbed_official | 76:aeb1df146756 | 60 | /** @addtogroup STM32F0xx_StdPeriph_Driver |
mbed_official | 76:aeb1df146756 | 61 | * @{ |
mbed_official | 76:aeb1df146756 | 62 | */ |
mbed_official | 76:aeb1df146756 | 63 | |
mbed_official | 76:aeb1df146756 | 64 | /** @defgroup SYSCFG |
mbed_official | 76:aeb1df146756 | 65 | * @brief SYSCFG driver modules |
mbed_official | 76:aeb1df146756 | 66 | * @{ |
mbed_official | 76:aeb1df146756 | 67 | */ |
mbed_official | 76:aeb1df146756 | 68 | |
mbed_official | 76:aeb1df146756 | 69 | /* Private typedef -----------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 70 | /* Private define ------------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 71 | /* Private macro -------------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 72 | /* Private variables ---------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 73 | /* Private function prototypes -----------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 74 | /* Private functions ---------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 75 | |
mbed_official | 76:aeb1df146756 | 76 | /** @defgroup SYSCFG_Private_Functions |
mbed_official | 76:aeb1df146756 | 77 | * @{ |
mbed_official | 76:aeb1df146756 | 78 | */ |
mbed_official | 76:aeb1df146756 | 79 | |
mbed_official | 76:aeb1df146756 | 80 | /** @defgroup SYSCFG_Group1 SYSCFG Initialization and Configuration functions |
mbed_official | 76:aeb1df146756 | 81 | * @brief SYSCFG Initialization and Configuration functions |
mbed_official | 76:aeb1df146756 | 82 | * |
mbed_official | 76:aeb1df146756 | 83 | @verbatim |
mbed_official | 76:aeb1df146756 | 84 | =============================================================================== |
mbed_official | 76:aeb1df146756 | 85 | ##### SYSCFG Initialization and Configuration functions ##### |
mbed_official | 76:aeb1df146756 | 86 | =============================================================================== |
mbed_official | 76:aeb1df146756 | 87 | |
mbed_official | 76:aeb1df146756 | 88 | @endverbatim |
mbed_official | 76:aeb1df146756 | 89 | * @{ |
mbed_official | 76:aeb1df146756 | 90 | */ |
mbed_official | 76:aeb1df146756 | 91 | |
mbed_official | 76:aeb1df146756 | 92 | /** |
mbed_official | 76:aeb1df146756 | 93 | * @brief Deinitializes the SYSCFG registers to their default reset values. |
mbed_official | 76:aeb1df146756 | 94 | * @param None |
mbed_official | 76:aeb1df146756 | 95 | * @retval None |
mbed_official | 76:aeb1df146756 | 96 | * @note MEM_MODE bits are not affected by APB reset. |
mbed_official | 76:aeb1df146756 | 97 | * @note MEM_MODE bits took the value from the user option bytes. |
mbed_official | 76:aeb1df146756 | 98 | * @note CFGR2 register is not affected by APB reset. |
mbed_official | 76:aeb1df146756 | 99 | * @note CLABBB configuration bits are locked when set. |
mbed_official | 76:aeb1df146756 | 100 | * @note To unlock the configuration, perform a system reset. |
mbed_official | 76:aeb1df146756 | 101 | */ |
mbed_official | 76:aeb1df146756 | 102 | void SYSCFG_DeInit(void) |
mbed_official | 76:aeb1df146756 | 103 | { |
mbed_official | 76:aeb1df146756 | 104 | /* Set SYSCFG_CFGR1 register to reset value without affecting MEM_MODE bits */ |
mbed_official | 76:aeb1df146756 | 105 | SYSCFG->CFGR1 &= SYSCFG_CFGR1_MEM_MODE; |
mbed_official | 76:aeb1df146756 | 106 | /* Set EXTICRx registers to reset value */ |
mbed_official | 76:aeb1df146756 | 107 | SYSCFG->EXTICR[0] = 0; |
mbed_official | 76:aeb1df146756 | 108 | SYSCFG->EXTICR[1] = 0; |
mbed_official | 76:aeb1df146756 | 109 | SYSCFG->EXTICR[2] = 0; |
mbed_official | 76:aeb1df146756 | 110 | SYSCFG->EXTICR[3] = 0; |
mbed_official | 76:aeb1df146756 | 111 | /* Set CFGR2 register to reset value: clear SRAM parity error flag */ |
mbed_official | 76:aeb1df146756 | 112 | SYSCFG->CFGR2 |= (uint32_t) SYSCFG_CFGR2_SRAM_PE; |
mbed_official | 76:aeb1df146756 | 113 | } |
mbed_official | 76:aeb1df146756 | 114 | |
mbed_official | 76:aeb1df146756 | 115 | /** |
mbed_official | 76:aeb1df146756 | 116 | * @brief Configures the memory mapping at address 0x00000000. |
mbed_official | 76:aeb1df146756 | 117 | * @param SYSCFG_MemoryRemap: selects the memory remapping. |
mbed_official | 76:aeb1df146756 | 118 | * This parameter can be one of the following values: |
mbed_official | 76:aeb1df146756 | 119 | * @arg SYSCFG_MemoryRemap_Flash: Main Flash memory mapped at 0x00000000 |
mbed_official | 76:aeb1df146756 | 120 | * @arg SYSCFG_MemoryRemap_SystemMemory: System Flash memory mapped at 0x00000000 |
mbed_official | 76:aeb1df146756 | 121 | * @arg SYSCFG_MemoryRemap_SRAM: Embedded SRAM mapped at 0x00000000 |
mbed_official | 76:aeb1df146756 | 122 | * @retval None |
mbed_official | 76:aeb1df146756 | 123 | */ |
mbed_official | 76:aeb1df146756 | 124 | void SYSCFG_MemoryRemapConfig(uint32_t SYSCFG_MemoryRemap) |
mbed_official | 76:aeb1df146756 | 125 | { |
mbed_official | 76:aeb1df146756 | 126 | uint32_t tmpctrl = 0; |
mbed_official | 76:aeb1df146756 | 127 | |
mbed_official | 76:aeb1df146756 | 128 | /* Check the parameter */ |
mbed_official | 76:aeb1df146756 | 129 | assert_param(IS_SYSCFG_MEMORY_REMAP(SYSCFG_MemoryRemap)); |
mbed_official | 76:aeb1df146756 | 130 | |
mbed_official | 76:aeb1df146756 | 131 | /* Get CFGR1 register value */ |
mbed_official | 76:aeb1df146756 | 132 | tmpctrl = SYSCFG->CFGR1; |
mbed_official | 76:aeb1df146756 | 133 | |
mbed_official | 76:aeb1df146756 | 134 | /* Clear MEM_MODE bits */ |
mbed_official | 76:aeb1df146756 | 135 | tmpctrl &= (uint32_t) (~SYSCFG_CFGR1_MEM_MODE); |
mbed_official | 76:aeb1df146756 | 136 | |
mbed_official | 76:aeb1df146756 | 137 | /* Set the new MEM_MODE bits value */ |
mbed_official | 76:aeb1df146756 | 138 | tmpctrl |= (uint32_t) SYSCFG_MemoryRemap; |
mbed_official | 76:aeb1df146756 | 139 | |
mbed_official | 76:aeb1df146756 | 140 | /* Set CFGR1 register with the new memory remap configuration */ |
mbed_official | 76:aeb1df146756 | 141 | SYSCFG->CFGR1 = tmpctrl; |
mbed_official | 76:aeb1df146756 | 142 | } |
mbed_official | 76:aeb1df146756 | 143 | |
mbed_official | 76:aeb1df146756 | 144 | /** |
mbed_official | 76:aeb1df146756 | 145 | * @brief Configure the DMA channels remapping. |
mbed_official | 76:aeb1df146756 | 146 | * @param SYSCFG_DMARemap: selects the DMA channels remap. |
mbed_official | 76:aeb1df146756 | 147 | * This parameter can be one of the following values: |
mbed_official | 76:aeb1df146756 | 148 | * @arg SYSCFG_DMARemap_TIM17: Remap TIM17 DMA requests from channel1 to channel2 |
mbed_official | 76:aeb1df146756 | 149 | * @arg SYSCFG_DMARemap_TIM16: Remap TIM16 DMA requests from channel3 to channel4 |
mbed_official | 76:aeb1df146756 | 150 | * @arg SYSCFG_DMARemap_USART1Rx: Remap USART1 Rx DMA requests from channel3 to channel5 |
mbed_official | 76:aeb1df146756 | 151 | * @arg SYSCFG_DMARemap_USART1Tx: Remap USART1 Tx DMA requests from channel2 to channel4 |
mbed_official | 76:aeb1df146756 | 152 | * @arg SYSCFG_DMARemap_ADC1: Remap ADC1 DMA requests from channel1 to channel2 |
mbed_official | 76:aeb1df146756 | 153 | * @param NewState: new state of the DMA channel remapping. |
mbed_official | 76:aeb1df146756 | 154 | * This parameter can be: ENABLE or DISABLE. |
mbed_official | 76:aeb1df146756 | 155 | * @note When enabled, DMA channel of the selected peripheral is remapped |
mbed_official | 76:aeb1df146756 | 156 | * @note When disabled, Default DMA channel is mapped to the selected peripheral |
mbed_official | 76:aeb1df146756 | 157 | * @note By default TIM17 DMA requests is mapped to channel 1, |
mbed_official | 76:aeb1df146756 | 158 | * use SYSCFG_DMAChannelRemapConfig(SYSCFG_DMARemap_TIM17, Enable) to remap |
mbed_official | 76:aeb1df146756 | 159 | * TIM17 DMA requests to channel 2 and use |
mbed_official | 76:aeb1df146756 | 160 | * SYSCFG_DMAChannelRemapConfig(SYSCFG_DMARemap_TIM17, Disable) to map |
mbed_official | 76:aeb1df146756 | 161 | * TIM17 DMA requests to channel 1 (default mapping) |
mbed_official | 76:aeb1df146756 | 162 | * @retval None |
mbed_official | 76:aeb1df146756 | 163 | */ |
mbed_official | 76:aeb1df146756 | 164 | void SYSCFG_DMAChannelRemapConfig(uint32_t SYSCFG_DMARemap, FunctionalState NewState) |
mbed_official | 76:aeb1df146756 | 165 | { |
mbed_official | 76:aeb1df146756 | 166 | /* Check the parameters */ |
mbed_official | 76:aeb1df146756 | 167 | assert_param(IS_SYSCFG_DMA_REMAP(SYSCFG_DMARemap)); |
mbed_official | 76:aeb1df146756 | 168 | assert_param(IS_FUNCTIONAL_STATE(NewState)); |
mbed_official | 76:aeb1df146756 | 169 | |
mbed_official | 76:aeb1df146756 | 170 | if (NewState != DISABLE) |
mbed_official | 76:aeb1df146756 | 171 | { |
mbed_official | 76:aeb1df146756 | 172 | /* Remap the DMA channel */ |
mbed_official | 76:aeb1df146756 | 173 | SYSCFG->CFGR1 |= (uint32_t)SYSCFG_DMARemap; |
mbed_official | 76:aeb1df146756 | 174 | } |
mbed_official | 76:aeb1df146756 | 175 | else |
mbed_official | 76:aeb1df146756 | 176 | { |
mbed_official | 76:aeb1df146756 | 177 | /* use the default DMA channel mapping */ |
mbed_official | 76:aeb1df146756 | 178 | SYSCFG->CFGR1 &= (uint32_t)(~SYSCFG_DMARemap); |
mbed_official | 76:aeb1df146756 | 179 | } |
mbed_official | 76:aeb1df146756 | 180 | } |
mbed_official | 76:aeb1df146756 | 181 | |
mbed_official | 76:aeb1df146756 | 182 | /** |
mbed_official | 76:aeb1df146756 | 183 | * @brief Configure the I2C fast mode plus driving capability. |
mbed_official | 76:aeb1df146756 | 184 | * @param SYSCFG_I2CFastModePlus: selects the pin. |
mbed_official | 76:aeb1df146756 | 185 | * This parameter can be one of the following values: |
mbed_official | 76:aeb1df146756 | 186 | * @arg SYSCFG_I2CFastModePlus_PB6: Configure fast mode plus driving capability for PB6 |
mbed_official | 76:aeb1df146756 | 187 | * @arg SYSCFG_I2CFastModePlus_PB7: Configure fast mode plus driving capability for PB7 |
mbed_official | 76:aeb1df146756 | 188 | * @arg SYSCFG_I2CFastModePlus_PB8: Configure fast mode plus driving capability for PB8 |
mbed_official | 76:aeb1df146756 | 189 | * @arg SYSCFG_I2CFastModePlus_PB9: Configure fast mode plus driving capability for PB9 |
mbed_official | 76:aeb1df146756 | 190 | * @arg SYSCFG_I2CFastModePlus_PA9: Configure fast mode plus driving capability for PA9 (only for STM32F031 and STM32F030 devices) |
mbed_official | 76:aeb1df146756 | 191 | * @arg SYSCFG_I2CFastModePlus_PA10: Configure fast mode plus driving capability for PA10 (only for STM32F031 and STM32F030 devices) |
mbed_official | 76:aeb1df146756 | 192 | * @arg SYSCFG_I2CFastModePlus_I2C1: Configure fast mode plus driving capability for PB10, PB11, PF6 and PF7(only for STM32F031 and STM32F030 devices) |
mbed_official | 76:aeb1df146756 | 193 | * @arg SYSCFG_I2CFastModePlus_I2C2: Configure fast mode plus driving capability for I2C2 pins, available only for STM32F072 devices |
mbed_official | 76:aeb1df146756 | 194 | * |
mbed_official | 76:aeb1df146756 | 195 | * @param NewState: new state of the DMA channel remapping. |
mbed_official | 76:aeb1df146756 | 196 | * This parameter can be: ENABLE or DISABLE. |
mbed_official | 76:aeb1df146756 | 197 | * @note ENABLE: Enable fast mode plus driving capability for selected I2C pin |
mbed_official | 76:aeb1df146756 | 198 | * @note DISABLE: Disable fast mode plus driving capability for selected I2C pin |
mbed_official | 76:aeb1df146756 | 199 | * @note For I2C1, fast mode plus driving capability can be enabled on all selected |
mbed_official | 76:aeb1df146756 | 200 | * I2C1 pins using SYSCFG_I2CFastModePlus_I2C1 parameter or independently |
mbed_official | 76:aeb1df146756 | 201 | * on each one of the following pins PB6, PB7, PB8 and PB9. |
mbed_official | 76:aeb1df146756 | 202 | * @note For remaing I2C1 pins (PA14, PA15...) fast mode plus driving capability |
mbed_official | 76:aeb1df146756 | 203 | * can be enabled only by using SYSCFG_I2CFastModePlus_I2C1 parameter. |
mbed_official | 76:aeb1df146756 | 204 | * @note For all I2C2 pins fast mode plus driving capability can be enabled |
mbed_official | 76:aeb1df146756 | 205 | * only by using SYSCFG_I2CFastModePlus_I2C2 parameter. |
mbed_official | 76:aeb1df146756 | 206 | * @retval None |
mbed_official | 76:aeb1df146756 | 207 | */ |
mbed_official | 76:aeb1df146756 | 208 | void SYSCFG_I2CFastModePlusConfig(uint32_t SYSCFG_I2CFastModePlus, FunctionalState NewState) |
mbed_official | 76:aeb1df146756 | 209 | { |
mbed_official | 76:aeb1df146756 | 210 | /* Check the parameters */ |
mbed_official | 76:aeb1df146756 | 211 | assert_param(IS_SYSCFG_I2C_FMP(SYSCFG_I2CFastModePlus)); |
mbed_official | 76:aeb1df146756 | 212 | assert_param(IS_FUNCTIONAL_STATE(NewState)); |
mbed_official | 76:aeb1df146756 | 213 | |
mbed_official | 76:aeb1df146756 | 214 | if (NewState != DISABLE) |
mbed_official | 76:aeb1df146756 | 215 | { |
mbed_official | 76:aeb1df146756 | 216 | /* Enable fast mode plus driving capability for selected pin */ |
mbed_official | 76:aeb1df146756 | 217 | SYSCFG->CFGR1 |= (uint32_t)SYSCFG_I2CFastModePlus; |
mbed_official | 76:aeb1df146756 | 218 | } |
mbed_official | 76:aeb1df146756 | 219 | else |
mbed_official | 76:aeb1df146756 | 220 | { |
mbed_official | 76:aeb1df146756 | 221 | /* Disable fast mode plus driving capability for selected pin */ |
mbed_official | 76:aeb1df146756 | 222 | SYSCFG->CFGR1 &= (uint32_t)(~SYSCFG_I2CFastModePlus); |
mbed_official | 76:aeb1df146756 | 223 | } |
mbed_official | 76:aeb1df146756 | 224 | } |
mbed_official | 76:aeb1df146756 | 225 | |
mbed_official | 76:aeb1df146756 | 226 | /** |
mbed_official | 76:aeb1df146756 | 227 | * @brief Selects the GPIO pin used as EXTI Line. |
mbed_official | 76:aeb1df146756 | 228 | * @param EXTI_PortSourceGPIOx: selects the GPIO port to be used as source |
mbed_official | 76:aeb1df146756 | 229 | * for EXTI lines where x can be (A, B, C, D, E or F). |
mbed_official | 76:aeb1df146756 | 230 | * @note GPIOE is available only for STM32F072. |
mbed_official | 76:aeb1df146756 | 231 | * @note GPIOD is not available for STM32F031. |
mbed_official | 76:aeb1df146756 | 232 | * @param EXTI_PinSourcex: specifies the EXTI line to be configured. |
mbed_official | 76:aeb1df146756 | 233 | * @note This parameter can be EXTI_PinSourcex where x can be: |
mbed_official | 76:aeb1df146756 | 234 | * For STM32F051 and STM32F030: (0..15) for GPIOA, GPIOB, GPIOC, (2) for GPIOD and (0..1, 4..7) for GIIOF. |
mbed_official | 76:aeb1df146756 | 235 | * For STM32F072: (0..15) for GPIOA, GPIOB, GPIOC, GPIOD, GPIOE, (0..10) for GPIOF. |
mbed_official | 76:aeb1df146756 | 236 | * For STM32F031: (0..15) for GPIOA, GPIOB, (13..15) for GPIOC and (0..1, 6..7) for GPIOF. |
mbed_official | 76:aeb1df146756 | 237 | * @retval None |
mbed_official | 76:aeb1df146756 | 238 | */ |
mbed_official | 76:aeb1df146756 | 239 | void SYSCFG_EXTILineConfig(uint8_t EXTI_PortSourceGPIOx, uint8_t EXTI_PinSourcex) |
mbed_official | 76:aeb1df146756 | 240 | { |
mbed_official | 76:aeb1df146756 | 241 | uint32_t tmp = 0x00; |
mbed_official | 76:aeb1df146756 | 242 | |
mbed_official | 76:aeb1df146756 | 243 | /* Check the parameters */ |
mbed_official | 76:aeb1df146756 | 244 | assert_param(IS_EXTI_PORT_SOURCE(EXTI_PortSourceGPIOx)); |
mbed_official | 76:aeb1df146756 | 245 | assert_param(IS_EXTI_PIN_SOURCE(EXTI_PinSourcex)); |
mbed_official | 76:aeb1df146756 | 246 | |
mbed_official | 76:aeb1df146756 | 247 | tmp = ((uint32_t)0x0F) << (0x04 * (EXTI_PinSourcex & (uint8_t)0x03)); |
mbed_official | 76:aeb1df146756 | 248 | SYSCFG->EXTICR[EXTI_PinSourcex >> 0x02] &= ~tmp; |
mbed_official | 76:aeb1df146756 | 249 | SYSCFG->EXTICR[EXTI_PinSourcex >> 0x02] |= (((uint32_t)EXTI_PortSourceGPIOx) << (0x04 * (EXTI_PinSourcex & (uint8_t)0x03))); |
mbed_official | 76:aeb1df146756 | 250 | } |
mbed_official | 76:aeb1df146756 | 251 | |
mbed_official | 76:aeb1df146756 | 252 | /** |
mbed_official | 76:aeb1df146756 | 253 | * @brief Connect the selected parameter to the break input of TIM1. |
mbed_official | 76:aeb1df146756 | 254 | * @note The selected configuration is locked and can be unlocked by system reset |
mbed_official | 76:aeb1df146756 | 255 | * @param SYSCFG_Break: selects the configuration to be connected to break |
mbed_official | 76:aeb1df146756 | 256 | * input of TIM1 |
mbed_official | 76:aeb1df146756 | 257 | * This parameter can be any combination of the following values: |
mbed_official | 76:aeb1df146756 | 258 | * @arg SYSCFG_Break_PVD: Connects the PVD event to the Break Input of TIM1,, not avaailable for STM32F030 devices. |
mbed_official | 76:aeb1df146756 | 259 | * @arg SYSCFG_Break_SRAMParity: Connects the SRAM_PARITY error signal to the Break Input of TIM1 . |
mbed_official | 76:aeb1df146756 | 260 | * @arg SYSCFG_Break_Lockup: Connects Lockup output of CortexM0 to the break input of TIM1. |
mbed_official | 76:aeb1df146756 | 261 | * @retval None |
mbed_official | 76:aeb1df146756 | 262 | */ |
mbed_official | 76:aeb1df146756 | 263 | void SYSCFG_BreakConfig(uint32_t SYSCFG_Break) |
mbed_official | 76:aeb1df146756 | 264 | { |
mbed_official | 76:aeb1df146756 | 265 | /* Check the parameter */ |
mbed_official | 76:aeb1df146756 | 266 | assert_param(IS_SYSCFG_LOCK_CONFIG(SYSCFG_Break)); |
mbed_official | 76:aeb1df146756 | 267 | |
mbed_official | 76:aeb1df146756 | 268 | SYSCFG->CFGR2 |= (uint32_t) SYSCFG_Break; |
mbed_official | 76:aeb1df146756 | 269 | } |
mbed_official | 76:aeb1df146756 | 270 | |
mbed_official | 76:aeb1df146756 | 271 | /** |
mbed_official | 76:aeb1df146756 | 272 | * @brief Checks whether the specified SYSCFG flag is set or not. |
mbed_official | 76:aeb1df146756 | 273 | * @param SYSCFG_Flag: specifies the SYSCFG flag to check. |
mbed_official | 76:aeb1df146756 | 274 | * This parameter can be one of the following values: |
mbed_official | 76:aeb1df146756 | 275 | * @arg SYSCFG_FLAG_PE: SRAM parity error flag. |
mbed_official | 76:aeb1df146756 | 276 | * @retval The new state of SYSCFG_Flag (SET or RESET). |
mbed_official | 76:aeb1df146756 | 277 | */ |
mbed_official | 76:aeb1df146756 | 278 | FlagStatus SYSCFG_GetFlagStatus(uint32_t SYSCFG_Flag) |
mbed_official | 76:aeb1df146756 | 279 | { |
mbed_official | 76:aeb1df146756 | 280 | FlagStatus bitstatus = RESET; |
mbed_official | 76:aeb1df146756 | 281 | |
mbed_official | 76:aeb1df146756 | 282 | /* Check the parameter */ |
mbed_official | 76:aeb1df146756 | 283 | assert_param(IS_SYSCFG_FLAG(SYSCFG_Flag)); |
mbed_official | 76:aeb1df146756 | 284 | |
mbed_official | 76:aeb1df146756 | 285 | /* Check the status of the specified SPI flag */ |
mbed_official | 76:aeb1df146756 | 286 | if ((SYSCFG->CFGR2 & SYSCFG_CFGR2_SRAM_PE) != (uint32_t)RESET) |
mbed_official | 76:aeb1df146756 | 287 | { |
mbed_official | 76:aeb1df146756 | 288 | /* SYSCFG_Flag is set */ |
mbed_official | 76:aeb1df146756 | 289 | bitstatus = SET; |
mbed_official | 76:aeb1df146756 | 290 | } |
mbed_official | 76:aeb1df146756 | 291 | else |
mbed_official | 76:aeb1df146756 | 292 | { |
mbed_official | 76:aeb1df146756 | 293 | /* SYSCFG_Flag is reset */ |
mbed_official | 76:aeb1df146756 | 294 | bitstatus = RESET; |
mbed_official | 76:aeb1df146756 | 295 | } |
mbed_official | 76:aeb1df146756 | 296 | /* Return the SYSCFG_Flag status */ |
mbed_official | 76:aeb1df146756 | 297 | return bitstatus; |
mbed_official | 76:aeb1df146756 | 298 | } |
mbed_official | 76:aeb1df146756 | 299 | |
mbed_official | 76:aeb1df146756 | 300 | /** |
mbed_official | 76:aeb1df146756 | 301 | * @brief Clear the selected SYSCFG flag. |
mbed_official | 76:aeb1df146756 | 302 | * @param SYSCFG_Flag: selects the flag to be cleared. |
mbed_official | 76:aeb1df146756 | 303 | * This parameter can be any combination of the following values: |
mbed_official | 76:aeb1df146756 | 304 | * @arg SYSCFG_FLAG_PE: SRAM parity error flag. |
mbed_official | 76:aeb1df146756 | 305 | * @retval None |
mbed_official | 76:aeb1df146756 | 306 | */ |
mbed_official | 76:aeb1df146756 | 307 | void SYSCFG_ClearFlag(uint32_t SYSCFG_Flag) |
mbed_official | 76:aeb1df146756 | 308 | { |
mbed_official | 76:aeb1df146756 | 309 | /* Check the parameter */ |
mbed_official | 76:aeb1df146756 | 310 | assert_param(IS_SYSCFG_FLAG(SYSCFG_Flag)); |
mbed_official | 76:aeb1df146756 | 311 | |
mbed_official | 76:aeb1df146756 | 312 | SYSCFG->CFGR2 |= (uint32_t) SYSCFG_Flag; |
mbed_official | 76:aeb1df146756 | 313 | } |
mbed_official | 76:aeb1df146756 | 314 | |
mbed_official | 76:aeb1df146756 | 315 | /** |
mbed_official | 76:aeb1df146756 | 316 | * @} |
mbed_official | 76:aeb1df146756 | 317 | */ |
mbed_official | 76:aeb1df146756 | 318 | |
mbed_official | 76:aeb1df146756 | 319 | /** |
mbed_official | 76:aeb1df146756 | 320 | * @} |
mbed_official | 76:aeb1df146756 | 321 | */ |
mbed_official | 76:aeb1df146756 | 322 | |
mbed_official | 76:aeb1df146756 | 323 | /** |
mbed_official | 76:aeb1df146756 | 324 | * @} |
mbed_official | 76:aeb1df146756 | 325 | */ |
mbed_official | 76:aeb1df146756 | 326 | |
mbed_official | 76:aeb1df146756 | 327 | /** |
mbed_official | 76:aeb1df146756 | 328 | * @} |
mbed_official | 76:aeb1df146756 | 329 | */ |
mbed_official | 76:aeb1df146756 | 330 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |