1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

stm32f1/gpio: pin direction readout of gpio_read was invalid

This commit is contained in:
DipSwitch 2015-11-06 16:57:10 +01:00
parent d3558d26b2
commit 4186e38976

View File

@ -170,7 +170,7 @@ int gpio_read(gpio_t pin)
GPIO_TypeDef *port = _port(pin);
int pin_num = _pin_num(pin);
if (port->CR[pin_num >> 3] & (0x3 << (pin_num & 0x7))) {
if (port->CR[pin_num >> 3] & (0x3 << ((pin_num & 0x7) << 2))) {
/* pin is output */
return (port->ODR & (1 << pin_num));
}