119#ifdef HAL_GPIO_MODULE_ENABLED
127#define GPIO_NUMBER 16U
167 uint32_t ioposition = 0x00U;
168 uint32_t iocurrent = 0x00U;
169 uint32_t temp = 0x00U;
177 for(position = 0U; position <
GPIO_NUMBER; position++)
180 ioposition = 0x01U << position;
182 iocurrent = (uint32_t)(GPIO_Init->
Pin) & ioposition;
184 if(iocurrent == ioposition)
194 temp = GPIOx->OSPEEDR;
195 temp &= ~(GPIO_OSPEEDER_OSPEEDR0 << (position * 2U));
196 temp |= (GPIO_Init->
Speed << (position * 2U));
197 GPIOx->OSPEEDR = temp;
200 temp = GPIOx->OTYPER;
201 temp &= ~(GPIO_OTYPER_OT_0 << position) ;
203 GPIOx->OTYPER = temp;
213 temp &= ~(GPIO_PUPDR_PUPDR0 << (position * 2U));
214 temp |= ((GPIO_Init->
Pull) << (position * 2U));
224 temp = GPIOx->AFR[position >> 3U];
225 temp &= ~(0xFU << ((uint32_t)(position & 0x07U) * 4U)) ;
226 temp |= ((uint32_t)(GPIO_Init->
Alternate) << (((uint32_t)position & 0x07U) * 4U));
227 GPIOx->AFR[position >> 3U] = temp;
232 temp &= ~(GPIO_MODER_MODER0 << (position * 2U));
243 temp = SYSCFG->EXTICR[position >> 2U];
244 temp &= ~(0x0FU << (4U * (position & 0x03U)));
245 temp |= ((uint32_t)(
GPIO_GET_INDEX(GPIOx)) << (4U * (position & 0x03U)));
246 SYSCFG->EXTICR[position >> 2U] = temp;
250 temp &= ~((uint32_t)iocurrent);
258 temp &= ~((uint32_t)iocurrent);
266 temp &= ~((uint32_t)iocurrent);
275 temp &= ~((uint32_t)iocurrent);
297 uint32_t ioposition = 0x00U;
298 uint32_t iocurrent = 0x00U;
299 uint32_t tmp = 0x00U;
305 for(position = 0U; position <
GPIO_NUMBER; position++)
308 ioposition = 0x01U << position;
310 iocurrent = (GPIO_Pin) & ioposition;
312 if(iocurrent == ioposition)
315 tmp = SYSCFG->EXTICR[position >> 2U];
316 tmp &= (0x0FU << (4U * (position & 0x03U)));
317 if(tmp == ((uint32_t)(
GPIO_GET_INDEX(GPIOx)) << (4U * (position & 0x03U))))
320 EXTI->IMR &= ~((uint32_t)iocurrent);
321 EXTI->EMR &= ~((uint32_t)iocurrent);
324 EXTI->FTSR &= ~((uint32_t)iocurrent);
325 EXTI->RTSR &= ~((uint32_t)iocurrent);
328 tmp = 0x0FU << (4U * (position & 0x03U));
329 SYSCFG->EXTICR[position >> 2U] &= ~tmp;
334 GPIOx->MODER &= ~(GPIO_MODER_MODER0 << (position * 2U));
337 GPIOx->AFR[position >> 3U] &= ~(0xFU << ((uint32_t)(position & 0x07U) * 4U)) ;
340 GPIOx->PUPDR &= ~(GPIO_PUPDR_PUPDR0 << (position * 2U));
343 GPIOx->OTYPER &= ~(GPIO_OTYPER_OT_0 << position) ;
346 GPIOx->OSPEEDR &= ~(GPIO_OSPEEDER_OSPEEDR0 << (position * 2U));
418 GPIOx->BSRR = GPIO_Pin;
422 GPIOx->BSRR = (uint32_t)GPIO_Pin << 16U;
444 GPIOx->BSRR = ((odr & GPIO_Pin) <<
GPIO_NUMBER) | (~odr & GPIO_Pin);
460 __IO uint32_t tmp = GPIO_LCKR_LCKK;
470 GPIOx->LCKR = GPIO_Pin;
477 if((GPIOx->LCKR & GPIO_LCKR_LCKK) != RESET)
#define GPIO_GET_INDEX(__GPIOx__)
void HAL_GPIO_Init(GPIO_TypeDef *GPIOx, GPIO_InitTypeDef *GPIO_Init)
Initializes the GPIOx peripheral according to the specified parameters in the GPIO_Init.
void HAL_GPIO_DeInit(GPIO_TypeDef *GPIOx, uint32_t GPIO_Pin)
De-initializes the GPIOx peripheral registers to their default reset values.
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
EXTI line detection callbacks.
void HAL_GPIO_EXTI_IRQHandler(uint16_t GPIO_Pin)
This function handles EXTI interrupt request.
HAL_StatusTypeDef HAL_GPIO_LockPin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
Locks GPIO Pins configuration registers.
GPIO_PinState HAL_GPIO_ReadPin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
Reads the specified input port pin.
void HAL_GPIO_WritePin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState)
Sets or clears the selected data port bit.
void HAL_GPIO_TogglePin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
Toggles the specified GPIO pins.
#define __HAL_GPIO_EXTI_GET_IT(__EXTI_LINE__)
Checks whether the specified EXTI line is asserted or not.
#define __HAL_GPIO_EXTI_CLEAR_IT(__EXTI_LINE__)
Clears the EXTI's line pending bits.
GPIO_PinState
GPIO Bit SET and Bit RESET enumeration.
#define IS_GPIO_PULL(PULL)
#define IS_GPIO_PIN_ACTION(ACTION)
#define IS_GPIO_SPEED(SPEED)
#define IS_GPIO_MODE(MODE)
#define __HAL_RCC_SYSCFG_CLK_ENABLE()
#define assert_param(expr)
This file contains all the functions prototypes for the HAL module driver.
HAL_StatusTypeDef
HAL Status structures definition
GPIO Init structure definition