From f121b4e9e7e42fce8feb1a827ca143f5dcd9a922 Mon Sep 17 00:00:00 2001 From: David Cruchon Date: Wed, 20 Oct 2021 13:03:35 +0200 Subject: [PATCH] Set PIN as output when blink_state is created --- include/mgos_pcf857x.h | 1 - src/mgos_pcf857x.c | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/mgos_pcf857x.h b/include/mgos_pcf857x.h index bceae50..b2cb5e2 100644 --- a/include/mgos_pcf857x.h +++ b/include/mgos_pcf857x.h @@ -66,7 +66,6 @@ bool mgos_pcf857x_gpio_set_button_handler(struct mgos_pcf857x *dev, int pin, enu /* * A utility function that takes care of blinking an LED. - * The pin must be configured as output first. * Set to (0, 0) to disable. */ bool mgos_pcf857x_gpio_blink(struct mgos_pcf857x *dev, int pin, int on_ms, int off_ms); diff --git a/src/mgos_pcf857x.c b/src/mgos_pcf857x.c index 5f5cc67..040b51f 100644 --- a/src/mgos_pcf857x.c +++ b/src/mgos_pcf857x.c @@ -31,6 +31,8 @@ static struct mgos_pcf857x_gpio_blink_state *mgos_pcf857x_get_or_create_blink_st blink_states[pin]->dev = dev; blink_states[pin]->pin = pin; blink_states[pin]->timer_id = MGOS_INVALID_TIMER_ID; + + mgos_pcf857x_gpio_setup_output(dev, pin, false); } return blink_states[pin];