stm32: Make sure to enable the gpio clock prior to setting the first value

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2019-08-20 01:04:20 -04:00
parent a67451fa36
commit c930fc392b
4 changed files with 22 additions and 4 deletions

View file

@ -52,6 +52,7 @@ gpio_out_setup(uint32_t pin, uint32_t val)
if (GPIO2PORT(pin) >= ARRAY_SIZE(digital_regs))
goto fail;
GPIO_TypeDef *regs = digital_regs[GPIO2PORT(pin)];
gpio_clock_enable(regs);
struct gpio_out g = { .regs=regs, .bit=GPIO2BIT(pin) };
gpio_out_reset(g, val);
return g;