diff --git a/src/adccmds.c b/src/adccmds.c index 09db9b9d..a27dc8c0 100644 --- a/src/adccmds.c +++ b/src/adccmds.c @@ -61,10 +61,11 @@ analog_in_event(struct timer *timer) void command_config_analog_in(uint32_t *args) { + struct gpio_adc pin = gpio_adc_setup(args[1]); struct analog_in *a = oid_alloc( args[0], command_config_analog_in, sizeof(*a)); a->timer.func = analog_in_event; - a->pin = gpio_adc_setup(args[1]); + a->pin = pin; a->state = 1; } DECL_COMMAND(command_config_analog_in, "config_analog_in oid=%c pin=%u");