attenuator: set initial state of outputs to 'low'

otherwise they might be high, which means the latch is permanently
enabled.
This commit is contained in:
Harald Welte 2021-04-13 19:02:20 +02:00
parent e8849c28ea
commit abfceb45f5
1 changed files with 3 additions and 0 deletions

View File

@ -153,11 +153,14 @@ void attenuator_init(const struct attenuator_cfg *cfg,
for (k = 0; k < ARRAY_SIZE(banks); k++) {
if (!pins[k])
continue;
printf("GPIO Bank %u: 0x%08lx\n", k, pins[k]);
rcc_periph_clock_enable(periph[k]);
#ifdef STM32F1
gpio_set_mode(banks[k], GPIO_MODE_OUTPUT_2_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, pins[k]);
#else
gpio_mode_setup(banks[k], GPIO_MODE_OUTPUT, 0, pins[k]);
#endif
gpio_clear(banks[k], pins[k]);
}
}