mirror of
https://github.com/STMicroelectronics/STM32CubeF4.git
synced 2025-04-26 13:49:08 +08:00
Fix HAL_GPIO_TogglePin if more than one bit is set in argument
This commit is contained in:
parent
2d5b78e2da
commit
b95577991e
@ -437,14 +437,9 @@ void HAL_GPIO_TogglePin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin)
|
|||||||
/* Check the parameters */
|
/* Check the parameters */
|
||||||
assert_param(IS_GPIO_PIN(GPIO_Pin));
|
assert_param(IS_GPIO_PIN(GPIO_Pin));
|
||||||
|
|
||||||
if ((GPIOx->ODR & GPIO_Pin) == GPIO_Pin)
|
uint16_t tmp = GPIOx->ODR;
|
||||||
{
|
|
||||||
GPIOx->BSRR = (uint32_t)GPIO_Pin << GPIO_NUMBER;
|
GPIOx->BSRR = ((((uint32_t)GPIO_Pin & tmp) << GPIO_NUMBER) | (GPIO_Pin & ~tmp));
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
GPIOx->BSRR = GPIO_Pin;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user