1 /** 2 ****************************************************************************** 3 * @file HAL_syscfg.h 4 * @author AE Team 5 * @version V2.0.0 6 * @date 22/08/2017 7 * @brief This file contains all the functions prototypes for the SYSCFG firmware 8 * library. 9 ****************************************************************************** 10 * @attention 11 * 12 * <h2><center>© COPYRIGHT 2017 MindMotion</center></h2> 13 * 14 */ 15 16 /*!< Define to prevent recursive inclusion -------------------------------------*/ 17 #ifndef __HAL_SYSCFG_H 18 #define __HAL_SYSCFG_H 19 20 #ifdef __cplusplus 21 extern "C" { 22 #endif 23 24 /*!< Includes ------------------------------------------------------------------*/ 25 #include "HAL_device.h" 26 27 /** @addtogroup StdPeriph_Driver 28 * @{ 29 */ 30 31 /** @addtogroup SYSCFG 32 * @{ 33 */ 34 /* Exported types ------------------------------------------------------------*/ 35 /* Exported constants --------------------------------------------------------*/ 36 37 /** @defgroup SYSCFG_Exported_Constants 38 * @{ 39 */ 40 41 /** @defgroup SYSCFG_EXTI_Port_Sources 42 * @{ 43 */ 44 #define EXTI_PortSourceGPIOA ((uint8_t)0x00) 45 #define EXTI_PortSourceGPIOB ((uint8_t)0x01) 46 #define EXTI_PortSourceGPIOC ((uint8_t)0x02) 47 #define EXTI_PortSourceGPIOD ((uint8_t)0x03) 48 #define EXTI_PortSourceGPIOE ((uint8_t)0x04) 49 #define EXTI_PortSourceGPIOF ((uint8_t)0x05) 50 51 #define IS_EXTI_PORT_SOURCE(PORTSOURCE) (((PORTSOURCE) == EXTI_PortSourceGPIOA) || \ 52 ((PORTSOURCE) == EXTI_PortSourceGPIOB) || \ 53 ((PORTSOURCE) == EXTI_PortSourceGPIOC) || \ 54 ((PORTSOURCE) == EXTI_PortSourceGPIOD) || \ 55 ((PORTSOURCE) == EXTI_PortSourceGPIOE) || \ 56 ((PORTSOURCE) == EXTI_PortSourceGPIOF)) 57 /** 58 * @} 59 */ 60 61 /** @defgroup SYSCFG_EXTI_Pin_sources 62 * @{ 63 */ 64 #define EXTI_PinSource0 ((uint8_t)0x00) 65 #define EXTI_PinSource1 ((uint8_t)0x01) 66 #define EXTI_PinSource2 ((uint8_t)0x02) 67 #define EXTI_PinSource3 ((uint8_t)0x03) 68 #define EXTI_PinSource4 ((uint8_t)0x04) 69 #define EXTI_PinSource5 ((uint8_t)0x05) 70 #define EXTI_PinSource6 ((uint8_t)0x06) 71 #define EXTI_PinSource7 ((uint8_t)0x07) 72 #define EXTI_PinSource8 ((uint8_t)0x08) 73 #define EXTI_PinSource9 ((uint8_t)0x09) 74 #define EXTI_PinSource10 ((uint8_t)0x0A) 75 #define EXTI_PinSource11 ((uint8_t)0x0B) 76 #define EXTI_PinSource12 ((uint8_t)0x0C) 77 #define EXTI_PinSource13 ((uint8_t)0x0D) 78 #define EXTI_PinSource14 ((uint8_t)0x0E) 79 #define EXTI_PinSource15 ((uint8_t)0x0F) 80 81 #define IS_EXTI_PIN_SOURCE(PINSOURCE) (((PINSOURCE) == EXTI_PinSource0) || \ 82 ((PINSOURCE) == EXTI_PinSource1) || \ 83 ((PINSOURCE) == EXTI_PinSource2) || \ 84 ((PINSOURCE) == EXTI_PinSource3) || \ 85 ((PINSOURCE) == EXTI_PinSource4) || \ 86 ((PINSOURCE) == EXTI_PinSource5) || \ 87 ((PINSOURCE) == EXTI_PinSource6) || \ 88 ((PINSOURCE) == EXTI_PinSource7) || \ 89 ((PINSOURCE) == EXTI_PinSource8) || \ 90 ((PINSOURCE) == EXTI_PinSource9) || \ 91 ((PINSOURCE) == EXTI_PinSource10) || \ 92 ((PINSOURCE) == EXTI_PinSource11) || \ 93 ((PINSOURCE) == EXTI_PinSource12) || \ 94 ((PINSOURCE) == EXTI_PinSource13) || \ 95 ((PINSOURCE) == EXTI_PinSource14) || \ 96 ((PINSOURCE) == EXTI_PinSource15)) 97 /** 98 * @} 99 */ 100 101 /** @defgroup SYSCFG_Memory_Remap_Config 102 * @{ 103 */ 104 #define SYSCFG_MemoryRemap_Flash ((uint8_t)0x00) 105 #define SYSCFG_MemoryRemap_SystemMemory ((uint8_t)0x01) 106 #define SYSCFG_MemoryRemap_SRAM ((uint8_t)0x03) 107 108 109 #define IS_SYSCFG_MEMORY_REMAP(REMAP) (((REMAP) == SYSCFG_MemoryRemap_Flash) || \ 110 ((REMAP) == SYSCFG_MemoryRemap_SystemMemory) || \ 111 ((REMAP) == SYSCFG_MemoryRemap_SRAM)) 112 113 /** 114 * @} 115 */ 116 117 /** @defgroup SYSCFG_DMA_Remap_Config 118 * @{ 119 */ 120 #define SYSCFG_DMARemap_TIM17 SYSCFG_CFGR_TIM17_DMA_RMP /* Remap TIM17 DMA requests from channel1 to channel2 */ 121 #define SYSCFG_DMARemap_TIM16 SYSCFG_CFGR_TIM16_DMA_RMP /* Remap TIM16 DMA requests from channel3 to channel4 */ 122 #define SYSCFG_DMARemap_UART1Rx SYSCFG_CFGR_UART1RX_DMA_RMP /* Remap UART1 Rx DMA requests from channel3 to channel5 */ 123 #define SYSCFG_DMARemap_UART1Tx SYSCFG_CFGR_UART1TX_DMA_RMP /* Remap UART1 Tx DMA requests from channel2 to channel4 */ 124 #define SYSCFG_DMARemap_ADC1 SYSCFG_CFGR_ADC_DMA_RMP /* Remap ADC1 DMA requests from channel1 to channel2 */ 125 126 #define IS_SYSCFG_DMA_REMAP(REMAP) (((REMAP) == SYSCFG_DMARemap_TIM17) || \ 127 ((REMAP) == SYSCFG_DMARemap_TIM16) || \ 128 ((REMAP) == SYSCFG_DMARemap_UART1Rx) || \ 129 ((REMAP) == SYSCFG_DMARemap_UART1Tx) || \ 130 ((REMAP) == SYSCFG_CFGR1_TIM3_DMA_RMP) || \ 131 ((REMAP) == SYSCFG_CFGR1_TIM2_DMA_RMP) || \ 132 ((REMAP) == SYSCFG_CFGR1_TIM1_DMA_RMP) || \ 133 ((REMAP) == SYSCFG_CFGR1_I2C1_DMA_RMP) || \ 134 ((REMAP) == SYSCFG_CFGR1_UART3_DMA_RMP) || \ 135 ((REMAP) == SYSCFG_CFGR1_UART2_DMA_RMP) || \ 136 ((REMAP) == SYSCFG_CFGR1_SPI2_DMA_RMP) || \ 137 ((REMAP) == SYSCFG_CFGR1_TIM17_DMA_RMP2) || \ 138 ((REMAP) == SYSCFG_CFGR1_TIM16_DMA_RMP2) || \ 139 ((REMAP) == SYSCFG_DMARemap_ADC1)) 140 141 142 /** 143 * @} 144 */ 145 146 147 148 149 /* Exported macro ------------------------------------------------------------*/ 150 /* Exported functions ------------------------------------------------------- */ 151 152 /* Function used to set the SYSCFG configuration to the default reset state **/ 153 void SYSCFG_DeInit(void); 154 155 /* SYSCFG configuration functions *********************************************/ 156 void SYSCFG_MemoryRemapConfig(uint32_t SYSCFG_MemoryRemap); 157 void SYSCFG_DMAChannelRemapConfig(uint32_t SYSCFG_DMARemap, FunctionalState NewState); 158 void SYSCFG_I2CFastModePlusConfig(uint32_t SYSCFG_I2CFastModePlus, FunctionalState NewState); 159 void SYSCFG_IRDAEnvSelection(uint32_t SYSCFG_IRDAEnv); 160 void SYSCFG_EXTILineConfig(uint8_t EXTI_PortSourceGPIOx, uint8_t EXTI_PinSourcex); 161 uint32_t SYSCFG_GetPendingIT(uint32_t ITSourceLine); 162 void SYSCFG_BreakConfig(uint32_t SYSCFG_Break); 163 FlagStatus SYSCFG_GetFlagStatus(uint32_t SYSCFG_Flag); 164 void SYSCFG_ClearFlag(uint32_t SYSCFG_Flag); 165 166 #ifdef __cplusplus 167 } 168 #endif 169 170 #endif /*__HAL_SYSCFG_H */ 171 172 /** 173 * @} 174 */ 175 176 /** 177 * @} 178 */ 179 180 /*-------------------------(C) COPYRIGHT 2017 MindMotion ----------------------*/ 181