mbed library with additional peripherals for ST F401 board
Fork of mbed-src by
This mbed LIB has additional peripherals for ST F401 board
- UART2 : PA_3 rx, PA_2 tx
- UART3 : PC_7 rx, PC_6 tx
- I2C2 : PB_3 SDA, PB_10 SCL
- I2C3 : PB_4 SDA, PA_8 SCL
targets/cmsis/TARGET_STM/TARGET_NUCLEO_F030R8/stm32f0xx_syscfg.c@76:aeb1df146756, 2014-01-27 (annotated)
- Committer:
- mbed_official
- Date:
- Mon Jan 27 14:30:07 2014 +0000
- Revision:
- 76:aeb1df146756
- Child:
- 106:ced8cbb51063
Synchronized with git revision a31ec9c5f7bcb5c8a1b2eced103f6a1dfa921abd
Full URL: https://github.com/mbedmicro/mbed/commit/a31ec9c5f7bcb5c8a1b2eced103f6a1dfa921abd/
Add NUCLEO_L152RE
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 | 76:aeb1df146756 | 30 | * <h2><center>© COPYRIGHT 2014 STMicroelectronics</center></h2> |
mbed_official | 76:aeb1df146756 | 31 | * |
mbed_official | 76:aeb1df146756 | 32 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); |
mbed_official | 76:aeb1df146756 | 33 | * You may not use this file except in compliance with the License. |
mbed_official | 76:aeb1df146756 | 34 | * You may obtain a copy of the License at: |
mbed_official | 76:aeb1df146756 | 35 | * |
mbed_official | 76:aeb1df146756 | 36 | * http://www.st.com/software_license_agreement_liberty_v2 |
mbed_official | 76:aeb1df146756 | 37 | * |
mbed_official | 76:aeb1df146756 | 38 | * Unless required by applicable law or agreed to in writing, software |
mbed_official | 76:aeb1df146756 | 39 | * distributed under the License is distributed on an "AS IS" BASIS, |
mbed_official | 76:aeb1df146756 | 40 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
mbed_official | 76:aeb1df146756 | 41 | * See the License for the specific language governing permissions and |
mbed_official | 76:aeb1df146756 | 42 | * limitations under the License. |
mbed_official | 76:aeb1df146756 | 43 | * |
mbed_official | 76:aeb1df146756 | 44 | ****************************************************************************** |
mbed_official | 76:aeb1df146756 | 45 | */ |
mbed_official | 76:aeb1df146756 | 46 | |
mbed_official | 76:aeb1df146756 | 47 | /* Includes ------------------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 48 | #include "stm32f0xx_syscfg.h" |
mbed_official | 76:aeb1df146756 | 49 | |
mbed_official | 76:aeb1df146756 | 50 | /** @addtogroup STM32F0xx_StdPeriph_Driver |
mbed_official | 76:aeb1df146756 | 51 | * @{ |
mbed_official | 76:aeb1df146756 | 52 | */ |
mbed_official | 76:aeb1df146756 | 53 | |
mbed_official | 76:aeb1df146756 | 54 | /** @defgroup SYSCFG |
mbed_official | 76:aeb1df146756 | 55 | * @brief SYSCFG driver modules |
mbed_official | 76:aeb1df146756 | 56 | * @{ |
mbed_official | 76:aeb1df146756 | 57 | */ |
mbed_official | 76:aeb1df146756 | 58 | |
mbed_official | 76:aeb1df146756 | 59 | /* Private typedef -----------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 60 | /* Private define ------------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 61 | /* Private macro -------------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 62 | /* Private variables ---------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 63 | /* Private function prototypes -----------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 64 | /* Private functions ---------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 65 | |
mbed_official | 76:aeb1df146756 | 66 | /** @defgroup SYSCFG_Private_Functions |
mbed_official | 76:aeb1df146756 | 67 | * @{ |
mbed_official | 76:aeb1df146756 | 68 | */ |
mbed_official | 76:aeb1df146756 | 69 | |
mbed_official | 76:aeb1df146756 | 70 | /** @defgroup SYSCFG_Group1 SYSCFG Initialization and Configuration functions |
mbed_official | 76:aeb1df146756 | 71 | * @brief SYSCFG Initialization and Configuration functions |
mbed_official | 76:aeb1df146756 | 72 | * |
mbed_official | 76:aeb1df146756 | 73 | @verbatim |
mbed_official | 76:aeb1df146756 | 74 | =============================================================================== |
mbed_official | 76:aeb1df146756 | 75 | ##### SYSCFG Initialization and Configuration functions ##### |
mbed_official | 76:aeb1df146756 | 76 | =============================================================================== |
mbed_official | 76:aeb1df146756 | 77 | |
mbed_official | 76:aeb1df146756 | 78 | @endverbatim |
mbed_official | 76:aeb1df146756 | 79 | * @{ |
mbed_official | 76:aeb1df146756 | 80 | */ |
mbed_official | 76:aeb1df146756 | 81 | |
mbed_official | 76:aeb1df146756 | 82 | /** |
mbed_official | 76:aeb1df146756 | 83 | * @brief Deinitializes the SYSCFG registers to their default reset values. |
mbed_official | 76:aeb1df146756 | 84 | * @param None |
mbed_official | 76:aeb1df146756 | 85 | * @retval None |
mbed_official | 76:aeb1df146756 | 86 | * @note MEM_MODE bits are not affected by APB reset. |
mbed_official | 76:aeb1df146756 | 87 | * @note MEM_MODE bits took the value from the user option bytes. |
mbed_official | 76:aeb1df146756 | 88 | * @note CFGR2 register is not affected by APB reset. |
mbed_official | 76:aeb1df146756 | 89 | * @note CLABBB configuration bits are locked when set. |
mbed_official | 76:aeb1df146756 | 90 | * @note To unlock the configuration, perform a system reset. |
mbed_official | 76:aeb1df146756 | 91 | */ |
mbed_official | 76:aeb1df146756 | 92 | void SYSCFG_DeInit(void) |
mbed_official | 76:aeb1df146756 | 93 | { |
mbed_official | 76:aeb1df146756 | 94 | /* Set SYSCFG_CFGR1 register to reset value without affecting MEM_MODE bits */ |
mbed_official | 76:aeb1df146756 | 95 | SYSCFG->CFGR1 &= SYSCFG_CFGR1_MEM_MODE; |
mbed_official | 76:aeb1df146756 | 96 | /* Set EXTICRx registers to reset value */ |
mbed_official | 76:aeb1df146756 | 97 | SYSCFG->EXTICR[0] = 0; |
mbed_official | 76:aeb1df146756 | 98 | SYSCFG->EXTICR[1] = 0; |
mbed_official | 76:aeb1df146756 | 99 | SYSCFG->EXTICR[2] = 0; |
mbed_official | 76:aeb1df146756 | 100 | SYSCFG->EXTICR[3] = 0; |
mbed_official | 76:aeb1df146756 | 101 | /* Set CFGR2 register to reset value: clear SRAM parity error flag */ |
mbed_official | 76:aeb1df146756 | 102 | SYSCFG->CFGR2 |= (uint32_t) SYSCFG_CFGR2_SRAM_PE; |
mbed_official | 76:aeb1df146756 | 103 | } |
mbed_official | 76:aeb1df146756 | 104 | |
mbed_official | 76:aeb1df146756 | 105 | /** |
mbed_official | 76:aeb1df146756 | 106 | * @brief Configures the memory mapping at address 0x00000000. |
mbed_official | 76:aeb1df146756 | 107 | * @param SYSCFG_MemoryRemap: selects the memory remapping. |
mbed_official | 76:aeb1df146756 | 108 | * This parameter can be one of the following values: |
mbed_official | 76:aeb1df146756 | 109 | * @arg SYSCFG_MemoryRemap_Flash: Main Flash memory mapped at 0x00000000 |
mbed_official | 76:aeb1df146756 | 110 | * @arg SYSCFG_MemoryRemap_SystemMemory: System Flash memory mapped at 0x00000000 |
mbed_official | 76:aeb1df146756 | 111 | * @arg SYSCFG_MemoryRemap_SRAM: Embedded SRAM mapped at 0x00000000 |
mbed_official | 76:aeb1df146756 | 112 | * @retval None |
mbed_official | 76:aeb1df146756 | 113 | */ |
mbed_official | 76:aeb1df146756 | 114 | void SYSCFG_MemoryRemapConfig(uint32_t SYSCFG_MemoryRemap) |
mbed_official | 76:aeb1df146756 | 115 | { |
mbed_official | 76:aeb1df146756 | 116 | uint32_t tmpctrl = 0; |
mbed_official | 76:aeb1df146756 | 117 | |
mbed_official | 76:aeb1df146756 | 118 | /* Check the parameter */ |
mbed_official | 76:aeb1df146756 | 119 | assert_param(IS_SYSCFG_MEMORY_REMAP(SYSCFG_MemoryRemap)); |
mbed_official | 76:aeb1df146756 | 120 | |
mbed_official | 76:aeb1df146756 | 121 | /* Get CFGR1 register value */ |
mbed_official | 76:aeb1df146756 | 122 | tmpctrl = SYSCFG->CFGR1; |
mbed_official | 76:aeb1df146756 | 123 | |
mbed_official | 76:aeb1df146756 | 124 | /* Clear MEM_MODE bits */ |
mbed_official | 76:aeb1df146756 | 125 | tmpctrl &= (uint32_t) (~SYSCFG_CFGR1_MEM_MODE); |
mbed_official | 76:aeb1df146756 | 126 | |
mbed_official | 76:aeb1df146756 | 127 | /* Set the new MEM_MODE bits value */ |
mbed_official | 76:aeb1df146756 | 128 | tmpctrl |= (uint32_t) SYSCFG_MemoryRemap; |
mbed_official | 76:aeb1df146756 | 129 | |
mbed_official | 76:aeb1df146756 | 130 | /* Set CFGR1 register with the new memory remap configuration */ |
mbed_official | 76:aeb1df146756 | 131 | SYSCFG->CFGR1 = tmpctrl; |
mbed_official | 76:aeb1df146756 | 132 | } |
mbed_official | 76:aeb1df146756 | 133 | |
mbed_official | 76:aeb1df146756 | 134 | /** |
mbed_official | 76:aeb1df146756 | 135 | * @brief Configure the DMA channels remapping. |
mbed_official | 76:aeb1df146756 | 136 | * @param SYSCFG_DMARemap: selects the DMA channels remap. |
mbed_official | 76:aeb1df146756 | 137 | * This parameter can be one of the following values: |
mbed_official | 76:aeb1df146756 | 138 | * @arg SYSCFG_DMARemap_TIM17: Remap TIM17 DMA requests from channel1 to channel2 |
mbed_official | 76:aeb1df146756 | 139 | * @arg SYSCFG_DMARemap_TIM16: Remap TIM16 DMA requests from channel3 to channel4 |
mbed_official | 76:aeb1df146756 | 140 | * @arg SYSCFG_DMARemap_USART1Rx: Remap USART1 Rx DMA requests from channel3 to channel5 |
mbed_official | 76:aeb1df146756 | 141 | * @arg SYSCFG_DMARemap_USART1Tx: Remap USART1 Tx DMA requests from channel2 to channel4 |
mbed_official | 76:aeb1df146756 | 142 | * @arg SYSCFG_DMARemap_ADC1: Remap ADC1 DMA requests from channel1 to channel2 |
mbed_official | 76:aeb1df146756 | 143 | * @param NewState: new state of the DMA channel remapping. |
mbed_official | 76:aeb1df146756 | 144 | * This parameter can be: ENABLE or DISABLE. |
mbed_official | 76:aeb1df146756 | 145 | * @note When enabled, DMA channel of the selected peripheral is remapped |
mbed_official | 76:aeb1df146756 | 146 | * @note When disabled, Default DMA channel is mapped to the selected peripheral |
mbed_official | 76:aeb1df146756 | 147 | * @note By default TIM17 DMA requests is mapped to channel 1, |
mbed_official | 76:aeb1df146756 | 148 | * use SYSCFG_DMAChannelRemapConfig(SYSCFG_DMARemap_TIM17, Enable) to remap |
mbed_official | 76:aeb1df146756 | 149 | * TIM17 DMA requests to channel 2 and use |
mbed_official | 76:aeb1df146756 | 150 | * SYSCFG_DMAChannelRemapConfig(SYSCFG_DMARemap_TIM17, Disable) to map |
mbed_official | 76:aeb1df146756 | 151 | * TIM17 DMA requests to channel 1 (default mapping) |
mbed_official | 76:aeb1df146756 | 152 | * @retval None |
mbed_official | 76:aeb1df146756 | 153 | */ |
mbed_official | 76:aeb1df146756 | 154 | void SYSCFG_DMAChannelRemapConfig(uint32_t SYSCFG_DMARemap, FunctionalState NewState) |
mbed_official | 76:aeb1df146756 | 155 | { |
mbed_official | 76:aeb1df146756 | 156 | /* Check the parameters */ |
mbed_official | 76:aeb1df146756 | 157 | assert_param(IS_SYSCFG_DMA_REMAP(SYSCFG_DMARemap)); |
mbed_official | 76:aeb1df146756 | 158 | assert_param(IS_FUNCTIONAL_STATE(NewState)); |
mbed_official | 76:aeb1df146756 | 159 | |
mbed_official | 76:aeb1df146756 | 160 | if (NewState != DISABLE) |
mbed_official | 76:aeb1df146756 | 161 | { |
mbed_official | 76:aeb1df146756 | 162 | /* Remap the DMA channel */ |
mbed_official | 76:aeb1df146756 | 163 | SYSCFG->CFGR1 |= (uint32_t)SYSCFG_DMARemap; |
mbed_official | 76:aeb1df146756 | 164 | } |
mbed_official | 76:aeb1df146756 | 165 | else |
mbed_official | 76:aeb1df146756 | 166 | { |
mbed_official | 76:aeb1df146756 | 167 | /* use the default DMA channel mapping */ |
mbed_official | 76:aeb1df146756 | 168 | SYSCFG->CFGR1 &= (uint32_t)(~SYSCFG_DMARemap); |
mbed_official | 76:aeb1df146756 | 169 | } |
mbed_official | 76:aeb1df146756 | 170 | } |
mbed_official | 76:aeb1df146756 | 171 | |
mbed_official | 76:aeb1df146756 | 172 | /** |
mbed_official | 76:aeb1df146756 | 173 | * @brief Configure the I2C fast mode plus driving capability. |
mbed_official | 76:aeb1df146756 | 174 | * @param SYSCFG_I2CFastModePlus: selects the pin. |
mbed_official | 76:aeb1df146756 | 175 | * This parameter can be one of the following values: |
mbed_official | 76:aeb1df146756 | 176 | * @arg SYSCFG_I2CFastModePlus_PB6: Configure fast mode plus driving capability for PB6 |
mbed_official | 76:aeb1df146756 | 177 | * @arg SYSCFG_I2CFastModePlus_PB7: Configure fast mode plus driving capability for PB7 |
mbed_official | 76:aeb1df146756 | 178 | * @arg SYSCFG_I2CFastModePlus_PB8: Configure fast mode plus driving capability for PB8 |
mbed_official | 76:aeb1df146756 | 179 | * @arg SYSCFG_I2CFastModePlus_PB9: Configure fast mode plus driving capability for PB9 |
mbed_official | 76:aeb1df146756 | 180 | * @arg SYSCFG_I2CFastModePlus_PA9: Configure fast mode plus driving capability for PA9 (only for STM32F031 and STM32F030 devices) |
mbed_official | 76:aeb1df146756 | 181 | * @arg SYSCFG_I2CFastModePlus_PA10: Configure fast mode plus driving capability for PA10 (only for STM32F031 and STM32F030 devices) |
mbed_official | 76:aeb1df146756 | 182 | * @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 | 183 | * @arg SYSCFG_I2CFastModePlus_I2C2: Configure fast mode plus driving capability for I2C2 pins, available only for STM32F072 devices |
mbed_official | 76:aeb1df146756 | 184 | * |
mbed_official | 76:aeb1df146756 | 185 | * @param NewState: new state of the DMA channel remapping. |
mbed_official | 76:aeb1df146756 | 186 | * This parameter can be: ENABLE or DISABLE. |
mbed_official | 76:aeb1df146756 | 187 | * @note ENABLE: Enable fast mode plus driving capability for selected I2C pin |
mbed_official | 76:aeb1df146756 | 188 | * @note DISABLE: Disable fast mode plus driving capability for selected I2C pin |
mbed_official | 76:aeb1df146756 | 189 | * @note For I2C1, fast mode plus driving capability can be enabled on all selected |
mbed_official | 76:aeb1df146756 | 190 | * I2C1 pins using SYSCFG_I2CFastModePlus_I2C1 parameter or independently |
mbed_official | 76:aeb1df146756 | 191 | * on each one of the following pins PB6, PB7, PB8 and PB9. |
mbed_official | 76:aeb1df146756 | 192 | * @note For remaing I2C1 pins (PA14, PA15...) fast mode plus driving capability |
mbed_official | 76:aeb1df146756 | 193 | * can be enabled only by using SYSCFG_I2CFastModePlus_I2C1 parameter. |
mbed_official | 76:aeb1df146756 | 194 | * @note For all I2C2 pins fast mode plus driving capability can be enabled |
mbed_official | 76:aeb1df146756 | 195 | * only by using SYSCFG_I2CFastModePlus_I2C2 parameter. |
mbed_official | 76:aeb1df146756 | 196 | * @retval None |
mbed_official | 76:aeb1df146756 | 197 | */ |
mbed_official | 76:aeb1df146756 | 198 | void SYSCFG_I2CFastModePlusConfig(uint32_t SYSCFG_I2CFastModePlus, FunctionalState NewState) |
mbed_official | 76:aeb1df146756 | 199 | { |
mbed_official | 76:aeb1df146756 | 200 | /* Check the parameters */ |
mbed_official | 76:aeb1df146756 | 201 | assert_param(IS_SYSCFG_I2C_FMP(SYSCFG_I2CFastModePlus)); |
mbed_official | 76:aeb1df146756 | 202 | assert_param(IS_FUNCTIONAL_STATE(NewState)); |
mbed_official | 76:aeb1df146756 | 203 | |
mbed_official | 76:aeb1df146756 | 204 | if (NewState != DISABLE) |
mbed_official | 76:aeb1df146756 | 205 | { |
mbed_official | 76:aeb1df146756 | 206 | /* Enable fast mode plus driving capability for selected pin */ |
mbed_official | 76:aeb1df146756 | 207 | SYSCFG->CFGR1 |= (uint32_t)SYSCFG_I2CFastModePlus; |
mbed_official | 76:aeb1df146756 | 208 | } |
mbed_official | 76:aeb1df146756 | 209 | else |
mbed_official | 76:aeb1df146756 | 210 | { |
mbed_official | 76:aeb1df146756 | 211 | /* Disable fast mode plus driving capability for selected pin */ |
mbed_official | 76:aeb1df146756 | 212 | SYSCFG->CFGR1 &= (uint32_t)(~SYSCFG_I2CFastModePlus); |
mbed_official | 76:aeb1df146756 | 213 | } |
mbed_official | 76:aeb1df146756 | 214 | } |
mbed_official | 76:aeb1df146756 | 215 | |
mbed_official | 76:aeb1df146756 | 216 | /** |
mbed_official | 76:aeb1df146756 | 217 | * @brief Selects the GPIO pin used as EXTI Line. |
mbed_official | 76:aeb1df146756 | 218 | * @param EXTI_PortSourceGPIOx: selects the GPIO port to be used as source |
mbed_official | 76:aeb1df146756 | 219 | * for EXTI lines where x can be (A, B, C, D, E or F). |
mbed_official | 76:aeb1df146756 | 220 | * @note GPIOE is available only for STM32F072. |
mbed_official | 76:aeb1df146756 | 221 | * @note GPIOD is not available for STM32F031. |
mbed_official | 76:aeb1df146756 | 222 | * @param EXTI_PinSourcex: specifies the EXTI line to be configured. |
mbed_official | 76:aeb1df146756 | 223 | * @note This parameter can be EXTI_PinSourcex where x can be: |
mbed_official | 76:aeb1df146756 | 224 | * For STM32F051 and STM32F030: (0..15) for GPIOA, GPIOB, GPIOC, (2) for GPIOD and (0..1, 4..7) for GIIOF. |
mbed_official | 76:aeb1df146756 | 225 | * For STM32F072: (0..15) for GPIOA, GPIOB, GPIOC, GPIOD, GPIOE, (0..10) for GPIOF. |
mbed_official | 76:aeb1df146756 | 226 | * For STM32F031: (0..15) for GPIOA, GPIOB, (13..15) for GPIOC and (0..1, 6..7) for GPIOF. |
mbed_official | 76:aeb1df146756 | 227 | * @retval None |
mbed_official | 76:aeb1df146756 | 228 | */ |
mbed_official | 76:aeb1df146756 | 229 | void SYSCFG_EXTILineConfig(uint8_t EXTI_PortSourceGPIOx, uint8_t EXTI_PinSourcex) |
mbed_official | 76:aeb1df146756 | 230 | { |
mbed_official | 76:aeb1df146756 | 231 | uint32_t tmp = 0x00; |
mbed_official | 76:aeb1df146756 | 232 | |
mbed_official | 76:aeb1df146756 | 233 | /* Check the parameters */ |
mbed_official | 76:aeb1df146756 | 234 | assert_param(IS_EXTI_PORT_SOURCE(EXTI_PortSourceGPIOx)); |
mbed_official | 76:aeb1df146756 | 235 | assert_param(IS_EXTI_PIN_SOURCE(EXTI_PinSourcex)); |
mbed_official | 76:aeb1df146756 | 236 | |
mbed_official | 76:aeb1df146756 | 237 | tmp = ((uint32_t)0x0F) << (0x04 * (EXTI_PinSourcex & (uint8_t)0x03)); |
mbed_official | 76:aeb1df146756 | 238 | SYSCFG->EXTICR[EXTI_PinSourcex >> 0x02] &= ~tmp; |
mbed_official | 76:aeb1df146756 | 239 | SYSCFG->EXTICR[EXTI_PinSourcex >> 0x02] |= (((uint32_t)EXTI_PortSourceGPIOx) << (0x04 * (EXTI_PinSourcex & (uint8_t)0x03))); |
mbed_official | 76:aeb1df146756 | 240 | } |
mbed_official | 76:aeb1df146756 | 241 | |
mbed_official | 76:aeb1df146756 | 242 | /** |
mbed_official | 76:aeb1df146756 | 243 | * @brief Connect the selected parameter to the break input of TIM1. |
mbed_official | 76:aeb1df146756 | 244 | * @note The selected configuration is locked and can be unlocked by system reset |
mbed_official | 76:aeb1df146756 | 245 | * @param SYSCFG_Break: selects the configuration to be connected to break |
mbed_official | 76:aeb1df146756 | 246 | * input of TIM1 |
mbed_official | 76:aeb1df146756 | 247 | * This parameter can be any combination of the following values: |
mbed_official | 76:aeb1df146756 | 248 | * @arg SYSCFG_Break_PVD: Connects the PVD event to the Break Input of TIM1,, not avaailable for STM32F030 devices. |
mbed_official | 76:aeb1df146756 | 249 | * @arg SYSCFG_Break_SRAMParity: Connects the SRAM_PARITY error signal to the Break Input of TIM1 . |
mbed_official | 76:aeb1df146756 | 250 | * @arg SYSCFG_Break_Lockup: Connects Lockup output of CortexM0 to the break input of TIM1. |
mbed_official | 76:aeb1df146756 | 251 | * @retval None |
mbed_official | 76:aeb1df146756 | 252 | */ |
mbed_official | 76:aeb1df146756 | 253 | void SYSCFG_BreakConfig(uint32_t SYSCFG_Break) |
mbed_official | 76:aeb1df146756 | 254 | { |
mbed_official | 76:aeb1df146756 | 255 | /* Check the parameter */ |
mbed_official | 76:aeb1df146756 | 256 | assert_param(IS_SYSCFG_LOCK_CONFIG(SYSCFG_Break)); |
mbed_official | 76:aeb1df146756 | 257 | |
mbed_official | 76:aeb1df146756 | 258 | SYSCFG->CFGR2 |= (uint32_t) SYSCFG_Break; |
mbed_official | 76:aeb1df146756 | 259 | } |
mbed_official | 76:aeb1df146756 | 260 | |
mbed_official | 76:aeb1df146756 | 261 | /** |
mbed_official | 76:aeb1df146756 | 262 | * @brief Checks whether the specified SYSCFG flag is set or not. |
mbed_official | 76:aeb1df146756 | 263 | * @param SYSCFG_Flag: specifies the SYSCFG flag to check. |
mbed_official | 76:aeb1df146756 | 264 | * This parameter can be one of the following values: |
mbed_official | 76:aeb1df146756 | 265 | * @arg SYSCFG_FLAG_PE: SRAM parity error flag. |
mbed_official | 76:aeb1df146756 | 266 | * @retval The new state of SYSCFG_Flag (SET or RESET). |
mbed_official | 76:aeb1df146756 | 267 | */ |
mbed_official | 76:aeb1df146756 | 268 | FlagStatus SYSCFG_GetFlagStatus(uint32_t SYSCFG_Flag) |
mbed_official | 76:aeb1df146756 | 269 | { |
mbed_official | 76:aeb1df146756 | 270 | FlagStatus bitstatus = RESET; |
mbed_official | 76:aeb1df146756 | 271 | |
mbed_official | 76:aeb1df146756 | 272 | /* Check the parameter */ |
mbed_official | 76:aeb1df146756 | 273 | assert_param(IS_SYSCFG_FLAG(SYSCFG_Flag)); |
mbed_official | 76:aeb1df146756 | 274 | |
mbed_official | 76:aeb1df146756 | 275 | /* Check the status of the specified SPI flag */ |
mbed_official | 76:aeb1df146756 | 276 | if ((SYSCFG->CFGR2 & SYSCFG_CFGR2_SRAM_PE) != (uint32_t)RESET) |
mbed_official | 76:aeb1df146756 | 277 | { |
mbed_official | 76:aeb1df146756 | 278 | /* SYSCFG_Flag is set */ |
mbed_official | 76:aeb1df146756 | 279 | bitstatus = SET; |
mbed_official | 76:aeb1df146756 | 280 | } |
mbed_official | 76:aeb1df146756 | 281 | else |
mbed_official | 76:aeb1df146756 | 282 | { |
mbed_official | 76:aeb1df146756 | 283 | /* SYSCFG_Flag is reset */ |
mbed_official | 76:aeb1df146756 | 284 | bitstatus = RESET; |
mbed_official | 76:aeb1df146756 | 285 | } |
mbed_official | 76:aeb1df146756 | 286 | /* Return the SYSCFG_Flag status */ |
mbed_official | 76:aeb1df146756 | 287 | return bitstatus; |
mbed_official | 76:aeb1df146756 | 288 | } |
mbed_official | 76:aeb1df146756 | 289 | |
mbed_official | 76:aeb1df146756 | 290 | /** |
mbed_official | 76:aeb1df146756 | 291 | * @brief Clear the selected SYSCFG flag. |
mbed_official | 76:aeb1df146756 | 292 | * @param SYSCFG_Flag: selects the flag to be cleared. |
mbed_official | 76:aeb1df146756 | 293 | * This parameter can be any combination of the following values: |
mbed_official | 76:aeb1df146756 | 294 | * @arg SYSCFG_FLAG_PE: SRAM parity error flag. |
mbed_official | 76:aeb1df146756 | 295 | * @retval None |
mbed_official | 76:aeb1df146756 | 296 | */ |
mbed_official | 76:aeb1df146756 | 297 | void SYSCFG_ClearFlag(uint32_t SYSCFG_Flag) |
mbed_official | 76:aeb1df146756 | 298 | { |
mbed_official | 76:aeb1df146756 | 299 | /* Check the parameter */ |
mbed_official | 76:aeb1df146756 | 300 | assert_param(IS_SYSCFG_FLAG(SYSCFG_Flag)); |
mbed_official | 76:aeb1df146756 | 301 | |
mbed_official | 76:aeb1df146756 | 302 | SYSCFG->CFGR2 |= (uint32_t) SYSCFG_Flag; |
mbed_official | 76:aeb1df146756 | 303 | } |
mbed_official | 76:aeb1df146756 | 304 | |
mbed_official | 76:aeb1df146756 | 305 | /** |
mbed_official | 76:aeb1df146756 | 306 | * @} |
mbed_official | 76:aeb1df146756 | 307 | */ |
mbed_official | 76:aeb1df146756 | 308 | |
mbed_official | 76:aeb1df146756 | 309 | /** |
mbed_official | 76:aeb1df146756 | 310 | * @} |
mbed_official | 76:aeb1df146756 | 311 | */ |
mbed_official | 76:aeb1df146756 | 312 | |
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 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |