Skip to content
Snippets Groups Projects
Commit 745320dc authored by Peter Kietzmann's avatar Peter Kietzmann
Browse files

Merge pull request #4232 from DipSwitch/fix_gpio_read

gpio: Pin direction readout of gpio_read was invalid
parents 4ef889f9 4186e389
No related branches found
No related tags found
No related merge requests found
......@@ -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));
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment