# HG changeset patch # User Ethan Zonca # Date 2015-01-03 00:04:24 # Node ID 9336fdac7c05fc85f829f89120d36370da7ecf1e # Parent 81af28f44609a954e5589e6ab907341222ee7c0a Add toggle GPIO func diff --git a/libraries/STM32F0xx_StdPeriph_Driver/inc/stm32f0xx_gpio.h b/libraries/STM32F0xx_StdPeriph_Driver/inc/stm32f0xx_gpio.h --- a/libraries/STM32F0xx_StdPeriph_Driver/inc/stm32f0xx_gpio.h +++ b/libraries/STM32F0xx_StdPeriph_Driver/inc/stm32f0xx_gpio.h @@ -342,6 +342,8 @@ void GPIO_Write(GPIO_TypeDef* GPIOx, uin /* GPIO Alternate functions configuration functions ***************************/ void GPIO_PinAFConfig(GPIO_TypeDef* GPIOx, uint16_t GPIO_PinSource, uint8_t GPIO_AF); +void GPIO_ToggleBits(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin); + #ifdef __cplusplus } #endif diff --git a/libraries/STM32F0xx_StdPeriph_Driver/src/stm32f0xx_gpio.c b/libraries/STM32F0xx_StdPeriph_Driver/src/stm32f0xx_gpio.c --- a/libraries/STM32F0xx_StdPeriph_Driver/src/stm32f0xx_gpio.c +++ b/libraries/STM32F0xx_StdPeriph_Driver/src/stm32f0xx_gpio.c @@ -523,6 +523,22 @@ void GPIO_PinAFConfig(GPIO_TypeDef* GPIO GPIOx->AFR[GPIO_PinSource >> 0x03] = temp_2; } + +/** + * @brief Toggles the specified GPIO pins. NOTE: Imported by EMZ + * @param GPIOx: where x can be (A..H) to select the GPIO peripheral. + * @param GPIO_Pin: Specifies the pins to be toggled. + * @retval None + */ +void GPIO_ToggleBits(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin) +{ + /* Check the parameters */ + assert_param(IS_GPIO_ALL_PERIPH(GPIOx)); + + GPIOx->ODR ^= GPIO_Pin; +} + + /** * @} */