Browse Source

Merge pull request #4232 from DipSwitch/fix_gpio_read

gpio: Pin direction readout of gpio_read was invalid
cc430
Peter Kietzmann 7 years ago
parent
commit
745320dc41
  1. 2
      cpu/stm32f1/periph/gpio.c

2
cpu/stm32f1/periph/gpio.c

@ -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));
}

Loading…
Cancel
Save